diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-08-08 06:12:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-08 11:12:11 +0100 |
commit | 5e7668c2cd7ef9d017536f1e2e4ec89708f5b74f (patch) | |
tree | 6c55b909fd258251c238bfad9caf83113fd88f33 /NorthstarDedicatedTest | |
parent | 286cea5f6280e568f5cb4c953d93993c98625ce4 (diff) | |
download | NorthstarLauncher-5e7668c2cd7ef9d017536f1e2e4ec89708f5b74f.tar.gz NorthstarLauncher-5e7668c2cd7ef9d017536f1e2e4ec89708f5b74f.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')
24 files changed, 96 insertions, 73 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 0bb2fe02..06ca7af4 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 41236506..3954991b 100644 --- a/NorthstarDedicatedTest/dllmain.cpp +++ b/NorthstarDedicatedTest/dllmain.cpp @@ -52,9 +52,9 @@ #include "rapidjson/writer.h" #include "rapidjson/error/en.h" #include "ExploitFixes.h" -#include "scriptJson.h" +#include "scriptjson.h" -typedef void (*initPluginFuncPtr)(void* getPluginObject); +typedef void (*initPluginFuncPtr)(void* (*getPluginObject)(PluginObject)); bool initialised = false; @@ -129,7 +129,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) { @@ -305,4 +305,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/scriptjson.cpp b/NorthstarDedicatedTest/scriptjson.cpp index 1921a429..bc65a5c1 100644 --- a/NorthstarDedicatedTest/scriptjson.cpp +++ b/NorthstarDedicatedTest/scriptjson.cpp @@ -1,5 +1,5 @@ #include "pch.h" -#include "scriptJson.h" +#include "scriptjson.h" #include "rapidjson/document.h" #include "rapidjson/writer.h" #include "rapidjson/stringbuffer.h" @@ -606,4 +606,4 @@ void InitialiseClientSquirrelJson(HMODULE baseAddress) g_UISquirrelManager->AddFuncRegistration("table", "DecodeJSON", "string json", "", ClientSq_DecodeJSON); g_UISquirrelManager->AddFuncRegistration("string", "EncodeJSON", "table data", "", SQ_EncodeJSON); -}
\ No newline at end of file +} 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 502afba0..2fa957fb 100644 --- a/NorthstarDedicatedTest/squirrel.cpp +++ b/NorthstarDedicatedTest/squirrel.cpp @@ -504,7 +504,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); @@ -586,4 +586,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 fd271dc2..719bcfad 100644 --- a/NorthstarDedicatedTest/squirrel.h +++ b/NorthstarDedicatedTest/squirrel.h @@ -138,7 +138,7 @@ enum SQObjectType : __int32 }; /* 156 */ -union __declspec(align(8)) SQObjectValue +union alignas(8) SQObjectValue { SQString* asString; SQTable* asTable; @@ -153,7 +153,7 @@ union __declspec(align(8)) SQObjectValue }; /* 128 */ -struct __declspec(align(8)) SQObject +struct alignas(8) SQObject { SQObjectType _Type; __int32 _structOffset; @@ -168,7 +168,7 @@ struct tableNode }; /* 138 */ -struct __declspec(align(8)) SQString +struct alignas(8) SQString { __int64* vftable; __int32 uiRef; @@ -182,7 +182,7 @@ struct __declspec(align(8)) SQString }; /* 137 */ -struct __declspec(align(8)) SQTable +struct alignas(8) SQTable { __int64* vftable; uint8 gap_08[4]; @@ -203,7 +203,7 @@ struct __declspec(align(8)) SQTable }; /* 140 */ -struct __declspec(align(8)) SQClosure +struct alignas(8) SQClosure { void* vftable; uint8 gap_08[4]; @@ -221,7 +221,7 @@ struct __declspec(align(8)) SQClosure }; /* 139 */ -struct __declspec(align(8)) SQFunctionProto +struct alignas(8) SQFunctionProto { void* vftable; uint8 gap_08[4]; @@ -262,7 +262,7 @@ struct SQStructInstance }; /* 157 */ -struct __declspec(align(8)) SQNativeClosure +struct alignas(8) SQNativeClosure { void* vftable; uint8 gap_08[4]; @@ -289,7 +289,7 @@ struct StringTable }; /* 129 */ -struct __declspec(align(8)) HSquirrelVM +struct alignas(8) HSquirrelVM { void* vftable; __int32 uiRef; @@ -331,7 +331,7 @@ struct __declspec(align(8)) HSquirrelVM }; /* 136 */ -struct __declspec(align(8)) CallInfo +struct alignas(8) CallInfo { SQInstruction* ip; SQObject* _literals; @@ -473,7 +473,7 @@ enum SQOpcode : int }; /* 141 */ -struct __declspec(align(8)) SQStackInfos +struct alignas(8) SQStackInfos { char* _name; char* _sourceName; @@ -481,7 +481,7 @@ struct __declspec(align(8)) SQStackInfos }; /* 151 */ -struct __declspec(align(4)) SQInstruction +struct alignas(4) SQInstruction { int op; int arg1; @@ -804,7 +804,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); } |