L L4D2node

CMapLoadHelper::InitFromMemory

0x001956d0 · 465 bytes · __cdecl

_ZN14CMapLoadHelper14InitFromMemoryEP7model_tPKvi

Decompiled

undefined (3 params)

/* CMapLoadHelper::InitFromMemory(model_t*, void const*, int) */

void CMapLoadHelper::InitFromMemory(model_t *param_1,void *param_2,int param_3)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int in_GS_OFFSET;
  undefined1 local_520 [8];
  undefined4 auStack_518 [257];
  char local_114 [260];
  int local_10;
  
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  s_nMapLoadRecursion = s_nMapLoadRecursion + 1;
  if (s_nMapLoadRecursion < 2) {
    s_pMap = (undefined *)0x0;
    s_MapFileHandle = 0;
    _V_memset(&s_MapHeader,0,0x40c);
    _V_memset(&s_MapLumpFiles,0,0x700);
    V_strncpy(s_szMapPathName,(char *)(param_1 + 4),0x104);
    V_strncpy(local_114,s_szMapPathName,0x104);
    CUtlBuffer::SetExternalBuffer((CUtlBuffer *)&s_MapBuffer,param_2,param_3,param_3,0);
    _V_memcpy(&s_MapHeader,param_2,0x40c);
    iVar1 = DAT_003a8704;
    if (DAT_003a8704 < 0x15) {
      memcpy(local_520,&s_MapHeader,0x40c);
      iVar2 = 0;
      do {
        *(undefined4 *)((int)&DAT_003a870c + iVar2) = *(undefined4 *)((int)auStack_518 + iVar2);
        *(undefined4 *)((int)&DAT_003a8710 + iVar2) = *(undefined4 *)((int)auStack_518 + iVar2 + 4);
        iVar3 = iVar2 + 0x10;
        *(undefined4 *)((int)&DAT_003a8708 + iVar2) = *(undefined4 *)((int)auStack_518 + iVar2 + 8);
        iVar2 = iVar3;
      } while (iVar3 != 0x400);
    }
    if (s_MapHeader == 0x50534256) {
      if (iVar1 - 0x13U < 3) {
        s_pMap = &DAT_003a8b88;
        g_ServerGlobalVariables._64_4_ = DAT_003a8b08;
      }
      else {
        Host_Error("CMapLoadHelper::Init, map %s has wrong version (%i when expecting %i)\n",
                   local_114,iVar1,0x15);
      }
    }
    else {
      Host_Error("CMapLoadHelper::Init, map %s has wrong identifier\n",local_114);
    }
  }
  if (local_10 != *(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)