diff options
65 files changed, 90 insertions, 174 deletions
diff --git a/NorthstarDedicatedTest/bansystem.h b/NorthstarDedicatedTest/bansystem.h index ed4d2aed..8080da91 100644 --- a/NorthstarDedicatedTest/bansystem.h +++ b/NorthstarDedicatedTest/bansystem.h @@ -15,4 +15,4 @@ class ServerBanSystem bool IsUIDAllowed(uint64_t uid); }; -extern ServerBanSystem* g_ServerBanSystem;
\ No newline at end of file +extern ServerBanSystem* g_ServerBanSystem; diff --git a/NorthstarDedicatedTest/bitbuf.h b/NorthstarDedicatedTest/bitbuf.h index 520e5d0a..8e8e216f 100644 --- a/NorthstarDedicatedTest/bitbuf.h +++ b/NorthstarDedicatedTest/bitbuf.h @@ -1145,4 +1145,4 @@ class BFWrite : public BitBufferBase bool m_Flushed = false; // :flushed: }; -#undef INLINE
\ No newline at end of file +#undef INLINE diff --git a/NorthstarDedicatedTest/buildainfile.cpp b/NorthstarDedicatedTest/buildainfile.cpp index e7ef6e59..30df6f91 100644 --- a/NorthstarDedicatedTest/buildainfile.cpp +++ b/NorthstarDedicatedTest/buildainfile.cpp @@ -352,7 +352,6 @@ void DumpAINInfo(CAI_Network* aiNetwork) typedef void (*CAI_NetworkBuilder__BuildType)(void* builder, CAI_Network* aiNetwork, void* unknown); CAI_NetworkBuilder__BuildType CAI_NetworkBuilder__Build; - void CAI_NetworkBuilder__BuildHook(void* builder, CAI_Network* aiNetwork, void* unknown) { CAI_NetworkBuilder__Build(builder, aiNetwork, unknown); @@ -362,7 +361,6 @@ void CAI_NetworkBuilder__BuildHook(void* builder, CAI_Network* aiNetwork, void* typedef void (*LoadAINFileType)(void* aimanager, void* buf, const char* filename); LoadAINFileType LoadAINFile; - void LoadAINFileHook(void* aimanager, void* buf, const char* filename) { LoadAINFile(aimanager, buf, filename); diff --git a/NorthstarDedicatedTest/buildainfile.h b/NorthstarDedicatedTest/buildainfile.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/buildainfile.h +++ b/NorthstarDedicatedTest/buildainfile.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/chatcommand.h b/NorthstarDedicatedTest/chatcommand.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/chatcommand.h +++ b/NorthstarDedicatedTest/chatcommand.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/clientauthhooks.h b/NorthstarDedicatedTest/clientauthhooks.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/clientauthhooks.h +++ b/NorthstarDedicatedTest/clientauthhooks.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/clientchathooks.cpp b/NorthstarDedicatedTest/clientchathooks.cpp index fefbe8ca..bdd0e8c2 100644 --- a/NorthstarDedicatedTest/clientchathooks.cpp +++ b/NorthstarDedicatedTest/clientchathooks.cpp @@ -6,9 +6,6 @@ #include "serverchathooks.h" #include "localchatwriter.h" -typedef void(__fastcall* CHudChat__AddGameLineType)(void* self, const char* message, int fromPlayerId, bool isteam, bool isdead); -CHudChat__AddGameLineType CHudChat__AddGameLine; - struct ChatTags { bool whisper; @@ -16,6 +13,8 @@ struct ChatTags bool dead; }; +typedef void(__fastcall* CHudChat__AddGameLineType)(void* self, const char* message, int fromPlayerId, bool isteam, bool isdead); +CHudChat__AddGameLineType CHudChat__AddGameLine; static void CHudChat__AddGameLineHook(void* self, const char* message, int inboxId, bool isTeam, bool isDead) { // This hook is called for each HUD, but we only want our logic to run once. diff --git a/NorthstarDedicatedTest/clientruihooks.cpp b/NorthstarDedicatedTest/clientruihooks.cpp index c34207dc..0f48ced7 100644 --- a/NorthstarDedicatedTest/clientruihooks.cpp +++ b/NorthstarDedicatedTest/clientruihooks.cpp @@ -7,7 +7,6 @@ ConVar* Cvar_rui_drawEnable; typedef char (*DrawRUIFuncType)(void* a1, float* a2); DrawRUIFuncType DrawRUIFunc; - char DrawRUIFuncHook(void* a1, float* a2) { if (!Cvar_rui_drawEnable->GetBool()) diff --git a/NorthstarDedicatedTest/clientvideooverrides.cpp b/NorthstarDedicatedTest/clientvideooverrides.cpp index 53eb892a..498d48ed 100644 --- a/NorthstarDedicatedTest/clientvideooverrides.cpp +++ b/NorthstarDedicatedTest/clientvideooverrides.cpp @@ -5,7 +5,6 @@ typedef void* (*BinkOpenType)(const char* path, uint32_t flags); BinkOpenType BinkOpen; - void* BinkOpenHook(const char* path, uint32_t flags) { std::string filename(fs::path(path).filename().string()); diff --git a/NorthstarDedicatedTest/clientvideooverrides.h b/NorthstarDedicatedTest/clientvideooverrides.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/clientvideooverrides.h +++ b/NorthstarDedicatedTest/clientvideooverrides.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/commandprint.h b/NorthstarDedicatedTest/commandprint.h index 803cccc4..6c3ef850 100644 --- a/NorthstarDedicatedTest/commandprint.h +++ b/NorthstarDedicatedTest/commandprint.h @@ -3,4 +3,4 @@ void PrintCommandHelpDialogue(const ConCommandBase* command, const char* name); void TryPrintCvarHelpForCommand(const char* pCommand); -void InitialiseCommandPrint();
\ No newline at end of file +void InitialiseCommandPrint(); diff --git a/NorthstarDedicatedTest/concommand.h b/NorthstarDedicatedTest/concommand.h index ca78381b..ec0b6c9e 100644 --- a/NorthstarDedicatedTest/concommand.h +++ b/NorthstarDedicatedTest/concommand.h @@ -136,4 +136,4 @@ class ConCommand : public ConCommandBase void RegisterConCommand(const char* name, void (*callback)(const CCommand&), const char* helpString, int flags); -#define MAKE_CONCMD(name, helpStr, flags, fn) RegisterConCommand(name, fn, helpStr, flags);
\ No newline at end of file +#define MAKE_CONCMD(name, helpStr, flags, fn) RegisterConCommand(name, fn, helpStr, flags); diff --git a/NorthstarDedicatedTest/convar.h b/NorthstarDedicatedTest/convar.h index d766933d..c39151b7 100644 --- a/NorthstarDedicatedTest/convar.h +++ b/NorthstarDedicatedTest/convar.h @@ -180,4 +180,4 @@ class ConVar float m_fMaxVal {}; // 0x0068 void* m_pMalloc {}; // 0x0070 char m_pPad80[10] {}; // 0x0080 -}; // Size: 0x0080
\ No newline at end of file +}; // Size: 0x0080 diff --git a/NorthstarDedicatedTest/cvar.h b/NorthstarDedicatedTest/cvar.h index c4525cef..a39df387 100644 --- a/NorthstarDedicatedTest/cvar.h +++ b/NorthstarDedicatedTest/cvar.h @@ -36,4 +36,4 @@ class CCvar }; extern SourceInterface<CCvar>* g_pCVarInterface; -extern CCvar* g_pCVar;
\ No newline at end of file +extern CCvar* g_pCVar; diff --git a/NorthstarDedicatedTest/debugoverlay.cpp b/NorthstarDedicatedTest/debugoverlay.cpp index 7dee42e9..051f34e6 100644 --- a/NorthstarDedicatedTest/debugoverlay.cpp +++ b/NorthstarDedicatedTest/debugoverlay.cpp @@ -77,36 +77,17 @@ struct OverlayBox_t : public OverlayBase_t int a; }; -// this is in cvar.h, don't need it here -/*class Color -{ - public: - Color(int r, int g, int b, int a) - { - _color[0] = (unsigned char)r; - _color[1] = (unsigned char)g; - _color[2] = (unsigned char)b; - _color[3] = (unsigned char)a; - } - - private: - unsigned char _color[4]; -};*/ - static HMODULE sEngineModule; -typedef void (*DrawOverlayType)(OverlayBase_t* a1); -DrawOverlayType DrawOverlay; - typedef void (*RenderLineType)(Vector3 v1, Vector3 v2, Color c, bool bZBuffer); static RenderLineType RenderLine; - typedef void (*RenderBoxType)(Vector3 vOrigin, QAngle angles, Vector3 vMins, Vector3 vMaxs, Color c, bool bZBuffer, bool bInsideOut); static RenderBoxType RenderBox; - static RenderBoxType RenderWireframeBox; // engine.dll+0xABCB0 +typedef void (*DrawOverlayType)(OverlayBase_t* a1); +DrawOverlayType DrawOverlay; void __fastcall DrawOverlayHook(OverlayBase_t* pOverlay) { EnterCriticalSection((LPCRITICAL_SECTION)((char*)sEngineModule + 0x10DB0A38)); // s_OverlayMutex diff --git a/NorthstarDedicatedTest/debugoverlay.h b/NorthstarDedicatedTest/debugoverlay.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/debugoverlay.h +++ b/NorthstarDedicatedTest/debugoverlay.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/dedicated.h b/NorthstarDedicatedTest/dedicated.h index 3339523a..bbca3c83 100644 --- a/NorthstarDedicatedTest/dedicated.h +++ b/NorthstarDedicatedTest/dedicated.h @@ -1,3 +1,3 @@ #pragma once -bool IsDedicated();
\ No newline at end of file +bool IsDedicated(); diff --git a/NorthstarDedicatedTest/dedicatedmaterialsystem.h b/NorthstarDedicatedTest/dedicatedmaterialsystem.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/dedicatedmaterialsystem.h +++ b/NorthstarDedicatedTest/dedicatedmaterialsystem.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/demofixes.h b/NorthstarDedicatedTest/demofixes.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/demofixes.h +++ b/NorthstarDedicatedTest/demofixes.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/filesystem.h b/NorthstarDedicatedTest/filesystem.h index 5348cd51..1aa4fb0c 100644 --- a/NorthstarDedicatedTest/filesystem.h +++ b/NorthstarDedicatedTest/filesystem.h @@ -73,4 +73,4 @@ namespace R2FS std::string ReadVPKFile(const char* path); std::string ReadVPKOriginalFile(const char* path); -} // namespace R2FS
\ No newline at end of file +} // namespace R2FS diff --git a/NorthstarDedicatedTest/hooks.cpp b/NorthstarDedicatedTest/hooks.cpp index 7e697701..82485e0e 100644 --- a/NorthstarDedicatedTest/hooks.cpp +++ b/NorthstarDedicatedTest/hooks.cpp @@ -15,40 +15,6 @@ namespace fs = std::filesystem; -typedef LPSTR (*GetCommandLineAType)(); -LPSTR GetCommandLineAHook(); - -typedef HMODULE (*LoadLibraryExAType)(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); -HMODULE LoadLibraryExAHook(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); - -typedef HMODULE (*LoadLibraryAType)(LPCSTR lpLibFileName); -HMODULE LoadLibraryAHook(LPCSTR lpLibFileName); - -typedef HMODULE (*LoadLibraryExWType)(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); -HMODULE LoadLibraryExWHook(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); - -typedef HMODULE (*LoadLibraryWType)(LPCWSTR lpLibFileName); -HMODULE LoadLibraryWHook(LPCWSTR lpLibFileName); - -GetCommandLineAType GetCommandLineAOriginal; -LoadLibraryExAType LoadLibraryExAOriginal; -LoadLibraryAType LoadLibraryAOriginal; -LoadLibraryExWType LoadLibraryExWOriginal; -LoadLibraryWType LoadLibraryWOriginal; - -void InstallInitialHooks() -{ - if (MH_Initialize() != MH_OK) - spdlog::error("MH_Initialize (minhook initialization) failed"); - - HookEnabler hook; - ENABLER_CREATEHOOK(hook, &GetCommandLineA, &GetCommandLineAHook, reinterpret_cast<LPVOID*>(&GetCommandLineAOriginal)); - ENABLER_CREATEHOOK(hook, &LoadLibraryExA, &LoadLibraryExAHook, reinterpret_cast<LPVOID*>(&LoadLibraryExAOriginal)); - ENABLER_CREATEHOOK(hook, &LoadLibraryA, &LoadLibraryAHook, reinterpret_cast<LPVOID*>(&LoadLibraryAOriginal)); - ENABLER_CREATEHOOK(hook, &LoadLibraryExW, &LoadLibraryExWHook, reinterpret_cast<LPVOID*>(&LoadLibraryExWOriginal)); - ENABLER_CREATEHOOK(hook, &LoadLibraryW, &LoadLibraryWHook, reinterpret_cast<LPVOID*>(&LoadLibraryWOriginal)); -} - // called from the ON_DLL_LOAD macros __dllLoadCallback::__dllLoadCallback( eDllLoadCallbackSide side, const std::string dllName, DllLoadCallbackFuncType callback, std::string uniqueStr, std::string reliesOn) @@ -75,6 +41,8 @@ __dllLoadCallback::__dllLoadCallback( } } +typedef LPSTR (*GetCommandLineAType)(); +GetCommandLineAType GetCommandLineAOriginal; LPSTR GetCommandLineAHook() { static char* cmdlineModified; @@ -266,6 +234,9 @@ void CallAllPendingDLLLoadCallbacks() } } + +typedef HMODULE (*LoadLibraryExAType)(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); +LoadLibraryExAType LoadLibraryExAOriginal; HMODULE LoadLibraryExAHook(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) { HMODULE moduleAddress = LoadLibraryExAOriginal(lpLibFileName, hFile, dwFlags); @@ -278,6 +249,8 @@ HMODULE LoadLibraryExAHook(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) return moduleAddress; } +typedef HMODULE (*LoadLibraryAType)(LPCSTR lpLibFileName); +LoadLibraryAType LoadLibraryAOriginal; HMODULE LoadLibraryAHook(LPCSTR lpLibFileName) { HMODULE moduleAddress = LoadLibraryAOriginal(lpLibFileName); @@ -290,6 +263,8 @@ HMODULE LoadLibraryAHook(LPCSTR lpLibFileName) return moduleAddress; } +typedef HMODULE (*LoadLibraryExWType)(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags); +LoadLibraryExWType LoadLibraryExWOriginal; HMODULE LoadLibraryExWHook(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) { HMODULE moduleAddress = LoadLibraryExWOriginal(lpLibFileName, hFile, dwFlags); @@ -302,6 +277,8 @@ HMODULE LoadLibraryExWHook(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) return moduleAddress; } +typedef HMODULE (*LoadLibraryWType)(LPCWSTR lpLibFileName); +LoadLibraryWType LoadLibraryWOriginal; HMODULE LoadLibraryWHook(LPCWSTR lpLibFileName) { HMODULE moduleAddress = LoadLibraryWOriginal(lpLibFileName); @@ -312,4 +289,17 @@ HMODULE LoadLibraryWHook(LPCWSTR lpLibFileName) } return moduleAddress; +} + +void InstallInitialHooks() +{ + if (MH_Initialize() != MH_OK) + spdlog::error("MH_Initialize (minhook initialization) failed"); + + HookEnabler hook; + ENABLER_CREATEHOOK(hook, &GetCommandLineA, &GetCommandLineAHook, reinterpret_cast<LPVOID*>(&GetCommandLineAOriginal)); + ENABLER_CREATEHOOK(hook, &LoadLibraryExA, &LoadLibraryExAHook, reinterpret_cast<LPVOID*>(&LoadLibraryExAOriginal)); + ENABLER_CREATEHOOK(hook, &LoadLibraryA, &LoadLibraryAHook, reinterpret_cast<LPVOID*>(&LoadLibraryAOriginal)); + ENABLER_CREATEHOOK(hook, &LoadLibraryExW, &LoadLibraryExWHook, reinterpret_cast<LPVOID*>(&LoadLibraryExWOriginal)); + ENABLER_CREATEHOOK(hook, &LoadLibraryW, &LoadLibraryWHook, reinterpret_cast<LPVOID*>(&LoadLibraryWOriginal)); }
\ No newline at end of file diff --git a/NorthstarDedicatedTest/hooks.h b/NorthstarDedicatedTest/hooks.h index bc0a6311..182cdbc4 100644 --- a/NorthstarDedicatedTest/hooks.h +++ b/NorthstarDedicatedTest/hooks.h @@ -44,4 +44,4 @@ __dllLoadCallback CONCAT(__dllLoadCallbackInstance, uniquestr, counter)(side, dl #define ON_DLL_LOAD_CLIENT(dllName, uniquestr, func) __ON_DLL_LOAD(dllName, func, eDllLoadCallbackSide::CLIENT, __LINE__, uniquestr, "") #define ON_DLL_LOAD_CLIENT_RELIESON(dllName, uniquestr, reliesOn, func) __ON_DLL_LOAD(dllName, func, eDllLoadCallbackSide::CLIENT, __LINE__, uniquestr, __STR(reliesOn)) #define ON_DLL_LOAD_DEDI(dllName, uniquestr, func) __ON_DLL_LOAD(dllName, func, eDllLoadCallbackSide::DEDICATED_SERVER, __LINE__, uniquestr, "") -#define ON_DLL_LOAD_DEDI_RELIESON(dllName, uniquestr, reliesOn, func) __ON_DLL_LOAD(dllName, func, eDllLoadCallbackSide::DEDICATED_SERVER, __LINE__, uniquestr, __STR(reliesOn))
\ No newline at end of file +#define ON_DLL_LOAD_DEDI_RELIESON(dllName, uniquestr, reliesOn, func) __ON_DLL_LOAD(dllName, func, eDllLoadCallbackSide::DEDICATED_SERVER, __LINE__, uniquestr, __STR(reliesOn)) diff --git a/NorthstarDedicatedTest/hookutils.h b/NorthstarDedicatedTest/hookutils.h index 47ec12bf..a3846b51 100644 --- a/NorthstarDedicatedTest/hookutils.h +++ b/NorthstarDedicatedTest/hookutils.h @@ -19,4 +19,4 @@ class HookEnabler }; // macro to call HookEnabler::CreateHook with the hook's name -#define ENABLER_CREATEHOOK(enabler, ppTarget, ppDetour, ppOriginal) enabler.CreateHook(ppTarget, ppDetour, ppOriginal, #ppDetour)
\ No newline at end of file +#define ENABLER_CREATEHOOK(enabler, ppTarget, ppDetour, ppOriginal) enabler.CreateHook(ppTarget, ppDetour, ppOriginal, #ppDetour) diff --git a/NorthstarDedicatedTest/hoststate.h b/NorthstarDedicatedTest/hoststate.h index 4861ac7e..a77385ef 100644 --- a/NorthstarDedicatedTest/hoststate.h +++ b/NorthstarDedicatedTest/hoststate.h @@ -42,4 +42,4 @@ namespace R2 }; extern CHostState* g_pHostState; -} // namespace R2
\ No newline at end of file +} // namespace R2 diff --git a/NorthstarDedicatedTest/keyvalues.h b/NorthstarDedicatedTest/keyvalues.h index b7de850d..6f70f09b 100644 --- a/NorthstarDedicatedTest/keyvalues.h +++ b/NorthstarDedicatedTest/keyvalues.h @@ -1,3 +1 @@ #pragma once - -void InitialiseKeyValues(HMODULE baseAddress);
\ No newline at end of file diff --git a/NorthstarDedicatedTest/languagehooks.h b/NorthstarDedicatedTest/languagehooks.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/languagehooks.h +++ b/NorthstarDedicatedTest/languagehooks.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/latencyflex.cpp b/NorthstarDedicatedTest/latencyflex.cpp index a2c044cf..72fe297b 100644 --- a/NorthstarDedicatedTest/latencyflex.cpp +++ b/NorthstarDedicatedTest/latencyflex.cpp @@ -4,15 +4,14 @@ #include "hookutils.h" #include "convar.h" -typedef void (*OnRenderStartType)(); -OnRenderStartType OnRenderStart; - ConVar* Cvar_r_latencyflex; HMODULE m_lfxModule {}; typedef void (*PFN_winelfx_WaitAndBeginFrame)(); PFN_winelfx_WaitAndBeginFrame m_winelfx_WaitAndBeginFrame {}; +typedef void (*OnRenderStartType)(); +OnRenderStartType OnRenderStart; void OnRenderStartHook() { if (Cvar_r_latencyflex->GetInt()) diff --git a/NorthstarDedicatedTest/latencyflex.h b/NorthstarDedicatedTest/latencyflex.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/latencyflex.h +++ b/NorthstarDedicatedTest/latencyflex.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/localchatwriter.h b/NorthstarDedicatedTest/localchatwriter.h index e9ab1efc..3ef3aca1 100644 --- a/NorthstarDedicatedTest/localchatwriter.h +++ b/NorthstarDedicatedTest/localchatwriter.h @@ -69,4 +69,4 @@ class LocalChatWriter const char* ApplyAnsiEscape(const char* escape); void InsertDefaultFade(); -};
\ No newline at end of file +}; diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp index 39babf29..c02e333a 100644 --- a/NorthstarDedicatedTest/logging.cpp +++ b/NorthstarDedicatedTest/logging.cpp @@ -396,7 +396,6 @@ void Status_ConMsg_Hook(const char* text, ...) typedef bool (*CClientState_ProcessPrint_Type)(__int64 thisptr, __int64 msg); CClientState_ProcessPrint_Type CClientState_ProcessPrint_Original; - bool CClientState_ProcessPrint_Hook(__int64 thisptr, __int64 msg) { char* text = *(char**)(msg + 0x20); diff --git a/NorthstarDedicatedTest/logging.h b/NorthstarDedicatedTest/logging.h index a3aa60cc..83fd0c12 100644 --- a/NorthstarDedicatedTest/logging.h +++ b/NorthstarDedicatedTest/logging.h @@ -1,4 +1,4 @@ #pragma once void CreateLogFiles(); -void InitialiseLogging();
\ No newline at end of file +void InitialiseLogging(); diff --git a/NorthstarDedicatedTest/main.h b/NorthstarDedicatedTest/main.h index 64f9cfd2..412f1e25 100644 --- a/NorthstarDedicatedTest/main.h +++ b/NorthstarDedicatedTest/main.h @@ -1,4 +1,4 @@ #pragma once extern "C" __declspec(dllexport) bool InitialiseNorthstar(); -extern "C" __declspec(dllexport) bool LoadPlugins();
\ No newline at end of file +extern "C" __declspec(dllexport) bool LoadPlugins(); diff --git a/NorthstarDedicatedTest/mapsprint.h b/NorthstarDedicatedTest/mapsprint.h index daa1df8c..b01761c0 100644 --- a/NorthstarDedicatedTest/mapsprint.h +++ b/NorthstarDedicatedTest/mapsprint.h @@ -1,2 +1,2 @@ #pragma once -void InitialiseMapsPrint();
\ No newline at end of file +void InitialiseMapsPrint(); diff --git a/NorthstarDedicatedTest/masterserver.h b/NorthstarDedicatedTest/masterserver.h index dcf6fb66..a485a1dc 100644 --- a/NorthstarDedicatedTest/masterserver.h +++ b/NorthstarDedicatedTest/masterserver.h @@ -150,4 +150,4 @@ void UpdateServerInfoFromUnicodeToUTF8(); extern MasterServerManager* g_MasterServerManager; extern ConVar* Cvar_ns_masterserver_hostname; -extern ConVar* Cvar_ns_server_password;
\ No newline at end of file +extern ConVar* Cvar_ns_server_password; diff --git a/NorthstarDedicatedTest/maxplayers.h b/NorthstarDedicatedTest/maxplayers.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/maxplayers.h +++ b/NorthstarDedicatedTest/maxplayers.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/miscclientfixes.cpp b/NorthstarDedicatedTest/miscclientfixes.cpp index 777d5696..bb59b539 100644 --- a/NorthstarDedicatedTest/miscclientfixes.cpp +++ b/NorthstarDedicatedTest/miscclientfixes.cpp @@ -5,49 +5,6 @@ #include "hookutils.h" #include "NSMem.h" -typedef void* (*CrashingWeaponActivityFuncType)(void* a1); -CrashingWeaponActivityFuncType CrashingWeaponActivityFunc0; -CrashingWeaponActivityFuncType CrashingWeaponActivityFunc1; - -ConVar* Cvar_ns_cl_move_always_send; - -void* CrashingWeaponActivityFunc0Hook(void* a1) -{ - // this return is safe, other functions that use this value seemingly dont care about it being null - if (!a1) - return 0; - - return CrashingWeaponActivityFunc0(a1); -} - -void* CrashingWeaponActivityFunc1Hook(void* a1) -{ - // this return is safe, other functions that use this value seemingly dont care about it being null - if (!a1) - return 0; - - return CrashingWeaponActivityFunc1(a1); -} - ON_DLL_LOAD_CLIENT_RELIESON("client.dll", MiscClientFixes, ConVar, [](HMODULE baseAddress) { - HookEnabler hook; - - // allow demo recording on loopback - NSMem::NOP((uintptr_t)GetModuleHandleA("engine.dll") + 0x8E1B1, 2); - NSMem::NOP((uintptr_t)GetModuleHandleA("engine.dll") + 0x56CC3, 2); - - // change default values of demo cvars to enable them by default, but not autorecord - // this is before Host_Init, the setvalue calls here will get overwritten by custom cfgs/launch options - ConVar* Cvar_demo_enableDemos = g_pCVar->FindVar("demo_enabledemos"); - Cvar_demo_enableDemos->m_pszDefaultValue = "1"; - Cvar_demo_enableDemos->SetValue(true); - - ConVar* Cvar_demo_writeLocalFile = g_pCVar->FindVar("demo_writeLocalFile"); - Cvar_demo_writeLocalFile->m_pszDefaultValue = "1"; - Cvar_demo_writeLocalFile->SetValue(true); - - ConVar* Cvar_demo_autoRecord = g_pCVar->FindVar("demo_autoRecord"); - Cvar_demo_autoRecord->m_pszDefaultValue = "0"; - Cvar_demo_autoRecord->SetValue(false); })
\ No newline at end of file diff --git a/NorthstarDedicatedTest/miscclientfixes.h b/NorthstarDedicatedTest/miscclientfixes.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/miscclientfixes.h +++ b/NorthstarDedicatedTest/miscclientfixes.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/misccommands.h b/NorthstarDedicatedTest/misccommands.h index cbd1df65..fbd41b32 100644 --- a/NorthstarDedicatedTest/misccommands.h +++ b/NorthstarDedicatedTest/misccommands.h @@ -1,2 +1,2 @@ #pragma once -void AddMiscConCommands();
\ No newline at end of file +void AddMiscConCommands(); diff --git a/NorthstarDedicatedTest/miscserverfixes.h b/NorthstarDedicatedTest/miscserverfixes.h index e69de29b..6f70f09b 100644 --- a/NorthstarDedicatedTest/miscserverfixes.h +++ b/NorthstarDedicatedTest/miscserverfixes.h @@ -0,0 +1 @@ +#pragma once diff --git a/NorthstarDedicatedTest/miscserverscript.h b/NorthstarDedicatedTest/miscserverscript.h index 59c77ddc..8353df0d 100644 --- a/NorthstarDedicatedTest/miscserverscript.h +++ b/NorthstarDedicatedTest/miscserverscript.h @@ -1 +1,2 @@ -void* GetPlayerByIndex(int playerIndex);
\ No newline at end of file +#pragma once +void* GetPlayerByIndex(int playerIndex); diff --git a/NorthstarDedicatedTest/modlocalisation.cpp b/NorthstarDedicatedTest/modlocalisation.cpp index b6cb38dd..7774c4b6 100644 --- a/NorthstarDedicatedTest/modlocalisation.cpp +++ b/NorthstarDedicatedTest/modlocalisation.cpp @@ -4,29 +4,28 @@ #include "hookutils.h" #include "modmanager.h" + typedef bool (*AddLocalisationFileType)(void* g_pVguiLocalize, const char* path, const char* pathId, char unknown); AddLocalisationFileType AddLocalisationFile; - -bool loadModLocalisationFiles = true; - bool AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, const char* pathId, char unknown) { + static bool bLoadModLocalisationFiles = true; bool ret = AddLocalisationFile(g_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_pModManager->m_loadedMods) if (mod.Enabled) for (std::string& localisationFile : mod.LocalisationFiles) AddLocalisationFile(g_pVguiLocalize, localisationFile.c_str(), pathId, unknown); - loadModLocalisationFiles = true; + bLoadModLocalisationFiles = true; return ret; } diff --git a/NorthstarDedicatedTest/modlocalisation.h b/NorthstarDedicatedTest/modlocalisation.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/modlocalisation.h +++ b/NorthstarDedicatedTest/modlocalisation.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/modmanager.h b/NorthstarDedicatedTest/modmanager.h index 6d89e934..ceddb402 100644 --- a/NorthstarDedicatedTest/modmanager.h +++ b/NorthstarDedicatedTest/modmanager.h @@ -144,4 +144,4 @@ class ModManager fs::path GetModFolderPath(); fs::path GetCompiledAssetsPath(); -extern ModManager* g_pModManager;
\ No newline at end of file +extern ModManager* g_pModManager; diff --git a/NorthstarDedicatedTest/pch.h b/NorthstarDedicatedTest/pch.h index a67315ba..d1ee9c74 100644 --- a/NorthstarDedicatedTest/pch.h +++ b/NorthstarDedicatedTest/pch.h @@ -46,4 +46,4 @@ template <typename T, size_t index, typename... Args> constexpr T CallVFunc_Alt( return CallVFunc_Alt<returnType, index> argsRaw; \ } -#endif
\ No newline at end of file +#endif diff --git a/NorthstarDedicatedTest/pdef.h b/NorthstarDedicatedTest/pdef.h index a6bffbe4..379e76da 100644 --- a/NorthstarDedicatedTest/pdef.h +++ b/NorthstarDedicatedTest/pdef.h @@ -1,4 +1,4 @@ #pragma once const fs::path MOD_PDEF_SUFFIX = "cfg/server/persistent_player_data_version_231.pdef"; -const char* VPK_PDEF_PATH = "cfg/server/persistent_player_data_version_231.pdef";
\ No newline at end of file +const char* VPK_PDEF_PATH = "cfg/server/persistent_player_data_version_231.pdef"; diff --git a/NorthstarDedicatedTest/playlist.h b/NorthstarDedicatedTest/playlist.h index fd5949e1..28e5aa9d 100644 --- a/NorthstarDedicatedTest/playlist.h +++ b/NorthstarDedicatedTest/playlist.h @@ -14,4 +14,4 @@ namespace R2 typedef char* (*GetCurrentPlaylistVarType)(const char* varName, bool useOverrides); extern GetCurrentPlaylistVarType GetCurrentPlaylistVar; -} // namespace R2
\ No newline at end of file +} // namespace R2 diff --git a/NorthstarDedicatedTest/plugin_abi.h b/NorthstarDedicatedTest/plugin_abi.h index 698c33ab..4b176a32 100644 --- a/NorthstarDedicatedTest/plugin_abi.h +++ b/NorthstarDedicatedTest/plugin_abi.h @@ -65,4 +65,4 @@ struct PlayerInfo int (*getPlayerInfoChar)(char* out_buf, size_t out_buf_len, PlayerInfoType var); int (*getPlayerInfoInt)(int* out_ptr, PlayerInfoType var); int (*getPlayerInfoBool)(bool* out_ptr, PlayerInfoType var); -};
\ No newline at end of file +}; diff --git a/NorthstarDedicatedTest/plugins.h b/NorthstarDedicatedTest/plugins.h index 3a0f9f79..953801a2 100644 --- a/NorthstarDedicatedTest/plugins.h +++ b/NorthstarDedicatedTest/plugins.h @@ -14,4 +14,4 @@ int getPlayerInfoInt(int* out_ptr, PlayerInfoType var); int getPlayerInfoBool(bool* out_ptr, PlayerInfoType var); void initGameState(); -void* getPluginObject(PluginObject var);
\ No newline at end of file +void* getPluginObject(PluginObject var); diff --git a/NorthstarDedicatedTest/rpakfilesystem.cpp b/NorthstarDedicatedTest/rpakfilesystem.cpp index 1e44ed50..45367766 100644 --- a/NorthstarDedicatedTest/rpakfilesystem.cpp +++ b/NorthstarDedicatedTest/rpakfilesystem.cpp @@ -5,9 +5,6 @@ #include "modmanager.h" #include "dedicated.h" -typedef void* (*LoadCommonPaksForMapType)(char* map); -LoadCommonPaksForMapType LoadCommonPaksForMap; - typedef void* (*LoadPakSyncType)(const char* path, void* unknownSingleton, int flags); typedef int (*LoadPakAsyncType)(const char* path, void* unknownSingleton, int flags, void* callback0, void* callback1); typedef void* (*UnloadPakType)(int pakHandle, void* callback); @@ -33,6 +30,7 @@ void PakLoadManager::LoadPakSync(const char* path) { g_pakLoadApi->LoadPakSync(path, *pUnknownPakLoadSingleton, 0); } + void PakLoadManager::LoadPakAsync(const char* path, bool bMarkForUnload) { int handle = g_pakLoadApi->LoadPakAsync(path, *pUnknownPakLoadSingleton, 2, nullptr, nullptr); diff --git a/NorthstarDedicatedTest/rpakfilesystem.h b/NorthstarDedicatedTest/rpakfilesystem.h index e72ab5ff..28b29b52 100644 --- a/NorthstarDedicatedTest/rpakfilesystem.h +++ b/NorthstarDedicatedTest/rpakfilesystem.h @@ -11,4 +11,4 @@ class PakLoadManager std::vector<int> m_pakHandlesToUnload; }; -extern PakLoadManager* g_pPakLoadManager;
\ No newline at end of file +extern PakLoadManager* g_pPakLoadManager; diff --git a/NorthstarDedicatedTest/scriptbrowserhooks.cpp b/NorthstarDedicatedTest/scriptbrowserhooks.cpp index 007bf412..138f821f 100644 --- a/NorthstarDedicatedTest/scriptbrowserhooks.cpp +++ b/NorthstarDedicatedTest/scriptbrowserhooks.cpp @@ -3,11 +3,10 @@ #include "scriptbrowserhooks.h" #include "hookutils.h" -typedef void (*OpenExternalWebBrowserType)(char* url, char flags); -OpenExternalWebBrowserType OpenExternalWebBrowser; - bool* bIsOriginOverlayEnabled; +typedef void (*OpenExternalWebBrowserType)(char* url, char flags); +OpenExternalWebBrowserType OpenExternalWebBrowser; void OpenExternalWebBrowserHook(char* url, char flags) { bool bIsOriginOverlayEnabledOriginal = *bIsOriginOverlayEnabled; diff --git a/NorthstarDedicatedTest/scriptbrowserhooks.h b/NorthstarDedicatedTest/scriptbrowserhooks.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/scriptbrowserhooks.h +++ b/NorthstarDedicatedTest/scriptbrowserhooks.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/scriptmainmenupromos.h b/NorthstarDedicatedTest/scriptmainmenupromos.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/scriptmainmenupromos.h +++ b/NorthstarDedicatedTest/scriptmainmenupromos.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/scriptmodmenu.h b/NorthstarDedicatedTest/scriptmodmenu.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/scriptmodmenu.h +++ b/NorthstarDedicatedTest/scriptmodmenu.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/scriptserverbrowser.h b/NorthstarDedicatedTest/scriptserverbrowser.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/scriptserverbrowser.h +++ b/NorthstarDedicatedTest/scriptserverbrowser.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/scriptservertoclientstringcommand.h b/NorthstarDedicatedTest/scriptservertoclientstringcommand.h index 7b9637ef..6f70f09b 100644 --- a/NorthstarDedicatedTest/scriptservertoclientstringcommand.h +++ b/NorthstarDedicatedTest/scriptservertoclientstringcommand.h @@ -1 +1 @@ -#pragma once
\ No newline at end of file +#pragma once diff --git a/NorthstarDedicatedTest/scriptsrson.h b/NorthstarDedicatedTest/scriptsrson.h index 140db341..5e1d5684 100644 --- a/NorthstarDedicatedTest/scriptsrson.h +++ b/NorthstarDedicatedTest/scriptsrson.h @@ -1,4 +1,4 @@ #pragma once const std::string MOD_SCRIPTS_RSON_SUFFIX = "scripts/vscripts/scripts.rson"; -const char* VPK_SCRIPTS_RSON_PATH = "scripts\\vscripts\\scripts.rson";
\ No newline at end of file +const char* VPK_SCRIPTS_RSON_PATH = "scripts\\vscripts\\scripts.rson"; diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index a0902f4e..74163d5a 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -23,7 +23,6 @@ using namespace Tier0; const char* AUTHSERVER_VERIFY_STRING = "I am a northstar server!"; - // global vars ServerAuthenticationManager* g_ServerAuthenticationManager; diff --git a/NorthstarDedicatedTest/serverauthentication.h b/NorthstarDedicatedTest/serverauthentication.h index 2cd0948b..182b3336 100644 --- a/NorthstarDedicatedTest/serverauthentication.h +++ b/NorthstarDedicatedTest/serverauthentication.h @@ -105,4 +105,4 @@ typedef void (*CBaseClient__DisconnectType)(void* self, uint32_t unknownButAlway extern CBaseClient__DisconnectType CBaseClient__Disconnect; extern ServerAuthenticationManager* g_ServerAuthenticationManager; -extern ConVar* Cvar_ns_player_auth_port;
\ No newline at end of file +extern ConVar* Cvar_ns_player_auth_port; diff --git a/NorthstarDedicatedTest/serverchathooks.h b/NorthstarDedicatedTest/serverchathooks.h index 04262d83..1d8a806a 100644 --- a/NorthstarDedicatedTest/serverchathooks.h +++ b/NorthstarDedicatedTest/serverchathooks.h @@ -22,4 +22,4 @@ void ChatSendMessage(unsigned int playerIndex, const char* text, bool isteam); // isDead: display a [DEAD] badge // messageType: send a specific message type void ChatBroadcastMessage( - int fromPlayerIndex, int toPlayerIndex, const char* text, bool isTeam, bool isDead, CustomMessageType messageType);
\ No newline at end of file + int fromPlayerIndex, int toPlayerIndex, const char* text, bool isTeam, bool isDead, CustomMessageType messageType); diff --git a/NorthstarDedicatedTest/sigscanning.h b/NorthstarDedicatedTest/sigscanning.h index 56979fbc..5d255152 100644 --- a/NorthstarDedicatedTest/sigscanning.h +++ b/NorthstarDedicatedTest/sigscanning.h @@ -4,4 +4,4 @@ // note: sigscanning is only really intended to be used for resolving stuff like shared function definitions // we mostly use raw function addresses for stuff -void* FindSignature(std::string dllName, const char* sig, const char* mask);
\ No newline at end of file +void* FindSignature(std::string dllName, const char* sig, const char* mask); diff --git a/NorthstarDedicatedTest/sourceconsole.h b/NorthstarDedicatedTest/sourceconsole.h index dc45d5b1..e8d44a84 100644 --- a/NorthstarDedicatedTest/sourceconsole.h +++ b/NorthstarDedicatedTest/sourceconsole.h @@ -102,4 +102,4 @@ class SourceConsoleSink : public spdlog::sinks::base_sink<std::mutex> void flush_() override; }; -void InitialiseConsoleOnInterfaceCreation();
\ No newline at end of file +void InitialiseConsoleOnInterfaceCreation(); diff --git a/NorthstarDedicatedTest/sourceinterface.h b/NorthstarDedicatedTest/sourceinterface.h index c4f41920..474e961b 100644 --- a/NorthstarDedicatedTest/sourceinterface.h +++ b/NorthstarDedicatedTest/sourceinterface.h @@ -28,4 +28,4 @@ template <typename T> class SourceInterface { return m_interface; } -};
\ No newline at end of file +}; diff --git a/NorthstarDedicatedTest/squirrel.h b/NorthstarDedicatedTest/squirrel.h index 6f4e4f9e..cb46ac87 100644 --- a/NorthstarDedicatedTest/squirrel.h +++ b/NorthstarDedicatedTest/squirrel.h @@ -227,4 +227,4 @@ template <ScriptContext context> class SquirrelManager extern SquirrelManager<ScriptContext::CLIENT>* g_pClientSquirrel; extern SquirrelManager<ScriptContext::SERVER>* g_pServerSquirrel; extern SquirrelManager<ScriptContext::UI>* g_pUISquirrel; -template <ScriptContext context> SquirrelManager<context>* GetSquirrelManager();
\ No newline at end of file +template <ScriptContext context> SquirrelManager<context>* GetSquirrelManager(); diff --git a/NorthstarDedicatedTest/version.h b/NorthstarDedicatedTest/version.h index d9d29fec..261a4cf1 100644 --- a/NorthstarDedicatedTest/version.h +++ b/NorthstarDedicatedTest/version.h @@ -3,4 +3,4 @@ extern char version[16]; extern char NSUserAgent[32]; -void InitialiseVersion();
\ No newline at end of file +void InitialiseVersion(); |