L L4D2node

PhysFrame

0x0077bec0 · 1082 bytes · __cdecl

_ZL9PhysFramef

Decompiled

undefined (1 param)

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

void PhysFrame(float param_1)

{
  code *pcVar1;
  int iVar2;
  uint uVar3;
  undefined8 uVar4;
  int iVar5;
  char cVar6;
  int iVar7;
  int iVar8;
  int *piVar9;
  undefined4 uVar10;
  int *piVar11;
  undefined *puVar12;
  uint *puVar13;
  int **ppiVar14;
  int **ppiVar15;
  int in_GS_OFFSET;
  longdouble lVar16;
  float in_XMM0_Da;
  float fVar17;
  undefined4 uStack_70;
  int *local_6c;
  float local_68 [5];
  int local_54;
  int local_50;
  float local_4c;
  bool local_45;
  float local_44;
  int local_40;
  code *local_3c;
  int local_38;
  undefined8 local_34;
  int local_20;
  
  ppiVar15 = &local_6c;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (((physenv == (int *)0x0) && (g_pPhys2World == (int *)0x0)) ||
     (ppiVar15 = &local_6c, g_PhysicsHook[0x58] != '\0')) {
LAB_0077c144:
    if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
      return;
    }
                    /* WARNING: Subroutine does not return */
    *(undefined **)((int)ppiVar15 + -4) = &UNK_0077c33e;
    __stack_chk_fail();
  }
  if ((in_XMM0_Da < 0.0) || (1.0 < in_XMM0_Da)) {
    local_6c = (int *)0xcb062c;
    uStack_70 = 0x77c16c;
    Msg();
    in_XMM0_Da = 0.0;
  }
  else if (0.1 <= in_XMM0_Da) {
    in_XMM0_Da = 0.1;
  }
  local_4c = 0.0;
  fVar17 = in_XMM0_Da * *(float *)(phys_timescale._28_4_ + 0x2c);
  local_44 = 0.1;
  if (fVar17 <= 0.1) {
    local_44 = fVar17;
  }
  local_45 = *(int *)(phys_speeds._28_4_ + 0x30) != 0;
  if (local_45) {
    uStack_70 = 0x77c215;
    lVar16 = (longdouble)Plat_FloatTime();
    local_34 = (double)lVar16;
    local_4c = (float)lVar16;
  }
  g_Collisions[0x164] = 1;
  if (physenv != (int *)0x0) {
    local_6c = physenv;
    local_68[0] = local_44;
    uStack_70 = 0x77bf6c;
    (**(code **)(*physenv + 0x8c))();
    local_6c = physenv;
    uStack_70 = 0x77bf7c;
    iVar7 = (**(code **)(*physenv + 0xb8))();
    if (iVar7 != 0) {
      iVar5 = -((iVar7 * 4 + 0xfU & 0xfffffff0) + 0x10);
      iVar8 = (int)&local_50 + iVar5;
      iVar2 = *physenv;
      local_40 = iVar7;
      *(int *)((int)local_68 + iVar5) = iVar8;
      *(int **)((int)local_68 + iVar5 + -4) = physenv;
      pcVar1 = *(code **)(iVar2 + 0xbc);
      *(undefined4 *)((int)&uStack_70 + iVar5) = 0x77c26f;
      (*pcVar1)();
      ppiVar14 = (int **)((int)local_68 + iVar5 + -4);
      if (0 < iVar7) {
        iVar7 = 0;
        do {
          piVar11 = *(int **)(iVar8 + iVar7 * 4);
          iVar2 = *piVar11;
          *(int **)((int)local_68 + iVar5 + -4) = piVar11;
          pcVar1 = *(code **)(iVar2 + 0x48);
          *(undefined4 *)((int)&uStack_70 + iVar5) = 0x77c2a9;
          piVar11 = (int *)(*pcVar1)();
          if (piVar11 != (int *)0x0) {
            *(int **)((int)local_68 + iVar5 + -4) = piVar11 + 0x65;
            local_34 = (double)CONCAT44(local_34._4_4_,piVar11 + 0x65);
            *(undefined4 *)((int)&uStack_70 + iVar5) = 0x77c2c0;
            cVar6 = CCollisionProperty::DoesVPhysicsInvalidateSurroundingBox
                              (*(CCollisionProperty **)((int)local_68 + iVar5 + -4));
            if (cVar6 != '\0') {
              *(int *)((int)local_68 + iVar5 + -4) = (int)local_34;
              *(undefined4 *)((int)&uStack_70 + iVar5) = 0x77c2cf;
              CCollisionProperty::MarkSurroundingBoundsDirty
                        (*(CCollisionProperty **)((int)local_68 + iVar5 + -4));
            }
            uVar10 = *(undefined4 *)(iVar8 + iVar7 * 4);
            iVar2 = *piVar11;
            *(int **)((int)local_68 + iVar5 + -4) = piVar11;
            *(undefined4 *)((int)local_68 + iVar5) = uVar10;
            pcVar1 = *(code **)(iVar2 + 0x29c);
            *(undefined4 *)((int)&uStack_70 + iVar5) = 0x77c292;
            (*pcVar1)();
          }
          iVar7 = iVar7 + 1;
          ppiVar14 = (int **)((int)local_68 + iVar5 + -4);
        } while (iVar7 != local_40);
      }
      goto LAB_0077bf8e;
    }
  }
  local_40 = 0;
  ppiVar14 = &local_6c;
