2022-01-23 18:26:48 +01:00
|
|
|
#pragma once
|
2022-08-09 11:53:33 +02:00
|
|
|
#include <public/iengine.h>
|
2022-01-23 18:26:48 +01:00
|
|
|
|
2022-08-09 11:53:33 +02:00
|
|
|
class CEngine : public IEngine
|
2022-01-23 18:26:48 +01:00
|
|
|
{
|
2023-04-10 22:35:41 +02:00
|
|
|
public:
|
|
|
|
static bool _Frame(CEngine* thisp);
|
|
|
|
|
2022-03-07 13:15:45 +01:00
|
|
|
private:
|
|
|
|
EngineState_t m_nDLLState;
|
|
|
|
EngineState_t m_nNextDLLState;
|
2022-08-09 11:53:33 +02:00
|
|
|
double m_flCurrentTime;
|
|
|
|
double m_flPreviousTime;
|
|
|
|
float m_flFrameTime;
|
|
|
|
float m_flPreviousFrameTime;
|
|
|
|
float m_flFilteredTime;
|
2022-03-07 13:15:45 +01:00
|
|
|
uint8_t gap2C[4];
|
|
|
|
int64_t field_30;
|
|
|
|
char field_38;
|
|
|
|
char field_39;
|
2022-01-23 18:26:48 +01:00
|
|
|
};
|
|
|
|
|
2022-04-09 02:18:57 +02:00
|
|
|
/* ==== CENGINE ======================================================================================================================================================= */
|
2023-04-10 22:35:41 +02:00
|
|
|
inline CMemory p_CEngine_Frame;
|
2023-07-02 23:01:29 +02:00
|
|
|
inline bool(*v_CEngine_Frame)(CEngine* thisp);
|
2023-04-10 22:35:41 +02:00
|
|
|
|
2022-04-18 03:35:08 +02:00
|
|
|
extern CEngine* g_pEngine;
|
2022-01-23 18:26:48 +01:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-05-13 14:53:25 +02:00
|
|
|
class VEngine : public IDetour
|
2022-01-23 18:26:48 +01:00
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2022-01-23 18:26:48 +01:00
|
|
|
{
|
2023-04-10 22:35:41 +02:00
|
|
|
LogFunAdr("CEngine::Frame", p_CEngine_Frame.GetPtr());
|
|
|
|
LogVarAdr("g_Engine", reinterpret_cast<uintptr_t>(g_pEngine));
|
|
|
|
}
|
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
2023-04-23 17:05:00 +02:00
|
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
2023-04-10 22:35:41 +02:00
|
|
|
p_CEngine_Frame = g_GameDll.FindPatternSIMD("40 55 53 56 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 8B F1");
|
|
|
|
#elif defined (GAMEDLL_S2)
|
|
|
|
p_CEngine_Frame = g_GameDll.FindPatternSIMD("48 8B C4 56 48 81 EC ?? ?? ?? ?? 0F 29 70 B8");
|
|
|
|
#else
|
|
|
|
p_CEngine_Frame = g_GameDll.FindPatternSIMD("48 8B C4 55 56 48 8D A8 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 0F 29 70 B8");
|
|
|
|
#endif
|
|
|
|
v_CEngine_Frame = p_CEngine_Frame.RCast<bool(*)(CEngine* thisp)>();
|
2022-01-23 18:26:48 +01:00
|
|
|
}
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetVar(void) const
|
|
|
|
{
|
|
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
2022-12-01 22:44:55 +01:00
|
|
|
g_pEngine = g_GameDll.FindPatternSIMD("48 83 EC 28 80 B9 ?? ?? ?? ?? ?? 48 8B 15 ?? ?? ?? ??").FindPatternSelf("48 8D ?? ?? ?? ?? 01", CMemory::Direction::DOWN, 300).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CEngine*>();
|
2022-04-18 03:35:08 +02:00
|
|
|
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
2022-12-01 22:44:55 +01:00
|
|
|
g_pEngine = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 80 B9 ?? ?? ?? ?? ?? BB ?? ?? ?? ??").FindPatternSelf("48 8B ?? ?? ?? ?? 01", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CEngine*>();
|
2022-04-18 03:35:08 +02:00
|
|
|
#endif
|
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetCon(void) const { }
|
2023-04-10 22:35:41 +02:00
|
|
|
virtual void Attach(void) const;
|
|
|
|
virtual void Detach(void) const;
|
2022-01-23 18:26:48 +01:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|