L L4D2node

Mod_LoadMarksurfaces

0x00199340 · 710 bytes · unknown

_Z20Mod_LoadMarksurfacesv

Decompiled

undefined (0 params)

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* Mod_LoadMarksurfaces() */

void Mod_LoadMarksurfaces(void)

{
  int iVar1;
  short sVar2;
  uint uVar3;
  void *pvVar4;
  char *pcVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  short sVar10;
  uint uVar11;
  uint *puVar12;
  uint uVar13;
  int iVar14;
  int iVar15;
  int in_GS_OFFSET;
  undefined1 *puVar16;
  int local_16c;
  int local_168;
  int local_160;
  uint local_140 [3];
  int local_134;
  int local_130;
  int local_128;
  undefined1 local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  puVar16 = (undefined1 *)0x10;
  CMapLoadHelper::CMapLoadHelper((CMapLoadHelper *)local_140,0x10);
  if ((local_140[0] & 1) != 0) {
    puVar16 = s_szMapPathName;
                    /* try { // try from 001995f8 to 001995fc has its CatchHandler @ 0019960d */
    Host_Error("Mod_LoadMarksurfaces: funny lump size in %s",s_szMapPathName);
  }
  uVar3 = local_140[0] >> 1;
  uVar11 = 0xffffffff;
  if (uVar3 < 0x1fc00001) {
    uVar11 = uVar3 * 4;
  }
                    /* try { // try from 001993a9 to 00199485 has its CatchHandler @ 0019960d */
  pvVar4 = operator_new__(uVar11);
  iVar1 = s_pMap;
  local_168 = 0;
  *(void **)(s_pMap + 0x90) = pvVar4;
  *(uint *)(iVar1 + 0x8c) = uVar3;
  if (uVar3 != 0) {
    uVar11 = 0;
    iVar15 = iVar1;
    do {
      uVar13 = (uint)*(ushort *)(local_130 + uVar11 * 2);
      if (*(int *)(iVar15 + 0x70) <= (int)uVar13) {
        Host_Error("Mod_LoadMarksurfaces: bad surface number",puVar16);
      }
      puVar12 = (uint *)(uVar13 * 0x20 + *(int *)(iVar1 + 0x78));
      *(uint **)((int)pvVar4 + uVar11 * 4) = puVar12;
      local_168 = local_168 + (uint)((*puVar12 & 0x810) == 0);
      uVar11 = uVar11 + 1;
      iVar15 = s_pMap;
    } while (uVar3 != uVar11);
  }
  puVar16 = s_szMapPathName;
  if ((&s_MapLumpFiles)[local_128 * 7] != 0) {
    puVar16 = local_124;
  }
  pcVar5 = (char *)va("%s [%s]",puVar16,"surfacehandle");
  iVar6 = Hunk_AllocName(local_168 << 2,pcVar5,true);
  iVar15 = *(int *)(iVar1 + 0x10);
  if (*(int *)(iVar1 + 0xc) < 1) {
LAB_00199589:
    *(int *)(iVar1 + 0x90) = iVar6;
    *(int *)(iVar1 + 0x8c) = local_168;
    if (pvVar4 != (void *)0x0) {
      operator_delete__(pvVar4);
    }
    if (local_134 != 0) {
      (**(code **)(*g_pFileSystem + 0x150))(g_pFileSystem,local_134);
    }
    if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
      __stack_chk_fail();
    }
    return;
  }
  local_160 = 0;
  local_16c = 0;
  if (*(short *)(iVar15 + 0x36) == 0) goto LAB_00199585;
  do {
    sVar10 = 0;
    iVar7 = 0;
    sVar2 = 0;
    iVar8 = local_160;
    do {
      puVar12 = *(uint **)((int)pvVar4 + ((uint)*(ushort *)(iVar15 + 0x34) + iVar7) * 4);
      iVar9 = iVar8;
      if ((*puVar12 & 0x810) == 0) {
        sVar2 = sVar2 + 1;
        iVar9 = iVar8 + 1;
        *(uint **)(iVar6 + iVar8 * 4) = puVar12;
        if ((*puVar12 & 2) != 0) {
          sVar10 = sVar10 + 1;
        }
      }
      iVar7 = iVar7 + 1;
      iVar8 = iVar9;
      iVar14 = iVar15;
    } while (iVar7 < (int)(uint)*(ushort *)(iVar15 + 0x36));
    while( true ) {
      local_16c = local_16c + 1;
      *(short *)(iVar14 + 0x36) = sVar2;
      iVar15 = iVar14 + 0x40;
      *(short *)(iVar14 + 0x38) = sVar10;
      *(undefined2 *)(iVar14 + 0x34) = (undefined2)local_160;
      if (*(int *)(iVar1 + 0xc) <= local_16c) goto LAB_00199589;
      local_160 = iVar9;
      if (*(short *)(iVar14 + 0x76) != 0) break;
LAB_00199585:
      sVar2 = 0;
      sVar10 = 0;
      iVar9 = local_160;
      iVar14 = iVar15;
    }
  } while( true );
}

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)