CBaseGameStats::LoadFromFile
0x00463be0 · 1250 bytes · __thiscall
_ZN14CBaseGameStats12LoadFromFileEv
Decompiled
undefined (1 param)
/* CBaseGameStats::LoadFromFile() */
uint __thiscall CBaseGameStats::LoadFromFile(CBaseGameStats *this)
{
short sVar1;
code *pcVar2;
char cVar3;
undefined4 uVar4;
uint uVar5;
short *psVar6;
int iVar7;
undefined4 *puVar8;
int in_GS_OFFSET;
int local_270;
short local_264;
undefined2 local_262;
undefined4 local_260;
undefined4 local_25c;
int local_258 [3];
int local_24c;
int local_248;
byte local_243;
int local_238;
byte local_224;
undefined1 local_220 [512];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pcVar2 = *(code **)(filesystem[1] + 0x28);
uVar4 = (**(code **)(*(int *)gamestats + 0x40))(gamestats);
cVar3 = (*pcVar2)(filesystem + 1,uVar4,&DAT_00c146f4);
if (cVar3 != '\0') {
pcVar2 = *(code **)(*filesystem + 0x30);
uVar4 = (**(code **)(*(int *)gamestats + 0x40))(gamestats);
(*pcVar2)(filesystem,uVar4,&DAT_00c146f4,local_220,0x200,0,0);
StatsLog(this,"Loading stats from \'%s\'\n",local_220);
}
CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_258,0,0,0);
pcVar2 = *(code **)(filesystem[1] + 0x38);
/* try { // try from 00463c6f to 00463d3c has its CatchHandler @ 004640e1 */
uVar4 = (**(code **)(*(int *)gamestats + 0x40))(gamestats);
uVar5 = (*pcVar2)(filesystem + 1,uVar4,&DAT_00c146f4,(CUtlBuffer *)local_258,0,0,0);
if ((char)uVar5 == '\0') {
(**(code **)(*filesystem + 0x40))(filesystem,"gamestats.log",&DAT_00c146f4);
}
else {
if ((local_243 & 1) == 0) {
/* try { // try from 00463dbb to 004640c3 has its CatchHandler @ 004640e1 */
cVar3 = CUtlBuffer::CheckGet((CUtlBuffer *)local_258,2);
if (cVar3 != '\0') {
if ((local_224 & 1) == 0) {
sVar1 = *(short *)(local_258[0] + (local_24c - local_238));
}
else {
psVar6 = (short *)((local_24c - local_238) + local_258[0]);
if (psVar6 == (short *)0x0) {
psVar6 = &local_264;
}
local_262 = local_264;
local_262 = CONCAT11((char)((ushort)local_264 >> 8),*(undefined1 *)((int)psVar6 + 1));
local_262 = CONCAT11((char)*psVar6,*(undefined1 *)((int)psVar6 + 1));
_V_memcpy(&local_264,&local_262,2);
sVar1 = local_264;
}
local_24c = local_24c + 2;
goto LAB_00463ce5;
}
local_270 = 0;
}
else {
local_264 = 0;
CUtlBuffer::Scanf((CUtlBuffer *)local_258,"%d",&local_264);
sVar1 = local_264;
LAB_00463ce5:
local_270 = (int)sVar1;
if (6 < local_270) goto LAB_00463cf4;
}
CBGSDriver._4856_4_ = local_270;
CUtlBuffer::Get((CUtlBuffer *)local_258,CBGSDriver + 0x12fc,0x10);
CBGSDriver[0x130c] = 0;
if (s_szPseudoUniqueID == '\0') goto LAB_00463cf6;
iVar7 = _V_stricmp(CBGSDriver + 0x12fc,&s_szPseudoUniqueID);
if (iVar7 != 0) {
pcVar2 = *(code **)(*filesystem + 0x40);
uVar4 = (**(code **)(*(int *)gamestats + 0x40))(gamestats);
(*pcVar2)(filesystem,uVar4,&DAT_00c146f4);
(**(code **)(*filesystem + 0x40))(filesystem,"gamestats.log",&DAT_00c146f4);
Warning("Userid changed, clearing stats file\n");
CBGSDriver[0x12fc] = 0;
CBGSDriver._4856_4_ = 0xffffffff;
BasicGameStats_t::Clear((BasicGameStats_t *)(gamestats + 4));
(**(code **)(*(int *)gamestats + 0x9c))(gamestats);
}
uVar5 = (uint)(iVar7 == 0);
if (local_270 == 6) {
if (*(int *)(local_258[0] + (local_24c - local_238)) == -0x1124111) {
if ((local_243 & 1) == 0) {
cVar3 = CUtlBuffer::CheckGet((CUtlBuffer *)local_258,4);
if (cVar3 != '\0') {
if ((local_224 & 1) != 0) {
puVar8 = (undefined4 *)((local_24c - local_238) + local_258[0]);
if (puVar8 == (undefined4 *)0x0) {
puVar8 = &local_260;
}
local_25c = local_260;
local_25c = CONCAT31((int3)((uint)local_260 >> 8),*(undefined1 *)((int)puVar8 + 3));
local_25c._2_2_ = (undefined2)((uint)local_260 >> 0x10);
local_25c._0_2_ =
CONCAT11(*(undefined1 *)((int)puVar8 + 2),*(undefined1 *)((int)puVar8 + 3));
local_25c._3_1_ = (undefined1)((uint)local_260 >> 0x18);
local_25c._0_3_ = CONCAT12(*(undefined1 *)((int)puVar8 + 1),(undefined2)local_25c);
local_25c = CONCAT13(*(undefined1 *)puVar8,(undefined3)local_25c);
_V_memcpy(&local_260,&local_25c,4);
}
local_24c = local_24c + 4;
}
}
else {
local_260 = 0;
CUtlBuffer::Scanf((CUtlBuffer *)local_258,"%d",&local_260);
}
}
else {
cVar3 = BasicGameStats_t::ParseFromBuffer
((BasicGameStats_t *)(gamestats + 4),(CUtlBuffer *)local_258,6);
if (cVar3 == '\0') {
BasicGameStats_t::Clear((BasicGameStats_t *)(this + 4));
}
}
if (local_248 != local_24c) {
(**(code **)(*(int *)gamestats + 0x98))(gamestats,(CUtlBuffer *)local_258);
}
goto LAB_00463cf6;
}
BasicGameStats_t::Clear((BasicGameStats_t *)(gamestats + 4));
}
LAB_00463cf4:
uVar5 = 0;
LAB_00463cf6:
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_258);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return uVar5;
}
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.