L L4D2node

CMultiplayRules::GetNextLevelName

0x0046f490 · 792 bytes · __thiscall

_ZN15CMultiplayRules16GetNextLevelNameEPcib

Decompiled

undefined (4 params)

/* CMultiplayRules::GetNextLevelName(char*, int, bool) */

void __thiscall
CMultiplayRules::GetNextLevelName(CMultiplayRules *this,char *param_1,int param_2,bool param_3)

{
  void *pvVar1;
  int iVar2;
  uchar *puVar3;
  int iVar4;
  char *pcVar5;
  int iVar6;
  char *local_20 [4];
  
  pcVar5 = "FCVAR_NEVER_AS_STRING";
  if ((mapcyclefile[0x15] & 0x10) == 0) {
    pcVar5 = "";
    if (*(char **)(mapcyclefile._28_4_ + 0x24) != (char *)0x0) {
      pcVar5 = *(char **)(mapcyclefile._28_4_ + 0x24);
    }
  }
  iVar2 = (**(code **)(*filesystem + 0x164))(filesystem,pcVar5,"GAME");
  if (iVar2 == 0) {
    local_20[0] = operator_new__(0x20);
    pcVar5 = "";
    if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
      pcVar5 = *(char **)(gpGlobals + 0x3c);
    }
    V_strncpy(local_20[0],pcVar5,0x20);
    CUtlVector<char*,CUtlMemory<char*,int>>::InsertBefore
              ((CUtlVector<char*,CUtlMemory<char*,int>> *)&m_MapList,DAT_00f7dccc,local_20);
  }
  else if (iVar2 != m_nMapCycleTimeStamp) {
    iVar6 = 0;
    m_nMapCycleindex = 0;
    m_nMapCycleTimeStamp = iVar2;
    if (0 < DAT_00f7dccc) {
      do {
        pvVar1 = *(void **)(m_MapList + iVar6 * 4);
        if (pvVar1 != (void *)0x0) {
          operator_delete__(pvVar1);
        }
        iVar6 = iVar6 + 1;
      } while (iVar6 < DAT_00f7dccc);
    }
    DAT_00f7dccc = 0;
    puVar3 = (uchar *)UTIL_LoadFileForMe(pcVar5,(int *)local_20);
    if ((puVar3 != (uchar *)0x0) && (local_20[0] != (char *)0x0)) {
      iVar2 = 0;
      V_SplitString((char *)puVar3,"\n",(CUtlVector *)&m_MapList);
      if (0 < DAT_00f7dccc) {
        do {
          while( true ) {
            iVar6 = iVar2 * 4;
            StripChar(*(char **)(m_MapList + iVar2 * 4),'\r');
            StripChar(*(char **)(m_MapList + iVar2 * 4),' ');
            iVar4 = (**(code **)(*engine + 4))(engine,*(undefined4 *)(m_MapList + iVar2 * 4));
            if (iVar4 != 0) break;
            Warning("Invalid map \'%s\' included in map cycle file. Ignored.\n",
                    *(undefined4 *)(m_MapList + iVar2 * 4));
LAB_0046f6c8:
            if (*(void **)(m_MapList + iVar6) != (void *)0x0) {
              operator_delete__(*(void **)(m_MapList + iVar6));
            }
            iVar4 = (DAT_00f7dccc - iVar2) + -1;
            if (0 < iVar4) {
              _V_memmove((void *)(m_MapList + iVar6),(void *)(m_MapList + 4 + iVar6),iVar4 * 4);
            }
            DAT_00f7dccc = DAT_00f7dccc + -1;
            if (DAT_00f7dccc <= iVar2) goto LAB_0046f7b6;
          }
          iVar4 = V_strncmp(*(char **)(m_MapList + iVar2 * 4),"//",2);
          if (iVar4 == 0) goto LAB_0046f6c8;
          iVar2 = iVar2 + 1;
        } while (iVar2 < DAT_00f7dccc);
      }
LAB_0046f7b6:
      UTIL_FreeFile(puVar3);
    }
  }
  if (DAT_00f7dccc == 0) {
    local_20[0] = operator_new__(0x20);
    pcVar5 = "";
    if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
      pcVar5 = *(char **)(gpGlobals + 0x3c);
    }
    V_strncpy(local_20[0],pcVar5,0x20);
    CUtlVector<char*,CUtlMemory<char*,int>>::InsertBefore
              ((CUtlVector<char*,CUtlMemory<char*,int>> *)&m_MapList,DAT_00f7dccc,local_20);
  }
  if (param_3) {
    m_nMapCycleindex = RandomInt(0,DAT_00f7dccc + -1);
  }
  V_strncpy(param_1,*(char **)(m_MapList + m_nMapCycleindex * 4),param_2);
  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)