Skip to content

Commit

Permalink
Merge branch 'main' into ci-build-number
Browse files Browse the repository at this point in the history
  • Loading branch information
ASpoonPlaysGames authored Oct 14, 2023
2 parents 1686b24 + 99c5c86 commit 36b78aa
Show file tree
Hide file tree
Showing 19 changed files with 716 additions and 351 deletions.
1 change: 1 addition & 0 deletions NorthstarDLL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ add_library(NorthstarDLL SHARED
"scripts/client/scriptbrowserhooks.cpp"
"scripts/client/scriptmainmenupromos.cpp"
"scripts/client/scriptmodmenu.cpp"
"scripts/client/scriptoriginauth.cpp"
"scripts/client/scriptserverbrowser.cpp"
"scripts/client/scriptservertoclientstringcommand.cpp"
"scripts/server/miscserverfixes.cpp"
Expand Down
9 changes: 9 additions & 0 deletions NorthstarDLL/client/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ extern "C"
extern void* __fastcall Audio_GetParentEvent();
}

ConVar* Cvar_mileslog_enable;
ConVar* Cvar_ns_print_played_sounds;

CustomAudioManager g_CustomAudioManager;
Expand Down Expand Up @@ -494,9 +495,17 @@ AUTOHOOK(MilesLog, client.dll + 0x57DAD0,
void, __fastcall, (int level, const char* string))
// clang-format on
{
if (!Cvar_mileslog_enable->GetBool())
return;

spdlog::info("[MSS] {} - {}", level, string);
}

ON_DLL_LOAD_RELIESON("engine.dll", MilesLogFuncHooks, ConVar, (CModule module))
{
Cvar_mileslog_enable = new ConVar("mileslog_enable", "0", FCVAR_NONE, "Enables/disables whether the mileslog func should be logged");
}

ON_DLL_LOAD_CLIENT_RELIESON("client.dll", AudioHooks, ConVar, (CModule module))
{
AUTOHOOK_DISPATCH()
Expand Down
3 changes: 1 addition & 2 deletions NorthstarDLL/core/convar/concommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions NorthstarDLL/core/hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)); \
} \
Expand All @@ -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)); \
} \
Expand All @@ -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)); \
} \
Expand All @@ -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)); \
Expand Down Expand Up @@ -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); \
Expand Down
4 changes: 3 additions & 1 deletion NorthstarDLL/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ bool InitialiseNorthstar()
InitialiseVersion();
CreateLogFiles();

InitialiseCrashHandler();
g_pCrashHandler = new CCrashHandler();
bool bAllFatal = strstr(GetCommandLineA(), "-crash_handle_all") != NULL;
g_pCrashHandler->SetAllFatal(bAllFatal);

// Write launcher version to log
StartupLog();
Expand Down
Loading

0 comments on commit 36b78aa

Please sign in to comment.