aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/scriptbrowserhooks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/scriptbrowserhooks.cpp')
-rw-r--r--NorthstarDLL/scriptbrowserhooks.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/NorthstarDLL/scriptbrowserhooks.cpp b/NorthstarDLL/scriptbrowserhooks.cpp
index 22f1101f..df4014de 100644
--- a/NorthstarDLL/scriptbrowserhooks.cpp
+++ b/NorthstarDLL/scriptbrowserhooks.cpp
@@ -1,27 +1,25 @@
#include "pch.h"
-#include "scriptbrowserhooks.h"
-#include "hookutils.h"
-typedef void (*OpenExternalWebBrowserType)(char* url, char flags);
-OpenExternalWebBrowserType OpenExternalWebBrowser;
+AUTOHOOK_INIT()
bool* bIsOriginOverlayEnabled;
-void OpenExternalWebBrowserHook(char* url, char flags)
+// clang-format off
+AUTOHOOK(OpenExternalWebBrowser, engine.dll + 0x184E40,
+void, __fastcall, (char* pUrl, char flags))
+// clang-format on
{
bool bIsOriginOverlayEnabledOriginal = *bIsOriginOverlayEnabled;
- if (flags & 2 && !strncmp(url, "http", 4)) // custom force external browser flag
+ if (flags & 2 && !strncmp(pUrl, "http", 4)) // custom force external browser flag
*bIsOriginOverlayEnabled = false; // if this bool is false, game will use an external browser rather than the origin overlay one
- OpenExternalWebBrowser(url, flags);
+ OpenExternalWebBrowser(pUrl, flags);
*bIsOriginOverlayEnabled = bIsOriginOverlayEnabledOriginal;
}
-void InitialiseScriptExternalBrowserHooks(HMODULE baseAddress)
+ON_DLL_LOAD_CLIENT("engine.dll", ScriptExternalBrowserHooks, (CModule module))
{
- bIsOriginOverlayEnabled = (bool*)baseAddress + 0x13978255;
+ AUTOHOOK_DISPATCH()
- HookEnabler hook;
- ENABLER_CREATEHOOK(
- hook, (char*)baseAddress + 0x184E40, &OpenExternalWebBrowserHook, reinterpret_cast<LPVOID*>(&OpenExternalWebBrowser));
+ bIsOriginOverlayEnabled = module.Offset(0x13978255).As<bool*>();
}