mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
add more miles debug hooks
This commit is contained in:
parent
3ab4597121
commit
feeaf5c545
r5dev
codecs/Miles
common
ebisusdk
tier1
vproj
@ -1,5 +1,6 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "miles_impl.h"
|
||||
#include "tier1/cvar.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: logs debug output emitted from the Miles Sound System
|
||||
@ -18,6 +19,8 @@ void AIL_LogFunc(int64_t nLogLevel, const char* pszMessage)
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Miles_Initialize()
|
||||
{
|
||||
DevMsg(eDLL_T::AUDIO, __FUNCTION__": initializing Miles Sound System\n");
|
||||
|
||||
bool bResult = v_Miles_Initialize();
|
||||
|
||||
bResult ? DevMsg(eDLL_T::AUDIO, __FUNCTION__": %s\n", "initialized successfully")
|
||||
@ -26,15 +29,33 @@ bool Miles_Initialize()
|
||||
return bResult;
|
||||
}
|
||||
|
||||
void MilesQueueEventRun(Miles::Queue* queue, const char* eventName)
|
||||
{
|
||||
if(miles_debug->GetBool())
|
||||
DevMsg(eDLL_T::AUDIO, __FUNCTION__": running event '%s'\n", eventName);
|
||||
|
||||
v_MilesQueueEventRun(queue, eventName);
|
||||
}
|
||||
|
||||
void MilesBankPatch(Miles::Bank* bank, char* streamPatch, char* localizedStreamPatch)
|
||||
{
|
||||
// TODO [REXX]: add print for patch loading when Miles::Bank struct is mapped out a bit better with file name
|
||||
v_MilesBankPatch(bank, streamPatch, localizedStreamPatch);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void MilesCore_Attach()
|
||||
{
|
||||
DetourAttach(&v_AIL_LogFunc, &AIL_LogFunc);
|
||||
DetourAttach(&v_Miles_Initialize, &Miles_Initialize);
|
||||
DetourAttach(&v_MilesQueueEventRun, &MilesQueueEventRun);
|
||||
DetourAttach(&v_MilesBankPatch, &MilesBankPatch);
|
||||
}
|
||||
|
||||
void MilesCore_Detach()
|
||||
{
|
||||
DetourDetach(&v_AIL_LogFunc, &AIL_LogFunc);
|
||||
DetourDetach(&v_Miles_Initialize, &Miles_Initialize);
|
||||
DetourDetach(&v_MilesQueueEventRun, &MilesQueueEventRun);
|
||||
DetourDetach(&v_MilesBankPatch, &MilesBankPatch);
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "miles_types.h"
|
||||
|
||||
/* ==== WASAPI THREAD SERVICE =========================================================================================================================================== */
|
||||
inline CMemory p_AIL_LogFunc;
|
||||
@ -7,6 +8,12 @@ inline auto v_AIL_LogFunc = p_AIL_LogFunc.RCast<void(*)(int64_t nLogLevel, const
|
||||
inline CMemory p_Miles_Initialize;
|
||||
inline auto v_Miles_Initialize = p_Miles_Initialize.RCast<bool(*)()>();
|
||||
|
||||
inline CMemory p_MilesQueueEventRun;
|
||||
inline auto v_MilesQueueEventRun = p_MilesQueueEventRun.RCast<void(*)(Miles::Queue*, const char*)>();
|
||||
|
||||
inline CMemory p_MilesBankPatch;
|
||||
inline auto v_MilesBankPatch = p_MilesBankPatch.RCast<void(*)(Miles::Bank*, char*, char*)>();
|
||||
|
||||
void MilesCore_Attach();
|
||||
void MilesCore_Detach();
|
||||
|
||||
@ -28,6 +35,13 @@ class MilesCore : public IDetour
|
||||
p_Miles_Initialize = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\xE8\x00\x00\x00\x00\xFF\x0D\x00\x00\x00\x00\xC6\x05\x00\x00\x00\x00\x00"), "x????xx????xx?????").FollowNearCallSelf();
|
||||
v_Miles_Initialize = p_Miles_Initialize.RCast<bool(*)()>();
|
||||
// 0x14095A140 // E8 ? ? ? ? FF 0D ? ? ? ? C6 05 ? ? ? ? ? //
|
||||
|
||||
p_MilesQueueEventRun = g_RadAudioSystemDll.GetExportedFunction("MilesQueueEventRun");
|
||||
v_MilesQueueEventRun = p_MilesQueueEventRun.RCast<void(*)(Miles::Queue*, const char*)>();
|
||||
|
||||
p_MilesBankPatch = g_RadAudioSystemDll.GetExportedFunction("MilesBankPatch");
|
||||
v_MilesBankPatch = p_MilesBankPatch.RCast<void(*)(Miles::Bank*, char*, char*)>();
|
||||
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
|
16
r5dev/codecs/Miles/miles_types.h
Normal file
16
r5dev/codecs/Miles/miles_types.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace Miles
|
||||
{
|
||||
struct Queue
|
||||
{
|
||||
char gap0[0x8];
|
||||
void* unk;
|
||||
char gap10[0x20];
|
||||
};
|
||||
|
||||
struct Bank
|
||||
{
|
||||
// TODO [REXX]: map out this struct and its internal counterpart
|
||||
};
|
||||
}
|
@ -345,6 +345,9 @@ void Dedicated_Init()
|
||||
|
||||
void RuntimePtc_Init() /* .TEXT */
|
||||
{
|
||||
|
||||
p_EbisuSDK_SetState.Offset(0x0).FindPatternSelf("0F 84", CMemory::Direction::DOWN).Patch({ 0x0F, 0x85 }); // JE --> JNZ | Prevent EbisuSDK from initializing on the engine and server.
|
||||
|
||||
#ifndef DEDICATED
|
||||
p_WASAPI_GetAudioDevice.Offset(0x410).FindPatternSelf("FF 15 ?? ?? 01 00", CMemory::Direction::DOWN, 100).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xEB }); // CAL --> NOP | Disable debugger check when miles searches for audio device to allow attaching the debugger to the game upon launch.
|
||||
#ifndef CLIENT_DLL
|
||||
|
@ -25,6 +25,24 @@ bool IsOriginInitialized()
|
||||
//-----------------------------------------------------------------------------
|
||||
void HEbisuSDK_Init()
|
||||
{
|
||||
|
||||
FILE* sNameCfg;
|
||||
CHAR sNameBuf[64] = { 0 };
|
||||
fopen_s(&sNameCfg, "platform\\cfg\\name.cfg", "r");
|
||||
|
||||
if (sNameCfg)
|
||||
{
|
||||
while (fgets(sNameBuf, sizeof(sNameBuf), sNameCfg) != NULL)
|
||||
{
|
||||
fclose(sNameCfg);
|
||||
}
|
||||
}
|
||||
memcpy((char*)g_sPlayerName, sNameBuf, sizeof(sNameBuf));
|
||||
|
||||
*(char*)g_bEbisuSDKInitialized = (char)0x1; // <- 1st EbisuSDK check
|
||||
*(char*)g_bEbisuSDKCvarInitialized = (char)0x1; // <- 2nd EbisuSDK check
|
||||
*(char*)g_NucleusID = (char)0x1; // <- 3rd EbisuSDK
|
||||
|
||||
#ifdef DEDICATED
|
||||
*(char*)g_bEbisuSDKInitialized = (char)0x1; // <- 1st EbisuSDK
|
||||
*(char*)g_bEbisuSDKCvarInitialized = (char)0x1; // <- 2nd EbisuSDK
|
||||
|
@ -18,6 +18,7 @@ inline char* g_OriginAuthCode = nullptr; /*SIZE = 256*/
|
||||
inline char* g_OriginNucleusToken = nullptr; /*SIZE = 1024*/
|
||||
inline bool* g_bEbisuSDKInitialized = nullptr;
|
||||
inline bool* g_bEbisuSDKCvarInitialized = nullptr;
|
||||
inline char* g_sPlayerName = nullptr;
|
||||
//#endif // DEDICATED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -67,6 +68,8 @@ class VEbisuSDK : public IDetour
|
||||
g_OriginNucleusToken = p_EbisuSDK_SetState.Offset(0x1EF).FindPatternSelf("80 3D", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x7).RCast<char*>();
|
||||
#endif
|
||||
g_OriginAuthCode = p_EbisuSDK_SetState.Offset(0x1BF).FindPatternSelf("0F B6", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7).RCast<char*>();
|
||||
|
||||
g_sPlayerName = p_EbisuSDK_CVar_Init.Offset(0x120).FindPatternSelf("48 8D 0D", CMemory::Direction::DOWN, 600).ResolveRelativeAddressSelf(0x3, 0x7).RCast<char*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
|
@ -222,6 +222,11 @@ void ConVar::Init(void)
|
||||
// RUI |
|
||||
#ifndef DEDICATED
|
||||
rui_drawEnable = ConVar::Create("rui_drawEnable", "1", FCVAR_RELEASE, "Draws the RUI if set.", false, 0.f, false, 0.f, nullptr, " 1 = Draw, 0 = No Draw.");
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// MILES |
|
||||
#ifndef DEDICATED
|
||||
miles_debug = ConVar::Create("miles_debug", "0", FCVAR_RELEASE, "Enables debug prints for the Miles Sound System", false, 0.f, false, 0.f, nullptr, " 1 = Print, 0 = No Print");
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
}
|
||||
|
@ -195,6 +195,12 @@ ConVar* rtech_debug = nullptr;
|
||||
ConVar* rui_drawEnable = nullptr;
|
||||
ConVar* rui_defaultDebugFontFace = nullptr;
|
||||
#endif // !DEDICATED
|
||||
//-----------------------------------------------------------------------------
|
||||
// MILES |
|
||||
#ifndef DEDICATED
|
||||
ConVar* miles_debug = nullptr;
|
||||
#endif
|
||||
|
||||
|
||||
struct ConVarFlags_t
|
||||
{
|
||||
|
@ -191,6 +191,11 @@ extern ConVar* rtech_debug;
|
||||
extern ConVar* rui_drawEnable;
|
||||
extern ConVar* rui_defaultDebugFontFace;
|
||||
#endif // !DEDICATED
|
||||
//-----------------------------------------------------------------------------
|
||||
// MILES |
|
||||
#ifndef DEDICATED
|
||||
extern ConVar* miles_debug;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
|
@ -170,6 +170,7 @@
|
||||
<ClInclude Include="..\client\vengineclient_impl.h" />
|
||||
<ClInclude Include="..\codecs\bink\bink_impl.h" />
|
||||
<ClInclude Include="..\codecs\Miles\miles_impl.h" />
|
||||
<ClInclude Include="..\codecs\Miles\miles_types.h" />
|
||||
<ClInclude Include="..\codecs\Miles\radshal_wasapi.h" />
|
||||
<ClInclude Include="..\common\igameserverdata.h" />
|
||||
<ClInclude Include="..\common\netmessages.h" />
|
||||
|
@ -1934,6 +1934,9 @@
|
||||
<ClInclude Include="..\codecs\Miles\radshal_wasapi.h">
|
||||
<Filter>sdk\codecs\miles</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\codecs\Miles\miles_types.h">
|
||||
<Filter>sdk\codecs\miles</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
Loading…
x
Reference in New Issue
Block a user