L L4D2node

ReloadParticleEffectsMap

0x00472890 · 1042 bytes · __cdecl

_Z24ReloadParticleEffectsMapb

Decompiled

undefined (1 param)

/* ReloadParticleEffectsMap(bool) */

void ReloadParticleEffectsMap(bool param_1)

{
  char cVar1;
  KeyValues *pKVar2;
  IBaseFileSystem *pIVar3;
  char *pcVar4;
  int iVar5;
  undefined4 uVar6;
  CUtlMemory<unsigned_char,int> *pCVar7;
  int iVar8;
  int in_GS_OFFSET;
  uint uVar9;
  CUtlMemory<CUtlString,int> *local_370;
  CUtlString local_368 [16];
  int local_358 [5];
  char local_344 [32];
  char local_324 [260];
  char local_220;
  char local_21f [511];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar4 = "";
  if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
    pcVar4 = *(char **)(gpGlobals + 0x3c);
  }
  V_FileBase(pcVar4,local_344,0x20);
  _V_strlower(local_344);
  uVar9 = 0x104;
  local_358[0] = 0;
  local_358[1] = 0;
  local_358[2] = 0;
  local_358[3] = 0;
  local_358[4] = 0;
  local_324[0] = '\0';
                    /* try { // try from 00472946 to 00472962 has its CatchHandler @ 00472cee */
  V_snprintf(local_324,0x104,"maps/%s_particles.txt",local_344);
  pKVar2 = KeyValues::operator_new((KeyValues *)0x2c,uVar9);
                    /* try { // try from 0047297c to 00472980 has its CatchHandler @ 00472cd6 */
  KeyValues::KeyValues(pKVar2,local_324,(IKeyValuesSystem *)0x0,false);
  pIVar3 = (IBaseFileSystem *)0x0;
  if (filesystem != 0) {
    pIVar3 = (IBaseFileSystem *)(filesystem + 4);
  }
                    /* try { // try from 004729b0 to 00472bc6 has its CatchHandler @ 00472cee */
  cVar1 = KeyValues::LoadFromFile(pKVar2,pIVar3,local_324,"GAME");
  if (cVar1 == '\0') {
    iVar5 = local_358[3] + -1;
    if (-1 < iVar5) {
      iVar8 = iVar5 * 0x10;
      do {
        iVar5 = iVar5 + -1;
        pCVar7 = (CUtlMemory<unsigned_char,int> *)(local_358[0] + iVar8);
        iVar8 = iVar8 + -0x10;
        CUtlMemory<unsigned_char,int>::Purge(pCVar7);
      } while (iVar5 != -1);
    }
  }
  else {
    DevMsg("Successfully loaded particle effects manifest \'%s\' for map \'%s\'\n",local_324,
           local_344);
    pKVar2 = (KeyValues *)KeyValues::GetFirstSubKey(pKVar2);
    if (pKVar2 != (KeyValues *)0x0) {
      do {
        pcVar4 = (char *)KeyValues::GetName(pKVar2);
        iVar5 = _V_stricmp(pcVar4,"file");
        if (iVar5 == 0) {
          pcVar4 = (char *)KeyValues::GetString(pKVar2,(char *)0x0,"");
          V_strncpy(&local_220,pcVar4,0x200);
          V_StripFilename(&local_220);
          pcVar4 = &local_220;
          cVar1 = local_220;
          if (local_220 == '!') {
            pcVar4 = local_21f;
            cVar1 = local_21f[0];
          }
          if ((cVar1 == '\0') || (iVar5 = _V_stricmp(pcVar4,"particles"), iVar5 != 0)) {
            uVar6 = KeyValues::GetString(pKVar2,(char *)0x0,"");
            Warning("CParticleMgr::LevelInit:  Manifest \'%s\' contains a particle file \'%s\' that\'s not under the particles directory. Custom particles must be placed in the particles directory.\n"
                    ,local_324,uVar6);
          }
          else {
            pcVar4 = (char *)KeyValues::GetString(pKVar2,(char *)0x0,"");
            CUtlString::CUtlString(local_368,pcVar4);
                    /* try { // try from 00472be4 to 00472be8 has its CatchHandler @ 00472cb0 */
            CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                      ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)local_358,local_358[3],
                       local_368);
            CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_368);
          }
        }
        else {
          uVar6 = KeyValues::GetName(pKVar2);
          Warning("CParticleMgr::LevelInit:  Manifest \'%s\' with bogus file type \'%s\', expecting \'file\'\n"
                  ,local_324,uVar6);
        }
        pKVar2 = (KeyValues *)KeyValues::GetNextKey(pKVar2);
      } while (pKVar2 != (KeyValues *)0x0);
    }
    iVar5 = local_358[3];
    if (local_358[3] != 0) {
                    /* try { // try from 00472c21 to 00472c77 has its CatchHandler @ 00472cee */
      CParticleSystemMgr::ShouldLoadSheets((CParticleSystemMgr *)g_pParticleSystemMgr,param_1);
      if (0 < iVar5) {
        iVar8 = 0;
        do {
          pcVar4 = CUtlString::operator_cast_to_char_((CUtlString *)(iVar8 * 0x10 + local_358[0]));
          CParticleSystemMgr::ReadParticleConfigFile
                    ((CParticleSystemMgr *)g_pParticleSystemMgr,pcVar4,true,true);
          iVar8 = iVar8 + 1;
        } while (iVar8 != iVar5);
      }
      CParticleSystemMgr::DecommitTempMemory();
      iVar5 = local_358[3] + -1;
      iVar8 = iVar5 * 0x10;
      if (-1 < iVar5) {
        do {
          iVar5 = iVar5 + -1;
          pCVar7 = (CUtlMemory<unsigned_char,int> *)(local_358[0] + iVar8);
          iVar8 = iVar8 + -0x10;
          CUtlMemory<unsigned_char,int>::Purge(pCVar7);
        } while (iVar5 != -1);
      }
    }
  }
  local_370 = (CUtlMemory<CUtlString,int> *)local_358;
  local_358[3] = 0;
  CUtlMemory<CUtlString,int>::Purge(local_370);
  local_358[4] = local_358[0];
  CUtlMemory<CUtlString,int>::Purge(local_370);
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* 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)