L L4D2node

CDownloadListGenerator::GetAddonVPKName

0x00140040 · 601 bytes · __thiscall

_ZN22CDownloadListGenerator15GetAddonVPKNameEPciPKc

Decompiled

undefined (4 params)

/* CDownloadListGenerator::GetAddonVPKName(char*, int, char const*) */

void __thiscall
CDownloadListGenerator::GetAddonVPKName
          (CDownloadListGenerator *this,char *param_1,int param_2,char *param_3)

{
  char *pcVar1;
  int iVar2;
  int iVar3;
  undefined4 *puVar4;
  int in_GS_OFFSET;
  int local_150 [5];
  undefined4 *local_13c [3];
  int local_130;
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((param_3 != (char *)0x0) && (*param_3 != '\0')) {
    V_snprintf(local_124,0x104,"maps/*.bsp");
    V_FixSlashes(local_124,'/');
    local_150[0] = 0;
    local_150[1] = 0;
    local_150[2] = 0;
    local_150[3] = 0;
    local_150[4] = 0;
                    /* try { // try from 00140110 to 0014017c has its CatchHandler @ 0014032b */
    (**(code **)(*g_pFileSystem + 0x84))(g_pFileSystem,local_150,local_124,&DAT_002a076d);
    if (0 < local_150[3]) {
      iVar3 = 0;
LAB_00140130:
      pcVar1 = CUtlString::operator_cast_to_char_((CUtlString *)(local_150[0] + iVar3 * 0x10));
      iVar2 = V_stristr(pcVar1,param_3);
      if (iVar2 == 0) goto LAB_001401a6;
      pcVar1 = CUtlString::operator_cast_to_char_((CUtlString *)(iVar3 * 0x10 + local_150[0]));
      CSplitString::CSplitString((CSplitString *)local_13c,pcVar1,".vpk");
                    /* try { // try from 00140191 to 00140250 has its CatchHandler @ 001402a9 */
      if ((local_130 < 2) ||
         (pcVar1 = (char *)V_UnqualifiedFileName((char *)*local_13c[0]), pcVar1 == (char *)0x0)) {
        CSplitString::~CSplitString((CSplitString *)local_13c);
        goto LAB_001401a6;
      }
      V_strncpy(param_1,pcVar1,param_2);
      CSplitString::~CSplitString((CSplitString *)local_13c);
      iVar3 = local_150[3] + -1;
      iVar2 = iVar3 * 0x10;
      for (; -1 < iVar3; iVar3 = iVar3 + -1) {
        puVar4 = (undefined4 *)(local_150[0] + iVar2);
        if (-1 < (int)puVar4[2]) {
          if ((void *)*puVar4 != (void *)0x0) {
            free((void *)*puVar4);
            *puVar4 = 0;
          }
          puVar4[1] = 0;
        }
        iVar2 = iVar2 + -0x10;
      }
      goto LAB_001401fc;
    }
LAB_001401b7:
    iVar3 = local_150[3] + -1;
    iVar2 = iVar3 * 0x10;
    for (; -1 < iVar3; iVar3 = iVar3 + -1) {
      puVar4 = (undefined4 *)(local_150[0] + iVar2);
      if (-1 < (int)puVar4[2]) {
        if ((void *)*puVar4 != (void *)0x0) {
          free((void *)*puVar4);
          *puVar4 = 0;
        }
        puVar4[1] = 0;
      }
      iVar2 = iVar2 + -0x10;
    }
LAB_001401fc:
    local_150[3] = 0;
    CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_150);
    local_150[4] = local_150[0];
    CUtlMemory<CUtlString,int>::Purge((CUtlMemory<CUtlString,int> *)local_150);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
LAB_001401a6:
  iVar3 = iVar3 + 1;
  if (local_150[3] <= iVar3) goto LAB_001401b7;
  goto LAB_00140130;
}

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)