diff options
author | Northstar <northstar@northstar.tf> | 2022-02-03 22:09:08 -0300 |
---|---|---|
committer | Barichello <artur@barichello.me> | 2022-02-03 22:09:08 -0300 |
commit | 75bf194b2fca06de805a7bc025c6dd8379250fa5 (patch) | |
tree | c9327ac7921ae80bb2d91381bb7db11b47ca2403 /NorthstarDedicatedTest/keyvalues.cpp | |
parent | e9f93ba2e8b9df280aed20131a1606d731d2dbbe (diff) | |
download | NorthstarLauncher-75bf194b2fca06de805a7bc025c6dd8379250fa5.tar.gz NorthstarLauncher-75bf194b2fca06de805a7bc025c6dd8379250fa5.zip |
Format project
Diffstat (limited to 'NorthstarDedicatedTest/keyvalues.cpp')
-rw-r--r-- | NorthstarDedicatedTest/keyvalues.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/NorthstarDedicatedTest/keyvalues.cpp b/NorthstarDedicatedTest/keyvalues.cpp index c1fefdd7..08c85dc1 100644 --- a/NorthstarDedicatedTest/keyvalues.cpp +++ b/NorthstarDedicatedTest/keyvalues.cpp @@ -7,22 +7,26 @@ #include <fstream> // hook forward defs -typedef char(*KeyValues__LoadFromBufferType)(void* self, const char* resourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7); +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); +char KeyValues__LoadFromBufferHook( + void* self, const char* resourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7); void InitialiseKeyValues(HMODULE baseAddress) { HookEnabler hook; - ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x426C30, &KeyValues__LoadFromBufferHook, reinterpret_cast<LPVOID*>(&KeyValues__LoadFromBuffer)); + ENABLER_CREATEHOOK( + hook, (char*)baseAddress + 0x426C30, &KeyValues__LoadFromBufferHook, reinterpret_cast<LPVOID*>(&KeyValues__LoadFromBuffer)); } void* savedFilesystemPtr; char KeyValues__LoadFromBufferHook(void* self, const char* resourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7) { - // this is just to allow playlists to get a valid pFileSystem ptr for kv building, other functions that call this particular overload of LoadFromBuffer seem to get called on network stuff exclusively - // not exactly sure what the address wanted here is, so just taking it from a function call that always happens before playlists is loaded + // this is just to allow playlists to get a valid pFileSystem ptr for kv building, other functions that call this particular overload of + // LoadFromBuffer seem to get called on network stuff exclusively not exactly sure what the address wanted here is, so just taking it + // from a function call that always happens before playlists is loaded if (pFileSystem != nullptr) savedFilesystemPtr = pFileSystem; if (!pFileSystem && !strcmp(resourceName, "playlists")) @@ -76,7 +80,7 @@ void ModManager::TryBuildKeyValues(const char* filename) } } - // add original #base last, #bases don't override preexisting keys, including the ones we've just done + // add original #base last, #bases don't override preexisting keys, including the ones we've just done newKvs += "#base \""; newKvs += ogFilePath; newKvs += "\"\n"; @@ -102,14 +106,14 @@ void ModManager::TryBuildKeyValues(const char* filename) if (originalFile[i] == '/' || originalFile[i] == '#') while (originalFile[i] != '\n') i++; - + i++; } - + int j = 0; for (int j = 0; originalFile[i] >= 65 && originalFile[i] <= 122; j++) rootName[j] = originalFile[i++]; - + // empty kv, all the other stuff gets #base'd newKvs += rootName; newKvs += "\n{\n}\n"; |