CHLTVServer::ReadCompeleteDemoFile
0x00173ec0 · 1184 bytes · __thiscall
_ZN11CHLTVServer21ReadCompeleteDemoFileEv
Decompiled
undefined (1 param)
/* CHLTVServer::ReadCompeleteDemoFile() */
void __thiscall CHLTVServer::ReadCompeleteDemoFile(CHLTVServer *this)
{
CDemoFile *this_00;
int iVar1;
char cVar2;
uchar *puVar3;
void *__ptr;
int iVar4;
int in_GS_OFFSET;
uchar uStack_100a1;
int aiStack_100a0 [3];
char *pcStack_10094;
undefined1 uStack_10090;
undefined4 uStack_1008c;
undefined4 uStack_10088;
netadr_s anStack_10070 [16];
double dStack_10060;
undefined4 uStack_10054;
undefined1 uStack_10050;
undefined4 uStack_1004c;
undefined4 uStack_10048;
int iStack_10030;
undefined **ppuStack_10020;
undefined1 uStack_1001c;
undefined4 uStack_10018;
undefined4 uStack_10014;
undefined4 uStack_10010;
undefined4 uStack_1000c;
undefined4 uStack_10008;
undefined4 uStack_10004;
undefined4 local_10000;
undefined4 local_fffc;
undefined4 local_fff8;
undefined4 local_fff4;
undefined4 local_fff0;
undefined1 local_ffec;
undefined4 local_ffe8;
undefined4 local_ffe4;
undefined4 local_ffe0;
undefined4 local_ffdc;
undefined4 local_ffd4;
iVar1 = *(int *)(in_GS_OFFSET + 0x14);
puVar3 = (uchar *)NET_AllocPayload();
aiStack_100a0[0] = 0;
uStack_100a1 = '\x01';
/* try { // try from 00173f0f to 0017409d has its CatchHandler @ 0017438c */
netadr_s::SetIP(anStack_10070,0);
netadr_s::SetPort(anStack_10070,0);
netadr_s::SetType(anStack_10070,3);
uStack_10050 = 0;
uStack_10054 = 0;
uStack_1004c = 0xffffffff;
uStack_10048 = 0;
_V_memset(anStack_10070,0,0x50);
netadr_s::SetType(anStack_10070,1);
this_00 = (CDemoFile *)(this + 0x8400);
do {
aiStack_100a0[1] = 0;
CDemoFile::ReadCmdHeader(this_00,&uStack_100a1,aiStack_100a0,aiStack_100a0 + 1);
switch(uStack_100a1) {
case '\x01':
case '\x02':
pcStack_10094 = (char *)0x0;
/* try { // try from 001742d7 to 00174381 has its CatchHandler @ 001743a4 */
CDemoFile::ReadCmdInfo(this_00,(democmdinfo_t *)(this + 0x8980));
CDemoFile::ReadSequenceInfo(this_00,aiStack_100a0 + 2,(int *)&pcStack_10094);
iVar4 = CDemoFile::ReadRawData(this_00,(char *)puVar3,0x37aa0);
if (0 < iVar4) {
dStack_10060 = (double)realtime;
iStack_10030 = iVar4;
CBitRead::StartReading((CBitRead *)&uStack_10054,puVar3,iVar4,0,-1);
(**(code **)(**(int **)(this + 0x224) + 0xa4))(*(int **)(this + 0x224),anStack_10070,0);
}
break;
case '\x03':
*(undefined4 *)(this + 0x897c) = host_tickcount;
break;
case '\x04':
local_ffd4 = CDemoFile::ReadConsoleCommand(this_00);
uStack_10014 = 0;
uStack_10010 = 0;
uStack_1000c = 0;
uStack_10008 = 0;
uStack_10004 = 0;
local_10000 = 0;
local_fffc = 0;
local_fff8 = 0;
local_fff4 = 0;
local_fff0 = 0;
local_ffec = 0;
local_ffe8 = 0;
local_ffe4 = 0;
local_ffe0 = 0;
local_ffdc = 0;
uStack_1001c = 1;
uStack_10018 = 0;
ppuStack_10020 = &PTR__NET_StringCmd_002a17c8;
CHLTVClientState::ProcessStringCmd
((CHLTVClientState *)(this + 0x214),(NET_StringCmd *)&ppuStack_10020);
break;
case '\x05':
pcStack_10094 = (char *)0x100;
CDemoFile::ReadUserCmd(this_00,(char *)&ppuStack_10020,(int *)&pcStack_10094);
break;
case '\x06':
uStack_10090 = 0;
uStack_1008c = 0xffffffff;
uStack_10088 = 0;
pcStack_10094 = "dem_datatables";
/* try { // try from 00174138 to 00174298 has its CatchHandler @ 0017438c */
CBitRead::StartReading((CBitRead *)&pcStack_10094,&ppuStack_10020,0x10000,0,-1);
CDemoFile::ReadNetworkDataTables(this_00,(bf_read *)&pcStack_10094);
CBitRead::Seek((CBitRead *)&pcStack_10094,0);
cVar2 = DataTable_LoadDataTablesFromBuffer((bf_read *)&pcStack_10094,*(int *)(this + 0x850c));
if (cVar2 == '\0') {
Host_Error("Error parsing network data tables during demo playback.");
}
break;
case '\a':
NET_FreePayload(puVar3);
if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
case '\t':
__ptr = malloc(0x80000);
uStack_10090 = 0;
uStack_1008c = 0xffffffff;
uStack_10088 = 0;
pcStack_10094 = "dem_stringtables";
CBitRead::StartReading((CBitRead *)&pcStack_10094,__ptr,0x80000,0,-1);
CDemoFile::ReadStringTables(this_00,(bf_read *)&pcStack_10094);
CBitRead::Seek((CBitRead *)&pcStack_10094,0);
cVar2 = CNetworkStringTableContainer::ReadStringTables
((CNetworkStringTableContainer *)networkStringTableContainerClient,
(bf_read *)&pcStack_10094);
if (cVar2 == '\0') {
Host_Error("Error parsing string tables during demo playback.");
}
free(__ptr);
}
} while( true );
}
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.