Update detours to S3 N1094

Update project to build R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
This commit is contained in:
Amos 2021-07-03 08:18:57 -07:00
parent e0ca233333
commit 02c02f53b0
3 changed files with 33 additions and 27 deletions

View File

@ -3,33 +3,40 @@
#include "utility.h" #include "utility.h"
void InstallOpcodes(); void InstallOpcodes();
inline HANDLE GameProcess = GetCurrentProcess();
namespace namespace
{ {
/* -------------- ORIGIN ------------------------------------------------------------------------------------------------------------------------------------------------ */ /* -------------- ORIGIN ------------------------------------------------------------------------------------------------------------------------------------------------ */
DWORD64 dst000 = /*0x14032C910*/ FindPattern("r5apex.exe", (const unsigned char*)"\x48\x83\xEC\x28\x80\x3D\x00\x00\x00\x22\x00\x0F\x85\x00\x02\x00", "xxxxxx???xxxx?xx"); DWORD64 dst000 = /*0x14032C910*/ FindPattern("r5apex.exe", (const unsigned char*)"\x48\x83\xEC\x28\x80\x3D\x00\x00\x00\x23\x00\x0F\x85\x00\x02\x00", "xxxxxx???xxxx?xx");
DWORD64 dst001 = /*0x14023C440*/ FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x5C\x24\x18\x55\x41\x56\x41\x57\x48\x81\xEC\x40\x02\x00", "xxxxxxxxxxxxxxxx"); DWORD64 dst001 = /*0x14023C440*/ FindPattern("r5apex.exe", (const unsigned char*)"\x48\x81\xEC\x58\x04\x00\x00\x80\x3D\x00\x00\x00\x00\x00\x0F\x84", "xxxxxxxxx????xxx");
/* -------------- ENGINE ------------------------------------------------------------------------------------------------------------------------------------------------ */ /* -------------- ENGINE ------------------------------------------------------------------------------------------------------------------------------------------------ */
DWORD64 dst002 = /*0x140E3E110*/ FindPattern("r5apex.exe", (const unsigned char*)"\x41\x56\x41\x57\x48\x81\xEC\x00\x00\x00\x00\x4C\x8B\xF2\x4C\x8B", "xxxxxxx????xxxxx"); DWORD64 dst002 = /*0x140438DE0*/ FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x4C\x24\x08\x56\x41\x55\x48\x81\xEC\x68\x03\x00\x00\x4C", "xxxx?xxxxxxxxxxx");
DWORD64 dst003 = /*0x1403604E0*/ FindPattern("r5apex.exe", (const unsigned char*)"\x40\x53\x41\x56\x41\x57\x48\x83\xEC\x20\x48\x8B\xD9\x48\x89\x74", "xxxxxxxxxxxxxxxx");
/* -------------- NETCHAN ----------------------------------------------------------------------------------------------------------------------------------------------- */ /* -------------- NETCHAN ----------------------------------------------------------------------------------------------------------------------------------------------- */
DWORD64 dst003 = /*0x14030BEF0*/ FindPattern("r5apex.exe", (const unsigned char*)"\x44\x89\x44\x24\x18\x55\x56\x57\x48\x8D\xAC\x24\x60\xFF\xFF\xFF", "xxxxxxxxxxxxxxxx"); DWORD64 dst004 = /*0x14030BEF0*/ FindPattern("r5apex.exe", (const unsigned char*)"\x40\x55\x57\x41\x55\x41\x57\x48\x8D\xAC\x24\x28\xFF\xFF\xFF\x48", "xxxxxxxxxxxxxxxx");
/* -------------- FAIRFIGHT --------------------------------------------------------------------------------------------------------------------------------------------- */ /* -------------- FAIRFIGHT --------------------------------------------------------------------------------------------------------------------------------------------- */
DWORD64 dst004 = /*0x140302D90*/ FindPattern("r5apex.exe", (const unsigned char*)"\x40\x53\x57\x41\x57\x48\x83\xEC\x30\x8B\x81\xB0\x03\x00\x00\x48", "xxxxxxxxxxxxxxxx"); DWORD64 dst005 = /*0x140302D90*/ FindPattern("r5apex.exe", (const unsigned char*)"\x40\x53\x48\x83\xEC\x20\x8B\x81\xB0\x03\x00\x00\x48\x8B\xD9\xC6", "xxxxxxxxxxxxxxxx");
/* -------------- OTHER ------------------------------------------------------------------------------------------------------------------------------------------------- */
/**/
/* -------------- ------- ----------------------------------------------------------------------------------------------------------------------------------------------- */ /* -------------- ------- ----------------------------------------------------------------------------------------------------------------------------------------------- */
void PrintOAddress() // Test the sigscan results void PrintOAddress() // Test the sigscan results
{ {
std::cout << "--------------------------------------------------" << std::endl; std::cout << "+--------------------------------------------------------+" << std::endl;
std::cout << " dst000 : " << std::hex << dst000 << std::endl; std::cout << "| dst000 : " << std::hex << dst000 << std::endl;
std::cout << " dst001 : " << std::hex << dst001 << std::endl; std::cout << "| dst001 : " << std::hex << dst001 << std::endl;
std::cout << " dst002 : " << std::hex << dst001 << std::endl; std::cout << "+--------------------------------------------------------+" << std::endl;
std::cout << " dst003 : " << std::hex << dst003 << std::endl; std::cout << "| dst002 : " << std::hex << dst002 << std::endl;
std::cout << " dst004 : " << std::hex << dst004 << std::endl; std::cout << "| dst003 : " << std::hex << dst003 << std::endl;
std::cout << "--------------------------------------------------" << std::endl; std::cout << "+--------------------------------------------------------+" << std::endl;
std::cout << "| dst004 : " << std::hex << dst004 << std::endl;
std::cout << "| dst005 : " << std::hex << dst005 << std::endl;
std::cout << "+--------------------------------------------------------+" << std::endl;
// TODO implement error handling when sigscan fails or result is 0 // TODO implement error handling when sigscan fails or result is 0
} }

View File

@ -21,8 +21,8 @@ namespace
DWORD64 p_SQVM_Print = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x8B\xC4\x48\x89\x50\x10\x4C\x89\x40\x18\x4C\x89\x48\x20\x53\x56\x57\x48\x81\xEC\x30\x08\x00\x00\x48\x8B\xDA\x48\x8D\x70\x18\x48\x8B\xF9\xE8\x00\x00\x00\xFF\x48\x89\x74\x24\x28\x48\x8D\x54\x24\x30\x33", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx???xxxxxxxxxxxx"); DWORD64 p_SQVM_Print = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x8B\xC4\x48\x89\x50\x10\x4C\x89\x40\x18\x4C\x89\x48\x20\x53\x56\x57\x48\x81\xEC\x30\x08\x00\x00\x48\x8B\xDA\x48\x8D\x70\x18\x48\x8B\xF9\xE8\x00\x00\x00\xFF\x48\x89\x74\x24\x28\x48\x8D\x54\x24\x30\x33", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx???xxxxxxxxxxxx");
void* SQVM_Print = (void*)p_SQVM_Print; /*48 8B C4 48 89 50 10 4C 89 40 18 4C 89 48 20 53 56 57 48 81 EC 30 08 00 00 48 8B DA 48 8D 70 18 48 8B F9 E8 ?? ?? ?? FF 48 89 74 24 28 48 8D 54 24 30 33*/ void* SQVM_Print = (void*)p_SQVM_Print; /*48 8B C4 48 89 50 10 4C 89 40 18 4C 89 48 20 53 56 57 48 81 EC 30 08 00 00 48 8B DA 48 8D 70 18 48 8B F9 E8 ?? ?? ?? FF 48 89 74 24 28 48 8D 54 24 30 33*/
DWORD64 p_SQVM_LoadScript = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x48\x89\x4C\x24\x08\x55\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8D\x6C", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // For S0 and S1 //DWORD64 p_SQVM_LoadScript = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x48\x89\x4C\x24\x08\x55\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8D\x6C", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // For S0 and S1
//DWORD64 p_SQVM_LoadScript = FindPattern("r5apex.exe", "\x48\x8B\xC4\x48\x89\x48\x08\x55\x41\x56\x48\x8D\x68", "xxxxxxxxxxxxx"); // For anything S2 and above (current S8) DWORD64 p_SQVM_LoadScript = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x8B\xC4\x48\x89\x48\x08\x55\x41\x56\x48\x8D\x68", "xxxxxxxxxxxxx"); // For anything S2 and above (current S8)
bool (*SQVM_LoadScript)(void* sqvm, const char* script_path, const char* script_name, int flag) = (bool (*)(void*, const char*, const char*, int))p_SQVM_LoadScript; /*E8 ?? ?? ?? ?? 84 C0 74 1C 41 B9 ?? ?? ?? ??*/ bool (*SQVM_LoadScript)(void* sqvm, const char* script_path, const char* script_name, int flag) = (bool (*)(void*, const char*, const char*, int))p_SQVM_LoadScript; /*E8 ?? ?? ?? ?? 84 C0 74 1C 41 B9 ?? ?? ?? ??*/
DWORD64 p_SQVM_LoadRson = FindPattern("r5apex.exe", (const unsigned char*)"\x4C\x8B\xDC\x49\x89\x5B\x08\x57\x48\x81\xEC\xA0\x00\x00\x00\x33", "xxxxxxxxxxxxxxxx"); DWORD64 p_SQVM_LoadRson = FindPattern("r5apex.exe", (const unsigned char*)"\x4C\x8B\xDC\x49\x89\x5B\x08\x57\x48\x81\xEC\xA0\x00\x00\x00\x33", "xxxxxxxxxxxxxxxx");
@ -34,7 +34,7 @@ namespace
bool (*NET_ReceiveDatagram)(int, void*, bool) = (bool (*)(int, void*, bool))p_NET_ReceiveDatagram; /*E8 ?? ?? ?? ?? 84 C0 75 35 48 8B D3*/ bool (*NET_ReceiveDatagram)(int, void*, bool) = (bool (*)(int, void*, bool))p_NET_ReceiveDatagram; /*E8 ?? ?? ?? ?? 84 C0 75 35 48 8B D3*/
DWORD64 p_NET_SendDatagram = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x41\x56\x41\x57\x48\x81\xEC\x00\x05\x00\x00", "xxxxxxxxxxxxxxxxxxxxxxx?xxx"); DWORD64 p_NET_SendDatagram = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x41\x56\x41\x57\x48\x81\xEC\x00\x05\x00\x00", "xxxxxxxxxxxxxxxxxxxxxxx?xxx");
unsigned int (*NET_SendDatagram)(SOCKET s, const char* buf, int len, int flags) = (unsigned int (*)(SOCKET, const char*, int, int))p_NET_SendDatagram; /*48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 81 EC ?? 05 00 00*/ int (*NET_SendDatagram)(SOCKET s, const char* buf, int len, int flags) = (int (*)(SOCKET, const char*, int, int))p_NET_SendDatagram; /*48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 81 EC ?? 05 00 00*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ==== ------- ========================================================================================================================================================= */ /* ==== ------- ========================================================================================================================================================= */

