From 024605399a4878f97fd789416d9ea4234241f039 Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Sat, 7 Oct 2023 13:28:43 +0100 Subject: Reduce warnings due to calling conventions (#555) Fix instances of "anachronism used: modifiers on data are ignored" --- NorthstarDLL/core/convar/concommand.h | 3 +-- NorthstarDLL/core/hooks.h | 10 +++++----- NorthstarDLL/shared/maxplayers.cpp | 4 ++-- NorthstarDLL/squirrel/squirrel.cpp | 16 +++++++--------- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/NorthstarDLL/core/convar/concommand.h b/NorthstarDLL/core/convar/concommand.h index 89363bc7..c11c7ea4 100644 --- a/NorthstarDLL/core/convar/concommand.h +++ b/NorthstarDLL/core/convar/concommand.h @@ -83,8 +83,7 @@ typedef void (*FnCommandCallback_t)(const CCommand& command); //----------------------------------------------------------------------------- // Returns 0 to COMMAND_COMPLETION_MAXITEMS worth of completion strings //----------------------------------------------------------------------------- -typedef int (*__fastcall FnCommandCompletionCallback)( - const char* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]); +typedef int (*FnCommandCompletionCallback)(const char* partial, char commands[COMMAND_COMPLETION_MAXITEMS][COMMAND_COMPLETION_ITEM_LENGTH]); // From r5reloaded class ConCommandBase diff --git a/NorthstarDLL/core/hooks.h b/NorthstarDLL/core/hooks.h index 8721628a..01244b3d 100644 --- a/NorthstarDLL/core/hooks.h +++ b/NorthstarDLL/core/hooks.h @@ -219,7 +219,7 @@ class __autohook type callingConvention CONCAT2(__autohookfunc, name) args; \ namespace \ { \ - type(*callingConvention name) args; \ + type(*name) args; \ __autohook CONCAT2(__autohook, __LINE__)( \ &__FILEAUTOHOOK, __STR(name), __STR(addrString), (LPVOID*)&name, (LPVOID)CONCAT2(__autohookfunc, name)); \ } \ @@ -230,7 +230,7 @@ class __autohook type callingConvention CONCAT2(__autohookfunc, name) args; \ namespace \ { \ - type(*callingConvention name) args; \ + type(*name) args; \ __autohook \ CONCAT2(__autohook, __LINE__)(&__FILEAUTOHOOK, __STR(name), addr, (LPVOID*)&name, (LPVOID)CONCAT2(__autohookfunc, name)); \ } \ @@ -241,7 +241,7 @@ class __autohook type callingConvention CONCAT2(__autohookfunc, name) args; \ namespace \ { \ - type(*callingConvention name) args; \ + type(*name) args; \ __autohook CONCAT2(__autohook, __LINE__)( \ &__FILEAUTOHOOK, __STR(name), __STR(moduleName), __STR(procName), (LPVOID*)&name, (LPVOID)CONCAT2(__autohookfunc, name)); \ } \ @@ -267,7 +267,7 @@ class ManualHook #define HOOK(varName, originalFunc, type, callingConvention, args) \ namespace \ { \ - type(*callingConvention originalFunc) args; \ + type(*originalFunc) args; \ } \ type callingConvention CONCAT2(__manualhookfunc, varName) args; \ ManualHook varName = ManualHook(__STR(varName), (LPVOID*)&originalFunc, (LPVOID)CONCAT2(__manualhookfunc, varName)); \ @@ -316,7 +316,7 @@ class __autovar // FUNCTION_AT(engine.dll + 0xDEADBEEF, void, __fastcall, SomeFunc, (void* a1)) #define FUNCTION_AT(addrString, type, callingConvention, name, args) \ - type(*callingConvention name) args; \ + type(*name) args; \ namespace \ { \ __autovar CONCAT2(__autovar, __LINE__)(&__FILEAUTOHOOK, __STR(addrString), (void**)&name); \ diff --git a/NorthstarDLL/shared/maxplayers.cpp b/NorthstarDLL/shared/maxplayers.cpp index b2a09578..4af8ea1c 100644 --- a/NorthstarDLL/shared/maxplayers.cpp +++ b/NorthstarDLL/shared/maxplayers.cpp @@ -282,7 +282,7 @@ void,, (bool a1, float a2)) // clang-format off AUTOHOOK(SendPropArray2, server.dll + 0x12B130, -__int64, __fastcall, (__int64 recvProp, int elements, int flags, const char* name, __int64 proxyFn, unsigned char unk1)) +__int64,, (__int64 recvProp, int elements, int flags, const char* name, __int64 proxyFn, unsigned char unk1)) // clang-format on { // Change the amount of elements to account for a bigger player amount @@ -453,7 +453,7 @@ ON_DLL_LOAD("server.dll", MaxPlayersOverride_Server, (CModule module)) // clang-format off AUTOHOOK(RecvPropArray2, client.dll + 0x1CEDA0, -__int64, __fastcall, (__int64 recvProp, int elements, int flags, const char* name, __int64 proxyFn)) +__int64,, (__int64 recvProp, int elements, int flags, const char* name, __int64 proxyFn)) // clang-format on { // Change the amount of elements to account for a bigger player amount diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index 0ee04508..592cd153 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -366,7 +366,7 @@ bool IsUIVM(ScriptContext context, HSquirrelVM* pSqvm) return ScriptContext(pSqvm->sharedState->cSquirrelVM->vmContext) == ScriptContext::UI; } -template void* (*__fastcall sq_compiler_create)(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError); +template void* (*sq_compiler_create)(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError); template void* __fastcall sq_compiler_createHook(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError) { // store whether errors generated from this compile should be fatal @@ -398,7 +398,7 @@ template SQInteger SQPrintHook(HSquirrelVM* sqvm, const return 0; } -template CSquirrelVM* (*__fastcall CreateNewVM)(void* a1, ScriptContext realContext); +template CSquirrelVM* (*CreateNewVM)(void* a1, ScriptContext realContext); template CSquirrelVM* __fastcall CreateNewVMHook(void* a1, ScriptContext realContext) { CSquirrelVM* sqvm = CreateNewVM(a1, realContext); @@ -411,7 +411,7 @@ template CSquirrelVM* __fastcall CreateNewVMHook(void* a return sqvm; } -template bool (*__fastcall CSquirrelVM_init)(CSquirrelVM* vm, ScriptContext realContext, float time); +template bool (*CSquirrelVM_init)(CSquirrelVM* vm, ScriptContext realContext, float time); template bool __fastcall CSquirrelVM_initHook(CSquirrelVM* vm, ScriptContext realContext, float time) { bool ret = CSquirrelVM_init(vm, realContext, time); @@ -428,7 +428,7 @@ template bool __fastcall CSquirrelVM_initHook(CSquirrelV return ret; } -template void (*__fastcall DestroyVM)(void* a1, CSquirrelVM* sqvm); +template void (*DestroyVM)(void* a1, CSquirrelVM* sqvm); template void __fastcall DestroyVMHook(void* a1, CSquirrelVM* sqvm) { ScriptContext realContext = context; // ui and client use the same function so we use this for prints @@ -447,8 +447,7 @@ template void __fastcall DestroyVMHook(void* a1, CSquirr spdlog::info("DestroyVM {} {}", GetContextName(realContext), (void*)sqvm); } -template -void (*__fastcall SQCompileError)(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column); +template void (*SQCompileError)(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column); template void __fastcall ScriptCompileErrorHook(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column) { @@ -496,8 +495,7 @@ void __fastcall ScriptCompileErrorHook(HSquirrelVM* sqvm, const char* error, con // dont call the original function since it kills game lol } -template -int64_t (*__fastcall RegisterSquirrelFunction)(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown); +template int64_t (*RegisterSquirrelFunction)(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown); template int64_t __fastcall RegisterSquirrelFunctionHook(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown) { @@ -523,7 +521,7 @@ int64_t __fastcall RegisterSquirrelFunctionHook(CSquirrelVM* sqvm, SQFuncRegistr return g_pSquirrel->RegisterSquirrelFunc(sqvm, funcReg, unknown); } -template bool (*__fastcall CallScriptInitCallback)(void* sqvm, const char* callback); +template bool (*CallScriptInitCallback)(void* sqvm, const char* callback); template bool __fastcall CallScriptInitCallbackHook(void* sqvm, const char* callback) { ScriptContext realContext = context; -- cgit v1.2.3