L L4D2node

DownloadManager::CheckActiveDownload

0x0013daa0 · 319 bytes · __thiscall

_ZN15DownloadManager19CheckActiveDownloadEv

Decompiled

undefined (1 param)

/* DownloadManager::CheckActiveDownload() */

void __thiscall DownloadManager::CheckActiveDownload(DownloadManager *this)

{
  int iVar1;
  int iVar2;
  char cVar3;
  uint uVar4;
  
  iVar1 = *(int *)(this + 0x14);
  if ((iVar1 != 0) && (*(char *)(iVar1 + 3) != '\0')) {
    iVar2 = *(int *)(iVar1 + 8);
    if (iVar2 == 2) {
      cVar3 = LoggingSystem_IsChannelEnabled(LOG_DownloadManager,0);
      if (cVar3 != '\0') {
        LoggingSystem_Log(LOG_DownloadManager,0,DownloadCompleteColor,"Download finished!\n");
      }
      if (*(int *)(*(RequestContext **)(this + 0x14) + 0x514) != 0) {
        DownloadCache::PersistToDisk(TheDownloadCache,*(RequestContext **)(this + 0x14));
        goto LAB_0013db93;
      }
    }
    else {
      if (iVar2 == 4) {
        cVar3 = LoggingSystem_IsChannelEnabled(LOG_DownloadManager,0);
        if (cVar3 != '\0') {
          LoggingSystem_Log(LOG_DownloadManager,0,DownloadErrorColor,"Error downloading %s%s\n",
                            *(int *)(this + 0x14) + 0x14,*(int *)(this + 0x14) + 0x214);
        }
LAB_0013db93:
        **(undefined1 **)(this + 0x14) = 1;
        CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>>::InsertBefore
                  ((CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>> *)(this + 0x18),
                   *(int *)(this + 0x24),(RequestContext **)(this + 0x14));
        *(undefined4 *)(this + 0x14) = 0;
        return;
      }
      if (((iVar2 == 1) && (*(uint *)(iVar1 + 0x514) != 0)) &&
         (uVar4 = (uint)(*(int *)(iVar1 + 0x518) * 100) / *(uint *)(iVar1 + 0x514),
         *(uint *)(this + 0x2c) != uVar4)) {
        *(uint *)(this + 0x2c) = uVar4;
      }
    }
  }
  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)