L L4D2node

FileSystem_UpdateAddonSearchPaths

0x0015e940 · 4799 bytes · unknown

_ZL33FileSystem_UpdateAddonSearchPathsv

Decompiled

undefined (0 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* FileSystem_UpdateAddonSearchPaths() */

void FileSystem_UpdateAddonSearchPaths(void)

{
  code *pcVar1;
  bool bVar2;
  int *piVar3;
  char cVar4;
  int iVar5;
  char *pcVar6;
  undefined4 *puVar7;
  int *piVar8;
  int iVar9;
  CUtlMemory<unsigned_char,int> *pCVar10;
  KeyValues *pKVar11;
  char *pcVar12;
  undefined4 uVar13;
  int iVar14;
  int in_GS_OFFSET;
  undefined8 uVar15;
  longlong lVar16;
  KeyValues **ppKVar17;
  undefined4 uVar18;
  undefined *puVar19;
  CUtlMemory<KeyValues*,int> *local_610;
  CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *local_604;
  KeyValues *local_5f8;
  undefined4 local_5f4;
  KeyValues *local_5f0;
  CUtlString local_5ec [16];
  CUtlMemory<unsigned_char,int> local_5dc [16];
  CUtlString local_5cc [16];
  CUtlString local_5bc [16];
  CUtlString local_5ac [16];
  CUtlMemory<unsigned_char,int> local_59c [16];
  undefined4 local_58c;
  undefined4 local_588;
  int local_578;
  undefined4 local_574;
  undefined4 local_570;
  int local_56c;
  int local_568;
  int local_564;
  undefined4 local_560;
  undefined4 local_55c;
  int local_558;
  int local_554;
  KeyValues *local_550;
  undefined4 local_54c;
  undefined4 local_548;
  int local_544;
  KeyValues *local_540;
  char local_53c [260];
  char local_438 [260];
  char local_334 [260];
  char local_230 [260];
  CFmtStrN<256> local_12c [5];
  undefined1 local_127 [123];
  undefined1 local_ac;
  undefined4 local_2c;
  undefined4 local_28;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (g_pFileSystem != (int *)0x0) {
    DAT_0039fab0 = 0;
    CUtlMemory<SAddOnMetaData,int>::Purge((CUtlMemory<SAddOnMetaData,int> *)&s_vecAddonMetadata);
    _DAT_0039fab4 = s_vecAddonMetadata;
    (**(code **)(*g_pFileSystem + 0x34))(g_pFileSystem,&DAT_002a0772,0,local_53c,0x104);
    iVar5 = _V_strrchr(local_53c,';');
    if (iVar5 != 0) {
      V_strncpy(local_53c,(char *)(iVar5 + 1),0x104);
    }
    FileSystem_RemoveAllAddonSearchPaths(local_53c);
    piVar3 = g_pFileSystem;
    if (g_pFileSystem != (int *)0x0) {
      ppKVar17 = &local_5f8;
      LoadAddonListFile(local_53c,ppKVar17);
      if (local_5f8 == (KeyValues *)0x0) {
        pKVar11 = KeyValues::operator_new((KeyValues *)0x2c,(uint)ppKVar17);
                    /* try { // try from 0015f7dc to 0015f7e0 has its CatchHandler @ 0015fcfc */
        KeyValues::KeyValues(pKVar11,"AddonList",(IKeyValuesSystem *)0x0,false);
        local_5f8 = pKVar11;
      }
      local_578 = 0;
      local_574 = 0;
      local_570 = 0;
      local_56c = 0;
      local_568 = 0;
                    /* try { // try from 0015eaa3 to 0015eb1f has its CatchHandler @ 0015fd28 */
      V_snprintf(local_438,0x104,"%s%s%c%s",local_53c,"addons",0x2f,&DAT_002af67c);
      pcVar6 = (char *)(**(code **)(*piVar3 + 0x70))(piVar3,local_438,&local_5f4);
      if (pcVar6 != (char *)0x0) {
        do {
          V_strncpy(local_334,pcVar6,0x104);
          V_FixSlashes(local_334,'\\');
          CUtlString::CUtlString((CUtlString *)&local_58c,local_334);
                    /* try { // try from 0015eb37 to 0015eb3b has its CatchHandler @ 0015fd85 */
          CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                    ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)&local_578,local_56c,
                     (CUtlString *)&local_58c);
          CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_58c);
                    /* try { // try from 0015eb53 to 0015eb6b has its CatchHandler @ 0015fd28 */
          pcVar6 = (char *)(**(code **)(*piVar3 + 0x74))(piVar3,local_5f4);
        } while (pcVar6 != (char *)0x0);
      }
      local_604 = (CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)&local_578;
      (**(code **)(*piVar3 + 0x7c))(piVar3,local_5f4);
      local_564 = 0;
      local_560 = 0;
      local_55c = 0;
      local_558 = 0;
      local_554 = 0;
                    /* try { // try from 0015ebe5 to 0015ecbe has its CatchHandler @ 0015fd75 */
      V_snprintf(local_438,0x104,"%s%s%c%s",local_53c,"addons",0x2f,&DAT_002ad0a0);
      pcVar6 = (char *)(**(code **)(*piVar3 + 0x70))(piVar3,local_438,&local_5f4);
      if (pcVar6 != (char *)0x0) {
        do {
          cVar4 = (**(code **)(*piVar3 + 0x78))(piVar3,local_5f4);
          if (((cVar4 != '\0') && (*pcVar6 != '.')) &&
             (iVar5 = _V_stricmp(pcVar6,"workshop"), iVar5 != 0)) {
            V_snprintf(local_230,0x104,"%s.vpk",pcVar6);
            CUtlString::CUtlString((CUtlString *)local_59c,local_230);
                    /* try { // try from 0015eccc to 0015ecd0 has its CatchHandler @ 0015fd3a */
            iVar5 = CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::Find
                              (local_604,(CUtlString *)local_59c);
            if ((iVar5 < 0) || (local_56c <= iVar5)) {
              CUtlMemory<unsigned_char,int>::Purge(local_59c);
                    /* try { // try from 0015ed26 to 0015ed5c has its CatchHandler @ 0015fd75 */
              V_snprintf((char *)local_12c,0x104,"%s%s\\%s\\%s",local_53c,"addons",pcVar6,
                         "addoninfo.txt");
              iVar5 = (**(code **)(*piVar3 + 0x70))(piVar3,local_12c,&local_550);
              if (iVar5 != 0) {
                CUtlString::CUtlString(local_5ac,pcVar6);
                    /* try { // try from 0015ed74 to 0015ed78 has its CatchHandler @ 0015fd35 */
                CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                          ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)&local_564,local_558
                           ,local_5ac);
                CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_5ac);
              }
                    /* try { // try from 0015ed90 to 0015ed92 has its CatchHandler @ 0015fd75 */
              (**(code **)(*piVar3 + 0x7c))(piVar3,local_550);
            }
            else {
              CUtlMemory<unsigned_char,int>::Purge(local_59c);
            }
          }
          pcVar6 = (char *)(**(code **)(*piVar3 + 0x74))(piVar3,local_5f4);
        } while (pcVar6 != (char *)0x0);
      }
                    /* try { // try from 0015ee57 to 0015ef58 has its CatchHandler @ 0015fd75 */
      (**(code **)(*piVar3 + 0x7c))(piVar3,local_5f4);
      if ((workshop == (undefined *)0x0) ||
         (cVar4 = (**(code **)(*(int *)workshop + 0x2c))(workshop), cVar4 == '\0')) {
        if (DAT_003b8088 != '\0') {
          puVar19 = &DAT_002af67c;
          uVar18 = 0x2f;
          pcVar6 = "workshop";
          uVar13 = 0x2f;
                    /* try { // try from 0015fb09 to 0015fb75 has its CatchHandler @ 0015fd75 */
          V_snprintf(local_230,0x104,"%s%s%c%s%c%s",local_53c,"addons",0x2f,"workshop",0x2f,
                     &DAT_002af67c);
          iVar5 = (**(code **)(*piVar3 + 0x70))(piVar3,local_230,&local_550);
          if (iVar5 != 0) {
            do {
              V_snprintf((char *)local_12c,0x104,"%s\\%s","workshop",iVar5,uVar13,pcVar6,uVar18,
                         puVar19);
              CUtlString::CUtlString(local_5cc,(char *)local_12c);
                    /* try { // try from 0015fb8d to 0015fb91 has its CatchHandler @ 0015fc44 */
              CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                        (local_604,local_56c,local_5cc);
              CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_5cc);
                    /* try { // try from 0015fba9 to 0015fbc1 has its CatchHandler @ 0015fd75 */
              iVar5 = (**(code **)(*piVar3 + 0x74))(piVar3,local_550);
            } while (iVar5 != 0);
          }
          (**(code **)(*piVar3 + 0x7c))(piVar3,local_550);
        }
        bVar2 = false;
      }
      else {
        iVar5 = (**(code **)(*(int *)workshop + 0x1c))(workshop);
        if (0 < iVar5) {
          iVar14 = 0;
          do {
            while( true ) {
              uVar15 = (**(code **)(*(int *)workshop + 0x20))(workshop,iVar14);
              puVar7 = (undefined4 *)(**(code **)(*(int *)workshop + 0x24))(workshop,uVar15);
              if (puVar7 != (undefined4 *)0x0) break;
LAB_0015eea0:
              iVar14 = iVar14 + 1;
              if (iVar5 == iVar14) goto LAB_0015ef98;
            }
            piVar8 = (int *)(**(code **)(*(int *)workshop + 0x14))(workshop);
            iVar9 = (**(code **)(*piVar8 + 0x30))(piVar8,puVar7[0x23],puVar7[0x24]);
            if (iVar9 != 4) goto LAB_0015eea0;
            V_snprintf((char *)local_12c,0x104,"workshop\\%llu.vpk",*puVar7,puVar7[1]);
            CUtlString::CUtlString(local_5bc,(char *)local_12c);
                    /* try { // try from 0015ef76 to 0015ef7a has its CatchHandler @ 0015fd0e */
            CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                      (local_604,local_56c,local_5bc);
            iVar14 = iVar14 + 1;
            CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_5bc);
          } while (iVar5 != iVar14);
        }
