L L4D2node

CMapLoadHelper::CMapLoadHelper

0x00195a00 · 621 bytes · __thiscall

_ZN14CMapLoadHelperC1Ei

Decompiled

undefined (2 params)

/* CMapLoadHelper::CMapLoadHelper(int) */

void __thiscall CMapLoadHelper::CMapLoadHelper(CMapLoadHelper *this,int param_1)

{
  uint uVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  int iVar7;
  uint local_30;
  int local_28;
  int local_24;
  undefined1 local_20 [16];
  
  if (0x3f < (uint)param_1) {
    Sys_Error("Can\'t load lump %i, range is 0 to %i!!!",param_1,0x3f);
  }
  *(undefined4 *)this = 0;
  *(undefined4 *)(this + 4) = 0xffffffff;
  *(int *)(this + 0x18) = param_1;
  *(undefined4 *)(this + 0x10) = 0;
  *(undefined4 *)(this + 0xc) = 0;
  *(undefined4 *)(this + 0x14) = 0;
  iVar3 = (&DAT_003a8710)[param_1 * 4];
  *(int *)this = iVar3;
  *(undefined4 *)(this + 4) = (&DAT_003a870c)[param_1 * 4];
  iVar7 = s_MapFileHandle;
  *(undefined4 *)(this + 8) = (&DAT_003a8708)[param_1 * 4];
  iVar6 = param_1 * 0x1c;
  iVar4 = (&s_MapLumpFiles)[param_1 * 7];
  if (iVar4 != 0) {
    iVar3 = *(int *)(&DAT_003a7d74 + iVar6);
    *(int *)this = iVar3;
    *(undefined4 *)(this + 4) = *(undefined4 *)(&DAT_003a7d68 + iVar6);
    *(undefined4 *)(this + 8) = *(undefined4 *)(&DAT_003a7d70 + iVar6);
    iVar7 = iVar4;
    if (serverGameDLL != (int *)0x0) {
      (**(code **)(*serverGameDLL + 0xa0))
                (serverGameDLL,s_szMapPathName,this + 0x1c,0x104,
                 *(undefined4 *)(&DAT_003a7d64 + iVar6));
      iVar3 = *(int *)this;
    }
  }
  if (iVar3 != 0) {
    if (s_MapBuffer == 0) {
      if (s_MapFileHandle == 0) {
        Sys_Error("Can\'t load map from invalid handle!!!");
      }
      cVar2 = (**(code **)(*g_pFileSystem + 0x148))
                        (g_pFileSystem,iVar7,&local_28,&local_24,local_20);
      uVar1 = *(uint *)(this + 4);
      if ((cVar2 == '\0') || ((uVar1 & 3) != 0)) {
        cVar2 = '\0';
      }
      uVar5 = 1;
      if (*(uint *)this != 0) {
        uVar5 = *(uint *)this;
      }
      local_30 = uVar1;
      if (cVar2 != '\0') {
        local_30 = -local_28 & uVar1;
        uVar5 = uVar5 + (((uVar1 - 1) + local_24) - local_30) & -local_24;
      }
      iVar4 = (**(code **)(*g_pFileSystem + 0x14c))(g_pFileSystem,iVar7,uVar5,local_30);
      *(int *)(this + 0xc) = iVar4;
      if (iVar4 == 0) {
        if (*(int *)this == 0) {
          return;
        }
        Sys_Error("Can\'t load lump %i, allocation of %i bytes failed!!!",param_1,*(int *)this + 1);
      }
      if (*(int *)this != 0) {
        (**(code **)(g_pFileSystem[1] + 0x10))(g_pFileSystem + 1,iVar7,local_30,0);
        (**(code **)(*g_pFileSystem + 0x118))
                  (g_pFileSystem,*(undefined4 *)(this + 0xc),uVar5,uVar5,iVar7);
        *(uint *)(this + 0x10) = (*(int *)(this + 4) - local_30) + *(int *)(this + 0xc);
      }
    }
    else {
      *(int *)(this + 0x10) = s_MapBuffer + *(int *)(this + 4);
    }
  }
  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)