CUGCFileRequestManager::Update
0x002233a0 · 1021 bytes · __thiscall
_ZN22CUGCFileRequestManager6UpdateEv
Decompiled
undefined (1 param)
/* CUGCFileRequestManager::Update() */
void __thiscall CUGCFileRequestManager::Update(CUGCFileRequestManager *this)
{
CUGCFileRequest *this_00;
char cVar1;
int iVar2;
uint *puVar3;
uint *puVar4;
uint uVar5;
int in_GS_OFFSET;
uint uVar6;
CUGCFileRequestManager *this_01;
uint *puVar7;
uint local_15c;
uint local_158;
uint *local_154;
undefined4 local_150;
undefined4 local_14c;
undefined1 local_148;
undefined4 local_140;
undefined4 local_13c;
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
this_01 = this + 0x1c;
LAB_002233c3:
if (*(int *)(this + 0x28) == 0) goto LAB_002233f3;
puVar7 = (uint *)**(int **)(this + 0x1c);
if (puVar7 != (uint *)0x0) {
this_00 = (CUGCFileRequest *)(puVar7 + 0xca);
iVar2 = CUGCFileRequest::Update(this_00);
if (iVar2 == 0) {
if (puVar7[0xc5] == 0) {
puVar4 = puVar7 + 0x84;
if ((char)puVar7[0x84] == '\0') {
puVar4 = (uint *)0x0;
}
puVar3 = (uint *)0x0;
if ((char)puVar7[0x43] != '\0') {
puVar3 = puVar7 + 0x43;
}
uVar5 = (uint)(byte)puVar7[199];
uVar6 = puVar7[0xc6];
iVar2 = CUGCFileRequest::StartDownload
(CONCAT44(*puVar7,this_00),(char *)puVar7[1],(char *)puVar4,(uint)puVar3,
SUB41(uVar6,0));
if (iVar2 == 4) {
CUtlPriorityQueue<UGCFileRequest_t*,CDefUtlPriorityQueueLessFunc<UGCFileRequest_t*>,CUtlMemory<UGCFileRequest_t*,int>>
::RemoveAtHead((CUtlPriorityQueue<UGCFileRequest_t*,CDefUtlPriorityQueueLessFunc<UGCFileRequest_t*>,CUtlMemory<UGCFileRequest_t*,int>>
*)(this + 0x1c));
}
cVar1 = LoggingSystem_IsChannelEnabled(LOG_WORKSHOP,0);
if (cVar1 != '\0') {
LoggingSystem_Log(LOG_WORKSHOP,0,"[CUGCRequestManager] Beginning download of %llu\n",
*puVar7,puVar7[1],uVar6,uVar5);
}
goto LAB_002233f3;
}
if (puVar7[0xc5] == 1) {
puVar4 = puVar7 + 0x84;
if ((char)puVar7[0x84] == '\0') {
puVar4 = (uint *)0x0;
}
puVar3 = (uint *)0x0;
if ((char)puVar7[0x43] != '\0') {
puVar3 = puVar7 + 0x43;
}
V_SafeComposeFilename((char *)puVar4,(char *)puVar3,local_124,0x104);
CUtlBuffer::CUtlBuffer((CUtlBuffer *)&local_15c,0,0,0);
puVar7 = puVar7 + 2;
/* try { // try from 002234fa to 00223555 has its CatchHandler @ 002237b4 */
cVar1 = (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0x38))
(g_pFullFileSystem + 4,puVar7,&DAT_002a076d,
(CUtlMemory<unsigned_char,int> *)&local_15c,0,0,0,puVar7);
if (cVar1 == '\0') {
local_150 = 0;
local_14c = 0;
local_13c = 0;
local_140 = 0;
local_148 = 0;
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_15c);
CUGCFileRequest::ThrowError(this_00,"Unable to read file: %s\n",puVar7);
}
else {
/* try { // try from 0022371e to 0022375c has its CatchHandler @ 002237b4 */
CUGCFileRequest::StartUpload(this_00,(CUtlBuffer *)&local_15c,local_124);
cVar1 = LoggingSystem_IsChannelEnabled(LOG_WORKSHOP,0);
if (cVar1 != '\0') {
LoggingSystem_Log(LOG_WORKSHOP,0,"[CUGCRequestManager] Beginning upload of %s\n",
local_124);
}
local_150 = 0;
local_14c = 0;
local_13c = 0;
local_140 = 0;
local_148 = 0;
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_15c);
}
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_15c);
LAB_002233f3:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
goto LAB_002233c3;
}
if (iVar2 != 4) {
if (iVar2 == -1) {
Warning("An error occurred while attempting to download a file from the UGC server!\n");
goto LAB_00223424;
}
goto LAB_002233f3;
}
if (puVar7[0xc5] == 1) {
uVar6 = puVar7[0x1ad];
uVar5 = puVar7[0x1ae];
if ((uVar6 & uVar5) != 0xffffffff) {
*puVar7 = uVar6;
puVar7[1] = uVar5;
local_15c = uVar6;
local_158 = uVar5;
local_154 = puVar7;
CUtlRBTree<CUtlMap<unsigned_long_long,UGCFileRequest_t_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_long_long,UGCFileRequest_t_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_long_long,UGCFileRequest_t_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Insert((CUtlRBTree<CUtlMap<unsigned_long_long,UGCFileRequest_t_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_long_long,UGCFileRequest_t_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_long_long,UGCFileRequest_t_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)this,(Node_t *)&local_15c);
cVar1 = LoggingSystem_IsChannelEnabled(LOG_WORKSHOP,0);
if (cVar1 != '\0') {
LoggingSystem_Log(LOG_WORKSHOP,0,"[CUGCRequestManager] Finished uploading %llu\n",*puVar7,
puVar7[1]);
}
}
}
else {
cVar1 = LoggingSystem_IsChannelEnabled(LOG_WORKSHOP,0);
if (cVar1 != '\0') {
LoggingSystem_Log(LOG_WORKSHOP,0,"[CUGCRequestManager] Finished downloading %llu\n",*puVar7,
puVar7[1]);
CUtlPriorityQueue<UGCFileRequest_t*,CDefUtlPriorityQueueLessFunc<UGCFileRequest_t*>,CUtlMemory<UGCFileRequest_t*,int>>
::RemoveAtHead((CUtlPriorityQueue<UGCFileRequest_t*,CDefUtlPriorityQueueLessFunc<UGCFileRequest_t*>,CUtlMemory<UGCFileRequest_t*,int>>
*)this_01);
goto LAB_002233c3;
}
}
}
LAB_00223424:
CUtlPriorityQueue<UGCFileRequest_t*,CDefUtlPriorityQueueLessFunc<UGCFileRequest_t*>,CUtlMemory<UGCFileRequest_t*,int>>
::RemoveAtHead((CUtlPriorityQueue<UGCFileRequest_t*,CDefUtlPriorityQueueLessFunc<UGCFileRequest_t*>,CUtlMemory<UGCFileRequest_t*,int>>
*)this_01);
goto LAB_002233c3;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.