LAB_0077bf8e:
  iVar7 = (int)_g_pLastMiniProfiler;
  ppiVar15 = ppiVar14;
  if (g_pPhys2World != (int *)0x0) {
    uVar4 = rdtsc();
    local_54 = (int)uVar4;
    _g_pLastMiniProfiler = g_mp_ServerPhysicsSimulate;
    local_50 = iVar7;
    iVar7 = *g_pPhys2World;
    *ppiVar14 = g_pPhys2World;
                    /* try { // try from 0077bfb8 to 0077c086 has its CatchHandler @ 0077c311 */
    pcVar1 = *(code **)(iVar7 + 0xc);
    ppiVar14[-1] = (int *)0x77bfbb;
    iVar8 = (*pcVar1)();
    iVar7 = 1;
    if (0 < iVar8) {
      iVar7 = iVar8;
    }
    iVar8 = -((iVar7 * 4 + 0xfU & 0xfffffff0) + 0x10);
    ppiVar15 = (int **)((int)ppiVar14 + iVar8);
    local_34 = (double)(CONCAT44(local_34._4_4_,(int)ppiVar14 + iVar8 + 0x27) & 0xfffffffffffffff0);
    iVar7 = *g_pPhys2World;
    *(float *)((int)ppiVar14 + iVar8 + 4) = local_44;
    uVar10 = (int)local_34;
    *(int **)((int)ppiVar14 + iVar8) = g_pPhys2World;
    *(undefined4 *)((int)ppiVar14 + iVar8 + 8) = uVar10;
    pcVar1 = *(code **)(iVar7 + 0x4c);
    *(undefined4 *)((int)ppiVar14 + iVar8 + -4) = 0x77bffe;
    local_38 = (*pcVar1)();
    if (0 < local_38) {
      iVar7 = 0;
      do {
        piVar11 = *(int **)((int)local_34 + iVar7 * 4);
        if (piVar11 != (int *)0x0) {
          iVar2 = *piVar11;
          *(int **)((int)ppiVar14 + iVar8) = piVar11;
          pcVar1 = *(code **)(iVar2 + 8);
          *(undefined4 *)((int)ppiVar14 + iVar8 + -4) = 0x77c022;
          piVar9 = (int *)(*pcVar1)();
          if (piVar9 != (int *)0x0) {
            *(int **)((int)ppiVar14 + iVar8) = piVar9 + 0x65;
            local_3c = (code *)(piVar9 + 0x65);
            *(undefined4 *)((int)ppiVar14 + iVar8 + -4) = 0x77c039;
            cVar6 = CCollisionProperty::DoesVPhysicsInvalidateSurroundingBox
                              (*(CCollisionProperty **)((int)ppiVar14 + iVar8));
            if (cVar6 != '\0') {
              *(code **)((int)ppiVar14 + iVar8) = local_3c;
              *(undefined4 *)((int)ppiVar14 + iVar8 + -4) = 0x77c048;
              CCollisionProperty::MarkSurroundingBoundsDirty
                        (*(CCollisionProperty **)((int)ppiVar14 + iVar8));
            }
            local_3c = *(code **)(*piVar9 + 0x29c);
            iVar2 = *piVar11;
            *(int **)((int)ppiVar14 + iVar8) = piVar11;
            pcVar1 = *(code **)(iVar2 + 0x60);
            *(undefined4 *)((int)ppiVar14 + iVar8 + -4) = 0x77c05b;
            uVar10 = (*pcVar1)();
            *(undefined4 *)((int)ppiVar14 + iVar8 + 4) = uVar10;
            pcVar1 = local_3c;
            *(int **)((int)ppiVar14 + iVar8) = piVar9;
            *(undefined4 *)((int)ppiVar14 + iVar8 + -4) = 0x77c067;
            (*pcVar1)();
          }
        }
        iVar7 = iVar7 + 1;
      } while (iVar7 != local_38);
    }
    iVar7 = *g_pPhys2World;
    *(float *)((int)ppiVar14 + iVar8 + 4) = local_44;
    *(int **)((int)ppiVar14 + iVar8) = g_pPhys2World;
    pcVar1 = *(code **)(iVar7 + 0x50);
    *(undefined4 *)((int)ppiVar14 + iVar8 + -4) = 0x77c087;
    (*pcVar1)();
    uVar4 = rdtsc();
    iVar7 = (int)uVar4 - local_54;
    g_mp_ServerPhysicsSimulate._4_4_ = g_mp_ServerPhysicsSimulate._4_4_ + 1;
    g_mp_ServerPhysicsSimulate._0_4_ = g_mp_ServerPhysicsSimulate._0_4_ + iVar7;
    *(int *)(local_50 + 8) = *(int *)(local_50 + 8) + iVar7;
    _g_pLastMiniProfiler = (undefined1 *)local_50;
  }
  puVar13 = *(uint **)(g_pShadowEntities + 4);
