diff options
Diffstat (limited to 'NorthstarDLL/modlocalisation.cpp')
-rw-r--r-- | NorthstarDLL/modlocalisation.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/NorthstarDLL/modlocalisation.cpp b/NorthstarDLL/modlocalisation.cpp index c8e76d63..b12f0a40 100644 --- a/NorthstarDLL/modlocalisation.cpp +++ b/NorthstarDLL/modlocalisation.cpp @@ -1,37 +1,35 @@ #include "pch.h" -#include "modlocalisation.h" -#include "hookutils.h" #include "modmanager.h" -typedef bool (*AddLocalisationFileType)(void* g_pVguiLocalize, const char* path, const char* pathId, char unknown); -AddLocalisationFileType AddLocalisationFile; +AUTOHOOK_INIT() -bool loadModLocalisationFiles = true; - -bool AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, const char* pathId, char unknown) +// clang-format off +AUTOHOOK(AddLocalisationFile, localize.dll + 0x6D80, +bool, __fastcall, (void* pVguiLocalize, const char* path, const char* pathId, char unknown)) +// clang-format on { - bool ret = AddLocalisationFile(g_pVguiLocalize, path, pathId, unknown); + static bool bLoadModLocalisationFiles = true; + bool ret = AddLocalisationFile(pVguiLocalize, path, pathId, unknown); if (ret) spdlog::info("Loaded localisation file {} successfully", path); - if (!loadModLocalisationFiles) + if (!bLoadModLocalisationFiles) return ret; - loadModLocalisationFiles = false; + bLoadModLocalisationFiles = false; - for (Mod mod : g_ModManager->m_loadedMods) - if (mod.Enabled) + for (Mod mod : g_pModManager->m_LoadedMods) + if (mod.m_bEnabled) for (std::string& localisationFile : mod.LocalisationFiles) - AddLocalisationFile(g_pVguiLocalize, localisationFile.c_str(), pathId, unknown); + AddLocalisationFile(pVguiLocalize, localisationFile.c_str(), pathId, unknown); - loadModLocalisationFiles = true; + bLoadModLocalisationFiles = true; return ret; } -void InitialiseModLocalisation(HMODULE baseAddress) +ON_DLL_LOAD_CLIENT("localize.dll", Localize, (CModule module)) { - HookEnabler hook; - ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x6D80, AddLocalisationFileHook, reinterpret_cast<LPVOID*>(&AddLocalisationFile)); + AUTOHOOK_DISPATCH() } |