aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-08-08 06:12:11 -0400
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-08-14 14:37:24 +0200
commitc0e8e576df16171da6f0e68cbfa18123e8d1e7e0 (patch)
treefb157acfec3c1a510644481aade8f7115efb2295 /NorthstarDedicatedTest
parentd20cf6f08af37830d3bfc934cef356fa6a1aa102 (diff)
downloadNorthstarLauncher-c0e8e576df16171da6f0e68cbfa18123e8d1e7e0.tar.gz
NorthstarLauncher-c0e8e576df16171da6f0e68cbfa18123e8d1e7e0.zip
Fix most clang/mingw issues (#226)
- Fix include case. - Replace MSVC-specific align with standard alignas. - Type fixes. - Delete operator noexcept. - A few other minor issues. - clang-format everything. - Use c++20 instead of c++17. - Rewrite ERROR macro for launcher_wsock32_proxy. - Use a plain ifstream for the audio.cpp wavStream. Note: When compiling with clang, you'll need -municode. Related to #212.
Diffstat (limited to 'NorthstarDedicatedTest')
-rw-r--r--NorthstarDedicatedTest/ExploitFixes.cpp8
-rw-r--r--NorthstarDedicatedTest/NSMem.h6
-rw-r--r--NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj4
-rw-r--r--NorthstarDedicatedTest/audio.cpp10
-rw-r--r--NorthstarDedicatedTest/bansystem.cpp3
-rw-r--r--NorthstarDedicatedTest/clientvideooverrides.cpp7
-rw-r--r--NorthstarDedicatedTest/convar.cpp2
-rw-r--r--NorthstarDedicatedTest/dedicatedmaterialsystem.cpp3
-rw-r--r--NorthstarDedicatedTest/dllmain.cpp6
-rw-r--r--NorthstarDedicatedTest/filesystem.cpp16
-rw-r--r--NorthstarDedicatedTest/hooks.cpp16
-rw-r--r--NorthstarDedicatedTest/hookutils.h3
-rw-r--r--NorthstarDedicatedTest/logging.cpp5
-rw-r--r--NorthstarDedicatedTest/masterserver.h4
-rw-r--r--NorthstarDedicatedTest/maxplayers.cpp6
-rw-r--r--NorthstarDedicatedTest/memalloc.cpp4
-rw-r--r--NorthstarDedicatedTest/memalloc.h2
-rw-r--r--NorthstarDedicatedTest/pch.h4
-rw-r--r--NorthstarDedicatedTest/rpakfilesystem.cpp16
-rw-r--r--NorthstarDedicatedTest/serverchathooks.cpp2
-rw-r--r--NorthstarDedicatedTest/sourceinterface.cpp8
-rw-r--r--NorthstarDedicatedTest/squirrel.cpp4
-rw-r--r--NorthstarDedicatedTest/squirrel.h2
23 files changed, 82 insertions, 59 deletions
diff --git a/NorthstarDedicatedTest/ExploitFixes.cpp b/NorthstarDedicatedTest/ExploitFixes.cpp
index 2f4e2b5c..31fa349a 100644
--- a/NorthstarDedicatedTest/ExploitFixes.cpp
+++ b/NorthstarDedicatedTest/ExploitFixes.cpp
@@ -204,7 +204,7 @@ KHOOK(ReadUsercmd, ("server.dll", "4C 89 44 24 ? 53 55 56 57"), void, __fastcall
oReadUsercmd(buf, pCmd_move, pCmd_from);
// Now let's make sure the CMD we read isnt messed up to prevent numerous exploits (including server crashing)
- struct __declspec(align(4)) SV_CUserCmd
+ struct alignas(4) SV_CUserCmd
{
DWORD command_number;
DWORD tick_count;
@@ -291,7 +291,11 @@ KHOOK(
static void* targetRetAddr = NSMem::PatternScan("engine.dll", "84 C0 75 2C 49 8B 16");
+#ifdef _MSC_VER
if (_ReturnAddress() == targetRetAddr)
+#else
+ if (__builtin_return_address(0) == targetRetAddr)
+#endif
{
if (!ExploitFixes_UTF8Parser::CheckValid(a1, a2, strData))
{
@@ -546,4 +550,4 @@ void ExploitFixes::LoadCallback_Full(HMODULE baseAddress)
HookEnabler hook;
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x2a8a50, &GetEntByIndexHook, reinterpret_cast<LPVOID*>(&GetEntByIndex));
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/NSMem.h b/NorthstarDedicatedTest/NSMem.h
index 84bb93db..9b1f9103 100644
--- a/NorthstarDedicatedTest/NSMem.h
+++ b/NorthstarDedicatedTest/NSMem.h
@@ -44,7 +44,7 @@ namespace NSMem
}
else
{
- assert(false, "Failed to parse invalid hex string.");
+ assert(false);
val = -1;
}
@@ -188,6 +188,6 @@ struct KHook
#define KHOOK(name, funcPatternInfo, returnType, convention, args) \
returnType convention hk##name args; \
auto o##name = (returnType(convention*) args)0; \
- KHook k##name = KHook(KHookPatternInfo funcPatternInfo, &hk##name, (void**)&o##name); \
+ KHook k##name = KHook(KHookPatternInfo funcPatternInfo, reinterpret_cast<void*>(&hk##name), (void**)&o##name); \
returnType convention hk##name args
-#pragma endregion \ No newline at end of file
+#pragma endregion
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
index ff6ca2ea..50f8a865 100644
--- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
+++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
@@ -59,7 +59,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- <LanguageStandard>stdcpp17</LanguageStandard>
+ <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>$(ProjectDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@@ -86,7 +86,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- <LanguageStandard>stdcpp17</LanguageStandard>
+ <LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>$(ProjectDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
diff --git a/NorthstarDedicatedTest/audio.cpp b/NorthstarDedicatedTest/audio.cpp
index 0b65670f..ed30d01b 100644
--- a/NorthstarDedicatedTest/audio.cpp
+++ b/NorthstarDedicatedTest/audio.cpp
@@ -194,7 +194,7 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
std::string pathString = file.path().string();
// Open the file.
- std::basic_ifstream<uint8_t> wavStream(pathString, std::ios::binary);
+ std::ifstream wavStream(pathString, std::ios::binary);
if (wavStream.fail())
{
@@ -219,7 +219,7 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
[pathString, fileSize, data]
{
std::shared_lock lock(g_CustomAudioManager.m_loadingMutex);
- std::basic_ifstream<uint8_t> wavStream(pathString, std::ios::binary);
+ std::ifstream wavStream(pathString, std::ios::binary);
// would be weird if this got hit, since it would've worked previously
if (wavStream.fail())
@@ -230,9 +230,9 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa
// read from after the header first to preserve the empty header, then read the header last
wavStream.seekg(sizeof(EMPTY_WAVE), std::ios::beg);
- wavStream.read(&data[sizeof(EMPTY_WAVE)], fileSize - sizeof(EMPTY_WAVE));
+ wavStream.read(reinterpret_cast<char*>(&data[sizeof(EMPTY_WAVE)]), fileSize - sizeof(EMPTY_WAVE));
wavStream.seekg(0, std::ios::beg);
- wavStream.read(data, sizeof(EMPTY_WAVE));
+ wavStream.read(reinterpret_cast<char*>(data), sizeof(EMPTY_WAVE));
wavStream.close();
spdlog::info("Finished async read of audio sample {}", pathString);
@@ -512,4 +512,4 @@ void InitialiseMilesAudioHooks(HMODULE baseAddress)
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x57DAD0, &MilesLog_Hook, reinterpret_cast<LPVOID*>(&MilesLog_Original));
MilesStopAll = (MilesStopAll_Type)((char*)baseAddress + 0x580850);
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/bansystem.cpp b/NorthstarDedicatedTest/bansystem.cpp
index 9c2507fd..9333d844 100644
--- a/NorthstarDedicatedTest/bansystem.cpp
+++ b/NorthstarDedicatedTest/bansystem.cpp
@@ -1,4 +1,3 @@
-#pragma once
#include "pch.h"
#include "bansystem.h"
#include "serverauthentication.h"
@@ -103,4 +102,4 @@ void InitialiseBanSystem(HMODULE baseAddress)
RegisterConCommand("ban", BanPlayerCommand, "bans a given player by uid or name", FCVAR_GAMEDLL);
RegisterConCommand("unban", UnbanPlayerCommand, "unbans a given player by uid", FCVAR_NONE);
RegisterConCommand("clearbanlist", ClearBanlistCommand, "clears all uids on the banlist", FCVAR_NONE);
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/clientvideooverrides.cpp b/NorthstarDedicatedTest/clientvideooverrides.cpp
index d5674f51..c5989968 100644
--- a/NorthstarDedicatedTest/clientvideooverrides.cpp
+++ b/NorthstarDedicatedTest/clientvideooverrides.cpp
@@ -35,5 +35,8 @@ void InitialiseClientVideoOverrides(HMODULE baseAddress)
{
HookEnabler hook;
ENABLER_CREATEHOOK(
- hook, GetProcAddress(GetModuleHandleA("bink2w64.dll"), "BinkOpen"), &BinkOpenHook, reinterpret_cast<LPVOID*>(&BinkOpen));
-} \ No newline at end of file
+ hook,
+ reinterpret_cast<void*>(GetProcAddress(GetModuleHandleA("bink2w64.dll"), "BinkOpen")),
+ &BinkOpenHook,
+ reinterpret_cast<LPVOID*>(&BinkOpen));
+}
diff --git a/NorthstarDedicatedTest/convar.cpp b/NorthstarDedicatedTest/convar.cpp
index 346e7b69..bf8edbf9 100644
--- a/NorthstarDedicatedTest/convar.cpp
+++ b/NorthstarDedicatedTest/convar.cpp
@@ -1,3 +1,5 @@
+#include <float.h>
+
#include "pch.h"
#include "bits.h"
#include "cvar.h"
diff --git a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
index f1a91e22..01197407 100644
--- a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
+++ b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp
@@ -1,4 +1,3 @@
-#pragma once
#include "pch.h"
#include "dedicated.h"
#include "dedicatedmaterialsystem.h"
@@ -120,4 +119,4 @@ void InitialiseDedicatedRtechGame(HMODULE baseAddress)
// unfortunately this is unstable, seems to freeze when changing maps
// ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0xB0F0, &PakLoadAPI__LoadRpakHook, reinterpret_cast<LPVOID*>(&PakLoadAPI__LoadRpak));
// ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0xB170, &PakLoadAPI__LoadRpak2Hook, reinterpret_cast<LPVOID*>(&PakLoadAPI__LoadRpak2));
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/dllmain.cpp b/NorthstarDedicatedTest/dllmain.cpp
index d64cc34f..6d32034f 100644
--- a/NorthstarDedicatedTest/dllmain.cpp
+++ b/NorthstarDedicatedTest/dllmain.cpp
@@ -53,7 +53,7 @@
#include "rapidjson/error/en.h"
#include "ExploitFixes.h"
-typedef void (*initPluginFuncPtr)(void* getPluginObject);
+typedef void (*initPluginFuncPtr)(void* (*getPluginObject)(PluginObject));
bool initialised = false;
@@ -128,7 +128,7 @@ bool LoadPlugins()
spdlog::info("Failed to load library {}: ", std::system_category().message(GetLastError()));
continue;
}
- HRSRC manifestResource = FindResourceW(datafile, MAKEINTRESOURCE(101), MAKEINTRESOURCE(RT_RCDATA));
+ HRSRC manifestResource = FindResourceW(datafile, MAKEINTRESOURCEW(101), MAKEINTRESOURCEW(RT_RCDATA));
if (manifestResource == NULL)
{
@@ -302,4 +302,4 @@ bool InitialiseNorthstar()
CallAllPendingDLLLoadCallbacks();
return true;
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/filesystem.cpp b/NorthstarDedicatedTest/filesystem.cpp
index 702141bb..c17d813f 100644
--- a/NorthstarDedicatedTest/filesystem.cpp
+++ b/NorthstarDedicatedTest/filesystem.cpp
@@ -41,11 +41,19 @@ void InitialiseFilesystem(HMODULE baseAddress)
// create hooks
HookEnabler hook;
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x5CBA0, &ReadFileFromVPKHook, reinterpret_cast<LPVOID*>(&readFileFromVPK));
- ENABLER_CREATEHOOK(hook, (*g_Filesystem)->m_vtable->ReadFromCache, &ReadFromCacheHook, reinterpret_cast<LPVOID*>(&readFromCache));
ENABLER_CREATEHOOK(
- hook, (*g_Filesystem)->m_vtable->AddSearchPath, &AddSearchPathHook, reinterpret_cast<LPVOID*>(&addSearchPathOriginal));
+ hook,
+ reinterpret_cast<void*>((*g_Filesystem)->m_vtable->ReadFromCache),
+ &ReadFromCacheHook,
+ reinterpret_cast<LPVOID*>(&readFromCache));
+ ENABLER_CREATEHOOK(
+ hook,
+ reinterpret_cast<void*>((*g_Filesystem)->m_vtable->AddSearchPath),
+ &AddSearchPathHook,
+ reinterpret_cast<LPVOID*>(&addSearchPathOriginal));
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x15F20, &ReadFileFromFilesystemHook, reinterpret_cast<LPVOID*>(&readFileFromFilesystem));
- ENABLER_CREATEHOOK(hook, (*g_Filesystem)->m_vtable->MountVPK, &MountVPKHook, reinterpret_cast<LPVOID*>(&mountVPK));
+ ENABLER_CREATEHOOK(
+ hook, reinterpret_cast<void*>((*g_Filesystem)->m_vtable->MountVPK), &MountVPKHook, reinterpret_cast<LPVOID*>(&mountVPK));
}
std::string ReadVPKFile(const char* path)
@@ -194,4 +202,4 @@ VPKData* MountVPKHook(IFileSystem* fileSystem, const char* vpkPath)
}
return ret;
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/hooks.cpp b/NorthstarDedicatedTest/hooks.cpp
index cc99341a..64099f48 100644
--- a/NorthstarDedicatedTest/hooks.cpp
+++ b/NorthstarDedicatedTest/hooks.cpp
@@ -10,7 +10,6 @@
#include <fstream>
#include <sstream>
#include <filesystem>
-#include <Psapi.h>
typedef LPSTR (*GetCommandLineAType)();
LPSTR GetCommandLineAHook();
@@ -39,11 +38,14 @@ void InstallInitialHooks()
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));
+ ENABLER_CREATEHOOK(
+ hook, reinterpret_cast<void*>(&GetCommandLineA), &GetCommandLineAHook, reinterpret_cast<LPVOID*>(&GetCommandLineAOriginal));
+ ENABLER_CREATEHOOK(
+ hook, reinterpret_cast<void*>(&LoadLibraryExA), &LoadLibraryExAHook, reinterpret_cast<LPVOID*>(&LoadLibraryExAOriginal));
+ ENABLER_CREATEHOOK(hook, reinterpret_cast<void*>(&LoadLibraryA), &LoadLibraryAHook, reinterpret_cast<LPVOID*>(&LoadLibraryAOriginal));
+ ENABLER_CREATEHOOK(
+ hook, reinterpret_cast<void*>(&LoadLibraryExW), &LoadLibraryExWHook, reinterpret_cast<LPVOID*>(&LoadLibraryExWOriginal));
+ ENABLER_CREATEHOOK(hook, reinterpret_cast<void*>(&LoadLibraryW), &LoadLibraryWHook, reinterpret_cast<LPVOID*>(&LoadLibraryWOriginal));
}
LPSTR GetCommandLineAHook()
@@ -252,4 +254,4 @@ HMODULE LoadLibraryWHook(LPCWSTR lpLibFileName)
}
return moduleAddress;
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/hookutils.h b/NorthstarDedicatedTest/hookutils.h
index 47ec12bf..d0473d69 100644
--- a/NorthstarDedicatedTest/hookutils.h
+++ b/NorthstarDedicatedTest/hookutils.h
@@ -19,4 +19,5 @@ 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, reinterpret_cast<void*>(ppDetour), ppOriginal, #ppDetour)
diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp
index 5936007f..8b752637 100644
--- a/NorthstarDedicatedTest/logging.cpp
+++ b/NorthstarDedicatedTest/logging.cpp
@@ -7,9 +7,8 @@
#include "convar.h"
#include <iomanip>
#include <sstream>
-#include <Psapi.h>
-#include <minidumpapiset.h>
#include "configurables.h"
+#include <dbghelp.h>
// This needs to be called after hooks are loaded so we can access the command line args
void CreateLogFiles()
@@ -484,4 +483,4 @@ void InitialiseClientPrintHooks(HMODULE baseAddress)
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x198710, TextMsgHook, reinterpret_cast<LPVOID*>(&TextMsg_Original));
Cvar_cl_showtextmsg = new ConVar("cl_showtextmsg", "1", FCVAR_NONE, "Enable/disable text messages printing on the screen.");
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/masterserver.h b/NorthstarDedicatedTest/masterserver.h
index 8dd42d77..e4dcb954 100644
--- a/NorthstarDedicatedTest/masterserver.h
+++ b/NorthstarDedicatedTest/masterserver.h
@@ -1,6 +1,6 @@
#pragma once
#include "convar.h"
-#include <WinSock2.h>
+#include <winsock2.h>
#include <string>
#include <cstring>
struct RemoteModInfo
@@ -132,4 +132,4 @@ void InitialiseSharedMasterServer(HMODULE baseAddress);
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.cpp b/NorthstarDedicatedTest/maxplayers.cpp
index 32f3b2ec..556819f1 100644
--- a/NorthstarDedicatedTest/maxplayers.cpp
+++ b/NorthstarDedicatedTest/maxplayers.cpp
@@ -212,7 +212,7 @@ void RunUserCmds_Hook(bool a1, float a2)
v3 = *(unsigned char*)(g_pGlobals + 73);
if (*(DWORD*)(qword_1814D9648 + 92) &&
- ((*(unsigned __int8(__fastcall**)(__int64))(*(__int64*)g_pEngineServer + 32i64))(g_pEngineServer) ||
+ ((*(unsigned __int8(__fastcall**)(__int64))(*(__int64*)g_pEngineServer + 32))(g_pEngineServer) ||
!*(DWORD*)(qword_1814DA408 + 92)) &&
v3)
{
@@ -282,7 +282,7 @@ void RunUserCmds_Hook(bool a1, float a2)
if (v23)
v19 = 1;
else
- *v21 = 0i64;
+ *v21 = 0;
}
++v20;
++v21;
@@ -679,4 +679,4 @@ void InitialiseMaxPlayersOverride_Client(HMODULE baseAddress)
*(DWORD*)((char*)baseAddress + 0xC3AFF8) = 0;
auto DT_Team_Construct = (__int64(__fastcall*)())((char*)baseAddress + 0x17F950);
DT_Team_Construct();
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/memalloc.cpp b/NorthstarDedicatedTest/memalloc.cpp
index 4ba54c73..e2240269 100644
--- a/NorthstarDedicatedTest/memalloc.cpp
+++ b/NorthstarDedicatedTest/memalloc.cpp
@@ -70,7 +70,7 @@ void* operator new(size_t n)
return _malloc_base(n);
}
-void operator delete(void* p)
+void operator delete(void* p) noexcept
{
_free_base(p);
-} // /FORCE:MULTIPLE \ No newline at end of file
+} // /FORCE:MULTIPLE
diff --git a/NorthstarDedicatedTest/memalloc.h b/NorthstarDedicatedTest/memalloc.h
index a1b16ad4..fdd6474b 100644
--- a/NorthstarDedicatedTest/memalloc.h
+++ b/NorthstarDedicatedTest/memalloc.h
@@ -11,7 +11,7 @@ extern "C" void _free_base(void* const block);
extern "C" char* _strdup_base(const char* src);
void* operator new(size_t n);
-void operator delete(void* p);
+void operator delete(void* p) noexcept;
// void* malloc(size_t n);
diff --git a/NorthstarDedicatedTest/pch.h b/NorthstarDedicatedTest/pch.h
index 1955071c..75737a44 100644
--- a/NorthstarDedicatedTest/pch.h
+++ b/NorthstarDedicatedTest/pch.h
@@ -13,8 +13,8 @@
// add headers that you want to pre-compile here
#include "memalloc.h"
-#include <Windows.h>
-#include <Psapi.h>
+#include <windows.h>
+#include <psapi.h>
#include <set>
#include <map>
#include <filesystem>
diff --git a/NorthstarDedicatedTest/rpakfilesystem.cpp b/NorthstarDedicatedTest/rpakfilesystem.cpp
index 1a4736a9..cb069b56 100644
--- a/NorthstarDedicatedTest/rpakfilesystem.cpp
+++ b/NorthstarDedicatedTest/rpakfilesystem.cpp
@@ -299,9 +299,15 @@ void InitialiseEngineRpakFilesystem(HMODULE baseAddress)
pUnknownPakLoadSingleton = (void**)((char*)baseAddress + 0x7C5E20);
HookEnabler hook;
- ENABLER_CREATEHOOK(hook, g_pakLoadApi->LoadPakSync, &LoadPakSyncHook, reinterpret_cast<LPVOID*>(&LoadPakSyncOriginal));
- ENABLER_CREATEHOOK(hook, g_pakLoadApi->LoadPakAsync, &LoadPakAsyncHook, reinterpret_cast<LPVOID*>(&LoadPakAsyncOriginal));
- ENABLER_CREATEHOOK(hook, g_pakLoadApi->UnloadPak, &UnloadPakHook, reinterpret_cast<LPVOID*>(&UnloadPakOriginal));
ENABLER_CREATEHOOK(
- hook, g_pakLoadApi->ReadFullFileFromDisk, &ReadFullFileFromDiskHook, reinterpret_cast<LPVOID*>(&ReadFullFileFromDiskOriginal));
-} \ No newline at end of file
+ hook, reinterpret_cast<void*>(g_pakLoadApi->LoadPakSync), &LoadPakSyncHook, reinterpret_cast<LPVOID*>(&LoadPakSyncOriginal));
+ ENABLER_CREATEHOOK(
+ hook, reinterpret_cast<void*>(g_pakLoadApi->LoadPakAsync), &LoadPakAsyncHook, reinterpret_cast<LPVOID*>(&LoadPakAsyncOriginal));
+ ENABLER_CREATEHOOK(
+ hook, reinterpret_cast<void*>(g_pakLoadApi->UnloadPak), &UnloadPakHook, reinterpret_cast<LPVOID*>(&UnloadPakOriginal));
+ ENABLER_CREATEHOOK(
+ hook,
+ reinterpret_cast<void*>(g_pakLoadApi->ReadFullFileFromDisk),
+ &ReadFullFileFromDiskHook,
+ reinterpret_cast<LPVOID*>(&ReadFullFileFromDiskOriginal));
+}
diff --git a/NorthstarDedicatedTest/serverchathooks.cpp b/NorthstarDedicatedTest/serverchathooks.cpp
index 985d3d1b..2f5be5c1 100644
--- a/NorthstarDedicatedTest/serverchathooks.cpp
+++ b/NorthstarDedicatedTest/serverchathooks.cpp
@@ -194,7 +194,7 @@ void InitialiseServerChatHooks_Server(HMODULE baseAddress)
HookEnabler hook;
ENABLER_CREATEHOOK(
hook,
- CServerGameDLL__OnReceivedSayTextMessage,
+ reinterpret_cast<void*>(CServerGameDLL__OnReceivedSayTextMessage),
&CServerGameDLL__OnReceivedSayTextMessageHook,
reinterpret_cast<LPVOID*>(&CServerGameDLL__OnReceivedSayTextMessageHookBase));
diff --git a/NorthstarDedicatedTest/sourceinterface.cpp b/NorthstarDedicatedTest/sourceinterface.cpp
index 2cc4733d..56020e5e 100644
--- a/NorthstarDedicatedTest/sourceinterface.cpp
+++ b/NorthstarDedicatedTest/sourceinterface.cpp
@@ -47,7 +47,7 @@ void HookClientCreateInterface(HMODULE baseAddress)
HookEnabler hook;
ENABLER_CREATEHOOK(
hook,
- GetProcAddress(baseAddress, "CreateInterface"),
+ reinterpret_cast<void*>(GetProcAddress(baseAddress, "CreateInterface")),
&ClientCreateInterfaceHook,
reinterpret_cast<LPVOID*>(&clientCreateInterfaceOriginal));
}
@@ -57,7 +57,7 @@ void HookServerCreateInterface(HMODULE baseAddress)
HookEnabler hook;
ENABLER_CREATEHOOK(
hook,
- GetProcAddress(baseAddress, "CreateInterface"),
+ reinterpret_cast<void*>(GetProcAddress(baseAddress, "CreateInterface")),
&ServerCreateInterfaceHook,
reinterpret_cast<LPVOID*>(&serverCreateInterfaceOriginal));
}
@@ -67,7 +67,7 @@ void HookEngineCreateInterface(HMODULE baseAddress)
HookEnabler hook;
ENABLER_CREATEHOOK(
hook,
- GetProcAddress(baseAddress, "CreateInterface"),
+ reinterpret_cast<void*>(GetProcAddress(baseAddress, "CreateInterface")),
&EngineCreateInterfaceHook,
reinterpret_cast<LPVOID*>(&engineCreateInterfaceOriginal));
}
@@ -79,4 +79,4 @@ void InitialiseInterfaceCreationHooks()
// not used atm
// AddDllLoadCallback("server.dll", HookServerCreateInterface);
// AddDllLoadCallback("engine.dll", HookEngineCreateInterface);
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp
index a0680d9a..9386c767 100644
--- a/NorthstarDedicatedTest/squirrel.cpp
+++ b/NorthstarDedicatedTest/squirrel.cpp
@@ -491,7 +491,7 @@ template <ScriptContext context> int64_t RegisterSquirrelFuncHook(void* sqvm, SQ
if ((funcReg->devLevel == 1) && (!CommandLine()->CheckParm("-allowSquirrelDevFunctions")) &&
(!allowedDevFunctions.count(funcReg->squirrelFuncName)))
- funcReg->funcPtr = SQ_DevFuncStub;
+ funcReg->funcPtr = reinterpret_cast<void*>(SQ_DevFuncStub);
if (context == ScriptContext::SERVER)
return ServerRegisterSquirrelFunc(sqvm, funcReg, unknown);
@@ -521,4 +521,4 @@ SQReturnTypeEnum GetReturnTypeEnumFromString(const char* returnTypeString)
{
return SqReturnDefault; // previous default value
}
-} \ No newline at end of file
+}
diff --git a/NorthstarDedicatedTest/squirrel.h b/NorthstarDedicatedTest/squirrel.h
index 0e49c7f8..397fa9ed 100644
--- a/NorthstarDedicatedTest/squirrel.h
+++ b/NorthstarDedicatedTest/squirrel.h
@@ -323,7 +323,7 @@ template <ScriptContext context> class SquirrelManager
reg->argTypes = new char[argTypes.size() + 1];
strcpy((char*)reg->argTypes, argTypes.c_str());
- reg->funcPtr = func;
+ reg->funcPtr = reinterpret_cast<void*>(func);
m_funcRegistrations.push_back(reg);
}