From c9771185a73ffb324887a85f6d2185bd14da374d Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Wed, 11 May 2022 14:53:04 +0100 Subject: replace files in ReadFromCache --- NorthstarDedicatedTest/keyvalues.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'NorthstarDedicatedTest/keyvalues.cpp') diff --git a/NorthstarDedicatedTest/keyvalues.cpp b/NorthstarDedicatedTest/keyvalues.cpp index 0d6ae964..f79ff194 100644 --- a/NorthstarDedicatedTest/keyvalues.cpp +++ b/NorthstarDedicatedTest/keyvalues.cpp @@ -7,20 +7,9 @@ #include -// hook forward defs typedef char (*KeyValues__LoadFromBufferType)( void* self, const char* resourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7); KeyValues__LoadFromBufferType KeyValues__LoadFromBuffer; -char KeyValues__LoadFromBufferHook( - void* self, const char* resourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7); - -ON_DLL_LOAD("engine.dll", KeyValues, [](HMODULE baseAddress) -{ - HookEnabler hook; - ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x426C30, &KeyValues__LoadFromBufferHook, reinterpret_cast(&KeyValues__LoadFromBuffer)); -}) - char KeyValues__LoadFromBufferHook(void* self, const char* resourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7) { static void* pSavedFilesystemPtr = nullptr; @@ -135,4 +124,11 @@ void ModManager::TryBuildKeyValues(const char* filename) m_modFiles.insert(std::make_pair(normalisedPath, overrideFile)); else m_modFiles[normalisedPath] = overrideFile; -} \ No newline at end of file +} + +ON_DLL_LOAD("engine.dll", KeyValues, [](HMODULE baseAddress) +{ + HookEnabler hook; + ENABLER_CREATEHOOK( + hook, (char*)baseAddress + 0x426C30, &KeyValues__LoadFromBufferHook, reinterpret_cast(&KeyValues__LoadFromBuffer)); +}) \ No newline at end of file -- cgit v1.2.3