L L4D2node

ServerDTI_Flush

0x0014b870 · 2072 bytes · unknown

_Z15ServerDTI_Flushv

Decompiled

undefined (0 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* ServerDTI_Flush() */

void ServerDTI_Flush(void)

{
  int *piVar1;
  ushort uVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  CUtlString *pCVar6;
  int iVar7;
  code *pcVar8;
  undefined8 uVar9;
  int iVar10;
  int iVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  uint uVar15;
  undefined4 *puVar16;
  undefined4 uVar17;
  uint uVar18;
  int iVar19;
  int iVar20;
  int iVar21;
  int iVar22;
  uint uVar23;
  uint uVar24;
  int iVar25;
  bool bVar26;
  longdouble lVar27;
  double dVar28;
  double dVar29;
  double dVar30;
  double dVar31;
  double dVar32;
  double dVar33;
  double local_7c;
  double local_44;
  undefined8 local_3c;
  undefined8 local_34;
  undefined8 local_2c;
  
  iVar19 = DAT_0039f4f4;
  uVar23 = g_ServerDTITimer;
  if (g_pServerDTIFilename != 0) {
    uVar9 = rdtsc();
    iVar10 = (**(code **)(g_pFileSystem[1] + 8))
                       (g_pFileSystem + 1,g_pServerDTIFilename,&DAT_002a5dab,"LOGDIR");
    if (iVar10 != 0) {
      iVar11 = (uint)uVar9 - uVar23;
      iVar19 = ((int)((ulonglong)uVar9 >> 0x20) - iVar19) - (uint)((uint)uVar9 < uVar23);
      (**(code **)(*g_pFileSystem + 100))
                (g_pFileSystem,iVar10,
                 "DTName\tCalcDelta calls\tCalcDelta ms\tEncode calls\tEncode ms\tShouldTransmit calls\tShouldTransmit ms\tWriteDeltaProps ms\t%% manual mode\tTotal\tPercent\n"
                );
      uVar23 = (uint)DAT_0039f508;
      if (uVar23 == 0xffff) {
        local_2c = (double)CONCAT44(iVar19,iVar11);
        local_7c = (double)(longlong)local_2c;
        if (iVar19 < 0) {
          local_7c = local_7c + 1.8446744073709552e+19;
        }
        local_2c = 0.0;
        local_44 = 0.0;
        local_3c = 0.0;
        local_34 = 0.0;
      }
      else {
        local_2c._0_4_ = 0;
        local_2c._4_4_ = 0;
        iVar25 = 0;
        local_34._0_4_ = 0;
        local_34._4_4_ = 0;
        local_3c._0_4_ = 0;
        local_3c._4_4_ = 0;
        uVar24 = 0;
        uVar18 = uVar23;
        do {
          piVar1 = (int *)(g_DTISendTables + uVar18 * 8);
          iVar22 = *piVar1;
          uVar12 = (uint)local_2c + *(uint *)(iVar22 + 0x10);
          iVar20 = local_2c._4_4_ + *(int *)(iVar22 + 0x14) +
                   (uint)CARRY4((uint)local_2c,*(uint *)(iVar22 + 0x10));
          bVar26 = CARRY4(uVar24,*(uint *)(iVar22 + 0x1c));
          uVar24 = uVar24 + *(uint *)(iVar22 + 0x1c);
          iVar25 = iVar25 + *(int *)(iVar22 + 0x20) + (uint)bVar26;
          uVar13 = (uint)local_3c + *(uint *)(iVar22 + 0x28);
          iVar21 = local_3c._4_4_ + *(int *)(iVar22 + 0x2c) +
                   (uint)CARRY4((uint)local_3c,*(uint *)(iVar22 + 0x28));
          uVar14 = (uint)local_34 + *(uint *)(iVar22 + 0x34);
          iVar22 = local_34._4_4_ + *(int *)(iVar22 + 0x38) +
                   (uint)CARRY4((uint)local_34,*(uint *)(iVar22 + 0x34));
          uVar18 = (uint)*(ushort *)((int)piVar1 + 6);
          local_2c._0_4_ = uVar12;
          local_2c._4_4_ = iVar20;
          local_3c._0_4_ = uVar13;
          local_3c._4_4_ = iVar21;
          local_34._0_4_ = uVar14;
          local_34._4_4_ = iVar22;
        } while (uVar18 != 0xffff);
        local_2c = (double)CONCAT44(iVar19,iVar11);
        local_7c = (double)(longlong)local_2c;
        iVar11 = g_DTISendTables;
        if (iVar19 < 0) {
          local_7c = local_7c + 1.8446744073709552e+19;
        }
        do {
          while( true ) {
            puVar16 = (undefined4 *)(iVar11 + uVar23 * 8);
            pCVar6 = (CUtlString *)*puVar16;
            iVar19 = *(int *)(pCVar6 + 0x18);
            if (iVar19 == 0) break;
            local_34._0_4_ = *(uint *)(pCVar6 + 0x30);
            iVar7 = *(int *)(pCVar6 + 0x24);
LAB_0014ba04:
            uVar18 = *(uint *)(pCVar6 + 0x1c);
            uVar3 = *(uint *)(pCVar6 + 0x10);
            uVar4 = *(uint *)(pCVar6 + 0x28);
            pcVar8 = *(code **)(*g_pFileSystem + 100);
            uVar15 = uVar3 + uVar18;
            iVar11 = *(int *)(pCVar6 + 0x14) + *(int *)(pCVar6 + 0x20) + (uint)CARRY4(uVar3,uVar18)
                     + *(int *)(pCVar6 + 0x2c) + (uint)CARRY4(uVar15,uVar4);
            dVar30 = (double)CONCAT44(iVar11,uVar15 + uVar4);
            if (iVar11 < 0) {
              dVar30 = dVar30 + 1.8446744073709552e+19;
            }
            dVar29 = local_7c * _g_ClockSpeedMillisecondsMultiplier;
            iVar11 = *(int *)(pCVar6 + 0x40);
            dVar30 = dVar30 * _g_ClockSpeedMillisecondsMultiplier;
            dVar31 = (double)*(longlong *)(pCVar6 + 0x34);
            iVar5 = *(int *)(pCVar6 + 0x3c);
            if (*(int *)(pCVar6 + 0x38) < 0) {
              dVar31 = dVar31 + 1.8446744073709552e+19;
            }
            dVar32 = (double)*(longlong *)(pCVar6 + 0x28);
            dVar31 = dVar31 * _g_ClockSpeedMillisecondsMultiplier;
            if (*(int *)(pCVar6 + 0x2c) < 0) {
              dVar32 = dVar32 + 1.8446744073709552e+19;
            }
            dVar33 = (double)*(longlong *)(pCVar6 + 0x1c);
            dVar32 = dVar32 * _g_ClockSpeedMillisecondsMultiplier;
            if (*(int *)(pCVar6 + 0x20) < 0) {
              dVar33 = dVar33 + 1.8446744073709552e+19;
            }
            lVar27 = (longdouble)*(longlong *)(pCVar6 + 0x10);
            dVar33 = dVar33 * _g_ClockSpeedMillisecondsMultiplier;
            if (*(int *)(pCVar6 + 0x14) < 0) {
              lVar27 = _DAT_002adb60 + lVar27;
            }
            dVar28 = _g_ClockSpeedMillisecondsMultiplier * (double)lVar27;
            uVar17 = CUtlString::Get(pCVar6);
            (*pcVar8)(g_pFileSystem,iVar10,
                      "%s\t%d\t%.3f\t%d\t%.3f\t%d\t%.3f\t%.3f\t%.2f\t%.3f\t%.3f\n",uVar17,iVar19,
                      dVar28,iVar7,dVar33,(uint)local_34,dVar32,dVar31,
                      (double)(((float)iVar11 * 100.0) / (float)(iVar11 + iVar5)),dVar30,
                      (dVar30 * 100.0) / dVar29);
            uVar23 = (uint)*(ushort *)(g_DTISendTables + uVar23 * 8 + 6);
            iVar11 = g_DTISendTables;
            if (uVar23 == 0xffff) goto LAB_0014bc26;
          }
          iVar7 = *(int *)(pCVar6 + 0x24);
          if (iVar7 != 0) {
            local_34._0_4_ = *(uint *)(pCVar6 + 0x30);
            goto LAB_0014ba04;
          }
          local_34._0_4_ = *(uint *)(pCVar6 + 0x30);
          if ((uint)local_34 != 0) goto LAB_0014ba04;
          uVar23 = (uint)*(ushort *)((int)puVar16 + 6);
        } while (uVar23 != 0xffff);
LAB_0014bc26:
        local_2c = (double)CONCAT44(iVar20,uVar12);
        local_34 = (double)(longlong)local_2c;
        if (iVar20 < 0) {
          local_34 = local_34 + 1.8446744073709552e+19;
        }
        local_2c = (double)CONCAT44(iVar25,uVar24);
        local_3c = (double)(longlong)local_2c;
        if (iVar25 < 0) {
          local_3c = local_3c + 1.8446744073709552e+19;
        }
        local_2c = (double)CONCAT44(iVar21,uVar13);
        local_44 = (double)(longlong)local_2c;
        if (iVar21 < 0) {
          local_44 = local_44 + 1.8446744073709552e+19;
        }
        local_2c = (double)CONCAT44(iVar22,uVar14);
        local_2c = (double)(longlong)local_2c;
        if (iVar22 < 0) {
          local_2c = local_2c + 1.8446744073709552e+19;
        }
      }
      (**(code **)(*g_pFileSystem + 100))(g_pFileSystem,iVar10,"\n\n");
      (**(code **)(*g_pFileSystem + 100))
                (g_pFileSystem,iVar10,"Total profile ms:\t%.3f\n",
                 local_7c * _g_ClockSpeedMillisecondsMultiplier);
      (**(code **)(*g_pFileSystem + 100))
                (g_pFileSystem,iVar10,"Total CalcDelta ms:\t%.3f\tPercent:\t%.3f\n",
                 local_34 * _g_ClockSpeedMillisecondsMultiplier,
                 (local_34 * _g_ClockSpeedMillisecondsMultiplier * 100.0) /
                 (_g_ClockSpeedMillisecondsMultiplier * local_7c));
      (**(code **)(*g_pFileSystem + 100))
                (g_pFileSystem,iVar10,"Total Encode ms:\t%.3f\tPercent:\t%.3f\n",
                 local_3c * _g_ClockSpeedMillisecondsMultiplier,
                 (local_3c * _g_ClockSpeedMillisecondsMultiplier * 100.0) /
                 (_g_ClockSpeedMillisecondsMultiplier * local_7c));
      (**(code **)(*g_pFileSystem + 100))
                (g_pFileSystem,iVar10,"Total ShouldTransmit ms:\t%.3f\tPercent:\t%.3f\n",
                 local_44 * _g_ClockSpeedMillisecondsMultiplier,
                 (local_44 * _g_ClockSpeedMillisecondsMultiplier * 100.0) /
                 (_g_ClockSpeedMillisecondsMultiplier * local_7c));
      (**(code **)(*g_pFileSystem + 100))
                (g_pFileSystem,iVar10,"Total WriteDeltaProps ms:\t%.3f\tPercent:\t%.3f\n",
                 local_2c * _g_ClockSpeedMillisecondsMultiplier,
                 (local_2c * _g_ClockSpeedMillisecondsMultiplier * 100.0) /
                 (_g_ClockSpeedMillisecondsMultiplier * local_7c));
      (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar10);
      Msg("DTI: Wrote delta distances into %s.\n",g_pServerDTIFilename);
    }
    iVar19 = (**(code **)(g_pFileSystem[1] + 8))
                       (g_pFileSystem + 1,"dti_delta_distances.txt",&DAT_002a5dab,"LOGDIR");
    if (iVar19 != 0) {
      (**(code **)(*g_pFileSystem + 100))(g_pFileSystem,iVar19,"ClassName");
      iVar10 = 200;
      do {
        iVar11 = iVar10 + 200;
        (**(code **)(*g_pFileSystem + 100))(g_pFileSystem,iVar19,&DAT_002ad97c,iVar10);
        iVar10 = iVar11;
      } while (iVar11 != 0x2008);
      (**(code **)(*g_pFileSystem + 100))(g_pFileSystem,iVar19,"\n");
      iVar10 = g_DTISendTables;
      uVar2 = DAT_0039f508;
      while (uVar2 != 0xffff) {
        iVar11 = (uint)uVar2 * 8;
        puVar16 = (undefined4 *)(iVar11 + iVar10);
        pCVar6 = (CUtlString *)*puVar16;
        if (((*(int *)(pCVar6 + 0x18) != 0) || (*(int *)(pCVar6 + 0x24) != 0)) ||
           (*(int *)(pCVar6 + 0x30) != 0)) {
          pcVar8 = *(code **)(*g_pFileSystem + 100);
          uVar17 = CUtlString::Get(pCVar6);
          (*pcVar8)(g_pFileSystem,iVar19,&DAT_002c48a3,uVar17);
          iVar10 = 0;
          do {
            iVar25 = iVar10 * 2;
            iVar10 = iVar10 + 1;
            (**(code **)(*g_pFileSystem + 100))
                      (g_pFileSystem,iVar19,&DAT_002ad981,*(undefined2 *)(pCVar6 + iVar25 + 0x44));
          } while (iVar10 != 0x28);
          (**(code **)(*g_pFileSystem + 100))(g_pFileSystem,iVar19,"\n");
          puVar16 = (undefined4 *)(iVar11 + g_DTISendTables);
          iVar10 = g_DTISendTables;
        }
        uVar2 = *(ushort *)((int)puVar16 + 6);
      }
      (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar19);
      Msg("DTI: Wrote instrumentation data into %s.\n","dti_delta_distances.txt");
    }
  }
  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)