_Host_RunFrame
0x001783c0 · 2708 bytes · __cdecl
_Z14_Host_RunFramef
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* _Host_RunFrame(float) */
void _Host_RunFrame(float param_1)
{
int *piVar1;
char cVar2;
char cVar3;
CMapReslistGenerator *this;
int iVar4;
int iVar5;
uint uVar6;
int iVar7;
bool bVar8;
longdouble lVar9;
float fVar10;
ulonglong uVar11;
float local_60;
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c;
undefined4 local_48;
undefined4 local_40;
undefined4 local_3c;
int local_38;
undefined4 local_34;
undefined4 local_30;
int local_2c;
undefined4 local_28;
undefined4 local_24;
int local_20;
piVar1 = g_pMDLCache;
(**(code **)(*g_pMDLCache + 0xb8))(g_pMDLCache);
uVar11 = ZEXT48(workshop);
/* try { // try from 001783eb to 00178472 has its CatchHandler @ 00178ec5 */
(**(code **)(*(int *)workshop + 0x18))(workshop);
if (_memmove == -1) {
/* try { // try from 00178d56 to 00178d72 has its CatchHandler @ 00178ec5 */
uVar6 = Cbuf_GetCurrentPlayer();
uVar11 = (ulonglong)uVar6;
Cbuf_AddText(uVar6,"quit\n",0);
}
local_34 = 0;
local_30 = 0;
if (_exit == 0) {
local_20 = 0;
}
else {
uVar11 = CONCAT44(&local_34,_exit);
(**(code **)(_exit + 0x50))
(_exit,&local_34,0,0,0,0,"/data/src/engine/./host.cpp",0xcf1,
&_Host_RunFrame(float)::tm_fmt,"(%s)%s","Unaccounted","_Host_RunFrame_Upto_MarkFrame"
);
local_20 = _exit;
}
iVar7 = _DAT_0040b9d4;
local_28 = local_34;
local_24 = local_30;
/* try { // try from 0017888e to 001788dc has its CatchHandler @ 00178ea6 */
if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
(iVar4 = ThreadGetCurrentId(), iVar7 == iVar4)) {
if ((char *)*_DAT_0040b030 != "_Host_RunFrame_Upto_MarkFrame") {
_DAT_0040b030 =
(int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2b27d0,&DAT_00000001,0x2a054b);
}
uVar11 = ZEXT48(_DAT_0040b030);
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
}
/* try { // try from 001784b0 to 001785d1 has its CatchHandler @ 00178eb5 */
if ((*(float *)(mem_incremental_compact_rate._28_4_ + 0x2c) <= 0.0) ||
(lVar9 = (longdouble)Plat_FloatTime(uVar11),
(double)lVar9 - _Host_RunFrame(float)::timeLastMemCompact <=
(double)*(float *)(mem_incremental_compact_rate._28_4_ + 0x2c))) {
iVar7 = *(int *)(host_Sleep._28_4_ + 0x30);
}
else {
_Host_RunFrame(float)::timeLastMemCompact = (double)lVar9;
iVar7 = *(int *)(host_Sleep._28_4_ + 0x30);
}
/* try { // try from 00178904 to 0017891f has its CatchHandler @ 00178eb5 */
if ((iVar7 != 0) && (iVar7 = (**(code **)(_g_pVCR + 0xc))(), iVar7 != 2)) {
Sys_Sleep(*(int *)(host_Sleep._28_4_ + 0x30));
}
if (g_iVCRPlaybackSleepInterval != 0) {
Sys_Sleep(g_iVCRPlaybackSleepInterval);
}
this = (CMapReslistGenerator *)MapReslistGenerator();
CMapReslistGenerator::RunFrame(this);
iVar4 = _setjmp((__jmp_buf_tag *)host_enddemo);
iVar7 = _DAT_0040b9d4;
if (iVar4 == 0) {
Host_AccumulateTime(param_1);
_Host_SetGlobalTime();
cVar3 = DAT_003b8088;
iVar7 = 0;
local_60 = 0.0;
if (0.0 <= _Host_RunFrame(float)::host_remainder) {
local_60 = _Host_RunFrame(float)::host_remainder;
}
_Host_RunFrame(float)::host_remainder = _Host_RunFrame(float)::host_remainder + host_frametime;
if (DAT_003a1730 <= _Host_RunFrame(float)::host_remainder) {
iVar7 = (int)(_Host_RunFrame(float)::host_remainder / DAT_003a1730);
if (((1 < DAT_003b7f64) && (DAT_003b8064 < 2)) &&
(*(int *)(sv_alternateticks._28_4_ + 0x30) != 0)) {
iVar7 = (iVar7 + 1 + g_ServerGlobalVariables._24_4_ & 0xfffffffeU) -
g_ServerGlobalVariables._24_4_;
}
_Host_RunFrame(float)::host_remainder =
_Host_RunFrame(float)::host_remainder - (float)iVar7 * DAT_003a1730;
}
(**(code **)(*g_pMDLCache + 0xb4))(g_pMDLCache);
iVar4 = _DAT_0040b9d4;
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar5 = ThreadGetCurrentId(), iVar4 == iVar5)) {
cVar2 = CVProfNode::ExitScope();
if (cVar2 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_20 != 0) {
(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
}
local_5c = 0;
local_58 = 0;
if (_exit == 0) {
local_38 = 0;
}
else {
/* try { // try from 001786a0 to 001786a2 has its CatchHandler @ 00178ec5 */
(**(code **)(_exit + 0x50))
(_exit,&local_5c,0,0,0,0,"/data/src/engine/./host.cpp",0xd48,
&_Host_RunFrame(float)::tm_fmt,"(%s)%s","Unaccounted","_Host_RunFrame");
local_38 = _exit;
}
iVar4 = _DAT_0040b9d4;
local_40 = local_5c;
local_3c = local_58;
/* try { // try from 001786d1 to 001786d5 has its CatchHandler @ 00178ed6 */
if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
(iVar5 = ThreadGetCurrentId(), iVar4 == iVar5)) {
if ((char *)*_DAT_0040b030 != "_Host_RunFrame") {
/* try { // try from 00178de4 to 00178df5 has its CatchHandler @ 00178ed6 */
_DAT_0040b030 =
(int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2b27ee,&DAT_00000001,0x2a054b);
}
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
}
local_54 = 0;
local_50 = 0;
if (_g_Telemetry == 0) {
local_2c = 0;
}
else {
/* try { // try from 00178743 to 00178745 has its CatchHandler @ 00178ed2 */
(**(code **)(_g_Telemetry + 0x50))
(_g_Telemetry,&local_54,0,0,0,0,"/data/src/engine/./host.cpp",0xd49,
&_Host_RunFrame(float)::tm_fmt,"_Host_RunFrame");
local_2c = _g_Telemetry;
}
local_34 = local_54;
local_30 = local_50;
/* try { // try from 0017875b to 0017887d has its CatchHandler @ 00178ec9 */
lVar9 = (longdouble)Plat_FloatTime();
g_HostTimes._160_8_ = (undefined8)lVar9;
Cbuf_Execute();
if (_Host_RunFrame(float)::bFirstFrame != '\0') {
_Host_RunFrame(float)::bFirstFrame = '\0';
_Host_RunFirstFrame();
}
cVar2 = NET_IsDedicated();
/* try { // try from 00178d2d to 00178d45 has its CatchHandler @ 00178ec9 */
if ((cVar2 != '\0') && (cVar2 = NET_IsMultiplayer(), cVar2 == '\0')) {
NET_SetMutiplayer(true);
}
lVar9 = (longdouble)Plat_FloatTime();
host_currentframetick = 0;
g_ServerGlobalVariables._36_4_ = 1;
g_HostTimes._216_8_ =
((double)g_HostTimes._216_8_ - (double)g_HostTimes._160_8_) + (double)lVar9;
g_ServerGlobalVariables._32_4_ = 0;
host_frameticks = iVar7;
if (0 < iVar7) {
iVar4 = 0;
while( true ) {
lVar9 = (longdouble)Plat_FloatTime();
NET_RunFrame((double)lVar9);
bVar8 = iVar7 + -1 == iVar4;
cVar2 = NET_IsDedicated();
if ((cVar2 != '\0') && (cVar2 = NET_IsMultiplayer(), cVar2 == '\0')) {
NET_SetMutiplayer(true);
}
host_tickcount = host_tickcount + 1;
host_currentframetick = host_currentframetick + 1;
g_ServerGlobalVariables._24_4_ = DAT_003b7f6c;
_Host_RunFrame_Input(local_60,bVar8);
_Host_RunFrame_Server(bVar8);
NET_SendQueuedPackets();
iVar4 = iVar4 + 1;
if (iVar4 == iVar7) break;
local_60 = 0.0;
}
}
if (hltv != (CHLTVServer *)0x0) {
local_4c = 0;
local_48 = 0;
if (_g_Telemetry == 0) {
local_20 = 0;
}
else {
/* try { // try from 0017899b to 0017899d has its CatchHandler @ 00178ec9 */
(**(code **)(_g_Telemetry + 0x50))
(_g_Telemetry,&local_4c,0,0,0,0,"/data/src/engine/./host.cpp",0xdba,
&_Host_RunFrame(float)::tm_fmt,"hltv->RunFrame()");
local_20 = _g_Telemetry;
}
local_28 = local_4c;
local_24 = local_48;
/* try { // try from 001789bc to 001789c0 has its CatchHandler @ 00178eda */
CHLTVServer::RunFrame(hltv);
if (local_20 != 0) {
(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
}
}
if (hltvtest != (CHLTVTestSystem *)0x0) {
local_4c = 0;
local_48 = 0;
if (_g_Telemetry == 0) {
local_20 = 0;
}
else {
/* try { // try from 00178a67 to 00178a69 has its CatchHandler @ 00178ec9 */
(**(code **)(_g_Telemetry + 0x50))
(_g_Telemetry,&local_4c,0,0,0,0,"/data/src/engine/./host.cpp",0xdc0,
&_Host_RunFrame(float)::tm_fmt,"hltvtest->RunFrame()");
local_20 = _g_Telemetry;
}
local_28 = local_4c;
local_24 = local_48;
/* try { // try from 00178a88 to 00178a8c has its CatchHandler @ 00178e61 */
CHLTVTestSystem::RunFrame(hltvtest);
if (local_20 != 0) {
(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
}
}
/* try { // try from 00178ac7 to 00178be4 has its CatchHandler @ 00178ec9 */
CLog::RunFrame((CLog *)g_Log);
if ((cVar3 == '\0') && (g_bVCRSingleStep != '\0')) {
/* try { // try from 00178d78 to 00178d7c has its CatchHandler @ 00178ec9 */
VCR_EnterPausedState();
}
lVar9 = (longdouble)Plat_FloatTime();
g_HostTimes._88_8_ = (double)lVar9 - (double)g_HostTimes._80_8_;
g_HostTimes._80_8_ = (undefined8)lVar9;
CFrameTimer::ComputeFrameVariability((CFrameTimer *)g_HostTimes);
g_EngineStats._96_4_ = (undefined4)(double)g_HostTimes._88_8_;
g_EngineStats._100_4_ = (undefined4)(double)g_HostTimes._96_8_;
host_frametime_stddeviation = (float)(double)g_HostTimes._104_8_;
Host_FinishAsyncServer();
Host_EndThreadedSound();
if (g_bAsyncServerHadError != '\0') {
Host_Disconnect(true);
g_bAsyncServerHadError = '\0';
}
CFrameTimer::MarkFrame((CFrameTimer *)g_HostTimes);
Host_UpdateMapList();
fVar10 = host_frametime;
if (host_frametime <= 0.0001) {
fVar10 = 0.0001;
}
host_framecount = host_framecount + 1;
if (1.0 <= fVar10) {
fVar10 = 1.0;
}
g_fFramesPerSecond = (1.0 / fVar10) * 0.100000024 + g_fFramesPerSecond * 0.9;
Host_CheckDumpMemoryStats();
CTestScriptMgr::CheckPoint((CTestScriptMgr *)g_TestScriptMgr,"frame_end");
if (local_2c != 0) {
(**(code **)(local_2c + 0x54))(local_2c,local_34,local_30,0,0,0);
}
iVar7 = _DAT_0040b9d4;
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar4 = ThreadGetCurrentId(), iVar7 == iVar4)) {
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_38 != 0) {
(**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
}
/* try { // try from 00178c70 to 00178c74 has its CatchHandler @ 00178ec5 */
Host_ShowIPCCallCount();
(**(code **)(*piVar1 + 0xbc))(piVar1);
return;
}
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar4 = ThreadGetCurrentId(), iVar7 == iVar4)) {
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_20 != 0) {
(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
}
(**(code **)(*piVar1 + 0xbc))(piVar1);
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.