diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2019-10-03 14:49:30 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2019-10-03 14:49:30 +0200 |
commit | dbbc310716c1d99a0a795ed2cc26214353e287f0 (patch) | |
tree | 9b664a97981d36109a57c78b86314179438daf89 /TestDLL | |
parent | a7301be075d556ae2a93861c942821f75ae1856b (diff) |
GlobalEnv/GameFramework interface uses correct vtables
Diffstat (limited to 'TestDLL')
-rw-r--r-- | TestDLL/HuntClasses.h | 8 | ||||
-rw-r--r-- | TestDLL/dllmain.cpp | 52 |
2 files changed, 51 insertions, 9 deletions
diff --git a/TestDLL/HuntClasses.h b/TestDLL/HuntClasses.h index c09771e..f6ed80f 100644 --- a/TestDLL/HuntClasses.h +++ b/TestDLL/HuntClasses.h @@ -434,6 +434,8 @@ struct IGameFramework virtual void ScheduleEndLevel(const char* nextLevel) = 0; virtual void ScheduleEndLevelNow(const char* nextLevel) = 0; virtual void OnEditorSetGameMode(int iMode) = 0; + virtual void fn_00(void); + virtual void fn_01(void); virtual bool IsEditing() = 0; virtual bool IsInLevelLoad() = 0; virtual bool IsLoadingSaveGame() = 0; @@ -479,11 +481,11 @@ struct SSystemGlobalEnvironment { UINT64 pOpticsManager; UINT64 pTimer; UINT64 pCryFont; - IGameFramework* pGameFramework; + UINT64 ukn_00; UINT64 pLocalMemoryUsage; + IGameFramework* pGameFramework; + UINT64 ukn_01; IEntitySystem* pEntitySystem; - UINT64 pConsole; - UINT64 pAudioSystem; ISystem* pSystem; UINT64 pCharacterManager; UINT64 pAISystem; diff --git a/TestDLL/dllmain.cpp b/TestDLL/dllmain.cpp index 63458ff..ea10877 100644 --- a/TestDLL/dllmain.cpp +++ b/TestDLL/dllmain.cpp @@ -173,6 +173,9 @@ static bool resolve_all_symbols(void) { } #endif +static UINT64 pEntSys = 0x0; +static IEntitySystem * iEnt = NULL; + void APIENTRY LibEntry(PVOID user_ptr) { static bool firstEntry = true; @@ -205,8 +208,8 @@ void APIENTRY LibEntry(PVOID user_ptr) "TestDLL Notification", MB_OK | MB_ICONINFORMATION); - UINT64 pEntSys = *(UINT64*)user_ptr; - IEntitySystem * iEnt = *(IEntitySystem **)user_ptr; + pEntSys = *(UINT64*)user_ptr; + iEnt = *(IEntitySystem **)user_ptr; #define PENTITYSYSTEM_ISYSTEM_OFFSET 104 if ((PVOID)(*(UINT64*)(pEntSys + PENTITYSYSTEM_ISYSTEM_OFFSET)) != iEnt->GetSystem()) { @@ -233,15 +236,52 @@ void APIENTRY LibEntry(PVOID user_ptr) return; } + if ((PVOID)pEntSys != iEnt->GetSystem()->GetGlobalEnvironment()->pEntitySystem) { + char errbuf[128]; + snprintf(errbuf, sizeof errbuf, + "WARNING: IEntitySystem interface instance not equal: GLOBAL[%p] != pEntitySystem[%p]\n", + (PVOID)pEntSys, iEnt->GetSystem()->GetGlobalEnvironment()->pEntitySystem); + MessageBoxA(NULL, + errbuf, + "Hunted WARNING", + MB_OK | MB_ICONINFORMATION); + return; + } + + if (iEnt->GetSystem() != iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->GetISystem()) { + char errbuf[128]; + snprintf(errbuf, sizeof errbuf, + "WARNING: ISystem interface instance not equal: IEntitySystem[%p] != pGameFramework[%p]\n", + iEnt->GetSystem(), iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->GetISystem()); + MessageBoxA(NULL, + errbuf, + "Hunted WARNING", + MB_OK | MB_ICONINFORMATION); + return; + } + char buf[128]; - snprintf(buf, sizeof buf, "---%p---%p---%p---%u------\n", - iEnt->GetSystem()->GetGlobalEnvironment(), (PVOID)pEntSys, - iEnt->GetSystem()->GetIEntitySystem(), - iEnt->GetSystem()->GetUsedMemory()); + snprintf(buf, sizeof buf, "---%X,%X,%X,%X,%X---%s---%X,%X,%X,%X,%X---%p---\n", + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->IsGamePaused(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->IsGameStarted(), + + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->CanSave(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->CanLoad(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->CanCheat(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->GetLevelName(), + + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->IsEditing(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->IsInLevelLoad(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->IsLoadingSaveGame(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->IsInTimeDemo(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->IsTimeDemoRecording(), + iEnt->GetSystem()->GetGlobalEnvironment()->pGameFramework->GetIPersistantDebug() + ); MessageBoxA(NULL, buf, "TestDLL Notification", MB_OK | MB_ICONINFORMATION); + //iEnt->GetSystem()->Quit(); #else MessageBoxA(NULL, "TEST !!!", |