Remove more unnneeded code
(pertains to offset resolving which is only required in 2012/2013 player beta)
This commit is contained in:
parent
ea84438423
commit
7a1ed6f4d8
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue