Merge pull request #8 from PixieCore/master

Renamed hook and memory addresses, FIxed calling original in isPersis…
This commit is contained in:
PixieCore 2021-07-19 13:37:35 +02:00 committed by GitHub
commit d8ba5a3740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -46,8 +46,8 @@ namespace
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ==== CCLIENT ========================================================================================================================================================= */
DWORD64 p_Persistence_IsReady = /*0x140315CF0*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "3B 15 ?? ?? ?? ?? 7D 33"));
bool (*org_Persistence_IsReady)(__int64 entidx, int client) = (bool(*)(__int64, int))p_Persistence_IsReady;
DWORD64 p_CVEngineServer_IsPersistenceDataAvailable = /*0x140315CF0*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "3B 15 ?? ?? ?? ?? 7D 33"));
bool (*org_CVEngineServer_IsPersistenceDataAvailable)(__int64 thisptr /*Class thisptr usually CVEngineServer*/, int client) = (bool(*)(__int64, int))p_CVEngineServer_IsPersistenceDataAvailable;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ==== UTILITY ========================================================================================================================================================= */

View File

@ -160,7 +160,7 @@ int HMSG_EngineError(char* fmt, va_list args)
}
// TODO: turn this into a playerstruct constructor if it ever becomes necessary
bool HPersistence_IsReady(__int64 entidx, int client)
bool HCVEngineClient_IsPersistenceDataAvailable(__int64 thisptr, int client)
{
static bool isPersistenceVarSet[256];
@ -182,7 +182,8 @@ bool HPersistence_IsReady(__int64 entidx, int client)
printf("\n");
isPersistenceVarSet[client] = true;
}
return org_Persistence_IsReady;
return org_CVEngineServer_IsPersistenceDataAvailable(thisptr, client);
}
//#################################################################################
@ -209,7 +210,7 @@ void InstallENHooks()
///////////////////////////////////////////////////////////////////////////////
// Hook Utility functions
DetourAttach((LPVOID*)&org_MSG_EngineError, &HMSG_EngineError);
DetourAttach((LPVOID*)&org_Persistence_IsReady, &HPersistence_IsReady);
DetourAttach((LPVOID*)&org_CVEngineServer_IsPersistenceDataAvailable, &HCVEngineClient_IsPersistenceDataAvailable);
///////////////////////////////////////////////////////////////////////////////
// Commit the transaction
@ -245,7 +246,7 @@ void RemoveENHooks()
///////////////////////////////////////////////////////////////////////////////
// Unhook Utility functions
DetourDetach((LPVOID*)&org_MSG_EngineError, &HMSG_EngineError);
DetourDetach((LPVOID*)&org_Persistence_IsReady, &HPersistence_IsReady);
DetourDetach((LPVOID*)&org_CVEngineServer_IsPersistenceDataAvailable, &HCVEngineClient_IsPersistenceDataAvailable);
///////////////////////////////////////////////////////////////////////////////
// Commit the transaction