L L4D2node

CollisionBSPData_LoadBrushes

0x00121af0 · 339 bytes · __cdecl

_Z28CollisionBSPData_LoadBrushesP17CCollisionBSPData

Decompiled

undefined (1 param)

/* CollisionBSPData_LoadBrushes(CCollisionBSPData*) */

void CollisionBSPData_LoadBrushes(CCollisionBSPData *param_1)

{
  undefined4 *puVar1;
  undefined4 *puVar2;
  uint uVar3;
  undefined4 uVar4;
  uint uVar5;
  uint uVar6;
  int in_GS_OFFSET;
  CMapLoadHelper local_140 [288];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  CMapLoadHelper::CMapLoadHelper(local_140,0x12);
                    /* try { // try from 00121b29 to 00121bf5 has its CatchHandler @ 00121c45 */
  puVar2 = (undefined4 *)CMapLoadHelper::LumpBase(local_140);
  uVar3 = CMapLoadHelper::LumpSize(local_140);
  if (uVar3 != (uVar3 / 0xc) * 0xc) {
    Sys_Error("CMod_LoadBrushes: funny lump size");
  }
  uVar3 = CMapLoadHelper::LumpSize(local_140);
  uVar3 = uVar3 / 0xc;
  if (0x2000 < uVar3) {
    Sys_Error("Map has too many brushes");
  }
  uVar4 = Hunk_AllocName(uVar3 << 3,"map_brushes",true);
  *(undefined4 *)(param_1 + 0xc4) = uVar4;
  *(uint *)(param_1 + 200) = uVar3;
  *(uint *)(param_1 + 0xc0) = uVar3;
  uVar6 = 0;
  uVar5 = uVar3;
  if (uVar3 != 0) {
    while( true ) {
      if ((int)uVar5 <= (int)uVar6) {
        Error("Cannot load corrupted map.\n");
      }
      puVar1 = (undefined4 *)(*(int *)(param_1 + 0xc4) + uVar6 * 8);
      uVar6 = uVar6 + 1;
      *(short *)((int)puVar1 + 6) = (short)*puVar2;
      *(short *)(puVar1 + 1) = (short)puVar2[1];
      *puVar1 = puVar2[2];
      if (uVar3 == uVar6) break;
      uVar5 = *(uint *)(param_1 + 200);
      puVar2 = puVar2 + 3;
    }
  }
  CMapLoadHelper::~CMapLoadHelper(local_140);
  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)