fix CEngine and HostState structs
This commit is contained in:
parent
a4434a4db1
commit
da212ca9b7
|
@ -41,14 +41,10 @@ void RunServer(CDedicatedExports* dedicated)
|
|||
CEngine__FrameType CEngine__Frame = (CEngine__FrameType)((char*)engine + 0x1C8650);
|
||||
CHostState__InitType CHostState__Init = (CHostState__InitType)((char*)engine + 0x16E110);
|
||||
|
||||
// call once to init
|
||||
CEngine__Frame(g_pEngine);
|
||||
|
||||
// init hoststate, if we don't do this, we get a crash later on
|
||||
CHostState__Init(g_pHostState);
|
||||
|
||||
// set up engine and host states to allow us to enter CHostState::FrameUpdate, with the state HS_NEW_GAME
|
||||
g_pEngine->m_nNextDllState = EngineState_t::DLL_ACTIVE;
|
||||
// set host state to allow us to enter CHostState::FrameUpdate, with the state HS_NEW_GAME
|
||||
g_pHostState->m_iNextState = HostState_t::HS_NEW_GAME;
|
||||
strncpy(g_pHostState->m_levelName, CommandLine()->ParmValue("+map", "mp_lobby"), sizeof(g_pHostState->m_levelName)); // set map to load into
|
||||
|
||||
|
@ -56,8 +52,7 @@ void RunServer(CDedicatedExports* dedicated)
|
|||
{
|
||||
CEngine__Frame(g_pEngine);
|
||||
|
||||
//engineApiStartSimulation(nullptr, true);
|
||||
Sys_Printf(dedicated, (char*)"engine->Frame()");
|
||||
spdlog::info("CEngine::Frame() on map {} took {}ms", g_pHostState->m_levelName, g_pEngine->m_flFrameTime);
|
||||
Sleep(50);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ void InitialiseEngineGameUtilFunctions(HMODULE baseAddress)
|
|||
Cbuf_Execute = (Cbuf_ExecuteType)((char*)baseAddress + 0x1204B0);
|
||||
|
||||
g_pHostState = (CHostState*)((char*)baseAddress + 0x7CF180);
|
||||
g_pEngine = (CEngine*)((char*)baseAddress + 0x7D70C8);
|
||||
g_pEngine = *(CEngine**)((char*)baseAddress + 0x7D70C8);
|
||||
|
||||
Cvar_hostport = (ConVar*)((char*)baseAddress + 0x13FA6070);
|
||||
|
||||
|
|
|
@ -109,15 +109,32 @@ public:
|
|||
float m_angLocation[3];
|
||||
|
||||
char m_levelName[32];
|
||||
char m_mapGroupName[32];
|
||||
char m_landmarkName[32];
|
||||
char m_saveName[32];
|
||||
float m_flShortFrameTime; // run a few one-tick frames to avoid large timesteps while loading assets
|
||||
|
||||
// not reversed past this point, struct seems weird
|
||||
// pretty decent chance m_levelname is bigger, given it was 256 long in normal source
|
||||
bool m_activeGame;
|
||||
bool m_bRememberLocation;
|
||||
bool m_bBackgroundLevel;
|
||||
bool m_bWaitingForConnection;
|
||||
bool m_bLetToolsOverrideLoadGameEnts; // During a load game, this tells Foundry to override ents that are selected in Hammer.
|
||||
bool m_bSplitScreenConnect;
|
||||
bool m_bGameHasShutDownAndFlushedMemory; // This is false once we load a map into memory, and set to true once the map is unloaded and all memory flushed
|
||||
bool m_bWorkshopMapDownloadPending;
|
||||
};
|
||||
|
||||
extern CHostState* g_pHostState;
|
||||
|
||||
// cengine stuff
|
||||
|
||||
enum EngineQuitState
|
||||
{
|
||||
QUIT_NOTQUITTING = 0,
|
||||
QUIT_TODESKTOP,
|
||||
QUIT_RESTART
|
||||
};
|
||||
|
||||
enum EngineState_t
|
||||
{
|
||||
DLL_INACTIVE = 0, // no dll
|
||||
|
@ -132,7 +149,7 @@ struct CEngine
|
|||
public:
|
||||
void* vtable;
|
||||
|
||||
int m_nQuitting;
|
||||
EngineQuitState m_nQuitting;
|
||||
EngineState_t m_nDllState;
|
||||
EngineState_t m_nNextDllState;
|
||||
double m_flCurrentTime;
|
||||
|
|
Loading…
Reference in New Issue