L L4D2node

CDownloadListGenerator::LoadServerWhiteList

0x0013fa60 · 801 bytes · __thiscall

_ZN22CDownloadListGenerator19LoadServerWhiteListEP9KeyValues

Decompiled

undefined (2 params)

/* CDownloadListGenerator::LoadServerWhiteList(KeyValues*) */

bool __thiscall
CDownloadListGenerator::LoadServerWhiteList(CDownloadListGenerator *this,KeyValues *param_1)

{
  int iVar1;
  KeyValues *this_00;
  char *pcVar2;
  char *pcVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  byte bVar7;
  int in_GS_OFFSET;
  int local_26c [3];
  int local_260;
  undefined4 *local_254 [3];
  int local_248;
  char local_239 [260];
  WhiteListFileData local_135 [260];
  undefined4 local_31;
  undefined4 local_2d;
  undefined4 local_29;
  undefined4 local_25;
  byte local_21;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  EnsureCRCFilePath();
  iVar1 = *(int *)(this + 0x18c);
  this_00 = (KeyValues *)KeyValues::GetFirstValue(param_1);
  do {
    if (this_00 == (KeyValues *)0x0) {
      if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
        return iVar1 != *(int *)(this + 0x18c);
      }
                    /* WARNING: Subroutine does not return */
      __stack_chk_fail();
    }
    pcVar2 = (char *)KeyValues::GetName(this_00);
    pcVar3 = (char *)KeyValues::GetString(this_00,(char *)0x0,"");
    if ((pcVar3 != (char *)0x0) && (pcVar2 != (char *)0x0)) {
      CSplitString::CSplitString((CSplitString *)local_26c,pcVar3,"+");
      if (local_260 < 1) {
        bVar7 = 0x80;
      }
      else {
        iVar6 = 0;
        bVar7 = 0x80;
        do {
          while( true ) {
            iVar5 = iVar6 * 4;
                    /* try { // try from 0013fb69 to 0013fbe8 has its CatchHandler @ 0013fd95 */
            iVar4 = _V_stricmp(*(char **)(local_26c[0] + iVar6 * 4),"allow_in_coop");
            if (iVar4 != 0) break;
            bVar7 = bVar7 | 0x10;
LAB_0013fb43:
            iVar6 = iVar6 + 1;
            if (local_260 <= iVar6) goto LAB_0013fba1;
          }
          iVar4 = _V_stricmp(*(char **)(local_26c[0] + iVar5),"allow_in_addon");
          if (iVar4 != 0) {
                    /* try { // try from 0013fcac to 0013fcd8 has its CatchHandler @ 0013fd95 */
            iVar4 = _V_stricmp(*(char **)(local_26c[0] + iVar5),"check_crc");
            if (iVar4 == 0) {
              bVar7 = bVar7 | 2;
            }
            else {
              iVar4 = _V_stricmp(*(char **)(local_26c[0] + iVar5),"check_every_map");
              if (iVar4 == 0) {
                bVar7 = bVar7 | 0x40;
              }
              else {
                    /* try { // try from 0013fd50 to 0013fd54 has its CatchHandler @ 0013fd95 */
                Warning("Unknown modifier in whitelist file: %s.\n",
                        *(undefined4 *)(local_26c[0] + iVar5));
              }
            }
            goto LAB_0013fb43;
          }
          iVar6 = iVar6 + 1;
          bVar7 = bVar7 | 0x20;
        } while (iVar6 < local_260);
      }
LAB_0013fba1:
      local_31 = 0;
      local_2d = 0;
      local_29 = 0;
      local_25 = 0;
      local_135[0] = (WhiteListFileData)0x0;
      local_21 = bVar7;
      CSplitString::CSplitString((CSplitString *)local_254,pcVar2,"+");
                    /* try { // try from 0013fbfe to 0013fc70 has its CatchHandler @ 0013fdad */
      V_strncpy(local_239,pcVar2,0x104);
      V_FixSlashes(local_239,'/');
      iVar6 = V_stristr((char *)*local_254[0],"...");
      iVar5 = V_stristr((char *)*local_254[0],"*.*");
      if ((iVar5 == 0) && (iVar6 == 0)) {
        AddFileToWhiteList(this,local_239,local_135);
      }
      else {
                    /* try { // try from 0013fcf3 to 0013fd36 has its CatchHandler @ 0013fdad */
        V_StripLastDir(local_239,0x104);
        pcVar2 = (char *)0x0;
        if (local_248 != 1) {
          pcVar2 = (char *)local_254[0][1];
        }
        AddMatchingFiles(this,local_239,pcVar2,local_135,iVar6 != 0);
      }
      CSplitString::~CSplitString((CSplitString *)local_254);
      CSplitString::~CSplitString((CSplitString *)local_26c);
    }
    this_00 = (KeyValues *)KeyValues::GetNextValue(this_00);
  } 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)