L L4D2node

MapList_CountMaps

0x0017f3a0 · 260 bytes · __regparm3

_ZL17MapList_CountMapsPKcbRi

Decompiled

undefined (3 params)

/* MapList_CountMaps(char const*, bool, int&) */

int __regparm3 MapList_CountMaps(char *param_1,bool param_2,int *param_3)

{
  size_t sVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  size_t sVar6;
  int local_2c;
  uint local_28;
  
  CMapListManager::RefreshList((CMapListManager *)g_MapListMgr);
  sVar6 = 0;
  *param_3 = 0;
  if ((param_1 != (char *)0x0) && (*param_1 != '\0')) {
    sVar6 = strlen(param_1);
  }
  local_28 = (uint)param_2;
  local_2c = 0;
  do {
    if (0 < (int)g_MapListMgr._20_4_) {
      iVar5 = 0;
      do {
        while( true ) {
          iVar2 = CMapListManager::GetMapName((CMapListManager *)g_MapListMgr,iVar5);
          iVar3 = CMapListManager::IsMapValid((CMapListManager *)g_MapListMgr,iVar5);
          if ((sVar6 != 0) && (iVar4 = V_stristr((char *)(iVar2 + 5),param_1), iVar4 == 0)) break;
          if (iVar3 != 0) {
            sVar1 = strlen((char *)(iVar2 + 5));
            iVar2 = *param_3;
            if (*param_3 <= (int)(sVar1 + 1)) {
              iVar2 = sVar1 + 1;
            }
            local_2c = local_2c + 1;
            *param_3 = iVar2;
          }
          iVar5 = iVar5 + 1;
          if ((int)g_MapListMgr._20_4_ <= iVar5) goto LAB_0017f480;
        }
        iVar5 = iVar5 + 1;
      } while (iVar5 < (int)g_MapListMgr._20_4_);
    }
LAB_0017f480:
    local_28 = local_28 - 1;
    if (local_28 == 0xffffffff) {
      return local_2c;
    }
  } while( true );
}

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)