L L4D2node

Mod_LoadSurfedges

0x00199640 · 465 bytes · __cdecl

_Z17Mod_LoadSurfedgesP7medge_t

Decompiled

undefined (1 param)

/* Mod_LoadSurfedges(medge_t*) */

void Mod_LoadSurfedges(medge_t *param_1)

{
  uint uVar1;
  undefined1 *puVar2;
  char *pcVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  int in_GS_OFFSET;
  bool bVar7;
  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);
  CMapLoadHelper::CMapLoadHelper((CMapLoadHelper *)local_140,0xd);
  if ((local_140[0] & 3) != 0) {
                    /* try { // try from 001997ef to 0019981d has its CatchHandler @ 00199828 */
    Host_Error("Mod_LoadSurfedges: funny lump size in %s",s_szMapPathName);
  }
  uVar1 = local_140[0] >> 2;
  if (0x7cffe < uVar1 - 1) {
    Host_Error("Mod_LoadSurfedges: bad surfedges count in %s: %i",s_szMapPathName,uVar1);
  }
  puVar2 = s_szMapPathName;
  if ((&s_MapLumpFiles)[local_128 * 7] != 0) {
    puVar2 = local_124;
  }
                    /* try { // try from 001996de to 00199777 has its CatchHandler @ 00199828 */
  pcVar3 = (char *)va("%s [%s]",puVar2,"surfedges");
  iVar4 = Hunk_AllocName(uVar1 * 2,pcVar3,true);
  iVar6 = s_pMap;
  uVar5 = 0;
  *(int *)(s_pMap + 0x88) = iVar4;
  *(uint *)(iVar6 + 0x84) = uVar1;
  if (uVar1 != 0) {
    do {
      iVar6 = *(int *)(local_130 + uVar5 * 4);
      bVar7 = iVar6 < 0;
      if (bVar7) {
        iVar6 = -iVar6;
      }
      if (s_nMapEdgesLoaded <= iVar6) {
        Host_Error("Map %s is corrupted and cannot be loaded.",s_szMapPathName);
      }
      *(undefined2 *)(iVar4 + uVar5 * 2) = *(undefined2 *)(param_1 + iVar6 * 4 + (uint)bVar7 * 2);
      uVar5 = uVar5 + 1;
    } while (uVar1 != uVar5);
  }
  if (param_1 != (medge_t *)0x0) {
    operator_delete__(param_1);
  }
  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;
}

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)