L L4D2node

CGameServer::ReloadWhitelist

0x001fd650 · 769 bytes · __thiscall

_ZN11CGameServer15ReloadWhitelistEPKc

Decompiled

undefined (2 params)

/* CGameServer::ReloadWhitelist(char const*) */

void __thiscall CGameServer::ReloadWhitelist(CGameServer *this,char *param_1)

{
  char cVar1;
  int iVar2;
  CPureServerWhitelist *this_00;
  char *this_01;
  IBaseFileSystem *pIVar3;
  uint uVar4;
  undefined4 *puVar5;
  int in_GS_OFFSET;
  bool bVar6;
  byte bVar7;
  longdouble lVar8;
  longdouble lVar9;
  uint in_stack_fffffeb8;
  IBaseFileSystem *local_13c;
  char local_124 [8];
  undefined4 local_11c [63];
  int local_20;
  
  bVar7 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(CPureServerWhitelist **)(this + 0x2d374) != (CPureServerWhitelist *)0x0) {
    CPureServerWhitelist::Release(*(CPureServerWhitelist **)(this + 0x2d374));
    *(undefined4 *)(this + 0x2d374) = 0;
  }
  iVar2 = (**(code **)(*(int *)this + 0x18))(this);
  if (1 < iVar2) {
    if (*(CPureServerWhitelist **)(this + 0x2d374) != (CPureServerWhitelist *)0x0) {
      CPureServerWhitelist::Release(*(CPureServerWhitelist **)(this + 0x2d374));
      *(undefined4 *)(this + 0x2d374) = 0;
    }
    if (g_sv_pure_mode != 0) {
      this_00 = (CPureServerWhitelist *)CPureServerWhitelist::Create(g_pFileSystem);
      bVar6 = g_sv_pure_mode == 2;
      *(CPureServerWhitelist **)(this + 0x2d374) = this_00;
      if (bVar6) {
        CPureServerWhitelist::EnableFullyPureMode(this_00);
        this_01 = "Server using sv_pure 2.\n";
        Msg("Server using sv_pure 2.\n");
      }
      else {
        this_01 = KeyValues::operator_new((KeyValues *)0x2c,in_stack_fffffeb8);
                    /* try { // try from 001fd729 to 001fd72d has its CatchHandler @ 001fd95c */
        KeyValues::KeyValues((KeyValues *)this_01,"",(IKeyValuesSystem *)0x0,false);
        pIVar3 = (IBaseFileSystem *)0x0;
        if (g_pFileSystem != (IFileSystem *)0x0) {
          pIVar3 = (IBaseFileSystem *)(g_pFileSystem + 4);
        }
        cVar1 = KeyValues::LoadFromFile
                          ((KeyValues *)this_01,pIVar3,"pure_server_whitelist.txt","game");
        if ((cVar1 == '\0') ||
           (cVar1 = CPureServerWhitelist::LoadFromKeyValues
                              (*(CPureServerWhitelist **)(this + 0x2d374),(KeyValues *)this_01),
           cVar1 == '\0')) {
          Warning("Can\'t load pure server whitelist in %s.\n","pure_server_whitelist.txt");
        }
        puVar5 = local_11c;
        for (iVar2 = 0x3f; iVar2 != 0; iVar2 = iVar2 + -1) {
          *puVar5 = 0;
          puVar5 = puVar5 + (uint)bVar7 * -2 + 1;
        }
        builtin_strncpy(local_124,"maps",5);
        local_124[5] = '\0';
        local_124[6] = '\0';
        local_124[7] = '\0';
        V_AppendSlash(local_124,0x104);
        V_strncat(local_124,param_1,0x104,-1);
        V_strncat(local_124,"_whitelist.txt",0x104,-1);
        KeyValues::Clear((KeyValues *)this_01);
        local_13c = (IBaseFileSystem *)0x0;
        if (g_pFileSystem != (IFileSystem *)0x0) {
          local_13c = (IBaseFileSystem *)(g_pFileSystem + 4);
        }
        cVar1 = KeyValues::LoadFromFile((KeyValues *)this_01,local_13c,local_124,(char *)0x0);
        if (cVar1 != '\0') {
          CPureServerWhitelist::LoadFromKeyValues
                    (*(CPureServerWhitelist **)(this + 0x2d374),(KeyValues *)this_01);
        }
        KeyValues::deleteThis();
      }
      lVar8 = (longdouble)Plat_FloatTime(this_01);
      Msg("Caching file CRCs for pure server...\n");
      uVar4 = (**(code **)(*(int *)g_pFileSystem + 0x184))(g_pFileSystem);
      if (0 < *(int *)(sv_pure_trace._28_4_ + 0x30)) {
        (**(code **)(*(int *)g_pFileSystem + 0x188))(g_pFileSystem,uVar4 | 1);
      }
      CPureServerWhitelist::CacheFileCRCs(*(CPureServerWhitelist **)(this + 0x2d374));
      (**(code **)(*(int *)g_pFileSystem + 0x188))(g_pFileSystem,uVar4);
      lVar9 = (longdouble)Plat_FloatTime();
      Msg("Finished caching file CRCs for pure server in %d seconds.\n",
          (int)((float)lVar9 - (float)lVar8));
    }
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)