Remove more unnneeded code

(pertains to offset resolving which is only required in 2012/2013 player beta)
This commit is contained in:
pizzaboxer 2022-04-10 12:03:42 +01:00
parent ea84438423
commit 7a1ed6f4d8
2 changed files with 0 additions and 46 deletions

View File

@ -13,48 +13,4 @@ LONG Patches::Apply()
DetourAttach(&(PVOID&)*patch.first, patch.second);
return DetourTransactionCommit();
}
VOID Patches::ResolveOffset()
{
// the only surviving fragment of PolygonUtil.dll
// RIP 05/08/2021 - 20/01/2022
MEMORY_BASIC_INFORMATION mbi;
DWORD ProcID = GetCurrentProcessId();
HANDLE Handle = OpenProcess(PROCESS_ALL_ACCESS, TRUE, ProcID);
unsigned int Opcode = 0xC7F18B56;
int BaseAddress = 0x00001000;
int Offset = 0x00010000;
int Searches = 0xFFF;
for (int i = 1; i <= Searches; i++)
{
int SearchAddress = Offset * i;
int Address = SearchAddress + BaseAddress;
if (VirtualQuery((LPVOID)Address, &mbi, sizeof(mbi)) == 0) continue;
std::vector<int> buffer(mbi.RegionSize);
if (!ReadProcessMemory(Handle, (LPCVOID)Address, &buffer[0], buffer.size(), NULL)) continue;
if (buffer[0] == Opcode)
{
addressOffset = SearchAddress;
break;
}
if (SearchAddress == Offset * Searches)
{
ExitProcess(EXIT_FAILURE);
}
}
}
INT Patches::GetAddressByOffset(int address)
{
if (!addressOffset) ResolveOffset();
return address + addressOffset;
}

View File

@ -7,8 +7,6 @@ namespace Patches
extern std::vector<Patch> patchList;
LONG Apply();
VOID ResolveOffset();
INT GetAddressByOffset(int address);
}
#define START_PATCH_LIST() std::vector<Patches::Patch> Patches::patchList = {