L L4D2node

Physics_RunThinkFunctions

0x00790aa0 · 753 bytes · __cdecl

_Z25Physics_RunThinkFunctionsb

Decompiled

undefined (1 param)

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

void Physics_RunThinkFunctions(bool param_1)

{
  code *pcVar1;
  int iVar2;
  int *piVar3;
  char cVar4;
  CBasePlayer *this;
  int iVar5;
  int iVar6;
  int iVar7;
  int *piVar8;
  int in_GS_OFFSET;
  undefined4 uStackY_80;
  int local_40 [6];
  int local_28;
  int local_24;
  int local_20;
  
  piVar3 = mdlcache;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  uStackY_80 = 0x790ac9;
  (**(code **)(*mdlcache + 0x68))();
  local_40[3] = 0;
  local_40[4] = 0;
  if (___atan2f_finite == 0) {
    local_24 = 0;
  }
  else {
                    /* try { // try from 00790b3e to 00790b40 has its CatchHandler @ 00790dc3 */
    uStackY_80 = 0x790b41;
    (**(code **)(___atan2f_finite + 0x50))();
    local_24 = ___atan2f_finite;
  }
  iVar6 = _DAT_0105db00;
  local_40[5] = local_40[3];
  local_28 = local_40[4];
  if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 00790cb6 to 00790d04 has its CatchHandler @ 00790dc7 */
    uStackY_80 = 0x790cbb;
    iVar5 = ThreadGetCurrentId();
    if (iVar6 == iVar5) {
      if ((char *)*_DAT_0105d15c != "Physics_RunThinkFunctions") {
        uStackY_80 = 0x790cf8;
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcb203c,(char *)0x1,0xbfafa1);
      }
      uStackY_80 = 0x790d05;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
  }
  g_bTestMoveTypeStepSimulation = *(int *)(sv_teststepsimulation._28_4_ + 0x30) != 0;
  local_40[0] = *(int *)(gpGlobals + 0xc);
                    /* try { // try from 00790b98 to 00790bec has its CatchHandler @ 00790d97 */
  uStackY_80 = 0x790b9d;
  CGlobalEntityList::CleanupDeleteList();
  if (param_1) {
                    /* try { // try from 00790d11 to 00790d7c has its CatchHandler @ 00790d97 */
    uStackY_80 = 0x790d16;
    UTIL_DisableRemoveImmediate();
    uStackY_80 = 0x790d1b;
    iVar5 = SimThink_ListCount();
    iVar6 = 1;
    if (0 < iVar5) {
      iVar6 = iVar5;
    }
    iVar2 = -((iVar6 * 4 + 0xfU & 0xfffffff0) + 0x10);
    piVar8 = (int *)(&stack0xffffff84 + iVar2);
    iVar5 = (int)local_40 + iVar2;
    *(int *)(&stack0xffffff88 + iVar2) = iVar6;
    *(int *)(&stack0xffffff84 + iVar2) = iVar5;
    *(undefined4 *)((int)&uStackY_80 + iVar2) = 0x790d47;
    iVar6 = SimThink_ListCopy(*(CBaseEntity ***)(&stack0xffffff84 + iVar2),
                              *(int *)(&stack0xffffff88 + iVar2));
    iVar7 = 0;
    if (0 < iVar6) {
      do {
        if (*(int *)(iVar5 + iVar7 * 4) != 0) {
          *(int *)(gpGlobals + 0xc) = local_40[0];
          *(undefined4 *)(&stack0xffffff84 + iVar2) = *(undefined4 *)(iVar5 + iVar7 * 4);
          *(undefined4 *)((int)&uStackY_80 + iVar2) = 0x790d71;
          Physics_SimulateEntity(*(CBaseEntity **)(&stack0xffffff84 + iVar2));
        }
        iVar7 = iVar7 + 1;
      } while (iVar7 != iVar6);
    }
    *(undefined4 *)((int)&uStackY_80 + iVar2) = 0x790d7d;
    UTIL_EnableRemoveImmediate();
  }
  else {
    piVar8 = (int *)&stack0xffffff84;
    if (0 < *(int *)(gpGlobals + 0x14)) {
      iVar6 = 1;
      do {
        uStackY_80 = 0x790bc8;
        this = (CBasePlayer *)UTIL_PlayerByIndex(iVar6);
        if (this != (CBasePlayer *)0x0) {
          *(int *)(gpGlobals + 0xc) = local_40[0];
          uStackY_80 = 0x790be5;
          CBasePlayer::ForceSimulation(this);
          uStackY_80 = 0x790bed;
          Physics_SimulateEntity((CBaseEntity *)this);
        }
        iVar6 = iVar6 + 1;
        piVar8 = (int *)&stack0xffffff84;
      } while (iVar6 <= *(int *)(gpGlobals + 0x14));
    }
  }
  *(int *)(gpGlobals + 0xc) = local_40[0];
  iVar6 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    piVar8[-1] = 0x790c7b;
    iVar5 = ThreadGetCurrentId();
    if (iVar6 == iVar5) {
      *piVar8 = (int)_DAT_0105d15c;
      piVar8[-1] = 0x790c8c;
      cVar4 = CVProfNode::ExitScope();
      if (cVar4 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  iVar5 = local_24;
  iVar6 = local_40[5];
  if (local_24 != 0) {
    piVar8[5] = 0;
    iVar2 = local_28;
    piVar8[4] = 0;
    piVar8[3] = 0;
    *piVar8 = iVar5;
    piVar8[1] = iVar6;
    piVar8[2] = iVar2;
    pcVar1 = *(code **)(iVar5 + 0x54);
    piVar8[-1] = 0x790c49;
    (*pcVar1)();
  }
  iVar6 = *piVar3;
  *piVar8 = (int)piVar3;
  pcVar1 = *(code **)(iVar6 + 0x6c);
  piVar8[-1] = 0x790c54;
  (*pcVar1)();
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  piVar8[-1] = (int)&LAB_00790d97;
  __stack_chk_fail();
}

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)