Implement abstract class 'IEngine'

Also reversed one new method: IEngine::GetPlaylistCount (gets the number of playlists read from the playlists file, the other 2 unknown methods after this one also do stuff with the playlists, but rather on KeyValues level, one checks if something exists i think, the other returns a const char. Haven't ran these yet).
This commit is contained in:
Kawe Mazidjatari 2022-08-09 11:53:33 +02:00
parent a399e1e190
commit ade1de41a9
11 changed files with 85 additions and 37 deletions

View File

@ -119,7 +119,7 @@ FORCEINLINE void CHostState::FrameUpdate(CHostState* pHostState, double flCurren
CL_EndMovie();
#endif // !DEDICATED
Stryder_SendOfflineRequest(); // We have hostnames nulled anyway.
g_pEngine->SetNextState(EngineState_t::DLL_RESTART);
g_pEngine->SetNextState(IEngine::DLL_RESTART);
break;
}
case HostStates_t::HS_SHUTDOWN:
@ -129,7 +129,7 @@ FORCEINLINE void CHostState::FrameUpdate(CHostState* pHostState, double flCurren
CL_EndMovie();
#endif // !DEDICATED
Stryder_SendOfflineRequest(); // We have hostnames nulled anyway.
g_pEngine->SetNextState(EngineState_t::DLL_CLOSE);
g_pEngine->SetNextState(IEngine::DLL_CLOSE);
break;
}
default:

View File

@ -4,6 +4,7 @@
///////////////////////////////////////////////////////////////////////////////
CEngine* g_pEngine = nullptr;
/*
//-----------------------------------------------------------------------------
// Purpose: Start initializing the engine.
// Output : Returns true on success, false on failure.
@ -81,3 +82,4 @@ void CEngine::SetQuitting(EngineDllQuitting_t quitDllState)
const int index = 9;
CallVFunc<void>(index, this, quitDllState);
}
*/

View File

@ -1,44 +1,17 @@
#pragma once
#include <launcher/IApplication.h>
#include <public/iengine.h>
enum class EngineState_t : int
class CEngine : public IEngine
{
DLL_INACTIVE = 0x0,
DLL_ACTIVE = 0x1,
DLL_CLOSE = 0x2,
DLL_RESTART = 0x3,
DLL_PAUSED = 0x4,
};
enum class EngineDllQuitting_t : int
{
QUIT_NOTQUITTING = 0x0,
QUIT_TODESKTOP = 0x1,
QUIT_RESTART = 0x2,
};
class CEngine
{
public:
bool Load(bool dedicated, const char* rootDir);
void Unload(void);
void SetNextState(EngineState_t iNextState);
EngineState_t GetState(void) const;
void Frame(void);
float GetFrameTime(void) const;
float GetPreviousTime(void);
__m128 GetCurTime(CEngine* thisPtr) const;
void SetQuitting(EngineDllQuitting_t quitDllState);
private:
void* vtable;
EngineState_t m_nDLLState;
EngineState_t m_nNextDLLState;
int64_t m_flCurrentTime;
int64_t m_flPreviousTime;
int m_flFrameTime;
int field_24;
int m_flFilteredTime;
double m_flCurrentTime;
double m_flPreviousTime;
float m_flFrameTime;
float m_flPreviousFrameTime;
float m_flFilteredTime;
uint8_t gap2C[4];
int64_t field_30;
char field_38;

View File

@ -33,7 +33,7 @@ int CModAppSystemGroup::Main(CModAppSystemGroup* pModAppSystemGroup)
return CModAppSystemGroup_Main(pModAppSystemGroup);
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
g_pEngine->SetQuitting(EngineDllQuitting_t::QUIT_NOTQUITTING);
g_pEngine->SetQuitting(IEngine::QUIT_NOTQUITTING);
if (g_pEngine->Load(pModAppSystemGroup->IsServerOnly(), g_pEngineParms->baseDirectory))
{
if (CEngineAPI_MainLoop())

61
r5dev/public/iengine.h Normal file
View File

@ -0,0 +1,61 @@
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//===========================================================================//
#if !defined( IENGINE_H )
#define IENGINE_H
#ifdef _WIN32
#pragma once
#endif
//#include "tier1/interface.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
abstract_class IEngine
{
public:
enum
{
QUIT_NOTQUITTING = 0,
QUIT_TODESKTOP,
QUIT_RESTART
};
// Engine State Flags
enum EngineState_t
{
DLL_INACTIVE = 0, // no dll
DLL_ACTIVE, // engine is focused
DLL_CLOSE, // closing down dll
DLL_RESTART, // engine is shutting down but will restart right away
DLL_PAUSED, // engine is paused, can become active from this state
};
virtual ~IEngine(void) { }
virtual bool Load(bool dedicated, const char* rootdir) = 0;
virtual void Unload(void) = 0;
virtual void SetNextState(EngineState_t iNextState) = 0;
virtual EngineState_t GetState(void) = 0;
virtual void Frame(void) = 0;
virtual float GetFrameTime(void) = 0;
virtual float GetPreviousTime(void) = 0;
virtual __m128 GetCurTime(void) = 0;
virtual void SetQuitting(int quittype) = 0;
virtual int GetPlaylistCount(void) = 0;
virtual const char* sub_1401FE2B0(int a2) = 0; // Playlists KeyValues stuff.
virtual bool sub_1401FE3B0(__int64 a2) = 0; // Playlists KeyValues stuff.
};
#endif // IENGINE_H

View File

@ -235,6 +235,7 @@
<ClInclude Include="..\protoc\sv_rcon.pb.h" />
<ClInclude Include="..\public\avi\iavi.h" />
<ClInclude Include="..\public\avi\ibik.h" />
<ClInclude Include="..\public\iengine.h" />
<ClInclude Include="..\public\include\client_class.h" />
<ClInclude Include="..\public\include\const.h" />
<ClInclude Include="..\public\include\edict.h" />

View File

@ -1673,6 +1673,9 @@
<ClInclude Include="..\tier0\memalloc.h">
<Filter>sdk\tier0</Filter>
</ClInclude>
<ClInclude Include="..\public\iengine.h">
<Filter>sdk\public</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">

View File

@ -211,6 +211,7 @@
<ClInclude Include="..\networksystem\sm_protocol.h" />
<ClInclude Include="..\protoc\cl_rcon.pb.h" />
<ClInclude Include="..\protoc\sv_rcon.pb.h" />
<ClInclude Include="..\public\iengine.h" />
<ClInclude Include="..\public\include\client_class.h" />
<ClInclude Include="..\public\include\const.h" />
<ClInclude Include="..\public\include\edict.h" />

View File

@ -1197,6 +1197,9 @@
<ClInclude Include="..\tier0\memalloc.h">
<Filter>sdk\tier0</Filter>
</ClInclude>
<ClInclude Include="..\public\iengine.h">
<Filter>sdk\public</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\common\opcodes.cpp">

View File

@ -258,6 +258,7 @@
<ClInclude Include="..\protoc\sv_rcon.pb.h" />
<ClInclude Include="..\public\avi\iavi.h" />
<ClInclude Include="..\public\avi\ibik.h" />
<ClInclude Include="..\public\iengine.h" />
<ClInclude Include="..\public\include\client_class.h" />
<ClInclude Include="..\public\include\const.h" />
<ClInclude Include="..\public\include\edict.h" />

View File

@ -1763,6 +1763,9 @@
<ClInclude Include="..\tier0\memalloc.h">
<Filter>sdk\tier0</Filter>
</ClInclude>
<ClInclude Include="..\public\iengine.h">
<Filter>sdk\public</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">