diff options
author | Kissaki <kissaki@gmx.de> | 2014-07-23 01:28:53 +0400 |
---|---|---|
committer | Kissaki <kissaki@gmx.de> | 2014-07-23 01:28:53 +0400 |
commit | 47d8a4f2a12eeb0f8238ef638101595ca1131efe (patch) | |
tree | c6c763c6b4b831d00322086ad4309d8ba45519bb /plugins | |
parent | 840a31de0e217f7908d3872b7cd76568ad28ccb1 (diff) |
Update gmod PA plugin with updated addresses.
* Update the gmod PA plugin with current memory addresses
** The state byte could not be found and thus is commented out for now.
This will result in spectators/dead people also hearing PA.
The state was not added to the context (for team context).
* Swap incorrect use of v and h variables; it’s the other way around
* Remove unused variable
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gmod/gmod.cpp | 69 |
1 files changed, 37 insertions, 32 deletions
diff --git a/plugins/gmod/gmod.cpp b/plugins/gmod/gmod.cpp index 5552831fd..6a931a1ac 100644 --- a/plugins/gmod/gmod.cpp +++ b/plugins/gmod/gmod.cpp @@ -39,29 +39,29 @@ BYTE *stateptr; BYTE *hostptr; static bool calcout(float *pos, float *rot, float *opos, float *front, float *top) { - float h = rot[0]; - float v = rot[1]; + float v = rot[0]; + float h = rot[1]; if ((v < -360.0f) || (v > 360.0f) || (h < -360.0f) || (h > 360.0f)) return false; - h *= static_cast<float>(M_PI / 180.0f); v *= static_cast<float>(M_PI / 180.0f); + h *= static_cast<float>(M_PI / 180.0f); // Seems Gmod is in inches. INCHES?!? opos[0] = pos[0] / 39.37f; opos[1] = pos[2] / 39.37f; opos[2] = pos[1] / 39.37f; - front[0] = cos(v) * cos(h); - front[1] = -sin(h); - front[2] = sin(v) * cos(h); + front[0] = cos(h) * cos(v); + front[1] = -sin(v); + front[2] = sin(h) * cos(v); - h -= static_cast<float>(M_PI / 2.0f); + v -= static_cast<float>(M_PI / 2.0f); - top[0] = cos(v) * cos(h); - top[1] = -sin(h); - top[2] = sin(v) * cos(h); + top[0] = cos(h) * cos(v); + top[1] = -sin(v); + top[2] = sin(h) * cos(v); return true; } @@ -72,16 +72,16 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa float ipos[3], rot[3]; bool ok; - char state; + //char state; char chHostStr[40]; string sHost; - wostringstream new_identity; ostringstream new_context; - ok = peekProc(posptr, ipos, 12) && - peekProc(rotptr, rot, 12) && - peekProc(stateptr, &state, 1) && - peekProc(hostptr, chHostStr, 40); + ok = peekProc(posptr, ipos, 12) + && peekProc(rotptr, rot, 12) + //&& peekProc(stateptr, &state, 1) + && peekProc(hostptr, chHostStr, 40) + ; if (!ok) return false; @@ -96,11 +96,11 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa << "<hostport>" << sHost << "</hostport>" << "</context>"; context = new_context.str(); - +/* // Check to see if you are spawned if (state != 18) return true; // Deactivate plugin - +*/ ok = calcout(ipos, rot, avatar_pos, avatar_front, avatar_top); if (ok) { for (int i=0;i<3;++i) { @@ -124,24 +124,28 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi if (!mod_engine) return false; - // Check if we really have Gmod running - /* - position tuple: client.dll+0x483fe0 (x,y,z, float) - orientation tuple: client.dll+0x4733bc (v,h float) - ID string: client.dll+0x5ec370 = "garrysmod" (9 characters, text) - spawn state: client.dll+0x46ab34 (0 when at main menu, 2 when not spawned, 15 to 14 when spawned, byte) - host string: engine.dll+0x3C2A04 - */ - // Remember addresses for later - posptr = pModule + 0x50A2B0; - rotptr = pModule + 0x50A16C; + // position tuple: x,y,z, float + // client.dll+0x6856B8 + posptr = pModule + 0x6856B8; + // orientation tuple: v,h,? float + // v: up = -90°, down = 90°; h (rotation): -180 - 180° + // client.dll+0x5B5914 + rotptr = pModule + 0x5B5914; + // spawn state: client.dll+0x?????? - 0 when at main menu, 2 when not spawned, 15 to 14 when spawned, byte + // This could not be verified/found by Kissaki stateptr = mod_engine + 0x375565; - hostptr = mod_engine + 0x3D3E94; + // ID string; Game name "garrysmod" + // engine.dll+0x6622DC + BYTE *idptr = mod_engine + 0x6622DC; + // host string: String in form "ip:port". + // engine.dll+0x49176C + hostptr = mod_engine + 0x49176C; // Gamecheck + const char ID[] = "garrysmod"; char sMagic[18]; - if (!peekProc(pModule + 0x4B2515, sMagic, 18) || strncmp("?AVCSpectatorGUI@@", sMagic, 18)!=0) + if (!peekProc(idptr, sMagic, sizeof(ID)) || strncmp(ID, sMagic, sizeof(ID))!=0) return false; // Check if we can get meaningful data from it @@ -159,10 +163,11 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi } static const std::wstring longdesc() { + // Exe build: 20:55:48 Jun 17 2014 (5692) (4000) return std::wstring(L"Supports Gmod 11 build 4426. No identity support yet."); } -static std::wstring description(L"Garry's Mod 11 (Build 4426)"); +static std::wstring description(L"Garry's Mod 11 (Build 5692)"); static std::wstring shortname(L"Garry's Mod 11"); static int trylock1() { |