Skip to content

Commit

Permalink
plugins: use new header
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebeatrici committed Aug 8, 2019
1 parent e8afc38 commit 9875c59
Show file tree
Hide file tree
Showing 46 changed files with 70 additions and 63 deletions.
2 changes: 1 addition & 1 deletion plugins/aoc/aoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion plugins/arma2/arma2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

procptr_t posptr, frontptr, topptr;

Expand Down
2 changes: 1 addition & 1 deletion plugins/bf1/bf1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h" // Include standard plugin header.
#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &context, std::wstring &identity) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/bf1942/bf1942.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

procptr_t faceptr, topptr;
//BYTE *stateptr;
Expand Down
3 changes: 2 additions & 1 deletion plugins/bf2/bf2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

using namespace std;


Expand Down
2 changes: 1 addition & 1 deletion plugins/bf2142/bf2142.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h" // Include standard plugin header.
#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".

// Variable to contain module's addresses
Expand Down
3 changes: 2 additions & 1 deletion plugins/bf3/bf3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

static bool ptr_chain_valid = false;

// Magic ptrs
Expand Down
2 changes: 1 addition & 1 deletion plugins/bf4/bf4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h" // Include standard plugin header.
#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &context, std::wstring &identity) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/bf4_x86/bf4_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h" // Include standard plugin header.
#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &context, std::wstring &identity) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/bfbc2/bfbc2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

bool is_steam = false;

Expand Down
2 changes: 1 addition & 1 deletion plugins/bfheroes/bfheroes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

procptr_t posptr, faceptr, topptr, stateptr;

Expand Down
2 changes: 1 addition & 1 deletion plugins/blacklight/blacklight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

