mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add logging hook for Miles Sound System debug output
Miles Sound System sets a pointer to a logger function in the exported function "MilesStartup", which can be set by passing a pointer to your logging function in the first parameter. Since this call is inline, we just hook the function that Respawn used for the audio logger instead, which has the actual print within the function stripped.
This commit is contained in:
parent
d20250e436
commit
6fbf78a4eb
@ -34,6 +34,7 @@
|
||||
#include "datacache/mdlcache.h"
|
||||
#include "ebisusdk/EbisuSDK.h"
|
||||
#ifndef DEDICATED
|
||||
#include "milessdk/shared/core.h"
|
||||
#include "milessdk/win64_rrthreads.h"
|
||||
#endif // !DEDICATED
|
||||
#include "vphysics/QHull.h"
|
||||
@ -165,6 +166,7 @@ void Systems_Init()
|
||||
MDLCache_Attach();
|
||||
|
||||
#ifndef DEDICATED
|
||||
MilesCore_Attach();
|
||||
CMaterialSystem_Attach();
|
||||
#endif // !DEDICATED
|
||||
|
||||
@ -300,6 +302,7 @@ void Systems_Shutdown()
|
||||
MDLCache_Detach();
|
||||
|
||||
#ifndef DEDICATED
|
||||
MilesCore_Detach();
|
||||
CMaterialSystem_Detach();
|
||||
#endif // !DEDICATED
|
||||
|
||||
|
18
r5dev/milessdk/shared/core.cpp
Normal file
18
r5dev/milessdk/shared/core.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "milessdk/shared/core.h"
|
||||
|
||||
void AIL_LogFunc(int64_t nLogLevel, const char* pszMessage)
|
||||
{
|
||||
DevMsg(eDLL_T::AUDIO, pszMessage);
|
||||
v_AIL_LogFunc(nLogLevel, pszMessage);
|
||||
}
|
||||
|
||||
void MilesCore_Attach()
|
||||
{
|
||||
DetourAttach(&v_AIL_LogFunc, &AIL_LogFunc);
|
||||
}
|
||||
|
||||
void MilesCore_Detach()
|
||||
{
|
||||
DetourDetach(&v_AIL_LogFunc, &AIL_LogFunc);
|
||||
}
|
31
r5dev/milessdk/shared/core.h
Normal file
31
r5dev/milessdk/shared/core.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
/* ==== WASAPI THREAD SERVICE =========================================================================================================================================== */
|
||||
inline CMemory p_AIL_LogFunc;
|
||||
inline auto v_AIL_LogFunc = p_AIL_LogFunc.RCast<void(*)(int64_t nLogLevel, const char* pszMessage)>();
|
||||
|
||||
void MilesCore_Attach();
|
||||
void MilesCore_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class MilesCore : public IDetour
|
||||
{
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
spdlog::debug("| FUN: AIL_LogFunc : {:#18x} |\n", p_AIL_LogFunc.GetPtr());
|
||||
spdlog::debug("+----------------------------------------------------------------+\n");
|
||||
}
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
p_AIL_LogFunc = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x53\x48\x83\xEC\x20\x48\x8B\xDA\x48\x8D\x15\x00\x00\x00\x00"), "xxxxxxxxxxxx????");
|
||||
v_AIL_LogFunc = p_AIL_LogFunc.RCast<void(*)(int64_t, const char*)>();
|
||||
// 0x1409D1420 // 40 53 48 83 EC 20 48 8B DA 48 8D 15 ? ? ? ? //
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(MilesCore);
|
@ -81,6 +81,7 @@
|
||||
<ClCompile Include="..\mathlib\ssenoise.cpp" />
|
||||
<ClCompile Include="..\mathlib\transform.cpp" />
|
||||
<ClCompile Include="..\mathlib\vmatrix.cpp" />
|
||||
<ClCompile Include="..\milessdk\shared\core.cpp" />
|
||||
<ClCompile Include="..\networksystem\listmanager.cpp" />
|
||||
<ClCompile Include="..\networksystem\pylon.cpp" />
|
||||
<ClCompile Include="..\pluginsystem\pluginsystem.cpp" />
|
||||
@ -243,6 +244,7 @@
|
||||
<ClInclude Include="..\mathlib\vector4d.h" />
|
||||
<ClInclude Include="..\mathlib\vmatrix.h" />
|
||||
<ClInclude Include="..\mathlib\vplane.h" />
|
||||
<ClInclude Include="..\milessdk\shared\core.h" />
|
||||
<ClInclude Include="..\milessdk\win64_rrthreads.h" />
|
||||
<ClInclude Include="..\networksystem\listmanager.h" />
|
||||
<ClInclude Include="..\networksystem\pylon.h" />
|
||||
|
@ -232,6 +232,9 @@
|
||||
<Filter Include="sdk\public\materialsystem">
|
||||
<UniqueIdentifier>{565eefdf-15cf-47dc-a22b-0d3521e8c5c9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\milessdk\shared">
|
||||
<UniqueIdentifier>{7823b9d7-9d02-4936-b326-4b6351df0c7e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\client\cdll_engine_int.cpp">
|
||||
@ -618,6 +621,9 @@
|
||||
<ClCompile Include="..\tier1\utlbuffer.cpp">
|
||||
<Filter>sdk\tier1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\milessdk\shared\core.cpp">
|
||||
<Filter>sdk\milessdk\shared</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||
@ -1820,6 +1826,9 @@
|
||||
<ClInclude Include="..\public\ipackedstore.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\milessdk\shared\core.h">
|
||||
<Filter>sdk\milessdk\shared</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
@ -89,6 +89,7 @@
|
||||
<ClCompile Include="..\mathlib\ssenoise.cpp" />
|
||||
<ClCompile Include="..\mathlib\transform.cpp" />
|
||||
<ClCompile Include="..\mathlib\vmatrix.cpp" />
|
||||
<ClCompile Include="..\milessdk\shared\core.cpp" />
|
||||
<ClCompile Include="..\networksystem\bansystem.cpp" />
|
||||
<ClCompile Include="..\networksystem\listmanager.cpp" />
|
||||
<ClCompile Include="..\networksystem\pylon.cpp" />
|
||||
@ -267,6 +268,7 @@
|
||||
<ClInclude Include="..\mathlib\vector4d.h" />
|
||||
<ClInclude Include="..\mathlib\vmatrix.h" />
|
||||
<ClInclude Include="..\mathlib\vplane.h" />
|
||||
<ClInclude Include="..\milessdk\shared\core.h" />
|
||||
<ClInclude Include="..\milessdk\win64_rrthreads.h" />
|
||||
<ClInclude Include="..\networksystem\bansystem.h" />
|
||||
<ClInclude Include="..\networksystem\listmanager.h" />
|
||||
|
@ -241,6 +241,9 @@
|
||||
<Filter Include="sdk\public\materialsystem">
|
||||
<UniqueIdentifier>{1718d302-db9b-4d2e-b666-cb9f2712eef4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\milessdk\shared">
|
||||
<UniqueIdentifier>{14049eac-0367-4235-b555-c4815be3e905}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\client\vengineclient_impl.cpp">
|
||||
@ -660,6 +663,9 @@
|
||||
<ClCompile Include="..\tier1\utlbuffer.cpp">
|
||||
<Filter>sdk\tier1</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\milessdk\shared\core.cpp">
|
||||
<Filter>sdk\milessdk\shared</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||
@ -1916,6 +1922,9 @@
|
||||
<ClInclude Include="..\public\ipackedstore.h">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\milessdk\shared\core.h">
|
||||
<Filter>sdk\milessdk\shared</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
Loading…
x
Reference in New Issue
Block a user