View File

@ -5,27 +5,26 @@
* _opcptc.cpp * _opcptc.cpp
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
void InstallOpcodes() void InstallOpcodes() /* .TEXT */
{ {
HANDLE GameProcess = GetCurrentProcess(); ///////////////////////////////////////////////////////////////////////////
// JNZ --> JMP | Prevent OriginSDK from initializing on the client // JNZ --> JMP | Prevent OriginSDK from initializing on the client
//WriteProcessMemory(GetCurrentProcess(), LPVOID(dst000 + 0x0B), "\xE9\x63\x02\x00\x00\x00", 6, NULL); //WriteProcessMemory(GameProcess, LPVOID(dst000 + 0x0B), "\xE9\x63\x02\x00\x00\x00", 6, NULL);
//WriteProcessMemory(GameProcess, LPVOID(dst001 + 0x0E), "\xE9\xCB\x03\x00\x00", 5, NULL);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// JE --> NOP | Allow execution of map commands even if the OriginSDK is not running // JNE --> JMP | Allow games to be loaded without the optional texture streaming file
WriteProcessMemory(GameProcess, LPVOID(dst001 + 0x2B), "\x90\x90\x90\x90\x90\x90", 6, NULL); WriteProcessMemory(GameProcess, LPVOID(dst002 + 0x8E5), "\xEB\x19", 2, NULL);
WriteProcessMemory(GameProcess, LPVOID(dst001 + 0x39), "\x90\x90\x90\x90\x90\x90", 6, NULL);
WriteProcessMemory(GameProcess, LPVOID(dst001 + 0x46), "\x90\x90\x90\x90\x90\x90", 6, NULL);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// JL --> NOP | Enable clientcommand callbacks without persistent player data // MOV --> NOP | Prevent PDATA global being initialized as NULL
WriteProcessMemory(GameProcess, LPVOID(dst002 + 0x76), "\x90\x90", 2, NULL); WriteProcessMemory(GameProcess, LPVOID(dst003 + 0x174), "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", 14, NULL);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// JE --> NOP | Disable server-side verification for duplicate accounts on the server // JA --> JMP | Disable server-side verification for duplicate accounts on the server
WriteProcessMemory(GameProcess, LPVOID(dst003 + 0x23A), "\x90\x90", 2, NULL); WriteProcessMemory(GameProcess, LPVOID(dst004 + 0x284), "\x90\x90", 2, NULL); // TODO: Verify for N1094
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// JA --> JMP | Prevent FairFight anti-cheat from initializing on the server // JA --> JMP | Prevent FairFight anti-cheat from initializing on the server
WriteProcessMemory(GameProcess, LPVOID(dst004 + 0x72), "\xE9\xE4\x00\x00\x00\x00", 6, NULL); WriteProcessMemory(GameProcess, LPVOID(dst005 + 0x61), "\xE9\xED\x00\x00\x00\x00", 6, NULL);
} }