diff --git a/plugins/aoc/aoc.pro b/plugins/aoc/aoc.pro index bdee1b245..de3227e99 100644 --- a/plugins/aoc/aoc.pro +++ b/plugins/aoc/aoc.pro @@ -7,6 +7,3 @@ include(../plugins.pri) TARGET = aoc SOURCES = aoc.cpp -LIBS += -luser32 - - diff --git a/plugins/arma2/arma2.pro b/plugins/arma2/arma2.pro index 293d242c1..212d2b92c 100644 --- a/plugins/arma2/arma2.pro +++ b/plugins/arma2/arma2.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = arma2 SOURCES = arma2.cpp -LIBS += -luser32 diff --git a/plugins/bf1/bf1.cpp b/plugins/bf1/bf1.cpp index 95c1c42a2..c2042f2d3 100644 --- a/plugins/bf1/bf1.cpp +++ b/plugins/bf1/bf1.cpp @@ -13,7 +13,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa bool ok, state; char server_name[100], team[4]; - BYTE squad, squad_leader; + uint8_t squad, squad_leader; // State pointers procptr_t state_base = peekProcPtr(pModule + 0x33DBD08); diff --git a/plugins/bf1/bf1.pro b/plugins/bf1/bf1.pro index fdb72462c..7066a0089 100644 --- a/plugins/bf1/bf1.pro +++ b/plugins/bf1/bf1.pro @@ -2,4 +2,3 @@ include(../plugins.pri) TARGET = bf1 SOURCES = bf1.cpp -LIBS += -luser32 diff --git a/plugins/bf1942/bf1942.pro b/plugins/bf1942/bf1942.pro index b93403073..31f4ae42f 100644 --- a/plugins/bf1942/bf1942.pro +++ b/plugins/bf1942/bf1942.pro @@ -7,6 +7,3 @@ include(../plugins.pri) TARGET = bf1942 SOURCES = bf1942.cpp -LIBS += -luser32 - - diff --git a/plugins/bf2/bf2.cpp b/plugins/bf2/bf2.cpp index 5902750b5..9dbb927f1 100644 --- a/plugins/bf2/bf2.cpp +++ b/plugins/bf2/bf2.cpp @@ -100,7 +100,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa avatar_pos[i] = avatar_front[i] = avatar_top[i] = camera_pos[i] = camera_front[i] = camera_top[i] = 0.0f; bool ok; - BYTE logincheck; + uint8_t logincheck; ok = peekProc(login_ptr, &logincheck, 1); if (! ok) return false; @@ -108,7 +108,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa if (logincheck == 0) return false; - BYTE state; + uint8_t state; ok = peekProc(state_ptr , &state, 1); // Magical state value if (! ok) return false; @@ -126,13 +126,13 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa char ccontext[128]; - BYTE is_commander; - BYTE is_squad_leader; - BYTE is_in_squad; - BYTE is_opfor; - BYTE on_voip; - BYTE on_voip_com; - BYTE target_squad_id; + uint8_t is_commander; + uint8_t is_squad_leader; + uint8_t is_in_squad; + uint8_t is_opfor; + uint8_t on_voip; + uint8_t on_voip_com; + uint8_t target_squad_id; ok = peekProc(pos_ptr, avatar_pos, 12) && peekProc(face_ptr, avatar_front, 12) && diff --git a/plugins/bf2/bf2.pro b/plugins/bf2/bf2.pro index 4d4c948e8..ab3fef34c 100644 --- a/plugins/bf2/bf2.pro +++ b/plugins/bf2/bf2.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = bf2 SOURCES = bf2.cpp -LIBS += -luser32 diff --git a/plugins/bf2142/bf2142.cpp b/plugins/bf2142/bf2142.cpp index a786fc41c..7ee8cff79 100644 --- a/plugins/bf2142/bf2142.cpp +++ b/plugins/bf2142/bf2142.cpp @@ -13,7 +13,7 @@ procptr_t RendDX9 = 0; 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) { bool ok; char server_name[100], soldier_name[100]; - BYTE team_id, squad_id, is_commander, is_squad_leader, target_squad_id, on_voip, on_voip_com; + uint8_t team_id, squad_id, is_commander, is_squad_leader, target_squad_id, on_voip, on_voip_com; for (int i=0;i<3;i++) avatar_pos[i] = avatar_front[i] = avatar_top[i] = camera_pos[i] = camera_front[i] = camera_top[i] = 0.0f; diff --git a/plugins/bf2142/bf2142.pro b/plugins/bf2142/bf2142.pro index 14df1e304..e404adb57 100644 --- a/plugins/bf2142/bf2142.pro +++ b/plugins/bf2142/bf2142.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = bf2142 SOURCES = bf2142.cpp -LIBS += -luser32 diff --git a/plugins/bf3/bf3.cpp b/plugins/bf3/bf3.cpp index b12a72c92..fdce9c831 100644 --- a/plugins/bf3/bf3.cpp +++ b/plugins/bf3/bf3.cpp @@ -89,16 +89,16 @@ inline bool resolve_ptrs() { */ /* Magic: - state : 0x238ABDC BYTE 1 when playing + state : 0x238ABDC uint8_t 1 when playing 2 while in menu/dead Context: IP:Port of server: 0x0235DB90 char[128] ip:port of the server Identity: - Squad state: BF3.exe+0x01EF25C4 + 0x1C + 0xBC + 0x36C + 0x8 + 0x104 BYTE 0 is not in squad; 1 is in Alpha squad, 2 Bravo, ... , 9 India - SLead state: BF3.exe+0x01EF25C4 + 0x1C + 0xBC + 0x36C + 0x8 + 0x108 BYTE 0 is not lead; 1 is lead - Team state: BF3.exe+0x01EF25C4 + 0x1C + 0xBC + 0x31C BYTE 1 is blufor (US team, for example), 2 is opfor (RU), 0 is probably upcoming spec mode + Squad state: BF3.exe+0x01EF25C4 + 0x1C + 0xBC + 0x36C + 0x8 + 0x104 uint8_t 0 is not in squad; 1 is in Alpha squad, 2 Bravo, ... , 9 India + SLead state: BF3.exe+0x01EF25C4 + 0x1C + 0xBC + 0x36C + 0x8 + 0x108 uint8_t 0 is not lead; 1 is lead + Team state: BF3.exe+0x01EF25C4 + 0x1C + 0xBC + 0x31C uint8_t 1 is blufor (US team, for example), 2 is opfor (RU), 0 is probably upcoming spec mode */ procptr_t base_bf3 = peekProcPtr(pModule + base_offset); @@ -126,10 +126,10 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa avatar_pos[i] = avatar_front[i] = avatar_top[i] = camera_pos[i] = camera_front[i] = camera_top[i] = 0.0f; char ccontext[128]; - char state; - BYTE squad_state; - BYTE is_squadleader; - BYTE team_state; + uint8_t state; + uint8_t squad_state; + uint8_t is_squadleader; + uint8_t team_state; bool ok; ok = peekProc(state_ptr, &state, 1); // State value diff --git a/plugins/bf3/bf3.pro b/plugins/bf3/bf3.pro index 764bcea36..ab6625e0e 100644 --- a/plugins/bf3/bf3.pro +++ b/plugins/bf3/bf3.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = bf3 SOURCES = bf3.cpp -LIBS += -luser32 diff --git a/plugins/bf4/bf4.cpp b/plugins/bf4/bf4.cpp index b63e33047..f20826872 100644 --- a/plugins/bf4/bf4.cpp +++ b/plugins/bf4/bf4.cpp @@ -13,7 +13,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa bool ok, state; char serverid[37], host[22], team[3]; - BYTE squad, squad_leader, squad_state; + uint8_t squad, squad_leader, squad_state; // Server ID pointers procptr_t serverid_base = peekProcPtr(pModule + 0x23D5368); diff --git a/plugins/bf4/bf4.pro b/plugins/bf4/bf4.pro index 35c999041..b41c3d419 100644 --- a/plugins/bf4/bf4.pro +++ b/plugins/bf4/bf4.pro @@ -2,4 +2,3 @@ include(../plugins.pri) TARGET = bf4 SOURCES = bf4.cpp -LIBS += -luser32 diff --git a/plugins/bf4_x86/bf4_x86.cpp b/plugins/bf4_x86/bf4_x86.cpp index 2381becb8..97f8ae1f8 100644 --- a/plugins/bf4_x86/bf4_x86.cpp +++ b/plugins/bf4_x86/bf4_x86.cpp @@ -13,7 +13,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa bool ok, state; char serverid[37], host[22], team[3]; - BYTE squad, squad_leader, squad_state; + uint8_t squad, squad_leader, squad_state; // Server ID pointers procptr_t serverid_base = peekProcPtr(pModule + 0x1D39C64); diff --git a/plugins/bf4_x86/bf4_x86.pro b/plugins/bf4_x86/bf4_x86.pro index 2aefb8ec3..06950a5f0 100644 --- a/plugins/bf4_x86/bf4_x86.pro +++ b/plugins/bf4_x86/bf4_x86.pro @@ -2,4 +2,3 @@ include(../plugins.pri) TARGET = bf4_x86 SOURCES = bf4_x86.cpp -LIBS += -luser32 diff --git a/plugins/bfbc2/bfbc2.pro b/plugins/bfbc2/bfbc2.pro index 9498f4187..98de82a2b 100644 --- a/plugins/bfbc2/bfbc2.pro +++ b/plugins/bfbc2/bfbc2.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = bfbc2 SOURCES = bfbc2.cpp -LIBS += -luser32 diff --git a/plugins/bfheroes/bfheroes.pro b/plugins/bfheroes/bfheroes.pro index 5bca8fdea..6bd435428 100644 --- a/plugins/bfheroes/bfheroes.pro +++ b/plugins/bfheroes/bfheroes.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = bfheroes SOURCES = bfheroes.cpp -LIBS += -luser32 diff --git a/plugins/blacklight/blacklight.cpp b/plugins/blacklight/blacklight.cpp index 5e704cc7e..f7ef3d343 100644 --- a/plugins/blacklight/blacklight.cpp +++ b/plugins/blacklight/blacklight.cpp @@ -59,7 +59,7 @@ static procptr_t camtopptr = camfrontptr + 0xC; static procptr_t camptr = camfrontptr + 0x18; static procptr_t hostipportptr; -static char prev_hostipport[22]; +static std::string prev_hostipport; static char state = 0; // 1 if connected to a server, 0 if not @@ -88,7 +88,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa float cam[3], camtop[3], camfront[3]; bool ok; - char hostipport[sizeof(prev_hostipport)]; + char hostipport[22]; ok = peekProc(camfrontptr, camfront, 12) && peekProc(camtopptr, camtop, 12) && @@ -99,16 +99,17 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa return false; hostipport[sizeof(hostipport) - 1] = '\0'; - if (strcmp(hostipport, prev_hostipport) != 0) { + if (hostipport != prev_hostipport) { context.clear(); state = 0; - strcpy_s(prev_hostipport, sizeof(prev_hostipport), hostipport); + prev_hostipport = hostipport; if (strcmp(hostipport, "") != 0 && strcmp(hostipport, "bot") != 0) { - char buffer[50]; - sprintf_s(buffer, sizeof(buffer), "{\"ipport\": \"%s\"}", hostipport); - context.assign(buffer); + std::ostringstream contextstream; + contextstream << "{\"ipport\": \"" << hostipport << "\"}"; + context = contextstream.str(); + state = 1; } } @@ -131,15 +132,14 @@ static int trylock(const std::multimap &pi return false; if (refreshPointers()) { // unlink plugin if this fails - - *prev_hostipport = '\0'; + prev_hostipport.clear(); float avatar_pos[3], avatar_front[3], avatar_top[3]; float camera_pos[3], camera_front[3], camera_top[3]; std::string context; std::wstring identity; if (fetch(avatar_pos, avatar_front, avatar_top, camera_pos, camera_front, camera_top, context, identity)) { - *prev_hostipport = '\0'; // we need to do this again since fetch() above overwrites this (which results in empty context until next change) + prev_hostipport.clear(); // we need to do this again since fetch() above overwrites this (which results in empty context until next change) return true; } } diff --git a/plugins/blacklight/blacklight.pro b/plugins/blacklight/blacklight.pro index f48cae570..f62642c1c 100644 --- a/plugins/blacklight/blacklight.pro +++ b/plugins/blacklight/blacklight.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = blacklight SOURCES = blacklight.cpp -LIBS += -luser32 diff --git a/plugins/borderlands/borderlands.pro b/plugins/borderlands/borderlands.pro index ebe6d1c9b..411396092 100644 --- a/plugins/borderlands/borderlands.pro +++ b/plugins/borderlands/borderlands.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = borderlands SOURCES = borderlands.cpp -LIBS += -luser32 diff --git a/plugins/borderlands2/borderlands2.pro b/plugins/borderlands2/borderlands2.pro index 8a22aa1f1..e0d9e909f 100644 --- a/plugins/borderlands2/borderlands2.pro +++ b/plugins/borderlands2/borderlands2.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = borderlands2 SOURCES = borderlands2.cpp -LIBS += -luser32 diff --git a/plugins/breach/breach.pro b/plugins/breach/breach.pro index 17559b741..558c0cfe2 100644 --- a/plugins/breach/breach.pro +++ b/plugins/breach/breach.pro @@ -7,5 +7,3 @@ include(../plugins.pri) TARGET = breach SOURCES = breach.cpp -LIBS += -luser32 - diff --git a/plugins/cod2/cod2.pro b/plugins/cod2/cod2.pro index 5f75b6e1e..04aca900f 100644 --- a/plugins/cod2/cod2.pro +++ b/plugins/cod2/cod2.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = cod2 SOURCES = cod2.cpp -LIBS += -luser32 diff --git a/plugins/cod4/cod4.pro b/plugins/cod4/cod4.pro index b371ad3f5..ce9006160 100644 --- a/plugins/cod4/cod4.pro +++ b/plugins/cod4/cod4.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = cod4 SOURCES = cod4.cpp -LIBS += -luser32 diff --git a/plugins/cod5/cod5.pro b/plugins/cod5/cod5.pro index 4f711a251..196c57c54 100644 --- a/plugins/cod5/cod5.pro +++ b/plugins/cod5/cod5.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = cod5 SOURCES = cod5.cpp -LIBS += -luser32 diff --git a/plugins/codmw2/codmw2.pro b/plugins/codmw2/codmw2.pro index 96bc1cefd..2569b1d40 100644 --- a/plugins/codmw2/codmw2.pro +++ b/plugins/codmw2/codmw2.pro @@ -7,6 +7,3 @@ include(../plugins.pri) TARGET = codmw2 SOURCES = codmw2.cpp -LIBS += -luser32 - - diff --git a/plugins/codmw2so/codmw2so.pro b/plugins/codmw2so/codmw2so.pro index fbbf0b18f..b10926120 100644 --- a/plugins/codmw2so/codmw2so.pro +++ b/plugins/codmw2so/codmw2so.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = codmw2so SOURCES = codmw2so.cpp -LIBS += -luser32 diff --git a/plugins/cs/cs.pro b/plugins/cs/cs.pro index 237d1719c..a89512db5 100644 --- a/plugins/cs/cs.pro +++ b/plugins/cs/cs.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = cs SOURCES = cs.cpp -LIBS += -luser32 diff --git a/plugins/css/css.pro b/plugins/css/css.pro index ef6aec2ed..f587e6204 100644 --- a/plugins/css/css.pro +++ b/plugins/css/css.pro @@ -8,4 +8,3 @@ include(../plugins.pri) DEFINES += "NULL_DESC=\"L\\\"CounterStrike : Source (Retracted, now using link)\\\"\"" TARGET = css SOURCES = ../null_plugin.cpp -LIBS += -luser32 diff --git a/plugins/dods/dods.pro b/plugins/dods/dods.pro index 54f28ecdd..a8f288909 100644 --- a/plugins/dods/dods.pro +++ b/plugins/dods/dods.pro @@ -8,4 +8,3 @@ include(../plugins.pri) DEFINES += "NULL_DESC=\"L\\\"Day of Defeat : Source (Retracted, now using link)\\\"\"" TARGET = dods SOURCES = ../null_plugin.cpp -LIBS += -luser32 diff --git a/plugins/dys/dys.pro b/plugins/dys/dys.pro index 71c72f8a2..477b9ba10 100644 --- a/plugins/dys/dys.pro +++ b/plugins/dys/dys.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = dys SOURCES = dys.cpp -LIBS += -luser32 diff --git a/plugins/etqw/etqw.pro b/plugins/etqw/etqw.pro index 0b1147eb3..07c0769e1 100644 --- a/plugins/etqw/etqw.pro +++ b/plugins/etqw/etqw.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = etqw SOURCES = etqw.cpp -LIBS += -luser32 diff --git a/plugins/ffxiv/ffxiv.pro b/plugins/ffxiv/ffxiv.pro index b8bc86a11..e50866925 100755 --- a/plugins/ffxiv/ffxiv.pro +++ b/plugins/ffxiv/ffxiv.pro @@ -7,5 +7,3 @@ include(../plugins.pri) TARGET = ffxiv SOURCES = ffxiv.cpp - -win32:LIBS += -luser32 diff --git a/plugins/ffxiv_x64/ffxiv_x64.pro b/plugins/ffxiv_x64/ffxiv_x64.pro index c2cc941b5..c50a50881 100755 --- a/plugins/ffxiv_x64/ffxiv_x64.pro +++ b/plugins/ffxiv_x64/ffxiv_x64.pro @@ -9,4 +9,3 @@ TARGET = ffxiv_x64 SOURCES = ../ffxiv/ffxiv.cpp DEFINES *= FFXIV_USE_x64 -win32:LIBS += -luser32 diff --git a/plugins/gmod/gmod.pro b/plugins/gmod/gmod.pro index 8df76808b..ca73713ff 100644 --- a/plugins/gmod/gmod.pro +++ b/plugins/gmod/gmod.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = gmod SOURCES = gmod.cpp -LIBS += -luser32 diff --git a/plugins/gtaiv/gtaiv.pro b/plugins/gtaiv/gtaiv.pro index 7a0e69322..c9805e36a 100644 --- a/plugins/gtaiv/gtaiv.pro +++ b/plugins/gtaiv/gtaiv.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = gtaiv SOURCES = gtaiv.cpp -LIBS += -luser32 diff --git a/plugins/gtasa/gtasa.pro b/plugins/gtasa/gtasa.pro index 49ba739f8..a4bf81735 100644 --- a/plugins/gtasa/gtasa.pro +++ b/plugins/gtasa/gtasa.pro @@ -7,5 +7,3 @@ include(../plugins.pri) TARGET = gtasa SOURCES = gtasa.cpp - -LIBS += -luser32 diff --git a/plugins/gtav/gtav.pro b/plugins/gtav/gtav.pro index ec8e7ef18..eeb45a117 100644 --- a/plugins/gtav/gtav.pro +++ b/plugins/gtav/gtav.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = gtav SOURCES = gtav.cpp -LIBS += -luser32 diff --git a/plugins/gw/gw.cpp b/plugins/gw/gw.cpp index cbb938c75..fc504a9b2 100644 --- a/plugins/gw/gw.cpp +++ b/plugins/gw/gw.cpp @@ -159,15 +159,14 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa calcout(pos, front, cam, camfront, avatar_pos, avatar_front, camera_pos, camera_front); if (areaid != prev_areaid || location != prev_location) { - context.clear(); - prev_areaid = areaid; prev_location = location; - char buffer[50]; - sprintf_s(buffer, sizeof(buffer), "{\"instance\": \"%d:%d\"}", areaid, static_cast(location)); - context.assign(buffer); + std::ostringstream contextstream; + contextstream << "{\"instance\": \"" << areaid << ":" << static_cast(location) << "\"}"; + context = contextstream.str(); } + return true; } diff --git a/plugins/gw/gw.pro b/plugins/gw/gw.pro index 998e2a44b..9c22be84e 100644 --- a/plugins/gw/gw.pro +++ b/plugins/gw/gw.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = gw SOURCES = gw.cpp -LIBS += -luser32 diff --git a/plugins/hl2dm/hl2dm.pro b/plugins/hl2dm/hl2dm.pro index 9204eb872..42fe07f3d 100644 --- a/plugins/hl2dm/hl2dm.pro +++ b/plugins/hl2dm/hl2dm.pro @@ -8,4 +8,3 @@ include(../plugins.pri) DEFINES += "NULL_DESC=\"L\\\"Half Life 2 Death Match (Retracted, now using link)\\\"\"" TARGET = hl2dm SOURCES = ../null_plugin.cpp -LIBS += -luser32 diff --git a/plugins/insurgency/insurgency.pro b/plugins/insurgency/insurgency.pro index 4c6511993..b468f6425 100644 --- a/plugins/insurgency/insurgency.pro +++ b/plugins/insurgency/insurgency.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = insurgency SOURCES = insurgency.cpp -LIBS += -luser32 diff --git a/plugins/jc2/jc2.pro b/plugins/jc2/jc2.pro index 863fd149c..e9a483d11 100755 --- a/plugins/jc2/jc2.pro +++ b/plugins/jc2/jc2.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = jc2 SOURCES = jc2.cpp -LIBS += -luser32 diff --git a/plugins/l4d/l4d.pro b/plugins/l4d/l4d.pro index 518801e50..0b6ea0d98 100644 --- a/plugins/l4d/l4d.pro +++ b/plugins/l4d/l4d.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = l4d SOURCES = l4d.cpp -LIBS += -luser32 diff --git a/plugins/l4d2/l4d2.pro b/plugins/l4d2/l4d2.pro index 81466537f..562299fce 100644 --- a/plugins/l4d2/l4d2.pro +++ b/plugins/l4d2/l4d2.pro @@ -7,5 +7,3 @@ include(../plugins.pri) TARGET = l4d2 SOURCES = l4d2.cpp - -win32:LIBS += -luser32 diff --git a/plugins/link/link.pro b/plugins/link/link.pro index 992429d99..db9bb825f 100644 --- a/plugins/link/link.pro +++ b/plugins/link/link.pro @@ -9,7 +9,6 @@ TARGET = link win32 { SOURCES = link.cpp - LIBS += -luser32 } unix { diff --git a/plugins/lol/lol.cpp b/plugins/lol/lol.cpp index 6402cc2ff..3f79c6474 100644 --- a/plugins/lol/lol.cpp +++ b/plugins/lol/lol.cpp @@ -67,7 +67,7 @@ static procptr_t gameptr = 0xE22E90; static procptr_t hostipptr = 0xAF69D18; static procptr_t hostportptr = hostipptr + 0x1C; -static char prev_hostip[16]; // These should never change while the game is running, but just in case... +static std::string prev_hostip; // These should never change while the game is running, but just in case... static int prev_hostport; static bool calcout(float *pos, float *cam, float *opos, float *ocam) { @@ -128,18 +128,19 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa calcout(ipos, cam, avatar_pos, camera_pos); //calculate proper position values - if (strcmp(hostip, prev_hostip) != 0 || hostport != prev_hostport) { - context.clear(); - - strcpy_s(prev_hostip, sizeof(prev_hostip), hostip); + if (hostip != prev_hostip || hostport != prev_hostport) { + prev_hostip = hostip; prev_hostport = hostport; if (strcmp(hostip, "") != 0) { - char buffer[50]; - sprintf_s(buffer, sizeof(buffer), "{\"ipport\": \"%s:%d\"}", hostip, hostport); - context.assign(buffer); + std::ostringstream contextstream; + contextstream << "{\"ipport\": \"" << hostip << ":" << hostport << "\"}"; + context = contextstream.str(); + } else { + context.clear(); } } + return true; } @@ -148,7 +149,7 @@ static int trylock(const std::multimap &pi return false; if (refreshPointers()) { // unlink plugin if this fails - *prev_hostip = '\0'; + prev_hostip.clear(); prev_hostport = 0; float avatar_pos[3], avatar_front[3], avatar_top[3]; @@ -157,7 +158,7 @@ static int trylock(const std::multimap &pi std::wstring identity; if (fetch(avatar_pos, avatar_front, avatar_top, camera_pos, camera_front, camera_top, context, identity)) { - *prev_hostip = '\0'; // we need to do this again since fetch() above overwrites this (which results in empty context until next change) + prev_hostip.clear(); // we need to do this again since fetch() above overwrites this (which results in empty context until next change) prev_hostport = 0; return true; } diff --git a/plugins/lol/lol.pro b/plugins/lol/lol.pro index 49d5ca71c..3acf1681d 100644 --- a/plugins/lol/lol.pro +++ b/plugins/lol/lol.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = lol SOURCES = lol.cpp -LIBS += -luser32 diff --git a/plugins/lotro/lotro.cpp b/plugins/lotro/lotro.cpp index 1077dcc3f..37fb5eb3a 100644 --- a/plugins/lotro/lotro.cpp +++ b/plugins/lotro/lotro.cpp @@ -42,8 +42,8 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa bool ok; - byte l[2]; - byte r,i; + uint8_t l[2]; + uint8_t r,i; float o[3]; procptr_t hPtr; float h; @@ -51,7 +51,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa /* Position as represented by /loc command - lx, ly = 8 * (byte)l; + lx, ly = 8 * (uint8_t)l; ox, oy, oz = (float)o; 0 < ox < 160 diff --git a/plugins/lotro/lotro.pro b/plugins/lotro/lotro.pro index afa3525a2..d8f79ea26 100644 --- a/plugins/lotro/lotro.pro +++ b/plugins/lotro/lotro.pro @@ -7,5 +7,3 @@ include(../plugins.pri) TARGET = lotro SOURCES = lotro.cpp -LIBS += -luser32 -CONFIG += qt diff --git a/plugins/mumble_plugin_utils.h b/plugins/mumble_plugin_utils.h index 0f7742f87..307dc76ff 100644 --- a/plugins/mumble_plugin_utils.h +++ b/plugins/mumble_plugin_utils.h @@ -6,6 +6,14 @@ #ifndef MUMBLE_MUMBLE_PLUGIN_UTILS_H_ #define MUMBLE_MUMBLE_PLUGIN_UTILS_H_ +#include +#include + +static inline std::string utf16ToUtf8(const std::wstring &wstr) { + std::wstring_convert> conv; + return conv.to_bytes(wstr); +} + // escape lossily converts the given // string to ASCII, replacing any // character not within the printable diff --git a/plugins/plugins.pri b/plugins/plugins.pri index bcb52e4d3..6f9253d88 100644 --- a/plugins/plugins.pri +++ b/plugins/plugins.pri @@ -16,6 +16,8 @@ CONFIG(static) { CONFIG += qt_dynamic_lookup } +win32:LIBS += -luser32 + DESTDIR = $$DESTDIR/plugins include(../qmake/symbols.pri) diff --git a/plugins/plugins.pro b/plugins/plugins.pro index 50b3eb044..3a280318f 100644 --- a/plugins/plugins.pro +++ b/plugins/plugins.pro @@ -10,14 +10,15 @@ TEMPLATE = subdirs CONFIG += debug_and_release SUBDIRS = link -win32 { - SUBDIRS += aoc arma2 bf1942 bf2 bf3 bf2142 bfbc2 bfheroes bf4_x86 blacklight borderlands borderlands2 breach cod2 cod4 cod5 codmw2 codmw2so cs css dods dys etqw ffxiv tf2 gmod gtaiv gtasa gw hl2dm insurgency jc2 l4d l4d2 lol lotro ql rl sr sto ut2004 ut3 ut99 wolfet wow +win32|linux { + SUBDIRS += aoc arma2 bf1942 bf2 bf3 bf2142 bfbc2 bfheroes bf4_x86 blacklight borderlands borderlands2 breach cod2 cod4 cod5 codmw2 codmw2so cs dys etqw ffxiv gmod gtaiv gtasa gw insurgency jc2 l4d l4d2 lol lotro ql rl sr ut2004 ut3 ut99 wolfet wow equals(MUMBLE_ARCH, x86_64) { SUBDIRS += bf1 bf4 ffxiv_x64 gtav wow_x64 } } -linux { - SUBDIRS += l4d2 rl +# Plugins which are now retracted were only released for Windows +win32 { + SUBDIRS += css dods hl2dm sto tf2 } diff --git a/plugins/ql/ql.cpp b/plugins/ql/ql.cpp index 7744d77b6..d089b60a6 100644 --- a/plugins/ql/ql.cpp +++ b/plugins/ql/ql.cpp @@ -18,7 +18,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa // Char values for extra features char host[22], servername[50], map[30]; // Team - BYTE team; + uint8_t team; // Peekproc and assign game addresses to our containers, so we can retrieve positional data ok = peekProc(pModule + 0x0188248, &state, 1) && // Magical state value: 1 when in-game and 0 when in main menu. diff --git a/plugins/ql/ql.pro b/plugins/ql/ql.pro index c6127c4bd..091b8ecc8 100644 --- a/plugins/ql/ql.pro +++ b/plugins/ql/ql.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = ql SOURCES = ql.cpp -LIBS += -luser32 diff --git a/plugins/rl/rl.pro b/plugins/rl/rl.pro index 6fa78247a..66eeaab40 100644 --- a/plugins/rl/rl.pro +++ b/plugins/rl/rl.pro @@ -7,5 +7,3 @@ include(../plugins.pri) TARGET = rl SOURCES = rl.cpp - -win32:LIBS += -luser32 diff --git a/plugins/sr/sr.pro b/plugins/sr/sr.pro index 6a0e784cf..f49380651 100644 --- a/plugins/sr/sr.pro +++ b/plugins/sr/sr.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = sr SOURCES = sr.cpp -LIBS += -luser32 diff --git a/plugins/sto/sto.pro b/plugins/sto/sto.pro index 96b7eb32d..9f116ba9a 100644 --- a/plugins/sto/sto.pro +++ b/plugins/sto/sto.pro @@ -8,4 +8,3 @@ include(../plugins.pri) DEFINES += "NULL_DESC=\"L\\\"Star Trek Online (Retracted due to lack of maintenance)\\\"\"" TARGET = sto SOURCES = ../null_plugin.cpp -LIBS += -luser32 diff --git a/plugins/tf2/tf2.pro b/plugins/tf2/tf2.pro index 5a464fdb9..c89c47e3a 100644 --- a/plugins/tf2/tf2.pro +++ b/plugins/tf2/tf2.pro @@ -8,4 +8,3 @@ include(../plugins.pri) DEFINES += "NULL_DESC=\"L\\\"Team Fortress 2 (Retracted, now using link)\\\"\"" TARGET = tf2 SOURCES = ../null_plugin.cpp -LIBS += -luser32 diff --git a/plugins/ut2004/ut2004.pro b/plugins/ut2004/ut2004.pro index b9ff3f232..5fd449040 100644 --- a/plugins/ut2004/ut2004.pro +++ b/plugins/ut2004/ut2004.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = ut2004 SOURCES = ut2004.cpp -LIBS += -luser32 diff --git a/plugins/ut3/ut3.pro b/plugins/ut3/ut3.pro index f9314646f..c8fd3edab 100644 --- a/plugins/ut3/ut3.pro +++ b/plugins/ut3/ut3.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = ut3 SOURCES = ut3.cpp -LIBS += -luser32 diff --git a/plugins/ut99/ut99.cpp b/plugins/ut99/ut99.cpp index 827ff9310..9b5a11a00 100644 --- a/plugins/ut99/ut99.cpp +++ b/plugins/ut99/ut99.cpp @@ -35,20 +35,12 @@ */ #include "../mumble_plugin_main.h" +#include "../mumble_plugin_utils.h" procptr_t posptr; procptr_t frtptr; procptr_t topptr; -static void wcsToMultibyteStdString(wchar_t *wcs, std::string &str) { - const int size = WideCharToMultiByte(CP_UTF8, 0, wcs, -1, NULL, 0, NULL, NULL); - if (size == 0) return; - - str.resize(size); - - WideCharToMultiByte(CP_UTF8, 0, wcs, -1, &str[0], size, NULL, NULL); -} - static bool cross(float *a, float *b, float *c) { if (a == 0 || b == 0 || c == 0) return false; @@ -161,8 +153,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa wservername[sizeof(wservername)/sizeof(wservername[0]) - 1] = '\0'; - std::string servername; - wcsToMultibyteStdString(wservername, servername); + const std::string servername = utf16ToUtf8(wservername); std::ostringstream contextss; contextss << "{" diff --git a/plugins/ut99/ut99.pro b/plugins/ut99/ut99.pro index d1b8a26b2..a773fe664 100644 --- a/plugins/ut99/ut99.pro +++ b/plugins/ut99/ut99.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = ut99 SOURCES = ut99.cpp -LIBS += -luser32 diff --git a/plugins/wolfet/wolfet.pro b/plugins/wolfet/wolfet.pro index d4f403977..02b9b7bbf 100644 --- a/plugins/wolfet/wolfet.pro +++ b/plugins/wolfet/wolfet.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = wolfet SOURCES = wolfet.cpp -LIBS += -luser32 diff --git a/plugins/wow/wow.pro b/plugins/wow/wow.pro index 685fa2ab3..5469d4068 100644 --- a/plugins/wow/wow.pro +++ b/plugins/wow/wow.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = wow SOURCES = wow.cpp -LIBS += -luser32 diff --git a/plugins/wow_x64/wow_x64.pro b/plugins/wow_x64/wow_x64.pro index d44209124..67ed8bc69 100644 --- a/plugins/wow_x64/wow_x64.pro +++ b/plugins/wow_x64/wow_x64.pro @@ -7,4 +7,3 @@ include(../plugins.pri) TARGET = wow_x64 SOURCES = wow_x64.cpp -LIBS += -luser32