L L4D2node

DownloadManager::StartNewDownload

0x0013dc80 · 631 bytes · __thiscall

_ZN15DownloadManager16StartNewDownloadEv

Decompiled

undefined (1 param)

/* DownloadManager::StartNewDownload() */

void __thiscall DownloadManager::StartNewDownload(DownloadManager *this)

{
  int iVar1;
  char cVar2;
  
  if ((*(int *)(this + 0x14) == 0) && (*(int *)(this + 0xc) != 0)) {
    do {
      while( true ) {
        if (*(int *)(this + 0xc) == 0) {
          return;
        }
        *(undefined4 *)(this + 0x14) = **(undefined4 **)this;
        CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>>::ShiftElementsLeft
                  ((CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>> *)this,0,1);
        iVar1 = g_pFileSystem;
        *(int *)(this + 0xc) = *(int *)(this + 0xc) + -1;
        cVar2 = (**(code **)(*(int *)(iVar1 + 4) + 0x28))(iVar1 + 4,*(int *)(this + 0x14) + 0x214,0)
        ;
        if ((cVar2 == '\0') ||
           (cVar2 = CL_ShouldRedownloadFile((char *)(*(int *)(this + 0x14) + 0x214)), cVar2 != '\0')
           ) break;
        cVar2 = LoggingSystem_IsChannelEnabled(LOG_DownloadManager,0);
        if (cVar2 != '\0') {
          LoggingSystem_Log(LOG_DownloadManager,0,DownloadColor,"Skipping existing file %s%s.\n",
                            *(int *)(this + 0x14) + 0x14,*(int *)(this + 0x14) + 0x214);
        }
        **(undefined1 **)(this + 0x14) = 1;
        *(undefined1 *)(*(int *)(this + 0x14) + 1) = 1;
        CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>>::InsertBefore
                  ((CUtlVector<RequestContext*,CUtlMemory<RequestContext*,int>> *)(this + 0x18),
                   *(int *)(this + 0x24),(RequestContext **)(this + 0x14));
        *(undefined4 *)(this + 0x14) = 0;
      }
    } while (*(int *)(this + 0x14) == 0);
    cVar2 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x28))
                      (g_pFileSystem + 4,*(int *)(this + 0x14) + 0x214,0);
    if ((cVar2 == '\0') ||
       (cVar2 = CL_ShouldRedownloadFile((char *)(*(int *)(this + 0x14) + 0x214)), cVar2 != '\0')) {
      if ((*(RequestContext **)(this + 0x14))[3] == (RequestContext)0x0) {
        cVar2 = LoggingSystem_IsChannelEnabled(LOG_DownloadManager,0);
        if (cVar2 != '\0') {
          LoggingSystem_Log(LOG_DownloadManager,0,DownloadColor,"Downloading %s.\n",
                            *(int *)(this + 0x14) + 0x214);
        }
      }
      else {
        DownloadCache::GetCachedData(TheDownloadCache,*(RequestContext **)(this + 0x14));
        cVar2 = LoggingSystem_IsChannelEnabled(LOG_DownloadManager,0);
        if (cVar2 != '\0') {
          LoggingSystem_Log(LOG_DownloadManager,0,DownloadColor,"Downloading %s%s.\n",
                            *(int *)(this + 0x14) + 0x14,*(int *)(this + 0x14) + 0x214);
        }
      }
      *(undefined4 *)(this + 0x2c) = 0;
      return;
    }
    **(undefined1 **)(this + 0x14) = 1;
    *(undefined1 *)(*(int *)(this + 0x14) + 1) = 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;
}

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)