aboutsummaryrefslogtreecommitdiff
path: root/primedev/dedicated/dedicated.cpp
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2024-09-16 17:47:32 +0100
committerGitHub <noreply@github.com>2024-09-16 18:47:32 +0200
commit1f4765d4a82d2ae3a17f66330f30d16f2eab2be7 (patch)
treecb629114c3f30389d13a06fb4e09f063aabddaa0 /primedev/dedicated/dedicated.cpp
parentf9a97985da5d30cb67243837726a5d853648b3d6 (diff)
downloadNorthstarLauncher-1f4765d4a82d2ae3a17f66330f30d16f2eab2be7.tar.gz
NorthstarLauncher-1f4765d4a82d2ae3a17f66330f30d16f2eab2be7.zip
dedicated: Remove uses of Autohook from `dedicated.cpp` (#799)v1.28.2-rc2
Removes use of AUTOHOOK macro from dedicated.cpp
Diffstat (limited to 'primedev/dedicated/dedicated.cpp')
-rw-r--r--primedev/dedicated/dedicated.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/primedev/dedicated/dedicated.cpp b/primedev/dedicated/dedicated.cpp
index eca9b9f1..8b0604fc 100644
--- a/primedev/dedicated/dedicated.cpp
+++ b/primedev/dedicated/dedicated.cpp
@@ -8,8 +8,6 @@
#include "masterserver/masterserver.h"
#include "util/printcommands.h"
-AUTOHOOK_INIT()
-
bool IsDedicatedServer()
{
static bool result = strstr(GetCommandLineA(), "-dedicated");
@@ -114,10 +112,8 @@ DWORD WINAPI ConsoleInputThread(PVOID pThreadParameter)
return 0;
}
-// clang-format off
-AUTOHOOK(IsGameActiveWindow, engine.dll + 0x1CDC80,
-bool,, ())
-// clang-format on
+static bool (*o_pIsGameActiveWindow)() = nullptr;
+static bool h_IsGameActiveWindow()
{
return true;
}
@@ -126,7 +122,8 @@ ON_DLL_LOAD_DEDI_RELIESON("engine.dll", DedicatedServer, ServerPresence, (CModul
{
spdlog::info("InitialiseDedicated");
- AUTOHOOK_DISPATCH_MODULE(engine.dll)
+ o_pIsGameActiveWindow = module.Offset(0x1CDC80).RCast<decltype(o_pIsGameActiveWindow)>();
+ HookAttach(&(PVOID&)o_pIsGameActiveWindow, (PVOID)h_IsGameActiveWindow);
// Host_Init
// prevent a particle init that relies on client dll
@@ -270,12 +267,10 @@ ON_DLL_LOAD_DEDI("tier0.dll", DedicatedServerOrigin, (CModule module))
module.GetExportedFunction("Tier0_InitOrigin").Patch("C3");
}
-// clang-format off
-AUTOHOOK(PrintSquirrelError, server.dll + 0x794D0,
-void, __fastcall, (void* sqvm))
-// clang-format on
+static void(__fastcall* o_pPrintSquirrelError)(void* sqvm) = nullptr;
+static void __fastcall h_PrintSquirrelError(void* sqvm)
{
- PrintSquirrelError(sqvm);
+ o_pPrintSquirrelError(sqvm);
// close dedicated server if a fatal error is hit
// atm, this will crash if not aborted, so this just closes more gracefully
@@ -289,7 +284,8 @@ void, __fastcall, (void* sqvm))
ON_DLL_LOAD_DEDI("server.dll", DedicatedServerGameDLL, (CModule module))
{
- AUTOHOOK_DISPATCH_MODULE(server.dll)
+ o_pPrintSquirrelError = module.Offset(0x794D0).RCast<decltype(o_pPrintSquirrelError)>();
+ HookAttach(&(PVOID&)o_pPrintSquirrelError, (PVOID)h_PrintSquirrelError);
if (CommandLine()->CheckParm("-nopakdedi"))
{