L L4D2node

DownloadCache::GenerateCacheFilename

0x0013ccf0 · 345 bytes · __thiscall

_ZN13DownloadCache21GenerateCacheFilenameEPK14RequestContextPc

Decompiled

undefined (3 params)

/* DownloadCache::GenerateCacheFilename(RequestContext const*, char*) */

void __thiscall
DownloadCache::GenerateCacheFilename(DownloadCache *this,RequestContext *param_1,char *param_2)

{
  char cVar1;
  char *pcVar2;
  char *pcVar3;
  RequestContext *__s;
  int iVar4;
  RequestContext *pRVar5;
  int iVar6;
  
  __s = param_1 + 0x214;
  GetCacheFilename(this,param_1,param_2);
  BuildKeyNames(this,(char *)__s);
  KeyValues::SetString(*(KeyValues **)this,(char *)(this + 0x144),(char *)(param_1 + 0x414));
  if (*param_2 != '\0') {
    return;
  }
  pcVar2 = strrchr((char *)__s,0x2f);
  pcVar3 = strrchr((char *)__s,0x5c);
  if (pcVar3 == (char *)0x0) {
    if (pcVar2 != (char *)0x0) {
      if (pcVar2 == (char *)0x0) {
        pcVar2 = (char *)0x0;
      }
      __s = (RequestContext *)(pcVar2 + 1);
    }
  }
  else {
    __s = (RequestContext *)(pcVar2 + 1);
    if (pcVar2 <= pcVar3) {
      __s = (RequestContext *)(pcVar3 + 1);
    }
  }
  iVar4 = 0;
  do {
    pRVar5 = __s;
    iVar6 = iVar4;
    V_snprintf(param_2,0x1000,"%s/%s%4.4d","cache",__s,iVar4);
    cVar1 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x28))(g_pFileSystem + 4,param_2,0);
    if (cVar1 == '\0') goto LAB_0013cde8;
    iVar4 = iVar4 + 1;
  } while (iVar4 != 1000);
  V_snprintf(param_2,0x1000,"%s/overflow","cache",pRVar5,iVar6);
LAB_0013cde8:
  KeyValues::SetString(*(KeyValues **)this,(char *)(this + 4),param_2);
  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)