L L4D2node

CPhysObjSaveRestoreOps::Save

0x00483480 · 1220 bytes · __thiscall

_ZN22CPhysObjSaveRestoreOps4SaveERK22SaveRestoreFieldInfo_tP5ISave

Decompiled

undefined (3 params)

/* CPhysObjSaveRestoreOps::Save(SaveRestoreFieldInfo_t const&, ISave*) */

void __thiscall
CPhysObjSaveRestoreOps::Save
          (CPhysObjSaveRestoreOps *this,SaveRestoreFieldInfo_t *param_1,ISave *param_2)

{
  int *piVar1;
  code *pcVar2;
  char cVar3;
  ushort uVar4;
  int iVar5;
  int *piVar6;
  uint uVar7;
  undefined4 uVar8;
  int iVar9;
  int *piVar10;
  undefined1 *puVar11;
  int iVar12;
  byte bVar13;
  longdouble lVar14;
  int iVar15;
  int local_a0;
  int local_9c;
  int local_98;
  int local_94;
  int local_90;
  uint local_8c;
  int local_80 [4];
  int *local_70 [7];
  int local_54;
  int local_50;
  int local_4c;
  uint local_48;
  int local_44;
  int local_40 [6];
  float local_28;
  int local_24;
  int *local_20;
  
  bVar13 = 0;
  iVar5 = (**(code **)(*(int *)param_2 + 0xbc))(param_2);
  piVar10 = *(int **)(iVar5 + 0x564);
  CGlobalEntityList::IsEntityPtr((CGlobalEntityList *)gEntList,piVar10);
  iVar5 = *(int *)(this + 4);
  if (iVar5 == 0) {
    return;
  }
  piVar1 = *(int **)param_1;
  iVar15 = *(int *)(param_1 + 8);
  if (piVar10 == (int *)0x0) {
    return;
  }
  cVar3 = (**(code **)(*piVar10 + 0xcc))(piVar10);
  piVar6 = &local_54;
  for (iVar12 = 0xd; iVar12 != 0; iVar12 = iVar12 + -1) {
    *piVar6 = 0;
    piVar6 = piVar6 + (uint)bVar13 * -2 + 1;
  }
  local_20 = piVar1;
  piVar6 = (int *)(**(code **)(*piVar10 + 0xc))(piVar10);
  local_50 = *piVar6;
  local_54 = iVar5;
  if (cVar3 == '\0') {
    AllocPooledString((char *)&local_4c);
    uVar7 = 0;
    do {
      *(undefined4 *)((int)local_40 + uVar7) = 0;
      uVar7 = uVar7 + 4;
    } while (uVar7 < 0x18);
    local_8c = 0;
    iVar15 = 0;
    iVar12 = 0;
    local_a0 = 0;
    local_9c = 0;
    local_98 = 0;
    local_94 = 0;
    local_90 = 0;
    goto LAB_0048364f;
  }
  local_8c = (uint)*(ushort *)(iVar15 + 0xc);
  local_48 = local_8c;
  AllocPooledString((char *)&local_4c);
  uVar7 = 0;
  do {
    *(undefined4 *)((int)local_40 + uVar7) = 0;
    uVar7 = uVar7 + 4;
  } while (uVar7 < 0x18);
  if ((iVar5 == 1) && (piVar6 = (int *)*piVar1, piVar6 != (int *)0x0)) {
    local_70[0] = piVar6;
    uVar4 = CUtlRBTree<CUtlMap<IPhysicsObject*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<IPhysicsObject*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<IPhysicsObject*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            ::Find((CUtlRBTree<CUtlMap<IPhysicsObject*,int,unsigned_short>::Node_t,unsigned_short,CUtlMap<IPhysicsObject*,int,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<IPhysicsObject*,int,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                    *)(g_PhysSaveRestoreBlockHandler + 0x44),(Node_t *)local_70);
    if (uVar4 == 0xffff) {
      local_44 = 0;
      pcVar2 = *(code **)(*physcollision + 0x74);
      uVar8 = (**(code **)(*piVar6 + 300))(piVar6);
      iVar12 = (*pcVar2)(physcollision,uVar8);
    }
    else {
      pcVar2 = *(code **)(*modelinfo + 0x10);
      uVar8 = (**(code **)(*modelinfo + 8))
                        (modelinfo,
                         *(undefined4 *)
                          ((uint)uVar4 * 0x10 + g_PhysSaveRestoreBlockHandler._72_4_ + 0xc));
      uVar8 = (*pcVar2)(modelinfo,uVar8);
      AllocPooledString((char *)local_80);
      local_44 = local_80[0];
      pcVar2 = *(code **)(*physcollision + 0x74);
      uVar8 = (**(code **)(*piVar6 + 300))(piVar6,uVar8);
      iVar12 = (*pcVar2)(physcollision,uVar8);
      local_24 = iVar12;
      if (local_80[0] != 0) goto LAB_00483624;
    }
    local_70[0] = piVar6;
    local_24 = iVar12;
    uVar4 = CUtlRBTree<CUtlMap<IPhysicsObject*,CPhysCollide_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<IPhysicsObject*,CPhysCollide_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<IPhysicsObject*,CPhysCollide_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            ::Find((CUtlRBTree<CUtlMap<IPhysicsObject*,CPhysCollide_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<IPhysicsObject*,CPhysCollide_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<IPhysicsObject*,CPhysCollide_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                    *)(g_PhysSaveRestoreBlockHandler + 0x60),(Node_t *)local_70);
    if (uVar4 != 0xffff) {
      local_70[0] = *(int **)((uint)uVar4 * 0x10 + g_PhysSaveRestoreBlockHandler._100_4_ + 0xc);
      uVar4 = CUtlRBTree<CUtlMap<CPhysCollide_const*,BBox_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<CPhysCollide_const*,BBox_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CPhysCollide_const*,BBox_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
              ::Find((CUtlRBTree<CUtlMap<CPhysCollide_const*,BBox_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<CPhysCollide_const*,BBox_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<CPhysCollide_const*,BBox_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                      *)(g_PhysSaveRestoreBlockHandler + 0x7c),(Node_t *)local_70);
      if ((uVar4 != 0xffff) &&
         (iVar15 = g_PhysSaveRestoreBlockHandler._128_4_ + (uint)uVar4 * 0x24, iVar15 != -0xc)) {
        local_90 = *(int *)(iVar15 + 0xc);
        local_94 = *(int *)(iVar15 + 0x10);
        local_98 = *(int *)(iVar15 + 0x14);
        local_9c = *(int *)(iVar15 + 0x18);
        local_a0 = *(int *)(iVar15 + 0x1c);
        iVar15 = *(int *)(iVar15 + 0x20);
        local_40[0] = local_90;
        local_40[1] = local_94;
        local_40[2] = local_98;
        local_40[3] = local_9c;
        local_40[4] = local_a0;
        local_40[5] = iVar15;
        goto LAB_0048364f;
      }
    }
    lVar14 = (longdouble)(**(code **)(*piVar6 + 0xac))(piVar6);
    if ((float)lVar14 == 0.0) {
      puVar11 = &DAT_00d539c2;
      if ((undefined1 *)piVar10[0x1f] != (undefined1 *)0x0) {
        puVar11 = (undefined1 *)piVar10[0x1f];
      }
      DevMsg("Don\'t know how to save model for physics object (class \"%s\")\n",puVar11);
    }
    else {
      lVar14 = (longdouble)(**(code **)(*piVar6 + 0xac))(piVar6);
      local_28 = (float)lVar14;
    }
  }
  else {
    iVar12 = 0;
  }
LAB_00483624:
  iVar15 = 0;
  local_a0 = 0;
  local_9c = 0;
  local_98 = 0;
  local_94 = 0;
  local_90 = 0;
LAB_0048364f:
  iVar9 = CUtlVector<CPhysSaveRestoreBlockHandler::QueuedItem_t,CUtlMemory<CPhysSaveRestoreBlockHandler::QueuedItem_t,int>>
          ::InsertBefore((CUtlVector<CPhysSaveRestoreBlockHandler::QueuedItem_t,CUtlMemory<CPhysSaveRestoreBlockHandler::QueuedItem_t,int>>
                          *)(g_PhysSaveRestoreBlockHandler + 0xc),
                         g_PhysSaveRestoreBlockHandler._24_4_);
  piVar10 = (int *)(iVar9 * 0x38 + g_PhysSaveRestoreBlockHandler._12_4_);
  piVar10[1] = local_50;
  piVar10[3] = local_8c;
  piVar10[10] = iVar15;
  *piVar10 = iVar5;
  piVar10[2] = local_4c;
  piVar10[5] = local_90;
  piVar10[6] = local_94;
  piVar10[7] = local_98;
  piVar10[4] = local_44;
  piVar10[8] = local_9c;
  piVar10[9] = local_a0;
  piVar10[0xb] = (int)local_28;
  piVar10[0xc] = iVar12;
  piVar10[0xd] = (int)piVar1;
  while( true ) {
    if (iVar9 == 0) {
      return;
    }
    iVar5 = (iVar9 + 1) / 2 + -1;
    cVar3 = (*(code *)g_PhysSaveRestoreBlockHandler._32_4_)
                      (g_PhysSaveRestoreBlockHandler._12_4_ + iVar9 * 0x38,
                       iVar5 * 0x38 + g_PhysSaveRestoreBlockHandler._12_4_);
    if (cVar3 != '\0') break;
    CUtlPriorityQueue<CPhysSaveRestoreBlockHandler::QueuedItem_t,CDefUtlPriorityQueueLessFunc<CPhysSaveRestoreBlockHandler::QueuedItem_t>,CUtlMemory<CPhysSaveRestoreBlockHandler::QueuedItem_t,int>>
    ::Swap((CUtlPriorityQueue<CPhysSaveRestoreBlockHandler::QueuedItem_t,CDefUtlPriorityQueueLessFunc<CPhysSaveRestoreBlockHandler::QueuedItem_t>,CUtlMemory<CPhysSaveRestoreBlockHandler::QueuedItem_t,int>>
            *)(g_PhysSaveRestoreBlockHandler + 0xc),iVar5,iVar9);
    iVar9 = iVar5;
  }
  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)