L L4D2node

CModelLoader::Map_IsValid

0x00194b80 · 704 bytes · __regparm3

_ZN12CModelLoader11Map_IsValidEPKcb.part.11

Decompiled

undefined (2 params)

/* CModelLoader::Map_IsValid(char const*, bool) [clone .part.11] */

undefined4 __regparm3 CModelLoader::Map_IsValid(char *param_1,bool param_2)

{
  bool bVar1;
  char *pcVar2;
  int iVar3;
  int *piVar4;
  undefined4 uVar5;
  int iVar6;
  char cVar7;
  int in_GS_OFFSET;
  byte bVar8;
  undefined *puVar9;
  undefined4 uVar10;
  int local_93c;
  int local_938;
  undefined4 auStack_934 [257];
  undefined1 local_530 [8];
  undefined4 auStack_528 [257];
  char local_124 [260];
  int local_20;
  
  bVar8 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar2 = (char *)V_UnqualifiedFileName(param_1);
  if ((pcVar2 != (char *)0x0) && (cVar7 = *pcVar2, cVar7 != '\0')) {
    bVar1 = false;
    do {
      if (cVar7 < ' ') {
        bVar1 = true;
      }
      switch(cVar7) {
      case '\"':
      case '\'':
      case '*':
      case '/':
      case ':':
      case ';':
      case '<':
      case '>':
      case '?':
      case '\\':
      case '|':
        bVar1 = true;
      }
      pcVar2 = pcVar2 + 1;
    } while ((pcVar2 != (char *)0x0) && (cVar7 = *pcVar2, cVar7 != '\0'));
    if (bVar1) {
      uVar10 = 0;
      Warning("Map with illegal characters in filename\n");
      goto LAB_00194d1b;
    }
  }
  V_snprintf(local_124,0x104,"maps/%s.bsp",param_1);
  uVar10 = 0;
  puVar9 = &DAT_002a076d;
  iVar3 = (**(code **)(*g_pFileSystem + 0x114))
                    (g_pFileSystem,local_124,&DAT_002a3e98,0,&DAT_002a076d,0);
  if (iVar3 == 0) {
    if (!param_2) {
      Warning("CModelLoader::Map_IsValid:  No such map \'%s\'\n",local_124);
    }
  }
  else {
    piVar4 = &local_93c;
    for (iVar6 = 0x103; iVar6 != 0; iVar6 = iVar6 + -1) {
      *piVar4 = 0;
      piVar4 = piVar4 + (uint)bVar8 * -2 + 1;
    }
    (**(code **)g_pFileSystem[1])(g_pFileSystem + 1,&local_93c,0x40c,iVar3,puVar9,uVar10,iVar3);
    (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar3);
    if (local_938 < 0x15) {
      memcpy(local_530,&local_93c,0x40c);
      iVar3 = 0;
      do {
        *(undefined4 *)((int)auStack_934 + iVar3 + 4) = *(undefined4 *)((int)auStack_528 + iVar3);
        *(undefined4 *)((int)auStack_934 + iVar3 + 8) =
             *(undefined4 *)((int)auStack_528 + iVar3 + 4);
        *(undefined4 *)((int)auStack_934 + iVar3) = *(undefined4 *)((int)auStack_528 + iVar3 + 8);
        iVar3 = iVar3 + 0x10;
      } while (iVar3 != 0x400);
    }
    if (local_93c == 0x50534256) {
      if (local_938 - 0x13U < 3) {
        uVar10 = 1;
        V_strncpy(Map_IsValid(char_const*,bool)::s_szBaseMapName,param_1,0x20);
        goto LAB_00194d1b;
      }
      if (!param_2) {
        Warning("CModelLoader::Map_IsValid:  Map \'%s\' bsp version %i, expecting %i\n",local_124,
                local_938,0x15);
      }
    }
    else if (!param_2) {
      Warning("CModelLoader::Map_IsValid: \'%s\' is not a valid BSP file\n",local_124);
    }
  }
  piVar4 = (int *)CommandLine_Tier0();
  uVar10 = 0;
  iVar3 = (**(code **)(*piVar4 + 0xc))(piVar4,"-dumpvidmemstats",0);
  if (iVar3 != 0) {
    uVar5 = Cbuf_GetCurrentPlayer();
    Cbuf_AddText(uVar5,"quit\n",0);
  }
LAB_00194d1b:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return uVar10;
}

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)