L L4D2node

CUGCFileRequest::Steam_OnUGCDownload

0x00228220 · 1038 bytes · __thiscall

_ZN15CUGCFileRequest19Steam_OnUGCDownloadEP32RemoteStorageDownloadUGCResult_tb

Decompiled

undefined (3 params)

/* WARNING: Type propagation algorithm not settling */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CUGCFileRequest::Steam_OnUGCDownload(RemoteStorageDownloadUGCResult_t*, bool) */

void __thiscall
CUGCFileRequest::Steam_OnUGCDownload
          (CUGCFileRequest *this,RemoteStorageDownloadUGCResult_t *param_1,bool param_2)

{
  CUtlBuffer *this_00;
  char cVar1;
  uint uVar2;
  int iVar3;
  char *pcVar4;
  int iVar5;
  int in_GS_OFFSET;
  longdouble lVar6;
  undefined1 local_138 [4];
  char *local_134;
  int local_130 [3];
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((param_2) || (*(int *)param_1 != 1)) {
    ThrowError(this,"[UGC] Download of file %s from cloud failed with result %d (%llu)\n",
               param_1 + 0x14,*(int *)param_1,*(undefined4 *)(this + 0x38c),
               *(undefined4 *)(this + 0x390));
  }
  else {
    local_130[0] = -1;
    local_130[1] = 0;
    local_130[2] = 0;
    cVar1 = (**(code **)(_DAT_00000000 + 0x68))
                      (0,*(undefined4 *)(this + 0x38c),*(undefined4 *)(this + 0x390),local_138,
                       &local_134,local_130,local_130 + 1);
    if ((cVar1 == '\0') || (local_130[0] < 1)) {
      ThrowError(this,"[UGC] Unable to retrieve cloud file %s (%llu) info from Steam\n",
                 param_1 + 0x14,*(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 8));
    }
    else {
      this_00 = (CUtlBuffer *)(this + 0x354);
      *(undefined4 *)(this + 0x360) = 0;
      *(undefined4 *)(this + 0x364) = 0;
      this[0x368] = (CUGCFileRequest)0x0;
      *(undefined4 *)(this + 0x374) = 0;
      *(undefined4 *)(this + 0x370) = 0xffffffff;
      CUtlBuffer::AddNullTermination(this_00);
      CUtlBuffer::EnsureCapacity(this_00,local_130[0]);
      CUtlBuffer::SeekPut(this_00,0,local_130[0]);
      if (0 < local_130[0]) {
        iVar5 = 0;
        do {
          uVar2 = local_130[0] - iVar5;
          if (0x6400000 < uVar2) {
            uVar2 = 0x6400000;
          }
          iVar3 = (**(code **)(_DAT_00000000 + 0x6c))
                            (0,*(undefined4 *)(this + 0x38c),*(undefined4 *)(this + 0x390),
                             *(int *)(this + 0x354) + iVar5,uVar2,iVar5,0);
          if (iVar3 < 1) {
            ThrowError(this,"[UGC] Failed call to UGCRead on cloud file %s (%llu)\n",param_1 + 0x14,
                       *(undefined4 *)(this + 0x38c),*(undefined4 *)(this + 0x390));
            goto LAB_00228279;
          }
          iVar5 = iVar5 + iVar3;
        } while (iVar5 < local_130[0]);
      }
      V_strncpy((char *)(this + 0x248),local_134,0x104);
      if (this[0x144] == (CUGCFileRequest)0x0) {
        pcVar4 = (char *)V_UnqualifiedFileName(local_134);
        V_strncpy((char *)(this + 0x144),pcVar4,0x104);
      }
      cVar1 = LoggingSystem_IsChannelEnabled(LOG_WORKSHOP,0);
      if (cVar1 != '\0') {
        lVar6 = (longdouble)Plat_FloatTime();
        LoggingSystem_Log(LOG_WORKSHOP,0,"[UGC] Read cloud file %s%c%s (%llu) (%f)\n",this + 0x40,
                          0x2f,this + 0x144,*(undefined4 *)(this + 0x38c),
                          *(undefined4 *)(this + 0x390),(double)lVar6);
      }
      GetFullPath(this,local_124,0x104);
      (**(code **)(*g_pFullFileSystem + 0x48))(g_pFullFileSystem,this + 0x40,"DEFAULT_WRITE_PATH");
      iVar5 = (**(code **)(*g_pFullFileSystem + 0x134))
                        (g_pFullFileSystem,local_124,*(undefined4 *)(this + 0x354),
                         *(undefined4 *)(this + 0x364),0,0,this + 0x394);
      if (iVar5 < 0) {
        ThrowError(this,"[UGC] Async write of downloaded file %s failed\n",local_124);
      }
      else {
        cVar1 = LoggingSystem_IsChannelEnabled(LOG_WORKSHOP,0);
        if (cVar1 != '\0') {
          lVar6 = (longdouble)Plat_FloatTime();
          LoggingSystem_Log(LOG_WORKSHOP,0,"[UGC] Async write started for %s (%llu) (%f)\n",
                            local_124,*(undefined4 *)(this + 0x38c),*(undefined4 *)(this + 0x390),
                            (double)lVar6);
        }
        *(undefined4 *)(this + 0x598) = 2;
      }
    }
  }
LAB_00228279:
  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)