L L4D2node

CUGCFileRequest::StartDownload

0x00228a60 · 729 bytes · __cdecl

_ZN15CUGCFileRequest13StartDownloadEyPKcS1_jb

Decompiled

undefined (5 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CUGCFileRequest::StartDownload(unsigned long long, char const*, char const*, unsigned int, bool)
    */

undefined4
CUGCFileRequest::StartDownload
          (ulonglong param_1,char *param_2,char *param_3,uint param_4,bool param_5)

{
  char cVar1;
  undefined4 uVar2;
  longdouble lVar3;
  longlong lVar4;
  undefined3 in_stack_00000019;
  char in_stack_0000001c;
  
  *(undefined4 *)((CUGCFileRequest *)param_1 + 0x598) = 0xffffffff;
  if (in_stack_0000001c == '\0') {
    cVar1 = FileInSync((CUGCFileRequest *)param_1,param_3,(char *)param_4,_param_5);
    if (cVar1 != '\0') {
      *(undefined4 *)((CUGCFileRequest *)param_1 + 0x38c) = param_1._4_4_;
      *(char **)((CUGCFileRequest *)param_1 + 0x390) = param_2;
      if (param_3 != (char *)0x0) {
        V_strncpy((char *)((CUGCFileRequest *)param_1 + 0x40),param_3,0x104);
        V_FixSlashes((char *)((CUGCFileRequest *)param_1 + 0x40),'/');
      }
      if (param_4 != 0) {
        V_strncpy((char *)((CUGCFileRequest *)param_1 + 0x144),(char *)param_4,0x104);
      }
      cVar1 = LoggingSystem_IsChannelEnabled(LOG_WORKSHOP,0);
      if (cVar1 != '\0') {
        lVar3 = (longdouble)Plat_FloatTime();
        LoggingSystem_Log(LOG_WORKSHOP,0,
                          "[UGC] File %s%c%s already in sync on client. (Duration: %f seconds)\n",
                          param_3,0x2f,param_4,
                          (double)lVar3 - (double)*(float *)((CUGCFileRequest *)param_1 + 0x59c));
      }
      MarkCompleteAndFree((CUGCFileRequest *)param_1);
      return *(undefined4 *)((CUGCFileRequest *)param_1 + 0x598);
    }
  }
  cVar1 = LoggingSystem_IsChannelEnabled(LOG_WORKSHOP,0);
  if (cVar1 != '\0') {
    lVar3 = (longdouble)Plat_FloatTime();
    LoggingSystem_Log(LOG_WORKSHOP,0,"[UGC] Beginning download of %s%c%s. (%f)\n",param_3,0x2f,
                      param_4,(double)lVar3);
  }
  lVar4 = (**(code **)(_DAT_00000000 + 0x60))(0,param_1._4_4_,param_2,0);
  if (*(int *)((CUGCFileRequest *)param_1 + 0xc) != 0 ||
      *(int *)((CUGCFileRequest *)param_1 + 0x10) != 0) {
    SteamAPI_UnregisterCallResult
              ((CUGCFileRequest *)param_1,*(int *)((CUGCFileRequest *)param_1 + 0xc),
               *(int *)((CUGCFileRequest *)param_1 + 0x10));
  }
  *(int *)((CUGCFileRequest *)param_1 + 0x10) = (int)((ulonglong)lVar4 >> 0x20);
  *(CUGCFileRequest **)((CUGCFileRequest *)param_1 + 0x14) = (CUGCFileRequest *)param_1;
  *(code **)((CUGCFileRequest *)param_1 + 0x18) = Steam_OnUGCDownload;
  *(undefined4 *)((CUGCFileRequest *)param_1 + 0x1c) = 0;
  *(int *)((CUGCFileRequest *)param_1 + 0xc) = (int)lVar4;
  if (lVar4 == 0) {
    uVar2 = ThrowError((CUGCFileRequest *)param_1,
                       "[UGC] Failed to initiate download of file (%s%s%s) from cloud\n");
    return uVar2;
  }
  SteamAPI_RegisterCallResult((CUGCFileRequest *)param_1,lVar4);
  *(undefined4 *)((CUGCFileRequest *)param_1 + 0x598) = 1;
  *(undefined4 *)((CUGCFileRequest *)param_1 + 0x38c) = param_1._4_4_;
  *(char **)((CUGCFileRequest *)param_1 + 0x390) = param_2;
  lVar3 = (longdouble)Plat_FloatTime();
  *(float *)((CUGCFileRequest *)param_1 + 0x59c) = (float)lVar3;
  if (param_3 != (char *)0x0) {
    V_strncpy((char *)((CUGCFileRequest *)param_1 + 0x40),param_3,0x104);
    V_FixSlashes((char *)((CUGCFileRequest *)param_1 + 0x40),'/');
  }
  if (param_4 != 0) {
    V_strncpy((char *)((CUGCFileRequest *)param_1 + 0x144),(char *)param_4,0x104);
  }
  *(undefined4 *)((CUGCFileRequest *)param_1 + 0x5a0) = 0;
  return *(undefined4 *)((CUGCFileRequest *)param_1 + 0x598);
}

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)