aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/scriptbrowserhooks.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-26 03:16:46 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-26 03:16:46 +0100
commitcc7b0ded08e3dc26fc970169a79c74c54e4f923b (patch)
tree6de8896695ab89534adaa912b9fdfac9d6bf396c /NorthstarDedicatedTest/scriptbrowserhooks.cpp
parent93d540dd37298b9e9a6c1f07b5c4a8dc46a2787d (diff)
downloadNorthstarLauncher-cc7b0ded08e3dc26fc970169a79c74c54e4f923b.tar.gz
NorthstarLauncher-cc7b0ded08e3dc26fc970169a79c74c54e4f923b.zip
lots of cleanup and starting moving to new hooking macros
Diffstat (limited to 'NorthstarDedicatedTest/scriptbrowserhooks.cpp')
-rw-r--r--NorthstarDedicatedTest/scriptbrowserhooks.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/NorthstarDedicatedTest/scriptbrowserhooks.cpp b/NorthstarDedicatedTest/scriptbrowserhooks.cpp
index bb917899..de78daf9 100644
--- a/NorthstarDedicatedTest/scriptbrowserhooks.cpp
+++ b/NorthstarDedicatedTest/scriptbrowserhooks.cpp
@@ -1,26 +1,23 @@
#include "pch.h"
-#include "hooks.h"
-#include "hookutils.h"
+
+AUTOHOOK_INIT()
bool* bIsOriginOverlayEnabled;
-typedef void (*OpenExternalWebBrowserType)(char* url, char flags);
-OpenExternalWebBrowserType OpenExternalWebBrowser;
-void OpenExternalWebBrowserHook(char* url, char flags)
+AUTOHOOK(OpenExternalWebBrowser, engine.dll + 0x184E40,
+void,, (char* pUrl, char flags),
{
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;
-}
+})
ON_DLL_LOAD_CLIENT("engine.dll", ScriptExternalBrowserHooks, [](HMODULE baseAddress)
{
- bIsOriginOverlayEnabled = (bool*)baseAddress + 0x13978255;
+ AUTOHOOK_DISPATCH()
- HookEnabler hook;
- ENABLER_CREATEHOOK(
- hook, (char*)baseAddress + 0x184E40, &OpenExternalWebBrowserHook, reinterpret_cast<LPVOID*>(&OpenExternalWebBrowser));
+ bIsOriginOverlayEnabled = (bool*)baseAddress + 0x13978255;
}) \ No newline at end of file