joined_r0x0077c0af:
  if (puVar13 != (uint *)0x0) {
    do {
      uVar3 = *puVar13;
      if (((uVar3 == 0xffffffff) ||
          (puVar12 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
         ((*(uint *)(puVar12 + 8) != uVar3 >> 0xc ||
          (piVar11 = *(int **)(puVar12 + 4), piVar11 == (int *)0x0)))) {
        *ppiVar15 = (int *)"Dangling pointer to physics entity!!!\n";
        ppiVar15[-1] = (int *)0x77c0c4;
        Msg();
      }
      else {
        piVar9 = (int *)piVar11[0x8e];
        if (piVar9 != (int *)0x0) {
          iVar7 = *piVar9;
          *ppiVar15 = piVar9;
          pcVar1 = *(code **)(iVar7 + 0xc);
          ppiVar15[-1] = (int *)0x77c111;
          cVar6 = (*pcVar1)();
          if (cVar6 == '\0') goto code_r0x0077c115;
        }
      }
      puVar13 = (uint *)puVar13[1];
      if (puVar13 == (uint *)0x0) break;
    } while( true );
  }
  if (local_45 != false) {
    ppiVar15[-1] = (int *)0x77c185;
    lVar16 = (longdouble)Plat_FloatTime();
    local_34 = (double)lVar16;
    fVar17 = (float)((double)lVar16 - (double)local_4c);
    if (fVar17 <= 0.0) {
      fVar17 = 0.0;
    }
    g_PhysAverageSimTime = fVar17 * 0.2 + g_PhysAverageSimTime * 0.8;
    if (local_40 != 0 || PhysFrame(float)::lastObjectCount != 0) {
      *ppiVar15 = (int *)"Physics: %3d objects, %4.1fms / AVG: %4.1fms\n";
      ppiVar15[1] = (int *)local_40;
      *(double *)(ppiVar15 + 4) = (double)(g_PhysAverageSimTime * 1000.0);
      *(double *)(ppiVar15 + 2) = (double)(fVar17 * 1000.0);
      ppiVar15[-1] = (int *)0x77c30c;
      Msg();
    }
    PhysFrame(float)::lastObjectCount = local_40;
  }
  *ppiVar15 = (int *)g_Collisions;
  g_Collisions[0x164] = 0;
  ppiVar15[-1] = (int *)0x77c144;
  CCollisionEvent::FrameUpdate((CCollisionEvent *)*ppiVar15);
  goto LAB_0077c144;
code_r0x0077c115:
  iVar7 = *piVar11;
  ppiVar15[1] = piVar9;
  *ppiVar15 = piVar11;
  pcVar1 = *(code **)(iVar7 + 0x2a8);
  ppiVar15[-1] = (int *)0x77c124;
  (*pcVar1)();
  puVar13 = (uint *)puVar13[1];
  goto joined_r0x0077c0af;
}

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)