aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-03-18 09:37:03 +0000
committerGitHub <noreply@github.com>2022-03-18 09:37:03 +0000
commit92f77b231ac324cc1326bef31251fc6b86df1f3b (patch)
tree1d5a2843af2db31305a96c194e8b21280dccd340
parent50e69bde548c5a1af3385f0eff6aa14c088c21c5 (diff)
downloadNorthstarLauncher-92f77b231ac324cc1326bef31251fc6b86df1f3b.tar.gz
NorthstarLauncher-92f77b231ac324cc1326bef31251fc6b86df1f3b.zip
refactor dll load callbacks to lower number of dedicated.h includes (#109)
-rw-r--r--NorthstarDedicatedTest/chatcommand.cpp4
-rw-r--r--NorthstarDedicatedTest/clientauthhooks.cpp4
-rw-r--r--NorthstarDedicatedTest/clientchathooks.cpp4
-rw-r--r--NorthstarDedicatedTest/clientvideooverrides.cpp4
-rw-r--r--NorthstarDedicatedTest/dedicated.cpp11
-rw-r--r--NorthstarDedicatedTest/dedicatedmaterialsystem.cpp6
-rw-r--r--NorthstarDedicatedTest/dllmain.cpp54
-rw-r--r--NorthstarDedicatedTest/hooks.cpp27
-rw-r--r--NorthstarDedicatedTest/hooks.h2
-rw-r--r--NorthstarDedicatedTest/languagehooks.cpp4
-rw-r--r--NorthstarDedicatedTest/latencyflex.cpp4
-rw-r--r--NorthstarDedicatedTest/logging.cpp2
-rw-r--r--NorthstarDedicatedTest/modlocalisation.cpp4
-rw-r--r--NorthstarDedicatedTest/playlist.cpp1
-rw-r--r--NorthstarDedicatedTest/rpakfilesystem.cpp9
-rw-r--r--NorthstarDedicatedTest/scriptbrowserhooks.cpp4
-rw-r--r--NorthstarDedicatedTest/scriptmainmenupromos.cpp4
-rw-r--r--NorthstarDedicatedTest/scriptmodmenu.cpp4
-rw-r--r--NorthstarDedicatedTest/scriptserverbrowser.cpp4
-rw-r--r--NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp4
-rw-r--r--NorthstarDedicatedTest/securitypatches.cpp4
-rw-r--r--NorthstarDedicatedTest/sourceconsole.cpp4
-rw-r--r--NorthstarDedicatedTest/squirrel.cpp4
23 files changed, 64 insertions, 108 deletions
diff --git a/NorthstarDedicatedTest/chatcommand.cpp b/NorthstarDedicatedTest/chatcommand.cpp
index ac41014a..2aa51737 100644
--- a/NorthstarDedicatedTest/chatcommand.cpp
+++ b/NorthstarDedicatedTest/chatcommand.cpp
@@ -2,7 +2,6 @@
#include "convar.h"
#include "concommand.h"
#include "chatcommand.h"
-#include "dedicated.h"
#include "localchatwriter.h"
// note: isIngameChat is an int64 because the whole register the arg is stored in needs to be 0'd out to work
@@ -32,9 +31,6 @@ void ConCommand_log(const CCommand& args)
void InitialiseChatCommands(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
ClientSayText = (ClientSayTextType)((char*)baseAddress + 0x54780);
RegisterConCommand("say", ConCommand_say, "Enters a message in public chat", FCVAR_CLIENTDLL);
RegisterConCommand("say_team", ConCommand_say_team, "Enters a message in team chat", FCVAR_CLIENTDLL);
diff --git a/NorthstarDedicatedTest/clientauthhooks.cpp b/NorthstarDedicatedTest/clientauthhooks.cpp
index 3b98e84a..40c218c4 100644
--- a/NorthstarDedicatedTest/clientauthhooks.cpp
+++ b/NorthstarDedicatedTest/clientauthhooks.cpp
@@ -1,7 +1,6 @@
#include "pch.h"
#include "clientauthhooks.h"
#include "hookutils.h"
-#include "dedicated.h"
#include "gameutils.h"
#include "masterserver.h"
#include "convar.h"
@@ -36,9 +35,6 @@ void AuthWithStryderHook(void* a1)
void InitialiseClientAuthHooks(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
// this cvar will save to cfg once initially agreed with
Cvar_ns_has_agreed_to_send_token = new ConVar(
"ns_has_agreed_to_send_token", "0", FCVAR_ARCHIVE_PLAYERPROFILE,
diff --git a/NorthstarDedicatedTest/clientchathooks.cpp b/NorthstarDedicatedTest/clientchathooks.cpp
index ca20b0dc..74418c06 100644
--- a/NorthstarDedicatedTest/clientchathooks.cpp
+++ b/NorthstarDedicatedTest/clientchathooks.cpp
@@ -2,7 +2,6 @@
#include "clientchathooks.h"
#include <rapidjson/document.h>
#include "squirrel.h"
-#include "dedicated.h"
#include "serverchathooks.h"
#include "localchatwriter.h"
@@ -87,9 +86,6 @@ static SQRESULT SQ_ChatWriteLine(void* sqvm)
void InitialiseClientChatHooks(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
HookEnabler hook;
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x22E580, &CHudChat__AddGameLineHook, reinterpret_cast<LPVOID*>(&CHudChat__AddGameLine));
diff --git a/NorthstarDedicatedTest/clientvideooverrides.cpp b/NorthstarDedicatedTest/clientvideooverrides.cpp
index 3a63c181..0b5ff5f5 100644
--- a/NorthstarDedicatedTest/clientvideooverrides.cpp
+++ b/NorthstarDedicatedTest/clientvideooverrides.cpp
@@ -1,7 +1,6 @@
#include "pch.h"
#include "clientvideooverrides.h"
#include "modmanager.h"
-#include "dedicated.h"
typedef void*(*BinkOpenType)(const char* path, uint32_t flags);
BinkOpenType BinkOpen;
@@ -34,9 +33,6 @@ void* BinkOpenHook(const char* path, uint32_t flags)
void InitialiseClientVideoOverrides(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
HookEnabler hook;
ENABLER_CREATEHOOK(hook, GetProcAddress(GetModuleHandleA("bink2w64.dll"), "BinkOpen"), &BinkOpenHook, reinterpret_cast<LPVOID*>(&BinkOpen));
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp
index 52d3802d..9372b7a5 100644
--- a/NorthstarDedicatedTest/dedicated.cpp
+++ b/NorthstarDedicatedTest/dedicated.cpp
@@ -4,6 +4,7 @@
#include "gameutils.h"
#include "serverauthentication.h"
#include "masterserver.h"
+
bool IsDedicated()
{
// return CommandLine()->CheckParm("-dedicated");
@@ -118,9 +119,6 @@ DWORD WINAPI ConsoleInputThread(PVOID pThreadParameter)
void InitialiseDedicated(HMODULE engineAddress)
{
- if (!IsDedicated())
- return;
-
spdlog::info("InitialiseDedicated");
{
@@ -417,6 +415,7 @@ void InitialiseDedicated(HMODULE engineAddress)
CommandLine()->AppendParm("-nomenuvid", 0);
CommandLine()->AppendParm("-nosound", 0);
CommandLine()->AppendParm("-windowed", 0);
+ CommandLine()->AppendParm("-nomessagebox", 0);
CommandLine()->AppendParm("+host_preload_shaders", "0");
CommandLine()->AppendParm("+net_usesocketsforloopback", "1");
@@ -455,9 +454,6 @@ void InitialiseDedicatedOrigin(HMODULE baseAddress)
// for any big ea lawyers, this can't be used to play the game without origin, game will throw a fit if you try to do anything without
// an origin id as a client for dedi it's fine though, game doesn't care if origin is disabled as long as there's only a server
- if (!IsDedicated())
- return;
-
char* ptr = (char*)GetProcAddress(GetModuleHandleA("tier0.dll"), "Tier0_InitOrigin");
TempReadWrite rw(ptr);
*ptr = (char)0xC3; // ret
@@ -473,9 +469,6 @@ void PrintFatalSquirrelErrorHook(void* sqvm)
void InitialiseDedicatedServerGameDLL(HMODULE baseAddress)
{
- if (!IsDedicated())
- return;
-
HookEnabler hook;
ENABLER_CREATEHOOK(hook, baseAddress + 0x794D0, &PrintFatalSquirrelErrorHook, reinterpret_cast<LPVOID*>(&PrintFatalSquirrelError));
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
index 0689bc74..00652698 100644
--- a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
+++ b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
@@ -30,9 +30,6 @@ HRESULT __stdcall D3D11CreateDeviceHook(
void InitialiseDedicatedMaterialSystem(HMODULE baseAddress)
{
- if (!IsDedicated())
- return;
-
HookEnabler hook;
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0xD9A0E, &D3D11CreateDeviceHook, reinterpret_cast<LPVOID*>(&D3D11CreateDevice));
@@ -106,9 +103,6 @@ void* PakLoadAPI__LoadRpak2Hook(char* filename, void* unknown, int flags, void*
void InitialiseDedicatedRtechGame(HMODULE baseAddress)
{
- if (!IsDedicated())
- return;
-
baseAddress = GetModuleHandleA("rtech_game.dll");
HookEnabler hook;
diff --git a/NorthstarDedicatedTest/dllmain.cpp b/NorthstarDedicatedTest/dllmain.cpp
index edf4161a..f838d82a 100644
--- a/NorthstarDedicatedTest/dllmain.cpp
+++ b/NorthstarDedicatedTest/dllmain.cpp
@@ -210,13 +210,13 @@ bool InitialiseNorthstar()
// dedi patches
{
- AddDllLoadCallback("tier0.dll", InitialiseDedicatedOrigin);
- AddDllLoadCallback("engine.dll", InitialiseDedicated);
- AddDllLoadCallback("server.dll", InitialiseDedicatedServerGameDLL);
- AddDllLoadCallback("materialsystem_dx11.dll", InitialiseDedicatedMaterialSystem);
+ AddDllLoadCallbackForDedicatedServer("tier0.dll", InitialiseDedicatedOrigin);
+ AddDllLoadCallbackForDedicatedServer("engine.dll", InitialiseDedicated);
+ AddDllLoadCallbackForDedicatedServer("server.dll", InitialiseDedicatedServerGameDLL);
+ AddDllLoadCallbackForDedicatedServer("materialsystem_dx11.dll", InitialiseDedicatedMaterialSystem);
// this fucking sucks, but seemingly we somehow load after rtech_game???? unsure how, but because of this we have to apply patches
// here, not on rtech_game load
- AddDllLoadCallback("engine.dll", InitialiseDedicatedRtechGame);
+ AddDllLoadCallbackForDedicatedServer("engine.dll", InitialiseDedicatedRtechGame);
}
AddDllLoadCallback("engine.dll", InitialiseConVars);
@@ -224,25 +224,28 @@ bool InitialiseNorthstar()
// client-exclusive patches
{
- AddDllLoadCallback("tier0.dll", InitialiseTier0LanguageHooks);
- AddDllLoadCallback("engine.dll", InitialiseClientEngineSecurityPatches);
- AddDllLoadCallback("client.dll", InitialiseClientSquirrel);
- AddDllLoadCallback("client.dll", InitialiseSourceConsole);
- AddDllLoadCallback("engine.dll", InitialiseChatCommands);
- AddDllLoadCallback("client.dll", InitialiseScriptModMenu);
- AddDllLoadCallback("client.dll", InitialiseScriptServerBrowser);
- AddDllLoadCallback("localize.dll", InitialiseModLocalisation);
- AddDllLoadCallback("engine.dll", InitialiseClientAuthHooks);
- AddDllLoadCallback("client.dll", InitialiseLatencyFleX);
- AddDllLoadCallback("engine.dll", InitialiseScriptExternalBrowserHooks);
- AddDllLoadCallback("client.dll", InitialiseScriptMainMenuPromos);
- AddDllLoadCallback("client.dll", InitialiseMiscClientFixes);
- AddDllLoadCallback("client.dll", InitialiseClientPrintHooks);
- AddDllLoadCallback("client.dll", InitialisePluginCommands);
- AddDllLoadCallback("client.dll", InitialiseClientChatHooks);
- AddDllLoadCallback("client.dll", InitialiseLocalChatWriter);
- AddDllLoadCallback("client.dll", InitialiseScriptServerToClientStringCommands);
- AddDllLoadCallback("client.dll", InitialiseClientVideoOverrides);
+ AddDllLoadCallbackForClient("tier0.dll", InitialiseTier0LanguageHooks);
+ AddDllLoadCallbackForClient("engine.dll", InitialiseClientEngineSecurityPatches);
+ AddDllLoadCallbackForClient("client.dll", InitialiseClientSquirrel);
+ AddDllLoadCallbackForClient("client.dll", InitialiseSourceConsole);
+ AddDllLoadCallbackForClient("engine.dll", InitialiseChatCommands);
+ AddDllLoadCallbackForClient("client.dll", InitialiseScriptModMenu);
+ AddDllLoadCallbackForClient("client.dll", InitialiseScriptServerBrowser);
+ AddDllLoadCallbackForClient("localize.dll", InitialiseModLocalisation);
+ AddDllLoadCallbackForClient("engine.dll", InitialiseClientAuthHooks);
+ AddDllLoadCallbackForClient("client.dll", InitialiseLatencyFleX);
+ AddDllLoadCallbackForClient("engine.dll", InitialiseScriptExternalBrowserHooks);
+ AddDllLoadCallbackForClient("client.dll", InitialiseScriptMainMenuPromos);
+ AddDllLoadCallbackForClient("client.dll", InitialiseMiscClientFixes);
+ AddDllLoadCallbackForClient("client.dll", InitialiseClientPrintHooks);
+ AddDllLoadCallbackForClient("client.dll", InitialisePluginCommands);
+ AddDllLoadCallbackForClient("client.dll", InitialiseClientChatHooks);
+ AddDllLoadCallbackForClient("client.dll", InitialiseLocalChatWriter);
+ AddDllLoadCallbackForClient("client.dll", InitialiseScriptServerToClientStringCommands);
+ AddDllLoadCallbackForClient("client.dll", InitialiseClientVideoOverrides);
+
+ // audio hooks
+ AddDllLoadCallbackForClient("client.dll", InitialiseMilesAudioHooks);
}
AddDllLoadCallback("engine.dll", InitialiseEngineSpewFuncHooks);
@@ -268,9 +271,6 @@ bool InitialiseNorthstar()
AddDllLoadCallback("client.dll", InitialiseMaxPlayersOverride_Client);
AddDllLoadCallback("server.dll", InitialiseMaxPlayersOverride_Server);
- // audio hooks
- AddDllLoadCallback("client.dll", InitialiseMilesAudioHooks);
-
// mod manager after everything else
AddDllLoadCallback("engine.dll", InitialiseModManager);
diff --git a/NorthstarDedicatedTest/hooks.cpp b/NorthstarDedicatedTest/hooks.cpp
index f44f1745..4c403872 100644
--- a/NorthstarDedicatedTest/hooks.cpp
+++ b/NorthstarDedicatedTest/hooks.cpp
@@ -2,6 +2,7 @@
#include "hooks.h"
#include "hookutils.h"
#include "sigscanning.h"
+#include "dedicated.h"
#include <wchar.h>
#include <iostream>
@@ -128,6 +129,32 @@ void AddDllLoadCallback(std::string dll, DllLoadCallbackFuncType callback)
dllLoadCallbacks.push_back(callbackStruct);
}
+void AddDllLoadCallbackForDedicatedServer(std::string dll, DllLoadCallbackFuncType callback)
+{
+ if (!IsDedicated())
+ return;
+
+ DllLoadCallback* callbackStruct = new DllLoadCallback;
+ callbackStruct->dll = dll;
+ callbackStruct->callback = callback;
+ callbackStruct->called = false;
+
+ dllLoadCallbacks.push_back(callbackStruct);
+}
+
+void AddDllLoadCallbackForClient(std::string dll, DllLoadCallbackFuncType callback)
+{
+ if (IsDedicated())
+ return;
+
+ DllLoadCallback* callbackStruct = new DllLoadCallback;
+ callbackStruct->dll = dll;
+ callbackStruct->callback = callback;
+ callbackStruct->called = false;
+
+ dllLoadCallbacks.push_back(callbackStruct);
+}
+
void CallLoadLibraryACallbacks(LPCSTR lpLibFileName, HMODULE moduleAddress)
{
for (auto& callbackStruct : dllLoadCallbacks)
diff --git a/NorthstarDedicatedTest/hooks.h b/NorthstarDedicatedTest/hooks.h
index 45695990..ab7b3d64 100644
--- a/NorthstarDedicatedTest/hooks.h
+++ b/NorthstarDedicatedTest/hooks.h
@@ -5,5 +5,7 @@ void InstallInitialHooks();
typedef void (*DllLoadCallbackFuncType)(HMODULE moduleAddress);
void AddDllLoadCallback(std::string dll, DllLoadCallbackFuncType callback);
+void AddDllLoadCallbackForDedicatedServer(std::string dll, DllLoadCallbackFuncType callback);
+void AddDllLoadCallbackForClient(std::string dll, DllLoadCallbackFuncType callback);
void CallAllPendingDLLLoadCallbacks(); \ No newline at end of file
diff --git a/NorthstarDedicatedTest/languagehooks.cpp b/NorthstarDedicatedTest/languagehooks.cpp
index 43547e82..95638ef2 100644
--- a/NorthstarDedicatedTest/languagehooks.cpp
+++ b/NorthstarDedicatedTest/languagehooks.cpp
@@ -1,7 +1,6 @@
#include "pch.h"
#include "languagehooks.h"
#include "gameutils.h"
-#include "dedicated.h"
#include <filesystem>
#include <regex>
@@ -115,9 +114,6 @@ char* GetGameLanguageHook()
void InitialiseTier0LanguageHooks(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
HookEnabler hook;
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0xF560, &GetGameLanguageHook, reinterpret_cast<LPVOID*>(&GetGameLanguageOriginal));
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/latencyflex.cpp b/NorthstarDedicatedTest/latencyflex.cpp
index a677b6d2..623ac06b 100644
--- a/NorthstarDedicatedTest/latencyflex.cpp
+++ b/NorthstarDedicatedTest/latencyflex.cpp
@@ -1,7 +1,6 @@
#include "pch.h"
#include "latencyflex.h"
#include "hookutils.h"
-#include "dedicated.h"
#include "convar.h"
typedef void (*OnRenderStartType)();
@@ -23,9 +22,6 @@ void OnRenderStartHook()
void InitialiseLatencyFleX(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
// Connect to the LatencyFleX service
// LatencyFleX is an open source vendor agnostic replacement for Nvidia Reflex input latency reduction technology.
// https://ishitatsuyuki.github.io/post/latencyflex/
diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp
index 342c18ee..975bc879 100644
--- a/NorthstarDedicatedTest/logging.cpp
+++ b/NorthstarDedicatedTest/logging.cpp
@@ -3,8 +3,8 @@
#include "sourceconsole.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "hookutils.h"
-#include "convar.h"
#include "dedicated.h"
+#include "convar.h"
#include <iomanip>
#include <sstream>
#include <Psapi.h>
diff --git a/NorthstarDedicatedTest/modlocalisation.cpp b/NorthstarDedicatedTest/modlocalisation.cpp
index 82eff242..a3c45e40 100644
--- a/NorthstarDedicatedTest/modlocalisation.cpp
+++ b/NorthstarDedicatedTest/modlocalisation.cpp
@@ -2,7 +2,6 @@
#include "modlocalisation.h"
#include "hookutils.h"
#include "modmanager.h"
-#include "dedicated.h"
typedef bool (*AddLocalisationFileType)(void* g_pVguiLocalize, const char* path, const char* pathId, char unknown);
AddLocalisationFileType AddLocalisationFile;
@@ -33,9 +32,6 @@ bool AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, const char
void InitialiseModLocalisation(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
HookEnabler hook;
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x6D80, AddLocalisationFileHook, reinterpret_cast<LPVOID*>(&AddLocalisationFile));
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/playlist.cpp b/NorthstarDedicatedTest/playlist.cpp
index 249230c8..7f06844f 100644
--- a/NorthstarDedicatedTest/playlist.cpp
+++ b/NorthstarDedicatedTest/playlist.cpp
@@ -4,7 +4,6 @@
#include "convar.h"
#include "gameutils.h"
#include "hookutils.h"
-#include "dedicated.h"
#include "squirrel.h"
typedef char (*Onclc_SetPlaylistVarOverrideType)(void* a1, void* a2);
diff --git a/NorthstarDedicatedTest/rpakfilesystem.cpp b/NorthstarDedicatedTest/rpakfilesystem.cpp
index a4c4fada..ba7cf3d2 100644
--- a/NorthstarDedicatedTest/rpakfilesystem.cpp
+++ b/NorthstarDedicatedTest/rpakfilesystem.cpp
@@ -7,7 +7,7 @@ typedef void* (*LoadCommonPaksForMapType)(char* map);
LoadCommonPaksForMapType LoadCommonPaksForMap;
typedef void* (*LoadPakSyncType)(const char* path, void* unknownSingleton, int flags);
-typedef void* (*LoadPakAsyncType)(const char* path, void* unknownSingleton, int flags, void* callback0, void* callback1);
+typedef int(*LoadPakAsyncType)(const char* path, void* unknownSingleton, int flags, void* callback0, void* callback1);
// there are more i'm just too lazy to add
struct PakLoadFuncs
@@ -76,15 +76,16 @@ void* LoadPakSyncHook(char* path, void* unknownSingleton, int flags)
}
LoadPakAsyncType LoadPakAsyncOriginal;
-void* LoadPakAsyncHook(char* path, void* unknownSingleton, int flags, void* callback0, void* callback1)
+int LoadPakAsyncHook(char* path, void* unknownSingleton, int flags, void* callback0, void* callback1)
{
HandlePakAliases(&path);
if (bShouldPreload)
LoadPreloadPaks();
- spdlog::info("LoadPakAsync {}", path);
- return LoadPakAsyncOriginal(path, unknownSingleton, flags, callback0, callback1);
+ int ret = LoadPakAsyncOriginal(path, unknownSingleton, flags, callback0, callback1);
+ spdlog::info("LoadPakAsync {} {}", path, ret);
+ return ret;
}
void InitialiseEngineRpakFilesystem(HMODULE baseAddress)
diff --git a/NorthstarDedicatedTest/scriptbrowserhooks.cpp b/NorthstarDedicatedTest/scriptbrowserhooks.cpp
index 542df13a..d90bc998 100644
--- a/NorthstarDedicatedTest/scriptbrowserhooks.cpp
+++ b/NorthstarDedicatedTest/scriptbrowserhooks.cpp
@@ -1,7 +1,6 @@
#include "pch.h"
#include "scriptbrowserhooks.h"
#include "hookutils.h"
-#include "dedicated.h"
typedef void (*OpenExternalWebBrowserType)(char* url, char flags);
OpenExternalWebBrowserType OpenExternalWebBrowser;
@@ -20,9 +19,6 @@ void OpenExternalWebBrowserHook(char* url, char flags)
void InitialiseScriptExternalBrowserHooks(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
bIsOriginOverlayEnabled = (bool*)baseAddress + 0x13978255;
HookEnabler hook;
diff --git a/NorthstarDedicatedTest/scriptmainmenupromos.cpp b/NorthstarDedicatedTest/scriptmainmenupromos.cpp
index b19f1b13..c63d58d3 100644
--- a/NorthstarDedicatedTest/scriptmainmenupromos.cpp
+++ b/NorthstarDedicatedTest/scriptmainmenupromos.cpp
@@ -2,7 +2,6 @@
#include "scriptmainmenupromos.h"
#include "squirrel.h"
#include "masterserver.h"
-#include "dedicated.h"
// mirror this in script
enum eMainMenuPromoDataProperty
@@ -131,9 +130,6 @@ SQRESULT SQ_GetCustomMainMenuPromoData(void* sqvm)
void InitialiseScriptMainMenuPromos(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
g_UISquirrelManager->AddFuncRegistration("void", "NSRequestCustomMainMenuPromos", "", "", SQ_RequestCustomMainMenuPromos);
g_UISquirrelManager->AddFuncRegistration("bool", "NSHasCustomMainMenuPromoData", "", "", SQ_HasCustomMainMenuPromoData);
g_UISquirrelManager->AddFuncRegistration("var", "NSGetCustomMainMenuPromoData", "int promoDataKey", "", SQ_GetCustomMainMenuPromoData);
diff --git a/NorthstarDedicatedTest/scriptmodmenu.cpp b/NorthstarDedicatedTest/scriptmodmenu.cpp
index aa12d5a7..44b3f1c9 100644
--- a/NorthstarDedicatedTest/scriptmodmenu.cpp
+++ b/NorthstarDedicatedTest/scriptmodmenu.cpp
@@ -2,7 +2,6 @@
#include "scriptmodmenu.h"
#include "modmanager.h"
#include "squirrel.h"
-#include "dedicated.h"
// array<string> function NSGetModNames()
SQRESULT SQ_GetModNames(void* sqvm)
@@ -178,9 +177,6 @@ SQRESULT SQ_ReloadMods(void* sqvm)
void InitialiseScriptModMenu(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
g_UISquirrelManager->AddFuncRegistration("array<string>", "NSGetModNames", "", "Returns the names of all loaded mods", SQ_GetModNames);
g_UISquirrelManager->AddFuncRegistration(
"bool", "NSIsModEnabled", "string modName", "Returns whether a given mod is enabled", SQ_IsModEnabled);
diff --git a/NorthstarDedicatedTest/scriptserverbrowser.cpp b/NorthstarDedicatedTest/scriptserverbrowser.cpp
index 00156856..c70cf248 100644
--- a/NorthstarDedicatedTest/scriptserverbrowser.cpp
+++ b/NorthstarDedicatedTest/scriptserverbrowser.cpp
@@ -4,7 +4,6 @@
#include "masterserver.h"
#include "gameutils.h"
#include "serverauthentication.h"
-#include "dedicated.h"
// functions for viewing server browser
@@ -375,9 +374,6 @@ SQRESULT SQ_CompleteAuthWithLocalServer(void* sqvm)
void InitialiseScriptServerBrowser(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
g_UISquirrelManager->AddFuncRegistration("bool", "NSIsMasterServerAuthenticated", "", "", SQ_IsMasterServerAuthenticated);
g_UISquirrelManager->AddFuncRegistration("void", "NSRequestServerList", "", "", SQ_RequestServerList);
g_UISquirrelManager->AddFuncRegistration("bool", "NSIsRequestingServerList", "", "", SQ_IsRequestingServerList);
diff --git a/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp b/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp
index 7bad2773..2abcb575 100644
--- a/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp
+++ b/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp
@@ -3,7 +3,6 @@
#include "squirrel.h"
#include "convar.h"
#include "concommand.h"
-#include "dedicated.h"
void ConCommand_ns_script_servertoclientstringcommand(const CCommand& arg)
{
@@ -17,9 +16,6 @@ void ConCommand_ns_script_servertoclientstringcommand(const CCommand& arg)
void InitialiseScriptServerToClientStringCommands(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
RegisterConCommand(
"ns_script_servertoclientstringcommand", ConCommand_ns_script_servertoclientstringcommand, "",
FCVAR_CLIENTDLL | FCVAR_SERVER_CAN_EXECUTE);
diff --git a/NorthstarDedicatedTest/securitypatches.cpp b/NorthstarDedicatedTest/securitypatches.cpp
index e684738e..ee16593b 100644
--- a/NorthstarDedicatedTest/securitypatches.cpp
+++ b/NorthstarDedicatedTest/securitypatches.cpp
@@ -2,7 +2,6 @@
#include "securitypatches.h"
#include "hookutils.h"
#include "concommand.h"
-#include "dedicated.h"
#include "gameutils.h"
#include "convar.h"
@@ -19,9 +18,6 @@ bool IsValveModHook()
void InitialiseClientEngineSecurityPatches(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
HookEnabler hook;
// note: this could break some things
diff --git a/NorthstarDedicatedTest/sourceconsole.cpp b/NorthstarDedicatedTest/sourceconsole.cpp
index 2ce45baa..1e2e2f20 100644
--- a/NorthstarDedicatedTest/sourceconsole.cpp
+++ b/NorthstarDedicatedTest/sourceconsole.cpp
@@ -4,7 +4,6 @@
#include "sourceinterface.h"
#include "concommand.h"
#include "hookutils.h"
-#include "dedicated.h"
SourceInterface<CGameConsole>* g_SourceGameConsole;
@@ -48,9 +47,6 @@ void InitialiseConsoleOnInterfaceCreation()
void InitialiseSourceConsole(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
g_SourceGameConsole = new SourceInterface<CGameConsole>("client.dll", "GameConsole004");
RegisterConCommand("toggleconsole", ConCommand_toggleconsole, "toggles the console", FCVAR_NONE);
}
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp
index 19c561c0..f2ee6e8f 100644
--- a/NorthstarDedicatedTest/squirrel.cpp
+++ b/NorthstarDedicatedTest/squirrel.cpp
@@ -5,7 +5,6 @@
#include "sigscanning.h"
#include "concommand.h"
#include "modmanager.h"
-#include "dedicated.h"
#include <iostream>
// hook forward declarations
@@ -98,9 +97,6 @@ SQInteger NSTestFunc(void* sqvm) { return 1; }
void InitialiseClientSquirrel(HMODULE baseAddress)
{
- if (IsDedicated())
- return;
-
HookEnabler hook;
// client inits