L L4D2node

CSceneCache::Restore

0x004add90 · 797 bytes · __thiscall

_ZN11CSceneCache7RestoreER10CUtlBuffer

Decompiled

undefined (2 params)

/* CSceneCache::Restore(CUtlBuffer&) */

void __thiscall CSceneCache::Restore(CSceneCache *this,CUtlBuffer *param_1)

{
  ushort uVar1;
  int iVar2;
  undefined2 uVar3;
  char cVar4;
  short sVar5;
  int iVar6;
  uint *puVar7;
  uint uVar8;
  int iVar9;
  int in_GS_OFFSET;
  uint local_228;
  undefined4 local_224;
  char local_220 [512];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (((byte)param_1[0x15] & 1) == 0) {
    cVar4 = CUtlBuffer::CheckGet(param_1,4);
    uVar8 = 0;
    if (cVar4 != '\0') {
      if (((byte)param_1[0x34] & 1) == 0) {
        iVar9 = *(int *)(param_1 + 0xc);
        uVar8 = *(uint *)(*(int *)param_1 + (iVar9 - *(int *)(param_1 + 0x20)));
      }
      else {
        puVar7 = (uint *)((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) + *(int *)param_1);
        if (puVar7 == (uint *)0x0) {
          puVar7 = &local_228;
        }
        local_224 = local_228;
        local_224._1_3_ = (undefined3)(local_228 >> 8);
        local_224 = CONCAT31(local_224._1_3_,*(undefined1 *)((int)puVar7 + 3));
        local_224._2_2_ = (undefined2)(local_228 >> 0x10);
        local_224._0_2_ =
             CONCAT11(*(undefined1 *)((int)puVar7 + 2),*(undefined1 *)((int)puVar7 + 3));
        local_224._3_1_ = (undefined1)(local_228 >> 0x18);
        local_224._0_3_ = CONCAT12(*(undefined1 *)((int)puVar7 + 1),(ushort)local_224);
        local_224 = CONCAT13((char)*puVar7,(undefined3)local_224);
        _V_memcpy(&local_228,&local_224,4);
        iVar9 = *(int *)(param_1 + 0xc);
        uVar8 = local_228;
      }
      *(int *)(param_1 + 0xc) = iVar9 + 4;
    }
  }
  else {
    local_228 = 0;
    CUtlBuffer::Scanf(param_1,"%u",&local_228);
    uVar8 = local_228;
  }
  *(uint *)(this + 4) = uVar8;
  if (((byte)param_1[0x15] & 1) == 0) {
    cVar4 = CUtlBuffer::CheckGet(param_1,2);
    if (cVar4 == '\0') goto LAB_004adeff;
    if (((byte)param_1[0x34] & 1) == 0) {
      iVar9 = *(int *)(param_1 + 0xc);
      uVar1 = *(ushort *)(*(int *)param_1 + (iVar9 - *(int *)(param_1 + 0x20)));
    }
    else {
      puVar7 = (uint *)((*(int *)(param_1 + 0xc) - *(int *)(param_1 + 0x20)) + *(int *)param_1);
      if (puVar7 == (uint *)0x0) {
        puVar7 = &local_228;
      }
      uVar3 = local_224._2_2_;
      local_224 = CONCAT22(local_224._2_2_,(ushort)local_228);
      local_224 = CONCAT31(local_224._1_3_,*(undefined1 *)((int)puVar7 + 1));
      local_224._0_2_ = CONCAT11((char)*puVar7,*(undefined1 *)((int)puVar7 + 1));
      local_224 = CONCAT22(uVar3,(ushort)local_224);
      _V_memcpy(&local_228,&local_224,2);
      iVar9 = *(int *)(param_1 + 0xc);
      uVar1 = (ushort)local_228;
    }
    *(int *)(param_1 + 0xc) = iVar9 + 2;
  }
  else {
    local_228 = local_228 & 0xffff0000;
    CUtlBuffer::Scanf(param_1,"%d",&local_228);
    uVar1 = (ushort)local_228;
  }
  if (uVar1 != 0) {
    iVar9 = 0;
    do {
      CUtlBuffer::GetString(param_1,local_220,0x200);
      iVar6 = (**(code **)(*soundemitterbase + 0x1c))(soundemitterbase,local_220);
      if (iVar6 != -1) {
        iVar2 = *(int *)(this + 0x14);
        sVar5 = (short)iVar6;
        if (iVar2 < 1) {
LAB_004adecd:
          local_224 = CONCAT22(local_224._2_2_,sVar5);
          CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>>::InsertBefore
                    ((CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>> *)(this + 8),iVar2,
                     (ushort *)&local_224);
        }
        else if (sVar5 != **(short **)(this + 8)) {
          iVar6 = 0;
          do {
            iVar6 = iVar6 + 1;
            if (iVar6 == iVar2) goto LAB_004adecd;
          } while (sVar5 != (*(short **)(this + 8))[iVar6]);
          if (iVar6 == -1) goto LAB_004adecd;
        }
      }
      iVar9 = iVar9 + 1;
    } while (iVar9 < (int)(uint)uVar1);
  }
LAB_004adeff:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)