From 2f82801261f25ed9bc586c89e46a95d9d4d96750 Mon Sep 17 00:00:00 2001 From: IcePixelx <41352111+PixieCore@users.noreply.github.com> Date: Sun, 23 Jan 2022 18:33:01 +0100 Subject: [PATCH] Moved CEngine class functions to sys_engine.cpp. --- r5dev/engine/sys_engine.cpp | 80 +++++++++++++++++++++++++++++++++- r5dev/engine/sys_engine.h | 86 ++++--------------------------------- r5dev/tier0/commandline.cpp | 4 +- 3 files changed, 90 insertions(+), 80 deletions(-) diff --git a/r5dev/engine/sys_engine.cpp b/r5dev/engine/sys_engine.cpp index 291a8b81..91de21cb 100644 --- a/r5dev/engine/sys_engine.cpp +++ b/r5dev/engine/sys_engine.cpp @@ -2,4 +2,82 @@ #include "sys_engine.h" /////////////////////////////////////////////////////////////////////////////// -CEngine* g_pEngine = reinterpret_cast(g_pEngineBuffer.GetPtr()); \ No newline at end of file +CEngine* g_pEngine = reinterpret_cast(g_pEngineBuffer.GetPtr()); + +//----------------------------------------------------------------------------- +// Purpose: Start initializing the engine. +//----------------------------------------------------------------------------- +bool CEngine::Load(bool dedicated, const char* rootDir) +{ + static int index = 1; + return CallVFunc(index, this, dedicated, rootDir); +} + +//----------------------------------------------------------------------------- +// Purpose: Start to shutdown the engine. +//----------------------------------------------------------------------------- +void CEngine::Unload() +{ + static int index = 2; + CallVFunc(index, this); +} + +//----------------------------------------------------------------------------- +// Purpose: Set the next dll engine state. +//----------------------------------------------------------------------------- +void CEngine::SetNextState(EngineState_t iNextState) +{ + // Rebuild function, vfunc index is 3 in season 3. + m_nNextDLLState() = iNextState; +} + +//----------------------------------------------------------------------------- +// Purpose: Get the dll engine state. +//----------------------------------------------------------------------------- +EngineState_t CEngine::GetState() +{ + // Rebuild function, vfunc index is 4 in season 3. + return m_nDLLState(); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CEngine::Frame() +{ + static int index = 5; + CallVFunc(index, this); +} + +//----------------------------------------------------------------------------- +// Purpose: Get engine frame time. +//----------------------------------------------------------------------------- +float CEngine::GetFrameTime() +{ + // Rebuild function, vfunc index is 6 in season 3. + return m_flFrameTime(); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +float CEngine::GetPreviousTime() // I'm not sure if this is right, should double check. +{ + static int index = 7; + return CallVFunc(index, this); +} + +// Yes that is the function, I have no clue how to implement it at this moment so its gonna reside here for now. It's vfunc index 8. +//__m128 __fastcall GetCurTime(CEngine *thisPtr) +//{ +// return _mm_cvtpd_ps((__m128d)(unsigned __int64)thisPtr->m_flCurrentTime); +//} + +//----------------------------------------------------------------------------- +// Purpose: Set dll state. +//----------------------------------------------------------------------------- +void CEngine::SetQuitting(EngineDllQuitting_t quitDllState) +{ + static int index = 9; + CallVFunc(index, this, quitDllState); +} \ No newline at end of file diff --git a/r5dev/engine/sys_engine.h b/r5dev/engine/sys_engine.h index 94220f0d..029c8a81 100644 --- a/r5dev/engine/sys_engine.h +++ b/r5dev/engine/sys_engine.h @@ -29,83 +29,15 @@ enum class EngineDllQuitting_t : int class CEngine { public: - //----------------------------------------------------------------------------- - // Purpose: Start initializing the engine. - //----------------------------------------------------------------------------- - bool Load(bool dedicated, const char* rootDir) - { - static int index = 1; - return CallVFunc(index, this, dedicated, rootDir); - } - - //----------------------------------------------------------------------------- - // Purpose: Start to shutdown the engine. - //----------------------------------------------------------------------------- - void Unload() - { - static int index = 2; - CallVFunc(index, this); - } - //----------------------------------------------------------------------------- - // Purpose: Set the next dll engine state. - //----------------------------------------------------------------------------- - void SetNextState(EngineState_t iNextState) - { - // Rebuild function, vfunc index is 3 in season 3. - m_nNextDLLState() = iNextState; - } - - //----------------------------------------------------------------------------- - // Purpose: Get the dll engine state. - //----------------------------------------------------------------------------- - EngineState_t GetState() - { - // Rebuild function, vfunc index is 4 in season 3. - return m_nDLLState(); - } - - //----------------------------------------------------------------------------- - // Purpose: - //----------------------------------------------------------------------------- - void Frame() - { - static int index = 5; - CallVFunc(index, this); - } - - //----------------------------------------------------------------------------- - // Purpose: Get engine frame time. - //----------------------------------------------------------------------------- - float GetFrameTime() - { - // Rebuild function, vfunc index is 6 in season 3. - return m_flFrameTime(); - } - - //----------------------------------------------------------------------------- - // Purpose: - //----------------------------------------------------------------------------- - float GetPreviousTime() // I'm not sure if this is right, should double check. - { - static int index = 7; - return CallVFunc(index, this); - } - - // Yes that is the function, I have no clue how to implement it at this moment so its gonna reside here for now. It's vfunc index 8. - - //__m128 __fastcall CEngine::GetCurTime(CEngine *thisPtr) - //{ - // return _mm_cvtpd_ps((__m128d)(unsigned __int64)thisPtr->m_flCurrentTime); - //} - - //----------------------------------------------------------------------------- - // Purpose: Set dll state. - //----------------------------------------------------------------------------- - void SetQuitting(EngineDllQuitting_t quitDllState) - { - static int index = 9; - CallVFunc(index, this, quitDllState); - } + bool Load(bool dedicated, const char* rootDir); + void Unload(); + void SetNextState(EngineState_t iNextState); + EngineState_t GetState(); + void Frame(); + float GetFrameTime(); + float GetPreviousTime(); + void SetQuitting(EngineDllQuitting_t quitDllState); + // __m128 __fastcall GetCurTime() // Last functions in class table. // sub_1401FE2A0 diff --git a/r5dev/tier0/commandline.cpp b/r5dev/tier0/commandline.cpp index 70822e1e..181e6624 100644 --- a/r5dev/tier0/commandline.cpp +++ b/r5dev/tier0/commandline.cpp @@ -10,8 +10,8 @@ //----------------------------------------------------------------------------- // Purpose: Create a command line from the passed in string -// Note that if you pass in a @filename, then the routine will read settings -// from a file instead of the command line +// Note that if you pass in a @filename, then the routine will read settings +// from a file instead of the command line //----------------------------------------------------------------------------- void CCommandLine::CreateCmdLine(const char* pszCommandline) {