aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/modlocalisation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/modlocalisation.cpp')
-rw-r--r--NorthstarDLL/modlocalisation.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/NorthstarDLL/modlocalisation.cpp b/NorthstarDLL/modlocalisation.cpp
index c8e76d63..14379bb3 100644
--- a/NorthstarDLL/modlocalisation.cpp
+++ b/NorthstarDLL/modlocalisation.cpp
@@ -1,37 +1,33 @@
#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)
+AUTOHOOK(AddLocalisationFile, localize.dll + 0x6D80,
+bool,, (void* pVguiLocalize, const char* path, const char* pathId, char unknown))
{
- 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()
}