LAB_0015ef98:
        bVar2 = true;
      }
      if (0 < local_558) {
        iVar5 = 0;
        do {
          while( true ) {
                    /* try { // try from 0015efeb to 0015f119 has its CatchHandler @ 0015fd75 */
            pcVar6 = CUtlString::operator_cast_to_char_((CUtlString *)(local_564 + iVar5 * 0x10));
            iVar14 = KeyValues::FindKey(local_5f8,pcVar6,false);
            if (iVar14 != 0) break;
            pcVar6 = CUtlString::operator_cast_to_char_((CUtlString *)(iVar5 * 0x10 + local_564));
            KeyValues::SetInt(local_5f8,pcVar6,1);
            iVar5 = iVar5 + 1;
            if (local_558 <= iVar5) goto LAB_0015f048;
          }
          iVar5 = iVar5 + 1;
        } while (iVar5 < local_558);
      }
LAB_0015f048:
      if (0 < local_56c) {
        iVar5 = 0;
        do {
          while( true ) {
            pcVar6 = CUtlString::operator_cast_to_char_((CUtlString *)(local_578 + iVar5 * 0x10));
            iVar14 = KeyValues::FindKey(local_5f8,pcVar6,false);
            if (iVar14 != 0) break;
            pcVar6 = CUtlString::operator_cast_to_char_((CUtlString *)(iVar5 * 0x10 + local_578));
            KeyValues::SetInt(local_5f8,pcVar6,1);
            iVar5 = iVar5 + 1;
            if (local_56c <= iVar5) goto LAB_0015f0d8;
          }
          iVar5 = iVar5 + 1;
        } while (iVar5 < local_56c);
      }
