mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Init concommand/convars a bit earlier
Init in 'CEngineAPI::Init'.
This commit is contained in:
parent
9978227915
commit
8b89c1d2b5
@ -77,16 +77,20 @@ static void InitVPKSystem()
|
||||
}
|
||||
}
|
||||
|
||||
InitReturnVal_t CEngineAPI::VInit(CEngineAPI* pEngineAPI)
|
||||
{
|
||||
ConCommand::InitShipped();
|
||||
ConCommand::PurgeShipped();
|
||||
ConVar::InitShipped();
|
||||
ConVar::PurgeShipped();
|
||||
return CEngineAPI_Init(pEngineAPI);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Initialization, shutdown of a mod.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CEngineAPI::VModInit(CEngineAPI* pEngineAPI, const char* pModName, const char* pGameDir)
|
||||
{
|
||||
ConCommand::InitShipped();
|
||||
ConCommand::PurgeShipped();
|
||||
ConVar::InitShipped();
|
||||
ConVar::PurgeShipped();
|
||||
|
||||
// Register new Pak Assets here!
|
||||
//RTech_RegisterAsset(0, 1, "", nullptr, nullptr, nullptr, CMemory(0x1660AD0A8).RCast<void**>(), 8, 8, 8, 0, 0xFFFFFFC);
|
||||
|
||||
@ -153,12 +157,14 @@ void CEngineAPI::VSetStartupInfo(CEngineAPI* pEngineAPI, StartupInfo_t* pStartup
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VSys_Dll2::Attach() const
|
||||
{
|
||||
DetourAttach(&CEngineAPI_Init, &CEngineAPI::VInit);
|
||||
DetourAttach(&CEngineAPI_ModInit, &CEngineAPI::VModInit);
|
||||
DetourAttach(&v_CEngineAPI_SetStartupInfo, &CEngineAPI::VSetStartupInfo);
|
||||
}
|
||||
|
||||
void VSys_Dll2::Detach() const
|
||||
{
|
||||
DetourDetach(&CEngineAPI_Init, &CEngineAPI::VInit);
|
||||
DetourDetach(&CEngineAPI_ModInit, &CEngineAPI::VModInit);
|
||||
DetourDetach(&v_CEngineAPI_SetStartupInfo, &CEngineAPI::VSetStartupInfo);
|
||||
}
|
@ -30,7 +30,7 @@ public:
|
||||
// Reset the map we're on
|
||||
virtual void SetMap(const char* pMapName) = 0;
|
||||
|
||||
|
||||
static InitReturnVal_t VInit(CEngineAPI* thisp);
|
||||
static bool VModInit(CEngineAPI* pEngineAPI, const char* pModName, const char* pGameDir);
|
||||
static void VSetStartupInfo(CEngineAPI* pEngineAPI, StartupInfo_t* pStartupInfo);
|
||||
//private:
|
||||
@ -39,6 +39,12 @@ public:
|
||||
StartupInfo_t m_StartupInfo;
|
||||
};
|
||||
|
||||
inline CMemory p_CEngineAPI_Init;
|
||||
inline auto CEngineAPI_Init = p_CEngineAPI_Init.RCast<InitReturnVal_t(*)(CEngineAPI* thisp)>();
|
||||
|
||||
inline CMemory p_CEngineAPI_Shutdown;
|
||||
inline auto CEngineAPI_Shutdown = p_CEngineAPI_Shutdown.RCast<void (*)(void)>();
|
||||
|
||||
inline CMemory p_CEngineAPI_Connect;
|
||||
inline auto CEngineAPI_Connect = p_CEngineAPI_Connect.RCast<bool (*)(CEngineAPI* thisptr, CreateInterfaceFn factory)>();
|
||||
|
||||
@ -67,6 +73,8 @@ class VSys_Dll2 : public IDetour
|
||||
{
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
LogFunAdr("CEngineAPI::Init", p_CEngineAPI_Init.GetPtr());
|
||||
LogFunAdr("CEngineAPI::Shutdown", p_CEngineAPI_Shutdown.GetPtr());
|
||||
LogFunAdr("CEngineAPI::Connect", p_CEngineAPI_Connect.GetPtr());
|
||||
LogFunAdr("CEngineAPI::ModInit", p_CEngineAPI_ModInit.GetPtr());
|
||||
LogFunAdr("CEngineAPI::MainLoop", p_CEngineAPI_MainLoop.GetPtr());
|
||||
@ -82,12 +90,15 @@ class VSys_Dll2 : public IDetour
|
||||
}
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
p_CEngineAPI_Init = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F1 48 8D 3D ?? ?? ?? ?? 33 DB 48 8D 15 ?? ?? ?? ??");
|
||||
p_CEngineAPI_Connect = g_GameDll.FindPatternSIMD("48 83 EC 28 48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? 48 85 C0 48 89 15");
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
p_CEngineAPI_Shutdown = g_GameDll.FindPatternSIMD("41 54 41 56 48 83 EC 38 48 8B 0D ?? ?? ?? ??");
|
||||
p_CEngineAPI_ModInit = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 4D 8B F0");
|
||||
p_CEngineAPI_MainLoop = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 55 48 81 EC ?? ?? ?? ?? 45 33 C9");
|
||||
p_PakFile_Init = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 44 88 44 24 ?? 56 57 41 54 41 56 41 57 48 83 EC 20");
|
||||
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
||||
p_CEngineAPI_Shutdown = g_GameDll.FindPatternSIMD("48 83 EC 28 48 8B 0D ?? ?? ?? ?? 33 D2 48 8B 01 FF 90 ?? ?? ?? ?? B1 01");
|
||||
p_CEngineAPI_ModInit = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 4C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 4D 8B F8");
|
||||
p_CEngineAPI_MainLoop = g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? 48 8B 15 ?? ?? ?? ?? 84 C0 B9 ?? ?? ?? ??").FollowNearCallSelf();
|
||||
p_PakFile_Init = g_GameDll.FindPatternSIMD("44 88 44 24 ?? 53 55 56 57");
|
||||
@ -95,6 +106,8 @@ class VSys_Dll2 : public IDetour
|
||||
p_CEngineAPI_SetStartupInfo = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? ?? 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ?? 48 8B DA");
|
||||
p_ResetMTVFTaskItem = g_GameDll.FindPatternSIMD("48 83 EC 28 48 8B 15 ?? ?? ?? ?? 48 85 D2 0F 84 ?? ?? ?? ?? 48 8B 0D ?? ?? ?? ?? 48 8B 01 FF 90 ?? ?? ?? ?? 33 C9 E8 ?? ?? ?? ?? 0F 28 05 ?? ?? ?? ?? 0F 28 0D ?? ?? ?? ?? 0F 11 05 ?? ?? ?? ?? 0F 28 05 ?? ?? ?? ?? 0F 11 0D ?? ?? ?? ?? 0F 28 0D ?? ?? ?? ?? 0F 11 05 ?? ?? ?? ?? 0F 11 0D ?? ?? ?? ?? 48 C7 05 ?? ?? ?? ?? ?? ?? ?? ?? FF 15 ?? ?? ?? ??");
|
||||
|
||||
CEngineAPI_Init = p_CEngineAPI_Init.RCast<InitReturnVal_t(*)(CEngineAPI*)>();
|
||||
CEngineAPI_Shutdown = p_CEngineAPI_Shutdown.RCast<void (*)(void)>();
|
||||
CEngineAPI_Connect = p_CEngineAPI_Connect.RCast<bool (*)(CEngineAPI*, CreateInterfaceFn)>(); /*48 83 EC 28 48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? 48 85 C0 48 89 15 ?? ?? ?? ??*/
|
||||
CEngineAPI_ModInit = p_CEngineAPI_ModInit.RCast<bool (*)(CEngineAPI*, const char*, const char*)>(); /*48 89 5C 24 ?? 48 89 4C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? 4D 8B F8*/
|
||||
CEngineAPI_MainLoop = p_CEngineAPI_MainLoop.RCast<bool(*)(void)>(); /*E8 ?? ?? ?? ?? 48 8B 15 ?? ?? ?? ?? 84 C0 B9 ?? ?? ?? ??*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user