L L4D2node

BuildGeneralMapList

0x0018c230 · 1283 bytes · __cdecl

_Z19BuildGeneralMapListP10CUtlVectorI13maplist_map_t10CUtlMemoryIS0_iEEbPKcPcPi

Decompiled

undefined (5 params)

/* BuildGeneralMapList(CUtlVector<maplist_map_t, CUtlMemory<maplist_map_t, int> >*, bool, char
   const*, char*, int*) */

undefined4
BuildGeneralMapList(CUtlVector *param_1,bool param_2,char *param_3,char *param_4,int *param_5)

{
  code *pcVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  char *pcVar5;
  int *piVar6;
  int iVar7;
  char *pcVar8;
  int in_GS_OFFSET;
  undefined4 uVar9;
  char *local_168;
  maplist_map_t local_164 [64];
  maplist_map_t local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (param_2) {
    if (param_3 == (char *)0x0) {
      Error("Unable to find %s maplist filename\n",param_4);
      uVar9 = 0;
      goto LAB_0018c428;
    }
    uVar9 = 0;
    iVar3 = (**(code **)(*(int *)(g_pFileSystem + 4) + 8))
                      (g_pFileSystem + 4,param_3,&DAT_002a3e98,0);
    if (iVar3 == 0) {
      Error("Unable to load %s maplist file: %s\n",param_4,param_3,uVar9,0);
      uVar9 = 0;
      goto LAB_0018c428;
    }
    iVar7 = iVar3;
    iVar4 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x18))(g_pFileSystem + 4,iVar3);
    if ((0 < iVar4) && (pcVar5 = operator_new__(iVar4 + 1), pcVar5 != (char *)0x0)) {
      iVar3 = (*(code *)**(undefined4 **)(g_pFileSystem + 4))(g_pFileSystem + 4,pcVar5,iVar4,iVar3);
      if (iVar4 == iVar3) {
        pcVar5[iVar4] = '\0';
        pcVar8 = pcVar5;
        while (pcVar8 = (char *)COM_Parse(pcVar8), com_token != '\0') {
          V_strncpy((char *)local_124,&com_token,0x104);
          iVar3 = (**(code **)(*(int *)g_pVEngineServer + 4))(g_pVEngineServer,local_124);
          if (iVar3 != 0) {
            iVar3 = COM_TokenWaiting(pcVar8);
            while (iVar3 != 0) {
              pcVar8 = (char *)COM_Parse(pcVar8);
              iVar3 = COM_TokenWaiting(pcVar8);
            }
            V_strncpy((char *)local_164,(char *)local_124,0x40);
            CUtlVector<maplist_map_t,CUtlMemory<maplist_map_t,int>>::InsertBefore
                      ((CUtlVector<maplist_map_t,CUtlMemory<maplist_map_t,int>> *)param_1,
                       *(int *)(param_1 + 0xc),local_164);
          }
        }
      }
      operator_delete__(pcVar5);
    }
    (**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))(g_pFileSystem + 4,iVar7);
  }
  else {
    local_168 = (char *)0x0;
    piVar6 = (int *)CommandLine_Tier0();
    iVar3 = (**(code **)(*piVar6 + 0xc))(piVar6,&DAT_002b6bf6,&local_168);
    if ((iVar3 == 0) || (local_168 == (char *)0x0)) {
      pcVar5 = (char *)Sys_FindFirst("maps/*.bsp",(char *)0x0,0);
      while (pcVar5 != (char *)0x0) {
        while( true ) {
          pcVar1 = *(code **)(*(int *)(g_pFileSystem + 4) + 0x28);
          uVar9 = va("maps/%s",pcVar5);
          cVar2 = (*pcVar1)(g_pFileSystem + 4,uVar9,&DAT_002a0772);
          if (cVar2 != '\0') break;
          pcVar5 = (char *)Sys_FindNext((char *)0x0,0);
          if (pcVar5 == (char *)0x0) goto LAB_0018c617;
        }
        V_strncpy((char *)local_124,pcVar5,0x104);
        pcVar5 = strchr((char *)local_124,0x2e);
        if (pcVar5 != (char *)0x0) {
          *pcVar5 = '\0';
        }
        pcVar5 = (char *)Sys_FindNext((char *)0x0,0);
        iVar3 = (**(code **)(*(int *)g_pVEngineServer + 4))(g_pVEngineServer,local_124);
        if (iVar3 != 0) {
          V_strncpy((char *)local_164,(char *)local_124,0x40);
          CUtlVector<maplist_map_t,CUtlMemory<maplist_map_t,int>>::InsertBefore
                    ((CUtlVector<maplist_map_t,CUtlMemory<maplist_map_t,int>> *)param_1,
                     *(int *)(param_1 + 0xc),local_164);
        }
      }
LAB_0018c617:
      Sys_FindClose();
    }
    else {
      iVar3 = (**(code **)(*(int *)g_pVEngineServer + 4))(g_pVEngineServer,local_168);
      if (iVar3 != 0) {
        V_strncpy((char *)local_124,local_168,0x40);
        CUtlVector<maplist_map_t,CUtlMemory<maplist_map_t,int>>::InsertBefore
                  ((CUtlVector<maplist_map_t,CUtlMemory<maplist_map_t,int>> *)param_1,
                   *(int *)(param_1 + 0xc),local_124);
      }
      piVar6 = (int *)CommandLine_Tier0();
      (**(code **)(*piVar6 + 0x10))(piVar6,&DAT_002b6bf6);
    }
  }
  iVar3 = *(int *)(param_1 + 0xc);
  if (iVar3 == 0) {
    Msg("%s: No maps found\n",param_4);
    uVar9 = 0;
    goto LAB_0018c428;
  }
  Msg("%s: Creating for:\n",param_4);
  local_168 = (char *)0x0;
  *param_5 = 0;
  piVar6 = (int *)CommandLine_Tier0();
  iVar7 = (**(code **)(*piVar6 + 0xc))(piVar6,"-startmap",&local_168);
  if ((iVar7 == 0) || (local_168 == (char *)0x0)) {
    if (0 < iVar3) goto LAB_0018c3cc;
  }
  else {
    iVar7 = 0;
    if (0 < iVar3) {
      do {
        iVar4 = _V_stricmp((char *)(iVar7 * 0x40 + *(int *)param_1),local_168);
        if (iVar4 == 0) {
          *param_5 = iVar7;
        }
        iVar7 = iVar7 + 1;
      } while (iVar7 != iVar3);
LAB_0018c3cc:
      iVar7 = 0;
      do {
        while (iVar4 = iVar7 * 0x40, *param_5 <= iVar7) {
          iVar7 = iVar7 + 1;
          Msg("+  %s\n",iVar4 + *(int *)param_1);
          if (iVar3 <= iVar7) goto LAB_0018c423;
        }
        iVar7 = iVar7 + 1;
        Msg("-  %s\n",iVar4 + *(int *)param_1);
      } while (iVar7 < iVar3);
    }
  }
LAB_0018c423:
  uVar9 = 1;
LAB_0018c428:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar9;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)