diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-08-09 22:21:46 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-08-09 22:21:46 +0100 |
commit | 9a3e1ec2daf753106ee95d53719d94921d3b051f (patch) | |
tree | 954d8b75530d66c15fcfcf153a3a4f351e49ef8e /NorthstarDedicatedTest/modlocalisation.cpp | |
parent | 4d0e4679d05b146e5e43a1a707708c6451099c54 (diff) | |
download | NorthstarLauncher-9a3e1ec2daf753106ee95d53719d94921d3b051f.tar.gz NorthstarLauncher-9a3e1ec2daf753106ee95d53719d94921d3b051f.zip |
add mod localisation, say command and more masterserver stuff
Diffstat (limited to 'NorthstarDedicatedTest/modlocalisation.cpp')
-rw-r--r-- | NorthstarDedicatedTest/modlocalisation.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/modlocalisation.cpp b/NorthstarDedicatedTest/modlocalisation.cpp new file mode 100644 index 00000000..ccc06722 --- /dev/null +++ b/NorthstarDedicatedTest/modlocalisation.cpp @@ -0,0 +1,38 @@ +#include "pch.h" +#include "modlocalisation.h" +#include "hookutils.h" +#include "modmanager.h" + +typedef char(*AddLocalisationFileType)(void* g_pVguiLocalize, const char* path, const char* pathId); +AddLocalisationFileType AddLocalisationFile; + +bool loadModLocalisationFiles = true; + +char AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, char* pathId) +{ + char ret = AddLocalisationFile(g_pVguiLocalize, path, pathId); + + if (!loadModLocalisationFiles) + return ret; + + loadModLocalisationFiles = false; + + for (Mod* mod : g_ModManager->m_loadedMods) + { + for (std::string& localisationFile : mod->LocalisationFiles) + { + spdlog::info("Adding mod localisation file {}", localisationFile); + AddLocalisationFile(g_pVguiLocalize, localisationFile.c_str(), pathId); + } + } + + loadModLocalisationFiles = true; + + return ret; +} + +void InitialiseModLocalisation(HMODULE baseAddress) +{ + HookEnabler hook; + ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x6D80, AddLocalisationFileHook, reinterpret_cast<LPVOID*>(&AddLocalisationFile)); +}
\ No newline at end of file |