Add support for versions 28 and 29; rename v30 hook to v28

This commit is contained in:
_ 2020-11-03 01:35:26 -07:00
parent bc350ff36a
commit c080101683

View File

@ -5,8 +5,8 @@
typedef int(__cdecl* keyToLE_v25)(unsigned int* dest, int* key, int bits); typedef int(__cdecl* keyToLE_v25)(unsigned int* dest, int* key, int bits);
keyToLE_v25 keyToLEFunc_v25_hook = nullptr; keyToLE_v25 keyToLEFunc_v25_hook = nullptr;
typedef int(__cdecl* keyToLE_v30)(unsigned int* dest, int* key, int bits, bool isEncoded); typedef int(__cdecl* keyToLE_v28)(unsigned int* dest, int* key, int bits, bool isEncoded);
keyToLE_v30 keyToLEFunc_v30_hook = nullptr; keyToLE_v28 keyToLEFunc_v28_hook = nullptr;
std::string prevKeyStr = std::string(); std::string prevKeyStr = std::string();
@ -29,7 +29,7 @@ int __cdecl keyToLE_hook_v25(unsigned int* dest, int* key, int bits)
return keyToLEFunc_v25_hook(dest, key, bits); return keyToLEFunc_v25_hook(dest, key, bits);
} }
int __cdecl keyToLE_hook_v30(unsigned int* dest, int* key, int bits, bool isEncoded) int __cdecl keyToLE_hook_v28(unsigned int* dest, int* key, int bits, bool isEncoded)
{ {
//std::cout << "TEST" << std::endl; //std::cout << "TEST" << std::endl;
@ -82,7 +82,7 @@ int __cdecl keyToLE_hook_v30(unsigned int* dest, int* key, int bits, bool isEnco
prevKeyStr = newKeyStr; prevKeyStr = newKeyStr;
} }
return keyToLEFunc_v30_hook(dest, key, bits, isEncoded); return keyToLEFunc_v28_hook(dest, key, bits, isEncoded);
} }
char* GetAddrV26() char* GetAddrV26()
@ -102,7 +102,7 @@ char* GetAddrV27()
BYTE ref_v7 = 0x55; BYTE ref_v7 = 0x55;
BYTE* byteAtAddrStr = (BYTE*)0x01068F90; BYTE* byteAtAddrStr = (BYTE*)0x01068F90;
// Byte at byteAtAddr in 1.1.26-19 is 0x55 // Byte at byteAtAddr in 1.1.27-7 is 0x55
if (*byteAtAddrStr == ref_v7) if (*byteAtAddrStr == ref_v7)
return (char*)0x01068F90; return (char*)0x01068F90;
else else
@ -130,20 +130,20 @@ void Hooks::Init()
// Two 1.1.27 versions // Two 1.1.27 versions
keyToLEFunc_v25_hook = (keyToLE_v25)Utils::TrampHook32(GetAddrV27(), (char*)keyToLE_hook_v25, 6); keyToLEFunc_v25_hook = (keyToLE_v25)Utils::TrampHook32(GetAddrV27(), (char*)keyToLE_hook_v25, 6);
break; break;
/*case 28: case 28:
//keyToLEFunc_v25_hook = (keyToLE_v25)Utils::TrampHook32((char*)0x0106B920, (char*)keyToLE_hook_v25, 6); keyToLEFunc_v28_hook = (keyToLE_v28)Utils::TrampHook32((char*)0x01074650, (char*)keyToLE_hook_v28, 6);
break; break;
case 29: case 29:
//keyToLEFunc_v25_hook = (keyToLE_v25)Utils::TrampHook32((char*)0x0106B920, (char*)keyToLE_hook_v25, 6); keyToLEFunc_v28_hook = (keyToLE_v28)Utils::TrampHook32((char*)0x010861B0, (char*)keyToLE_hook_v28, 6);
break;*/ break;
case 30: case 30:
keyToLEFunc_v30_hook = (keyToLE_v30)Utils::TrampHook32((char*)0x0108E840, (char*)keyToLE_hook_v30, 6); keyToLEFunc_v28_hook = (keyToLE_v28)Utils::TrampHook32((char*)0x0108E840, (char*)keyToLE_hook_v28, 6);
break; break;
case 44: case 44:
keyToLEFunc_v30_hook = (keyToLE_v30)Utils::TrampHook32((char*)0x010CABC0, (char*)keyToLE_hook_v30, 6); keyToLEFunc_v28_hook = (keyToLE_v28)Utils::TrampHook32((char*)0x010CABC0, (char*)keyToLE_hook_v28, 6);
break; break;
case 45: case 45:
keyToLEFunc_v30_hook = (keyToLE_v30)Utils::TrampHook32((char*)0x010CF780, (char*)keyToLE_hook_v30, 6); keyToLEFunc_v28_hook = (keyToLE_v28)Utils::TrampHook32((char*)0x010CF780, (char*)keyToLE_hook_v28, 6);
break; break;
} }
} }