diff options
-rw-r--r-- | plugins/lol/lol.cpp | 107 |
1 files changed, 64 insertions, 43 deletions
diff --git a/plugins/lol/lol.cpp b/plugins/lol/lol.cpp index 55eecc758..34f962a4a 100644 --- a/plugins/lol/lol.cpp +++ b/plugins/lol/lol.cpp @@ -1,5 +1,4 @@ /* Copyright (C) 2012, dark_skeleton (d-rez) <dark.skeleton@gmail.com> - Copyright (C) 2005-2012, Thorvald Natvig <thorvald@natvig.com> All rights reserved. @@ -36,14 +35,17 @@ static BYTE *camptr; static BYTE *camfrontptr; static BYTE *camtopptr; static BYTE *afrontptr; +static BYTE *atopptr; static BYTE *hostipptr; static BYTE *hostportptr; +static BYTE *summonerptr; static BYTE *gameptr; -static char prev_hostip[16]; +static char prev_hostip[16]; // These should never change while the game is running, but just in case... static int prev_hostport; +static char prev_summoner[17]; static bool calcout(float *pos, float *cam, float *opos, float *ocam) { // Seems League of Legends is in centimeters? ;o Well it's not inches for sure :) @@ -56,55 +58,77 @@ static bool calcout(float *pos, float *cam, float *opos, float *ocam) { } static bool refreshPointers(void) { - // camera position vector @ 0xb56308 - // camera front vector @ 0xb562ec - // camera top vector @ 0xb5631c - // avatar position vector @ 0x2eafae8 - // avatar front vector @ 0xe00f88 -> +0x2a54 - // host ip (text) @ 0xaf4f028 - // host port (4 bytes) @ 0xaf4f044 - - posptr = camptr = camfrontptr = camtopptr = afrontptr = NULL; + /* Arrays of bytes to find addresses accessed by respective functions so we don't have to blindly search for addresses after every update + Remember to disable scanning writable memory only in CE! We're searching for functions here, not values! + Current addresses as of version 1.0.0.142 + + Camera position vector address: F3 0F 11 03 F3 0F 10 44 24 14 D9 5C 24 28 :00B4B858 + Camera front vector address: campos+0x14 (offset, not pointer!) + Camera top vector address: campos+0x20 (offset, not pointer!) + + D9 5F 40 D9 46 04 D9 5F 44 D9 46 08 D9 5F 48 59 C3 CC (non-static! NEEDS POINTER) :00DFA4E8 + Avatar front vector address: +0x2ab4 + Avatar top vector address: +0x2ac0 + + D9 9E E8 01 00 00 D9 40 70 D9 9E EC 01 00 00 D9 40 74 D9 9E F0 01 00 00 :02F2DE68 + Avatar position vector address: +0x1e8 + + IP: Look for a non-unicode string that will contain server's IP. 28 bytes further from IP, there should be server's port + :0AF395B8 + PORT: +0x1C (offset, not pointer!) + IDENTITY: Just look for your nickname saved in non-unicode that is static. Length is 16 + :0AF3957C + */ + + posptr = camptr = camfrontptr = camtopptr = afrontptr = atopptr = NULL; // Camera position - camptr = (BYTE *)0xb56308; + camptr = (BYTE *)0xB4B858; // Camera front - camfrontptr = (BYTE *)0xb562ec; + camfrontptr = camptr + 0x14; // Camera top - camtopptr = (BYTE *)0xb5631c; + camtopptr = camptr + 0x20; // Avatar front vector pointer BYTE *tmpptr = NULL; - gameptr = (BYTE *)0xe00f88; // NOTE: This pointer is availible ONLY when ingame. We are using this fact to unlink plugin when not ingame. + gameptr = (BYTE *)0xDFA4E8; tmpptr = peekProc<BYTE *>(gameptr); if (!tmpptr) - return false; // Player not in game (game is still loading), unlink plugin + return false; // Something went wrong, unlink - afrontptr = tmpptr + 0x2a54; + afrontptr = tmpptr + 0x2ab4; + atopptr = tmpptr + 0x2ac0; // Avatar position vector - posptr = (BYTE *)0x2eafae8; // NOTE: This consists of all zeros right after game is loaded until your avatar moves, but we don't have to worry about it since (0,0,0) is close to our spawning position + tmpptr = peekProc<BYTE *>((BYTE *)0x2F2DE68); + if (!tmpptr) + return false; // Something went wrong, unlink + + posptr = tmpptr + 0x1e8; // Host IP:PORT. It is kept in 3 places in memory, but 1 of them looks the coolest, so let's use it, ha! // IP is kept as text @ hostipptr // PORT is kept as a 4-byte decimal value @ hostportptr - hostipptr = (BYTE *)0xaf4f028; - hostportptr = (BYTE *)0xaf4f044; + hostipptr = (BYTE *)0xAF395B8; + hostportptr = hostipptr + 0x1C; + + summonerptr = (BYTE *)0xAF3957C; return true; } -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*/) { +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) { 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; float ipos[3], cam[3]; int hostport; char hostip[16]; + char summoner[17]; bool ok; // Player not in game (or something broke), unlink @@ -116,16 +140,14 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa peekProc(camptr, cam, 12) && peekProc(posptr, ipos, 12) && peekProc(afrontptr, avatar_front, 12) && + peekProc(atopptr, avatar_top, 12) && peekProc(hostipptr, hostip) && - peekProc(hostportptr, &hostport, 4); + peekProc(hostportptr, &hostport, 4) && + peekProc(summonerptr, summoner); if (ok) { int res = calcout(ipos, cam, avatar_pos, camera_pos); if (res) { - avatar_top[0] = 0.0f; - avatar_top[1] = 1.0f; // Your character is always looking straight ahead ;) - avatar_top[2] = 0.0f; - if (strcmp(hostip, prev_hostip) != 0 || hostport != prev_hostport) { context.clear(); memcpy(prev_hostip, hostip, 16); @@ -137,6 +159,18 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa context.assign(buffer); } } + if (strcmp(summoner, prev_summoner) != 0) { + identity.clear(); + memcpy(prev_summoner,summoner,17); + + if (strcmp(summoner, "") != 0) { + wchar_t tmp[sizeof(summoner)]; + mbstowcs_s(NULL,tmp,summoner,sizeof(summoner)); + wchar_t buffer[50]; + swprintf_s(buffer, 50, L"{\"summoner\": \"%s\"}", tmp); + identity.assign(buffer); + } + } } return res; } @@ -150,10 +184,6 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi float pos[3], opos[3]; float cam[3], ocam[3]; - float afront[3]; - float camfront[3], camtop[3]; - char hostip[16]; - int hostport; // unlink plugin if this fails if (!refreshPointers()) { @@ -161,19 +191,10 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi return false; } - bool ok = peekProc(camfrontptr, camfront, 12) && - peekProc(camtopptr, camtop, 12) && - peekProc(posptr, pos, 12) && - peekProc(camptr, cam, 12) && - peekProc(afrontptr, afront, 12) && - peekProc(hostipptr, hostip) && - peekProc(hostportptr, &hostport, 4); - - ok = ok && calcout(pos,cam,opos,ocam); // make sure values are OK - - if (ok) { + if (calcout(pos,cam,opos,ocam)) { // make sure values are OK *prev_hostip = '\0'; prev_hostport = 0; + *prev_summoner = '\0'; return true; } @@ -182,10 +203,10 @@ static int trylock(const std::multimap<std::wstring, unsigned long long int> &pi } static const std::wstring longdesc() { - return std::wstring(L"Supports League of Legends v1.0.0.139 with context. No identity support yet."); + return std::wstring(L"Supports League of Legends v1.0.0.142 with context and identity support."); } -static std::wstring description(L"League of Legends (v1.0.0.139)"); +static std::wstring description(L"League of Legends (v1.0.0.142)"); static std::wstring shortname(L"League of Legends"); static int trylock1() { |