LAB_0015f0d8:
      V_snprintf(local_230,0x104,"%s%c","workshop",0x2f);
      iVar5 = _V_strlen(local_230);
      local_550 = (KeyValues *)0x0;
      local_54c = 0;
      local_548 = 0;
      local_544 = 0;
      local_540 = (KeyValues *)0x0;
                    /* try { // try from 0015f167 to 0015f1b5 has its CatchHandler @ 0015fd94 */
      local_5f0 = (KeyValues *)KeyValues::GetFirstSubKey(local_5f8);
      if (local_5f0 == (KeyValues *)0x0) {
        local_5f0 = (KeyValues *)0x0;
      }
      else {
        do {
                    /* try { // try from 0015f1c7 to 0015f1cb has its CatchHandler @ 0015fd49 */
          pcVar6 = (char *)KeyValues::GetName(local_5f0);
                    /* try { // try from 0015f1d9 to 0015f1dd has its CatchHandler @ 0015fd4e */
          CUtlString::CUtlString((CUtlString *)local_5dc,pcVar6);
                    /* try { // try from 0015f1eb to 0015f1ef has its CatchHandler @ 0015fd55 */
          iVar14 = CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::Find
                             ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)&local_564,
                              (CUtlString *)local_5dc);
          if ((iVar14 < 0) || (local_558 <= iVar14)) {
                    /* try { // try from 0015f205 to 0015f209 has its CatchHandler @ 0015fd65 */
            pcVar6 = (char *)KeyValues::GetName(local_5f0);
                    /* try { // try from 0015f217 to 0015f21b has its CatchHandler @ 0015fc72 */
            CUtlString::CUtlString(local_5ec,pcVar6);
                    /* try { // try from 0015f229 to 0015f22d has its CatchHandler @ 0015fcbc */
            iVar14 = CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::Find(local_604,local_5ec);
            if ((-1 < iVar14) && (iVar14 < local_56c)) {
              CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_5ec);
              goto LAB_0015f1a0;
            }
            CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_5ec);
            CUtlMemory<unsigned_char,int>::Purge(local_5dc);
                    /* try { // try from 0015f269 to 0015f427 has its CatchHandler @ 0015fd94 */
            pcVar6 = (char *)KeyValues::GetName(local_5f0);
            V_strncpy((char *)local_12c,pcVar6,0x104);
            V_FixSlashes((char *)local_12c,'/');
            iVar14 = V_strnicmp((char *)local_12c,local_230,iVar5);
            if (iVar14 == 0) {
              if (bVar2) {
                sscanf((char *)(local_12c + iVar5),"%llu.vpk",&local_58c);
                iVar14 = (**(code **)(*(int *)workshop + 0x24))(workshop,local_58c,local_588);
                if (iVar14 == 0) goto LAB_0015f2da;
              }
              else if (DAT_003b8088 != '\0') goto LAB_0015f2da;
            }
            else {
LAB_0015f2da:
              CUtlVector<KeyValues*,CUtlMemory<KeyValues*,int>>::InsertBefore
                        ((CUtlVector<KeyValues*,CUtlMemory<KeyValues*,int>> *)&local_550,local_544,
                         &local_5f0);
            }
          }
          else {
LAB_0015f1a0:
            CUtlMemory<unsigned_char,int>::Purge(local_5dc);
          }
          local_5f0 = (KeyValues *)KeyValues::GetNextKey(local_5f0);
        } while (local_5f0 != (KeyValues *)0x0);
      }
      local_610 = (CUtlMemory<KeyValues*,int> *)&local_550;
      if (0 < local_544) {
        iVar5 = 0;
        do {
          KeyValues::RemoveSubKey(local_5f8,*(KeyValues **)(local_550 + iVar5 * 4));
          KeyValues::deleteThis();
          iVar5 = iVar5 + 1;
        } while (iVar5 < local_544);
      }
      V_snprintf((char *)local_12c,0x104,"%s%s",local_53c,"addonlist.txt");
      iVar5 = KeyValues::GetFirstSubKey(local_5f8);
      if (iVar5 == 0) {
                    /* try { // try from 0015fc09 to 0015fc2d has its CatchHandler @ 0015fd94 */
        cVar4 = (**(code **)(piVar3[1] + 0x28))(piVar3 + 1,local_12c,0);
        if (cVar4 != '\0') {
          (**(code **)(*piVar3 + 0x40))(piVar3,local_12c,0);
        }
      }
      else {
        KeyValues::SaveToFile
                  (local_5f8,(IBaseFileSystem *)(piVar3 + 1),(char *)local_12c,(char *)0x0);
      }
      KeyValues::deleteThis();
      local_544 = 0;
      CUtlMemory<KeyValues*,int>::Purge(local_610);
      local_540 = local_550;
      CUtlMemory<KeyValues*,int>::Purge(local_610);
      iVar5 = local_558 + -1;
      iVar14 = iVar5 * 0x10;
      if (-1 < iVar5) {
        do {
          iVar5 = iVar5 + -1;
          pCVar10 = (CUtlMemory<unsigned_char,int> *)(local_564 + iVar14);
          iVar14 = iVar14 + -0x10;
          CUtlMemory<unsigned_char,int>::Purge(pCVar10);
        } while (iVar5 != -1);
      }
      local_558 = 0;
      CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)&local_564);
      local_554 = local_564;
      CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)&local_564);
      iVar5 = local_56c + -1;
      iVar14 = iVar5 * 0x10;
      if (-1 < iVar5) {
        do {
          iVar5 = iVar5 + -1;
          pCVar10 = (CUtlMemory<unsigned_char,int> *)(local_578 + iVar14);
          iVar14 = iVar14 + -0x10;
          CUtlMemory<unsigned_char,int>::Purge(pCVar10);
        } while (iVar5 != -1);
      }
      local_56c = 0;
      CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_604);
      local_568 = local_578;
      CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_604);
      piVar3 = g_pFileSystem;
      cVar4 = (**(code **)(*(int *)workshop + 0x2c))(workshop);
      if (cVar4 != '\0') {
        V_snprintf(local_334,0x104,"%s%s%c%s%c%s",local_53c,"addons",0x2f,"workshop",0x2f,
                   &DAT_002ad0a0);
        pcVar6 = (char *)(**(code **)(*piVar3 + 0x70))(piVar3,local_334,local_604);
        local_550 = (KeyValues *)0x0;
        local_54c = 0;
        local_548 = 0;
        local_544 = 0;
        local_540 = (KeyValues *)0x0;
        if (pcVar6 != (char *)0x0) {
          do {
            cVar4 = (**(code **)(*piVar3 + 0x78))(piVar3,local_578);
            if ((((cVar4 == '\0') && (*pcVar6 != '.')) &&
                (pcVar12 = (char *)V_GetFileExtension(pcVar6), pcVar12 != (char *)0x0)) &&
               ((iVar5 = _V_stricmp(pcVar12,"JPG"), iVar5 == 0 ||
                (iVar5 = _V_stricmp(pcVar12,"VPK"), iVar5 == 0)))) {
              local_610 = (CUtlMemory<KeyValues*,int> *)&local_550;
                    /* try { // try from 0015f8a5 to 0015f8a9 has its CatchHandler @ 0015fcf8 */
              CUtlString::CUtlString((CUtlString *)&local_564,pcVar6);
                    /* try { // try from 0015f8c7 to 0015f8cb has its CatchHandler @ 0015fcd2 */
              CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
                        ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)local_610,local_544,
                         (CUtlString *)&local_564);
              CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_564);
            }
                    /* try { // try from 0015f8e3 to 0015faa5 has its CatchHandler @ 0015fcf8 */
            pcVar6 = (char *)(**(code **)(*piVar3 + 0x74))(piVar3,local_578);
          } while (pcVar6 != (char *)0x0);
          iVar5 = 0;
          if (0 < local_544) {
            do {
              uVar13 = CUtlString::Get((CUtlString *)(local_550 + iVar5 * 0x10));
              V_snprintf(local_230,0x104,"%s%c%s%c%s","addons",0x2f,"workshop",0x2f,uVar13);
              piVar8 = (int *)(**(code **)(*(int *)workshop + 0x14))(workshop);
              lVar16 = (**(code **)(*piVar8 + 0x3c))(piVar8,local_230);
              if (lVar16 == -1) {
                Msg("Deleting file %s\n",local_230);
                pcVar1 = *(code **)(*piVar3 + 0x40);
                CFmtStrN<256>::CFmtStrN(local_12c,"%s%s",local_53c,local_230);
                (*pcVar1)(piVar3,local_127,0);
              }
              iVar5 = iVar5 + 1;
            } while (iVar5 < local_544);
          }
          iVar5 = local_544 + -1;
          iVar14 = iVar5 * 0x10;
          if (-1 < iVar5) {
            do {
              iVar5 = iVar5 + -1;
              pCVar10 = (CUtlMemory<unsigned_char,int> *)(local_550 + iVar14);
              iVar14 = iVar14 + -0x10;
              CUtlMemory<unsigned_char,int>::Purge(pCVar10);
            } while (iVar5 != -1);
          }
        }
        local_610 = (CUtlMemory<KeyValues*,int> *)&local_550;
        local_544 = 0;
        CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_610);
        local_540 = local_550;
        CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_610);
      }
    }
    local_610 = (CUtlMemory<KeyValues*,int> *)&local_550;
    cVar4 = LoadAddonListFile(local_53c,(KeyValues **)local_610);
    if (cVar4 != '\0') {
      for (pKVar11 = (KeyValues *)KeyValues::GetFirstValue(local_550); pKVar11 != (KeyValues *)0x0;
          pKVar11 = (KeyValues *)KeyValues::GetNextValue(pKVar11)) {
        iVar5 = KeyValues::GetInt(pKVar11,(char *)0x0,0);
        if (iVar5 != 0) {
          pcVar6 = (char *)KeyValues::GetName(pKVar11);
          V_snprintf((char *)local_12c,0x104,"%s%s%c%s",local_53c,"addons",0x2f,pcVar6);
          iVar5 = V_stristr(pcVar6,".vpk");
          if (iVar5 == 0) {
            (**(code **)(*g_pFileSystem + 0x1c))(g_pFileSystem,local_12c,&DAT_002a076d,0,0);
          }
          else {
            (**(code **)(*g_pFileSystem + 0x1ac))(g_pFileSystem,local_12c,1);
          }
        }
      }
      KeyValues::deleteThis();
    }
    CollectAddonsOfType("missions/*.txt",1,1);
    CollectAddonsOfType("modes/*.txt",2,1);
    CollectAddonsOfType("addoninfo.txt",0,0);
    local_550 = (KeyValues *)0x0;
    local_54c = 0;
    local_548 = 0;
    local_544 = 0;
    local_540 = (KeyValues *)0x0;
                    /* try { // try from 0015f5ce to 0015f6d5 has its CatchHandler @ 0015fd99 */
    (**(code **)(*g_pFileSystem + 0x1b8))(g_pFileSystem,local_610);
    V_snprintf(local_230,0x104,"%s%s",local_53c,"addons");
    iVar5 = local_544 + -1;
    if (-1 < iVar5) {
      iVar14 = iVar5 * 0x10;
      do {
        pcVar6 = CUtlString::operator_cast_to_char_((CUtlString *)(local_550 + iVar14));
        iVar9 = V_stristr(pcVar6,local_230);
        if (iVar9 != 0) {
          local_2c = 0;
          local_12c[0] = (CFmtStrN<256>)0x0;
          local_ac = 0;
          local_28 = 0;
          if (pcVar6 != (char *)0x0) {
            V_strncpy((char *)local_12c,pcVar6,0x80);
          }
          local_2c = 0;
          iVar9 = CUtlVector<SAddOnMetaData,CUtlMemory<SAddOnMetaData,int>>::Find
                            ((CUtlVector<SAddOnMetaData,CUtlMemory<SAddOnMetaData,int>> *)
                             &s_vecAddonMetadata,(SAddOnMetaData *)local_12c);
          if (iVar9 == -1) {
            CUtlVector<SAddOnMetaData,CUtlMemory<SAddOnMetaData,int>>::InsertBefore
                      ((CUtlVector<SAddOnMetaData,CUtlMemory<SAddOnMetaData,int>> *)
                       &s_vecAddonMetadata,DAT_0039fab0,(SAddOnMetaData *)local_12c);
          }
        }
        iVar5 = iVar5 + -1;
        iVar14 = iVar14 + -0x10;
      } while (iVar5 != -1);
    }
                    /* try { // try from 0015edbf to 0015edc3 has its CatchHandler @ 0015fd99 */
    FileSystem_ManageAddonsForActiveSession(false,(char *)0x0,(char *)0x0,false);
    iVar5 = local_544 + -1;
    iVar14 = iVar5 * 0x10;
    if (-1 < iVar5) {
      do {
        iVar5 = iVar5 + -1;
        pCVar10 = (CUtlMemory<unsigned_char,int> *)(local_550 + iVar14);
        iVar14 = iVar14 + -0x10;
        CUtlMemory<unsigned_char,int>::Purge(pCVar10);
      } while (iVar5 != -1);
    }
    local_544 = 0;
    CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_610);
    local_540 = local_550;
    CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_610);
  }
  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)