L L4D2node

CRC_MapFile

0x00114f80 · 835 bytes · __cdecl

_Z11CRC_MapFilePmPKc

Decompiled

undefined (2 params)

/* CRC_MapFile(unsigned long*, char const*) */

undefined4 CRC_MapFile(ulong *param_1,char *param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  uint uVar5;
  uint *__dest;
  int in_GS_OFFSET;
  undefined4 uStack_10840;
  void *pvStack_1083c;
  undefined1 auStack_10838 [4];
  int iStack_10834;
  uint auStack_10830 [516];
  undefined1 auStack_10020 [65552];
  
  iVar1 = *(int *)(in_GS_OFFSET + 0x14);
  iVar2 = COM_OpenFile(param_2,&pvStack_1083c,0);
  if ((pvStack_1083c != (void *)0x0) && (iVar2 != -1)) {
    iVar2 = (**(code **)(g_pFileSystem[1] + 0x14))(g_pFileSystem + 1,pvStack_1083c);
    iVar3 = (**(code **)g_pFileSystem[1])(g_pFileSystem + 1,auStack_10838,0x40c,pvStack_1083c);
    if (iVar3 != 0) {
      if (iStack_10834 - 0x13U < 3) {
        __dest = auStack_10830 + 0x101;
        if (iStack_10834 != 0x15) {
          memcpy(__dest,auStack_10838,0x40c);
          iVar3 = 0;
          do {
            *(undefined4 *)((int)auStack_10830 + iVar3 + 4) =
                 *(undefined4 *)((int)auStack_10830 + iVar3 + 0x40c);
            *(undefined4 *)((int)auStack_10830 + iVar3 + 8) =
                 *(undefined4 *)((int)auStack_10830 + iVar3 + 0x410);
            *(undefined4 *)((int)auStack_10830 + iVar3) =
                 *(undefined4 *)((int)auStack_10830 + iVar3 + 0x414);
            iVar3 = iVar3 + 0x10;
          } while (iVar3 != 0x400);
        }
        g_pMapHeader = auStack_10838;
        uVar4 = 0;
        do {
          __dest[uVar4] = uVar4;
          uVar4 = uVar4 + 1;
        } while (uVar4 != 0x40);
        qsort(__dest,0x40,4,LumpCompare);
        do {
          uVar4 = *__dest;
          if (uVar4 != 0) {
            uVar5 = auStack_10830[uVar4 * 4 + 2];
            if (0 < (int)uVar5) {
              (**(code **)(g_pFileSystem[1] + 0x10))
                        (g_pFileSystem + 1,pvStack_1083c,iVar2 + auStack_10830[uVar4 * 4 + 1],0);
              do {
                if (uVar5 < 0x10001) {
                  iVar3 = (**(code **)g_pFileSystem[1])(g_pFileSystem + 1,auStack_10020,uVar5);
                }
                else {
                  iVar3 = (**(code **)g_pFileSystem[1])
                                    (g_pFileSystem + 1,auStack_10020,0x10000,pvStack_1083c);
                }
                if (0 < iVar3) {
                  uVar5 = uVar5 - iVar3;
                  CRC32_ProcessBuffer(param_1,auStack_10020,iVar3);
                }
                uStack_10840 = (**(code **)(*g_pFileSystem + 0x58))(g_pFileSystem,pvStack_1083c);
                if ((char)uStack_10840 == '\0') {
                  if (pvStack_1083c == (void *)0x0) goto LAB_001151f8;
                  goto LAB_00115250;
                }
              } while (0 < (int)uVar5);
            }
          }
          __dest = __dest + 1;
        } while (__dest != auStack_10830 + 0x141);
        uStack_10840 = 1;
        if (pvStack_1083c != (void *)0x0) {
          uStack_10840 = 1;
LAB_00115250:
          (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,pvStack_1083c);
        }
      }
      else {
        (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,pvStack_1083c);
        ConMsg("Map [%s] has incorrect BSP version (%i should be %i).\n",param_2,iStack_10834,0x15);
        uStack_10840 = 0;
      }
      goto LAB_001151fa;
    }
    ConMsg("Could not read BSP header for map [%s].\n",param_2);
    (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,pvStack_1083c);
  }
LAB_001151f8:
  uStack_10840 = 0;
LAB_001151fa:
  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return uStack_10840;
}

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)