/*
Arrays of bytes to find addresses accessed by respective functions so we don't have to blindly search for addresses after every update
Expand Down
2 changes: 1 addition & 1 deletion plugins/borderlands/borderlands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

procptr_t posptr, frontptr, topptr, contextptraddress, stateaddress, loginaddress;

Expand Down
3 changes: 2 additions & 1 deletion plugins/borderlands2/borderlands2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

#include <algorithm>

procptr_t vects_ptr;
Expand Down
2 changes: 1 addition & 1 deletion plugins/breach/breach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

procptr_t posptr, frontptr, topptr;

Expand Down
2 changes: 1 addition & 1 deletion plugins/cod2/cod2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &, std::wstring &) {
float viewHor, viewVer;
Expand Down
2 changes: 1 addition & 1 deletion plugins/cod4/cod4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion plugins/cod5/cod5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &, std::wstring &) {
float viewHor, viewVer;
Expand Down
2 changes: 1 addition & 1 deletion plugins/codmw2/codmw2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &, std::wstring &) {
float viewHor, viewVer;
Expand Down
2 changes: 1 addition & 1 deletion plugins/codmw2so/codmw2so.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &, std::wstring &) {
float viewHor, viewVer;
Expand Down
2 changes: 1 addition & 1 deletion plugins/cs/cs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion plugins/dys/dys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion plugins/etqw/etqw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

using namespace std;

Expand Down
4 changes: 2 additions & 2 deletions plugins/ffxiv/ffxiv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h" // Include standard plugin header.

#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".

#include <cmath>

// Offset values can be obtained from:
Expand Down
2 changes: 1 addition & 1 deletion plugins/gmod/gmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion plugins/gtaiv/gtaiv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

static unsigned int playerid;
static procptr_t base_address;
Expand Down
3 changes: 2 additions & 1 deletion plugins/gtav/gtav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h" // Include standard plugin header.
#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".

#include <algorithm> // Include algorithm header for the game version detector

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &context, std::wstring &identity) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/gw/gw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

/*
Arrays of bytes to find addresses accessed by respective functions so we don't have to blindly search for addresses after every update
Expand Down
2 changes: 1 addition & 1 deletion plugins/insurgency/insurgency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion plugins/jc2/jc2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

const unsigned int off_character_manager = 0xD8FB24;
const unsigned int off_local_player = 0x3570;
Expand Down
2 changes: 1 addition & 1 deletion plugins/l4d/l4d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "../mumble_plugin_win32.h" // Include standard plugin header.
#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".

static procptr_t steamclient, engine; // Variables to contain modules addresses
Expand Down
7 changes: 1 addition & 6 deletions plugins/l4d2/l4d2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifdef WIN32
#include "../mumble_plugin_win32.h" // Include standard plugin header.
#else
#include "../mumble_plugin_linux.h" // Include standard plugin header.
#endif

#include "../mumble_plugin_main.h" // Include standard plugin header.
#include "../mumble_plugin_utils.h" // Include plugin header for special functions, like "escape".

// Variables to contain modules addresses
Expand Down
2 changes: 1 addition & 1 deletion plugins/lol/lol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

/*
Arrays of bytes to find addresses accessed by respective functions so we don't have to blindly search for addresses after every update
Expand Down
2 changes: 1 addition & 1 deletion plugins/lotro/lotro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "../mumble_plugin_win32.h"
#include "../mumble_plugin_main.h"

static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &context, std::wstring &) {
for (int i=0;i<3;i++)
Expand Down
10 changes: 6 additions & 4 deletions plugins/mumble_plugin_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#ifndef MUMBLE_PLUGIN_LINUX_H_
#define MUMBLE_PLUGIN_LINUX_H_

# ifndef MUMBLE_PLUGIN_MAIN_H_
# error "Include mumble_plugin_main.h instead of mumble_plugin_linux.h"
# endif

#include <sys/uio.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -16,8 +20,6 @@
#include <fstream>
#include <sstream>

#include "mumble_plugin.h"

static inline std::string readAll(const std::string &fn) {
std::ifstream ifs;
ifs.open(fn.c_str(), std::ifstream::binary);
Expand Down Expand Up @@ -168,7 +170,7 @@ static inline procptr_t getModuleAddr(const procid_t &pid, const wchar_t *modnam
if (pathname.size() > lastSlash + 1) {
std::string basename = pathname.substr(lastSlash + 1);
if (basename == modnameNonWide) {
unsigned long addr = strtoul(baseaddr.c_str(), NULL, 16);
unsigned long addr = strtoul(baseaddr.c_str(), nullptr, 16);
return addr;
}
}
Expand All @@ -192,7 +194,7 @@ static inline bool peekProc(const procptr_t &addr, void *dest, const size_t &len
return (nread != -1 && static_cast<size_t>(nread) == in.iov_len);
}

static bool inline initialize(const std::multimap<std::wstring, unsigned long long int> &pids, const wchar_t *procname, const wchar_t *modname = NULL) {
static bool inline initialize(const std::multimap<std::wstring, unsigned long long int> &pids, const wchar_t *procname, const wchar_t *modname = nullptr) {
pModule = 0;

if (! pids.empty()) {
Expand Down
12 changes: 10 additions & 2 deletions plugins/mumble_plugin_main.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
// Copyright 2005-2019 The Mumble Developers. All rights reserved.
// Copyright 2019 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

// This is the main header for process/OS stuff; it's included in most plugins
// because values can rarely be retrieved without accessing the process' memory.
//
// Various functions are provided for common tasks when reading from memory.
// The most important are getModuleAddr() and peekProc(); the first returns the
// base address of a module (e.g. shared library), the latter reads memory at the
// specified address and stores it in a variable.

#ifndef MUMBLE_PLUGIN_MAIN_H_
#define MUMBLE_PLUGIN_MAIN_H_

#include "mumble_plugin.h"

static procid_t pPid;
static bool is64Bit;
static procid_t pPid;
static procptr_t pModule;

static inline bool peekProc(const procptr_t &addr, void *dest, const size_t &len);
Expand Down
Loading

0 comments on commit 9875c59

Please sign in to comment.