CGameEventManager::UnserializeEvent
0x00161130 · 2733 bytes · __thiscall
_ZN17CGameEventManager16UnserializeEventEP7bf_read
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CGameEventManager::UnserializeEvent(bf_read*) */
int * __thiscall CGameEventManager::UnserializeEvent(CGameEventManager *this,bf_read *param_1)
{
bf_read *pbVar1;
int iVar2;
uint uVar3;
undefined4 *puVar4;
char *pcVar5;
uint uVar6;
short sVar7;
char cVar8;
CGameEventManager *pCVar9;
uint uVar10;
KeyValues *this_00;
undefined4 uVar11;
undefined4 uVar12;
uint *puVar13;
int iVar14;
int *piVar15;
code *pcVar16;
int in_GS_OFFSET;
undefined8 uVar17;
int local_454;
CGameEventDescriptor *local_450;
uint local_448;
uint local_444;
int local_440;
char local_420 [1024];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pCVar9 = this + 0x9c;
if (_SetSeed != 0) {
if (CTelemetryLock::CTelemetryLock(void*,char_const*)::s_bNameSet == '\0') {
(**(code **)(_SetSeed + 0x5c))
(_SetSeed,pCVar9,&CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,
"CGameEventManager");
CTelemetryLock::CTelemetryLock(void*,char_const*)::s_bNameSet = '\x01';
if (_SetSeed == 0) goto LAB_00161219;
}
(**(code **)(_SetSeed + 0x60))
(_SetSeed,0,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3eb,pCVar9,
&CTelemetryLock::CTelemetryLock(void*,char_const*)::tm_fmt,&DAT_002c48a3,
"CGameEventManager");
}
LAB_00161219:
/* try { // try from 00161219 to 0016121d has its CatchHandler @ 00161c60 */
uVar10 = ThreadGetCurrentId();
if (uVar10 == *(uint *)(this + 0x9c)) {
LAB_00161242:
*(int *)(this + 0xa0) = *(int *)(this + 0xa0) + 1;
}
else {
LOCK();
uVar3 = *(uint *)pCVar9;
if (uVar3 == 0) {
*(uint *)pCVar9 = uVar10;
}
UNLOCK();
if (uVar3 == 0) goto LAB_00161242;
/* try { // try from 0016147c to 00161480 has its CatchHandler @ 00161c60 */
CThreadFastMutex::Lock((uint)pCVar9,uVar10);
}
/* try { // try from 001612a1 to 0016139c has its CatchHandler @ 00161c7d */
if ((_SetSeed != 0) &&
((**(code **)(_SetSeed + 100))
(_SetSeed,0,0,"/data/src/public/tier0/vprof_telemetry.h",0x3f3,
&CTelemetryLock::Locked()::tm_fmt,pCVar9,0), _SetSeed != 0)) {
(**(code **)(_SetSeed + 0x6c))
(_SetSeed,pCVar9,2,"/data/src/public/tier0/vprof_telemetry.h",0x3f4,
&CTelemetryLock::Locked()::tm_fmt,"%s Locked","CGameEventManager");
}
if (*(int *)(param_1 + 0x20) == 0) {
local_454 = 0;
iVar14 = *(int *)(param_1 + 0x14);
}
else {
iVar14 = *(int *)(param_1 + 0x14);
iVar2 = (((uint)(*(int *)(param_1 + 0x18) - *(int *)(param_1 + 0x20)) >> 2) * 0x20 - iVar14) +
(*(uint *)(param_1 + 0xc) & 3) * 8;
local_454 = *(int *)(param_1 + 8);
if (iVar2 <= *(int *)(param_1 + 8)) {
local_454 = iVar2;
}
}
if (iVar14 < 9) {
uVar10 = *(uint *)(param_1 + 0x10);
puVar13 = *(uint **)(param_1 + 0x18);
if (puVar13 == *(uint **)(param_1 + 0x1c)) {
*(undefined4 *)(param_1 + 0x14) = 1;
uVar10 = 0;
*(undefined4 *)(param_1 + 0x10) = 0;
*(uint **)(param_1 + 0x18) = puVar13 + 1;
param_1[4] = (bf_read)0x1;
}
else {
if (*(uint **)(param_1 + 0x1c) < puVar13) {
param_1[4] = (bf_read)0x1;
*(undefined4 *)(param_1 + 0x10) = 0;
}
else {
*(uint **)(param_1 + 0x18) = puVar13 + 1;
uVar3 = *puVar13;
*(uint *)(param_1 + 0x10) = uVar3;
if (param_1[4] == (bf_read)0x0) {
uVar11 = *(undefined4 *)(param_1 + 0x14);
uVar6 = (&CBitBuffer::s_nMaskTable)[9 - iVar14];
*(int *)(param_1 + 0x14) = iVar14 + 0x17;
uVar10 = (uVar6 & uVar3) << ((byte)uVar11 & 0x1f) | uVar10;
*(uint *)(param_1 + 0x10) = uVar3 >> ((byte)(9 - iVar14) & 0x1f);
goto LAB_00161349;
}
}
uVar10 = 0;
}
LAB_0016134f:
if (*(int *)(this + 0x10) < 1) goto LAB_0016138d;
local_450 = *(CGameEventDescriptor **)(this + 4);
if (uVar10 != *(uint *)local_450) {
iVar14 = 0;
do {
local_450 = local_450 + 0x34;
iVar14 = iVar14 + 1;
if (iVar14 == *(int *)(this + 0x10)) goto LAB_0016138d;
} while (uVar10 != *(uint *)local_450);
}
pcVar5 = *(char **)(*(int *)(local_450 + 4) * 0x18 + *(int *)(this + 0x7c) + 0x10);
/* try { // try from 001614e1 to 00161c3a has its CatchHandler @ 00161c7d */
piVar15 = (int *)CreateEvent(this,local_450,pcVar5);
if (piVar15 != (int *)0x0) {
this_00 = (KeyValues *)KeyValues::GetFirstSubKey(*(KeyValues **)(local_450 + 8));
if (this_00 != (KeyValues *)0x0) {
LAB_00161510:
uVar11 = KeyValues::GetName(this_00);
uVar12 = KeyValues::GetInt(this_00,(char *)0x0,0);
switch(uVar12) {
case 0:
goto switchD_00161541_caseD_0;
case 1:
cVar8 = CBitRead::ReadString((CBitRead *)param_1,local_420,0x400,false,(int *)0x0);
if (cVar8 == '\0') goto switchD_00161541_caseD_0;
(**(code **)(*piVar15 + 0x3c))(piVar15,uVar11,local_420);
this_00 = (KeyValues *)KeyValues::GetNextKey(this_00);
break;
case 2:
iVar14 = *(int *)(param_1 + 0x14);
pcVar16 = *(code **)(*piVar15 + 0x38);
if (iVar14 < 0x20) {
uVar10 = *(uint *)(param_1 + 0x10);
puVar13 = *(uint **)(param_1 + 0x18);
if (puVar13 == *(uint **)(param_1 + 0x1c)) {
*(undefined4 *)(param_1 + 0x14) = 1;
*(undefined4 *)(param_1 + 0x10) = 0;
*(uint **)(param_1 + 0x18) = puVar13 + 1;
param_1[4] = (bf_read)0x1;
}
else if (*(uint **)(param_1 + 0x1c) < puVar13) {
param_1[4] = (bf_read)0x1;
*(undefined4 *)(param_1 + 0x10) = 0;
}
else {
*(uint **)(param_1 + 0x18) = puVar13 + 1;
uVar3 = *puVar13;
*(uint *)(param_1 + 0x10) = uVar3;
if (param_1[4] == (bf_read)0x0) {
*(int *)(param_1 + 0x14) = iVar14;
local_440._0_1_ = (byte)(0x20 - iVar14);
uVar10 = (uVar3 & (&CBitBuffer::s_nMaskTable)[0x20 - iVar14]) <<
((byte)iVar14 & 0x1f) | uVar10;
*(uint *)(param_1 + 0x10) = uVar3 >> ((byte)local_440 & 0x1f);
goto LAB_001615a1;
}
}
uVar10 = 0;
}
else {
*(int *)(param_1 + 0x14) = iVar14 + -0x20;
uVar10 = *(uint *)(param_1 + 0x10);
if (iVar14 + -0x20 == 0) {
puVar4 = *(undefined4 **)(param_1 + 0x18);
*(undefined4 *)(param_1 + 0x14) = 0x20;
if (puVar4 == *(undefined4 **)(param_1 + 0x1c)) {
*(undefined4 *)(param_1 + 0x14) = 1;
*(undefined4 *)(param_1 + 0x10) = 0;
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
}
else {
if (*(undefined4 **)(param_1 + 0x1c) < puVar4) {
param_1[4] = (bf_read)0x1;
goto LAB_00161596;
}
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
*(undefined4 *)(param_1 + 0x10) = *puVar4;
}
}
else {
LAB_00161596:
*(undefined4 *)(param_1 + 0x10) = 0;
}
}
LAB_001615a1:
(*pcVar16)(piVar15,uVar11,uVar10);
goto switchD_00161541_caseD_0;
case 3:
iVar14 = *(int *)(param_1 + 0x14);
pcVar16 = *(code **)(*piVar15 + 0x30);
if (iVar14 < 0x20) {
local_444 = *(uint *)(param_1 + 0x10);
puVar13 = *(uint **)(param_1 + 0x18);
if (puVar13 == *(uint **)(param_1 + 0x1c)) {
LAB_001618c0:
*(undefined4 *)(param_1 + 0x14) = 1;
*(undefined4 *)(param_1 + 0x10) = 0;
*(uint **)(param_1 + 0x18) = puVar13 + 1;
param_1[4] = (bf_read)0x1;
goto LAB_001618d8;
}
if (puVar13 < *(uint **)(param_1 + 0x1c)) {
*(uint **)(param_1 + 0x18) = puVar13 + 1;
local_448 = *puVar13;
*(uint *)(param_1 + 0x10) = local_448;
if (param_1[4] != (bf_read)0x0) goto LAB_001618d8;
local_440 = 0x20 - iVar14;
uVar10 = (local_448 & (&CBitBuffer::s_nMaskTable)[local_440]) << ((byte)iVar14 & 0x1f)
;
LAB_00161899:
*(int *)(param_1 + 0x14) = iVar14;
uVar10 = uVar10 | local_444;
*(uint *)(param_1 + 0x10) = local_448 >> ((byte)local_440 & 0x1f);
}
else {
LAB_001618e0:
param_1[4] = (bf_read)0x1;
uVar10 = 0;
*(undefined4 *)(param_1 + 0x10) = 0;
}
}
else {
*(int *)(param_1 + 0x14) = iVar14 + -0x20;
uVar10 = *(uint *)(param_1 + 0x10);
if (iVar14 + -0x20 == 0) {
LAB_001619b0:
puVar4 = *(undefined4 **)(param_1 + 0x18);
*(undefined4 *)(param_1 + 0x14) = 0x20;
if (puVar4 == *(undefined4 **)(param_1 + 0x1c)) {
*(undefined4 *)(param_1 + 0x14) = 1;
*(undefined4 *)(param_1 + 0x10) = 0;
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
}
else {
if (*(undefined4 **)(param_1 + 0x1c) < puVar4) {
param_1[4] = (bf_read)0x1;
goto LAB_0016179d;
}
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
*(undefined4 *)(param_1 + 0x10) = *puVar4;
}
}
else {
LAB_0016179d:
*(undefined4 *)(param_1 + 0x10) = 0;
}
}
goto LAB_00161708;
case 4:
iVar14 = *(int *)(param_1 + 0x14);
pcVar16 = *(code **)(*piVar15 + 0x30);
if (iVar14 < 0x10) {
uVar12 = *(undefined4 *)(param_1 + 0x10);
puVar13 = *(uint **)(param_1 + 0x18);
if (puVar13 == *(uint **)(param_1 + 0x1c)) goto LAB_001618c0;
if (*(uint **)(param_1 + 0x1c) <= puVar13) goto LAB_001618e0;
*(uint **)(param_1 + 0x18) = puVar13 + 1;
uVar10 = *puVar13;
*(uint *)(param_1 + 0x10) = uVar10;
if (param_1[4] != (bf_read)0x0) goto LAB_001618d8;
uVar3 = (&CBitBuffer::s_nMaskTable)[0x10 - iVar14];
*(int *)(param_1 + 0x14) = iVar14 + 0x10;
local_440._0_1_ = (byte)(0x10 - iVar14);
*(uint *)(param_1 + 0x10) = uVar10 >> ((byte)local_440 & 0x1f);
uVar10 = (uint)(short)((ushort)((uVar10 & uVar3) << ((byte)iVar14 & 0x1f)) |
(ushort)uVar12);
}
else {
*(int *)(param_1 + 0x14) = iVar14 + -0x10;
sVar7 = (short)*(uint *)(param_1 + 0x10);
if (iVar14 + -0x10 == 0) {
puVar4 = *(undefined4 **)(param_1 + 0x18);
*(undefined4 *)(param_1 + 0x14) = 0x20;
if (puVar4 == *(undefined4 **)(param_1 + 0x1c)) {
*(undefined4 *)(param_1 + 0x14) = 1;
uVar10 = (uint)sVar7;
*(undefined4 *)(param_1 + 0x10) = 0;
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
}
else if (*(undefined4 **)(param_1 + 0x1c) < puVar4) {
param_1[4] = (bf_read)0x1;
uVar10 = (uint)sVar7;
*(undefined4 *)(param_1 + 0x10) = 0;
}
else {
uVar10 = (uint)sVar7;
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
*(undefined4 *)(param_1 + 0x10) = *puVar4;
}
}
else {
uVar10 = (uint)sVar7;
*(uint *)(param_1 + 0x10) = *(uint *)(param_1 + 0x10) >> 0x10;
}
}
goto LAB_00161708;
case 5:
iVar14 = *(int *)(param_1 + 0x14);
pcVar16 = *(code **)(*piVar15 + 0x30);
if (iVar14 < 8) {
local_444 = *(uint *)(param_1 + 0x10);
puVar13 = *(uint **)(param_1 + 0x18);
if (puVar13 == *(uint **)(param_1 + 0x1c)) goto LAB_001618c0;
if (*(uint **)(param_1 + 0x1c) <= puVar13) goto LAB_001618e0;
*(uint **)(param_1 + 0x18) = puVar13 + 1;
local_448 = *puVar13;
*(uint *)(param_1 + 0x10) = local_448;
if (param_1[4] == (bf_read)0x0) {
local_440 = 8 - iVar14;
uVar10 = (local_448 & (&CBitBuffer::s_nMaskTable)[local_440]) << ((byte)iVar14 & 0x1f)
;
iVar14 = iVar14 + 0x18;
goto LAB_00161899;
}
LAB_001618d8:
uVar10 = 0;
}
else {
*(int *)(param_1 + 0x14) = iVar14 + -8;
uVar10 = *(uint *)(param_1 + 0x10) & 0xff;
if (iVar14 + -8 == 0) goto LAB_001619b0;
*(uint *)(param_1 + 0x10) = *(uint *)(param_1 + 0x10) >> 8;
}
LAB_00161708:
(*pcVar16)(piVar15,uVar11,uVar10);
this_00 = (KeyValues *)KeyValues::GetNextKey(this_00);
break;
case 6:
uVar10 = *(uint *)(param_1 + 0x10);
pcVar16 = *(code **)(*piVar15 + 0x30);
pbVar1 = param_1 + 0x14;
*(int *)pbVar1 = *(int *)pbVar1 + -1;
if (*(int *)pbVar1 == 0) {
puVar4 = *(undefined4 **)(param_1 + 0x18);
*(undefined4 *)(param_1 + 0x14) = 0x20;
if (puVar4 == *(undefined4 **)(param_1 + 0x1c)) {
*(undefined4 *)(param_1 + 0x14) = 1;
*(undefined4 *)(param_1 + 0x10) = 0;
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
}
else if (*(undefined4 **)(param_1 + 0x1c) < puVar4) {
param_1[4] = (bf_read)0x1;
*(undefined4 *)(param_1 + 0x10) = 0;
}
else {
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
*(undefined4 *)(param_1 + 0x10) = *puVar4;
}
}
else {
*(uint *)(param_1 + 0x10) = uVar10 >> 1;
}
(*pcVar16)(piVar15,uVar11,uVar10 & 1);
this_00 = (KeyValues *)KeyValues::GetNextKey(this_00);
break;
case 7:
pcVar16 = *(code **)(*piVar15 + 0x34);
uVar17 = CBitRead::ReadLongLong((CBitRead *)param_1);
(*pcVar16)(piVar15,uVar11,uVar17);
this_00 = (KeyValues *)KeyValues::GetNextKey(this_00);
break;
default:
uVar11 = KeyValues::GetName(this_00);
DevMsg(1,"CGameEventManager: unknown type %i for key \'%s\' [%s].\n",uVar12,uVar11,pcVar5)
;
this_00 = (KeyValues *)KeyValues::GetNextKey(this_00);
}
LAB_001615c4:
if (this_00 == (KeyValues *)0x0) goto LAB_001615ce;
goto LAB_00161510;
}
LAB_001615ce:
if (*(int *)(param_1 + 0x20) == 0) {
iVar14 = 0;
}
else {
iVar2 = (((uint)(*(int *)(param_1 + 0x18) - *(int *)(param_1 + 0x20)) >> 2) * 0x20 -
*(int *)(param_1 + 0x14)) + (*(uint *)(param_1 + 0xc) & 3) * 8;
iVar14 = *(int *)(param_1 + 8);
if (iVar2 <= *(int *)(param_1 + 8)) {
iVar14 = iVar2;
}
}
*(int *)(local_450 + 0x28) = *(int *)(local_450 + 0x28) + 1;
*(int *)(local_450 + 0x30) = *(int *)(local_450 + 0x30) + (iVar14 - local_454);
goto LAB_0016139f;
}
DevMsg("CGameEventManager::UnserializeEvent:: failed to create event %s.\n",pcVar5);
}
else {
*(int *)(param_1 + 0x14) = iVar14 + -9;
uVar10 = *(uint *)(param_1 + 0x10) & 0x1ff;
if (iVar14 + -9 == 0) {
puVar4 = *(undefined4 **)(param_1 + 0x18);
*(undefined4 *)(param_1 + 0x14) = 0x20;
if (puVar4 == *(undefined4 **)(param_1 + 0x1c)) {
*(undefined4 *)(param_1 + 0x14) = 1;
*(undefined4 *)(param_1 + 0x10) = 0;
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
}
else if (*(undefined4 **)(param_1 + 0x1c) < puVar4) {
param_1[4] = (bf_read)0x1;
*(undefined4 *)(param_1 + 0x10) = 0;
}
else {
*(undefined4 **)(param_1 + 0x18) = puVar4 + 1;
*(undefined4 *)(param_1 + 0x10) = *puVar4;
}
}
else {
*(uint *)(param_1 + 0x10) = *(uint *)(param_1 + 0x10) >> 9;
}
LAB_00161349:
if (-1 < (int)uVar10) goto LAB_0016134f;
LAB_0016138d:
DevMsg("CGameEventManager::UnserializeEvent:: unknown event id %i.\n",uVar10);
}
piVar15 = (int *)0x0;
LAB_0016139f:
*(int *)(this + 0xa0) = *(int *)(this + 0xa0) + -1;
if (*(int *)(this + 0xa0) == 0) {
LOCK();
*(uint *)pCVar9 = 0;
UNLOCK();
}
if ((pCVar9 != (CGameEventManager *)0x0) && (_SetSeed != 0)) {
(**(code **)(_SetSeed + 0x6c))
(_SetSeed,pCVar9,1,"/data/src/public/tier0/vprof_telemetry.h",0x3fa,
&CTelemetryLock::Unlocked()::tm_fmt,"%s Released","CGameEventManager");
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return piVar15;
switchD_00161541_caseD_0:
this_00 = (KeyValues *)KeyValues::GetNextKey(this_00);
goto LAB_001615c4;
}
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.