2022-11-27 15:02:22 +01:00
|
|
|
#pragma once
|
2022-11-27 20:44:17 +00:00
|
|
|
#include "miles_types.h"
|
2022-11-27 15:02:22 +01:00
|
|
|
|
|
|
|
/* ==== WASAPI THREAD SERVICE =========================================================================================================================================== */
|
2023-07-02 23:01:29 +02:00
|
|
|
inline void(*v_AIL_LogFunc)(int64_t nLogLevel, const char* pszMessage);
|
|
|
|
inline bool(*v_Miles_Initialize)();
|
|
|
|
inline void(*v_MilesQueueEventRun)(Miles::Queue*, const char*);
|
|
|
|
inline void(*v_MilesBankPatch)(Miles::Bank*, char*, char*);
|
2024-03-16 11:47:59 +01:00
|
|
|
inline void(*v_CSOM_AddEventToQueue)(const char* eventName);
|
|
|
|
|
|
|
|
struct MilesBankList_t
|
|
|
|
{
|
|
|
|
char banks[64][16];
|
|
|
|
int bankCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MilesGlobalState_t
|
|
|
|
{
|
|
|
|
char gap0[24];
|
|
|
|
bool mismatchedBuildTag;
|
|
|
|
char gap19[63];
|
|
|
|
uintptr_t queuedEventHash;
|
|
|
|
char gap60[4];
|
|
|
|
Vector3D queuedSoundPosition;
|
|
|
|
char gap70[24];
|
|
|
|
float soundMasterVolume;
|
|
|
|
char gap8c[28];
|
|
|
|
void* samplesXlogType;
|
|
|
|
char gapB0[8];
|
|
|
|
void* dumpXlogType;
|
|
|
|
char gapC0[48];
|
|
|
|
void* driver;
|
|
|
|
void* queue;
|
|
|
|
char gap100[40];
|
|
|
|
MilesBankList_t bankList;
|
|
|
|
char gap52c[4];
|
|
|
|
void* loadedBanks[16];
|
|
|
|
char gap5b0[290448];
|
|
|
|
HANDLE milesInitializedEvent;
|
|
|
|
HANDLE milesThread;
|
|
|
|
char gap47450[272];
|
|
|
|
char milesOutputBuffer[1024];
|
|
|
|
char unk[96];
|
|
|
|
};
|
|
|
|
|
|
|
|
inline MilesGlobalState_t* g_milesGlobals;
|
2022-11-27 20:44:37 +00:00
|
|
|
|
2022-11-27 15:02:22 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
class MilesCore : public IDetour
|
|
|
|
{
|
|
|
|
virtual void GetAdr(void) const
|
|
|
|
{
|
2024-01-02 15:21:36 +01:00
|
|
|
LogFunAdr("AIL_LogFunc", v_AIL_LogFunc);
|
|
|
|
LogFunAdr("Miles_Initialize", v_Miles_Initialize);
|
|
|
|
LogFunAdr("MilesQueueEventRun", v_MilesQueueEventRun);
|
|
|
|
LogFunAdr("MilesBankPatch", v_MilesBankPatch);
|
2024-03-16 11:47:59 +01:00
|
|
|
LogFunAdr("CSOM_AddEventToQueue", v_CSOM_AddEventToQueue);
|
|
|
|
LogVarAdr("g_milesGlobals", g_milesGlobals);
|
2022-11-27 15:02:22 +01:00
|
|
|
}
|
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
2024-01-02 15:21:36 +01:00
|
|
|
g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 48 8B DA 48 8D 15 ?? ?? ?? ??").GetPtr(v_AIL_LogFunc);
|
2024-03-16 11:47:59 +01:00
|
|
|
g_GameDll.FindPatternSIMD("0F B6 11 4C 8B C1").GetPtr(v_CSOM_AddEventToQueue);
|
|
|
|
|
|
|
|
CMemory milesInitializeFunc = g_GameDll.FindPatternSIMD("40 53 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ??");
|
|
|
|
milesInitializeFunc.GetPtr(v_Miles_Initialize);
|
|
|
|
|
|
|
|
g_milesGlobals = milesInitializeFunc.FindPatternSelf("48 8D", CMemory::Direction::DOWN, 0x50).ResolveRelativeAddressSelf(0x3, 0x7).RCast<MilesGlobalState_t*>();
|
2022-11-27 20:44:37 +00:00
|
|
|
|
2024-01-02 15:21:36 +01:00
|
|
|
g_RadAudioSystemDll.GetExportedSymbol("MilesQueueEventRun").GetPtr(v_MilesQueueEventRun);
|
|
|
|
g_RadAudioSystemDll.GetExportedSymbol("MilesBankPatch").GetPtr(v_MilesBankPatch);
|
2022-11-27 15:02:22 +01:00
|
|
|
}
|
|
|
|
virtual void GetVar(void) const { }
|
|
|
|
virtual void GetCon(void) const { }
|
2023-11-26 13:21:20 +01:00
|
|
|
virtual void Detour(const bool bAttach) const;
|
2022-11-27 15:02:22 +01:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|