L L4D2node

CEngine::Frame

0x00218ea0 · 1327 bytes · __thiscall

_ZN7CEngine5FrameEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CEngine::Frame() */

void __thiscall CEngine::Frame(CEngine *this)

{
  uint *puVar1;
  double dVar2;
  double dVar3;
  undefined8 uVar4;
  undefined8 uVar5;
  char cVar6;
  int iVar7;
  int iVar8;
  longdouble lVar9;
  float fVar10;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  int local_1c;
  undefined4 local_18;
  undefined4 local_14;
  int local_10;
  
  cVar6 = (**(code **)(*(int *)game + 0x40))(game);
  if ((((cVar6 == '\0') && (DAT_003b8088 == '\0')) &&
      (0 < *(int *)(engine_no_focus_sleep._28_4_ + 0x30))) && (_SteamAPI_SetBreakpadAppID == 0)) {
    (**(code **)(*g_pInputSystem + 0x7c))
              (g_pInputSystem,*(int *)(engine_no_focus_sleep._28_4_ + 0x30));
  }
  lVar9 = (longdouble)Plat_FloatTime();
  dVar3 = (double)lVar9;
  *(double *)(this + 0x10) = dVar3;
  dVar2 = *(double *)(this + 0x1c);
  *(double *)(this + 0x1c) = dVar3;
  fVar10 = (float)(dVar3 - dVar2) + *(float *)(this + 0x18);
  *(float *)(this + 0x18) = fVar10;
  if (0.0 <= fVar10) {
    cVar6 = FilterTime(this,fVar10);
    if (cVar6 == '\0') {
      *(float *)(this + 0x24) = (float)(dVar3 - dVar2) + *(float *)(this + 0x24);
      return;
    }
    if (*(int *)(async_serialize._28_4_ + 0x30) != 0) {
      if (Frame()::pSyncReportConVar == '\0') {
        iVar8 = __cxa_guard_acquire(&Frame()::pSyncReportConVar);
        if (iVar8 != 0) {
                    /* try { // try from 0021939e to 002193a0 has its CatchHandler @ 00219481 */
          Frame()::pSyncReportConVar =
               (int *)(**(code **)(*g_pCVar + 0x30))(g_pCVar,"fs_report_sync_opens");
          __cxa_guard_release(&Frame()::pSyncReportConVar);
        }
      }
      if ((Frame()::pSyncReportConVar == (int *)0x0) ||
         (iVar8 = *(int *)(Frame()::pSyncReportConVar[7] + 0x30), iVar8 == 0)) {
        (**(code **)(*g_pFileSystem + 0xa8))(g_pFileSystem,0);
      }
      else {
        (**(code **)(*Frame()::pSyncReportConVar + 0x44))(Frame()::pSyncReportConVar,0);
        (**(code **)(*g_pFileSystem + 0xa8))(g_pFileSystem,0);
        (**(code **)(*Frame()::pSyncReportConVar + 0x44))(Frame()::pSyncReportConVar,iVar8);
      }
    }
    PreUpdateProfile(*(float *)(this + 0x24));
    *(undefined4 *)(this + 0x24) = 0;
    PostUpdateProfile();
    TelemetryTick();
    local_34 = 0;
    local_30 = 0;
    if (_Plat_SetBenchmarkMode == 0) {
      local_1c = 0;
    }
    else {
      (**(code **)(_Plat_SetBenchmarkMode + 0x50))
                (_Plat_SetBenchmarkMode,&local_34,0,0,0,0,"/data/src/engine/./sys_engine.cpp",0x169,
                 &Frame()::tm_fmt,"(%s)%s","Unaccounted","CEngine::Frame");
      local_1c = _Plat_SetBenchmarkMode;
    }
    iVar8 = _DAT_0040b9d4;
    local_24 = local_34;
    local_20 = local_30;
    if ((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) {
                    /* try { // try from 00219286 to 002192e6 has its CatchHandler @ 00219497 */
      iVar7 = ThreadGetCurrentId();
      if (iVar8 == iVar7) {
        if ((char *)*_DAT_0040b030 != "CEngine::Frame") {
          _DAT_0040b030 =
               (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2c706e,(char *)0x0,0x2a054b);
        }
        puVar1 = (uint *)(_DAT_0040b0bc + 4 + _DAT_0040b030[0x1c] * 8);
        *puVar1 = *puVar1 | 4;
        CVProfNode::EnterScope();
        DAT_0040b02c = '\0';
      }
    }
    local_2c = 0;
    local_28 = 0;
    if (_g_Telemetry == 0) {
      local_10 = 0;
    }
    else {
                    /* try { // try from 002190cc to 002190ce has its CatchHandler @ 0021947d */
      (**(code **)(_g_Telemetry + 0x50))
                (_g_Telemetry,&local_2c,0,0,0,0,"/data/src/engine/./sys_engine.cpp",0x16a,
                 &Frame()::tm_fmt,&DAT_002c48a3,"Frame");
      local_10 = _g_Telemetry;
    }
    uVar4 = rdtsc();
    iVar8 = *(int *)(this + 8);
    local_18 = local_2c;
    local_14 = local_28;
    if (iVar8 - 1U < 3) {
                    /* try { // try from 002193ea to 002193ee has its CatchHandler @ 0021940b */
      HostState_Frame(*(float *)(this + 0x18));
      iVar8 = *(int *)(this + 8);
    }
    iVar7 = *(int *)(this + 0xc);
    if (iVar7 != iVar8) {
      *(int *)(this + 8) = iVar7;
      if (iVar7 == 2) {
                    /* try { // try from 0021936d to 0021936f has its CatchHandler @ 0021940b */
        (**(code **)(*(int *)this + 0x28))(this,1);
      }
      else if (iVar7 == 3) {
                    /* try { // try from 00219120 to 0021919b has its CatchHandler @ 0021940b */
        (**(code **)(*(int *)this + 0x28))(this,2);
      }
    }
    uVar5 = rdtsc();
    iVar8 = ((int)((ulonglong)uVar5 >> 0x20) - (int)((ulonglong)uVar4 >> 0x20)) -
            (uint)((uint)uVar5 < (uint)uVar4);
    fVar10 = (float)CONCAT44(iVar8,(uint)uVar5 - (uint)uVar4);
    if (iVar8 < 0) {
      fVar10 = fVar10 + 1.8446744e+19;
    }
    if ((0.5 < fVar10 * _syscall) && (_g_Telemetry != 0)) {
      (**(code **)(_g_Telemetry + 0x84))
                (_g_Telemetry,7,0,fVar10 * _syscall,&Frame()::tm_fmt,"CEngine::Frame");
    }
    if (local_10 != 0) {
      (**(code **)(local_10 + 0x54))(local_10,local_18,local_14,0,0,0);
    }
    iVar8 = _DAT_0040b9d4;
    if ((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) {
      iVar7 = ThreadGetCurrentId();
      if (iVar8 == iVar7) {
        cVar6 = CVProfNode::ExitScope();
        if (cVar6 != '\0') {
          _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
        }
        DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
      }
    }
    if (local_1c != 0) {
      (**(code **)(local_1c + 0x54))(local_1c,local_24,local_20,0,0,0);
    }
    *(undefined4 *)(this + 0x18) = 0;
  }
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)