CBaseEntity::GetDemoRecordingState
0x0060b400 · 1730 bytes · __thiscall
_ZN11CBaseEntity21GetDemoRecordingStateEP9KeyValues
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBaseEntity::GetDemoRecordingState(KeyValues*) */
undefined4 __thiscall CBaseEntity::GetDemoRecordingState(CBaseEntity *this,KeyValues *param_1)
{
uint *puVar1;
code *pcVar2;
uint uVar3;
char cVar4;
undefined2 uVar5;
int iVar6;
undefined4 uVar7;
char *pcVar8;
KeyValues *this_00;
CServerDemo *this_01;
int iVar9;
int *piVar10;
undefined *puVar11;
undefined *puVar12;
undefined4 local_34;
undefined4 local_30;
undefined4 local_28;
undefined4 local_24;
int local_20;
local_34 = 0;
local_30 = 0;
if (_towlower == 0) {
local_20 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_34,0,0,0,0,"/data/src/game/server/baseentity.cpp",0x210b,
&GetDemoRecordingState(KeyValues*)::tm_fmt,"(%s)%s","Tools",
"CBaseEntity::GetDemoRecordingState");
local_20 = _towlower;
}
iVar6 = _DAT_0105db00;
local_28 = local_34;
local_24 = local_30;
/* try { // try from 0060b806 to 0060b866 has its CatchHandler @ 0060bb08 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar9 = ThreadGetCurrentId(), iVar6 == iVar9)) {
if ((char *)*_DAT_0105d15c != "CBaseEntity::GetDemoRecordingState") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc5da94,(char *)0x0,0xc59908);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
if ((GetDemoRecordingState(KeyValues*)::currentState == '\0') &&
(iVar6 = __cxa_guard_acquire(&GetDemoRecordingState(KeyValues*)::currentState), iVar6 != 0)) {
GetDemoRecordingState(KeyValues*)::currentState._8_4_ = 0;
GetDemoRecordingState(KeyValues*)::currentState._12_3_ = 0xffff;
GetDemoRecordingState(KeyValues*)::currentState._16_4_ = 0xffffffff;
GetDemoRecordingState(KeyValues*)::currentState._20_4_ = 0;
GetDemoRecordingState(KeyValues*)::currentState._24_4_ =
GetDemoRecordingState(KeyValues*)::currentState._24_4_ & 0xffffff00;
GetDemoRecordingState(KeyValues*)::currentState._52_4_ = 0xffffffff;
GetDemoRecordingState(KeyValues*)::currentState._28_4_ = 0;
GetDemoRecordingState(KeyValues*)::currentState._32_4_ = 0;
GetDemoRecordingState(KeyValues*)::currentState._36_4_ = 0;
GetDemoRecordingState(KeyValues*)::currentState._40_4_ = 0;
GetDemoRecordingState(KeyValues*)::currentState._44_4_ = 0;
GetDemoRecordingState(KeyValues*)::currentState._48_4_ = 0;
__cxa_guard_release(&GetDemoRecordingState(KeyValues*)::currentState);
}
if (*(int *)(this + 0x30) == 0) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
*(int *)(this + 0x410) = iVar6;
pcVar2 = *(code **)(*modelinfo + 0x10);
/* try { // try from 0060b4ee to 0060b7a2 has its CatchHandler @ 0060bb1d */
uVar7 = GetModel(this);
pcVar8 = (char *)(*pcVar2)(modelinfo,uVar7);
if ((GetDemoRecordingState(KeyValues*)::serverDemoSym == '\0') &&
(iVar6 = __cxa_guard_acquire(&GetDemoRecordingState(KeyValues*)::serverDemoSym), iVar6 != 0)) {
/* try { // try from 0060bab0 to 0060bacc has its CatchHandler @ 0060bb2d */
piVar10 = (int *)KeyValuesSystem();
GetDemoRecordingState(KeyValues*)::serverDemoSym =
(**(code **)(*piVar10 + 0x14))(piVar10,"serverdemo",1);
__cxa_guard_release(&GetDemoRecordingState(KeyValues*)::serverDemoSym);
}
this_00 = (KeyValues *)
KeyValues::FindKey(param_1,GetDemoRecordingState(KeyValues*)::serverDemoSym);
if (this_00 == (KeyValues *)0x0) {
this_01 = (CServerDemo *)0x0;
}
else {
this_01 = (CServerDemo *)KeyValues::GetPtr(this_00,(char *)0x0,(void *)0x0);
}
if (((pcVar8 == (char *)0x0) || (*pcVar8 == '\0')) || (this_01 == (CServerDemo *)0x0)) {
*(undefined2 *)(this + 0x414) = 0xffff;
}
else {
uVar5 = CServerDemo::LookupOrAddModel(this_01,pcVar8);
*(undefined2 *)(this + 0x414) = uVar5;
}
uVar3 = *(uint *)(this + 0x220);
if (((uVar3 == 0xffffffff) ||
(puVar11 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar11 + 8) != uVar3 >> 0xc)) {
iVar6 = 0;
GetDemoRecordingState(KeyValues*)::currentState._16_4_ = -1;
}
else {
iVar6 = *(int *)(puVar11 + 4);
if (iVar6 == 0) {
GetDemoRecordingState(KeyValues*)::currentState._16_4_ = -1;
}
else if (*(int *)(iVar6 + 0x30) == 0) {
GetDemoRecordingState(KeyValues*)::currentState._16_4_ = 0;
}
else {
GetDemoRecordingState(KeyValues*)::currentState._16_4_ =
*(int *)(iVar6 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
}
GetDemoRecordingState(KeyValues*)::currentState._20_4_ = *(undefined4 *)(this + 0xd4);
GetDemoRecordingState(KeyValues*)::currentState._24_4_ =
GetDemoRecordingState(KeyValues*)::currentState._24_4_ & 0xffffff00;
GetDemoRecordingState(KeyValues*)::currentState._12_4_ =
(CONCAT13(GetDemoRecordingState(KeyValues*)::currentState[0xf],
CONCAT12((char)((uint)GetDemoRecordingState(KeyValues*)::currentState._20_4_ >> 5),
GetDemoRecordingState(KeyValues*)::currentState._12_2_)) ^ 0x10000) &
0xff01ffff;
if (((byte)this[0x14d] & 8) == 0) {
GetDemoRecordingState(KeyValues*)::currentState._28_4_ = *(undefined4 *)(this + 0x2e0);
GetDemoRecordingState(KeyValues*)::currentState._32_4_ = *(undefined4 *)(this + 0x2e4);
GetDemoRecordingState(KeyValues*)::currentState._36_4_ = *(undefined4 *)(this + 0x2e8);
}
else {
CalcAbsolutePosition(this);
GetDemoRecordingState(KeyValues*)::currentState._28_4_ = *(undefined4 *)(this + 0x2e0);
GetDemoRecordingState(KeyValues*)::currentState._32_4_ = *(undefined4 *)(this + 0x2e4);
GetDemoRecordingState(KeyValues*)::currentState._36_4_ = *(undefined4 *)(this + 0x2e8);
if ((*(uint *)(this + 0x14c) & 0x800) != 0) {
CalcAbsolutePosition(this);
}
}
puVar11 = g_pEntityList;
GetDemoRecordingState(KeyValues*)::currentState._40_4_ = *(undefined4 *)(this + 0x37c);
GetDemoRecordingState(KeyValues*)::currentState._44_4_ = *(undefined4 *)(this + 0x380);
GetDemoRecordingState(KeyValues*)::currentState._48_4_ = *(undefined4 *)(this + 900);
iVar9 = GetFollowedEntity(this);
if ((((byte)this[0xd4] & 1) == 0) || (iVar9 == 0)) {
GetDemoRecordingState(KeyValues*)::currentState._52_4_ = 0xffffffff;
}
else if (*(int *)(iVar9 + 0x30) == 0) {
GetDemoRecordingState(KeyValues*)::currentState._52_4_ = 0;
}
else {
GetDemoRecordingState(KeyValues*)::currentState._52_4_ =
*(int *)(iVar9 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
if ((iVar6 != 0) && ((*(byte *)(iVar6 + 0xd4) & 8) != 0)) {
GetDemoRecordingState(KeyValues*)::currentState._20_4_ =
GetDemoRecordingState(KeyValues*)::currentState._20_4_ | 8;
}
uVar3 = *(uint *)(this + 0x188);
if (((uVar3 == 0xffffffff) ||
(puVar12 = puVar11 + (uVar3 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar12 + 8) != uVar3 >> 0xc)) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(puVar12 + 4);
}
do {
if (iVar6 == 0) {
LAB_0060b6f0:
if (this[0x10] == (CBaseEntity)0x0) {
*(undefined4 *)(this + 0x408) = 0;
/* try { // try from 0060b9bb to 0060ba5b has its CatchHandler @ 0060bb1d */
uVar7 = ServerDemoPacket_BaseEntity::CompareAndCacheModifiedFields
((ServerDemoPacket_BaseEntity *)(this + 0x408),
(ServerDemoPacket_BaseEntity *)
GetDemoRecordingState(KeyValues*)::currentState);
}
else {
*(undefined4 *)(this + 0x40c) = GetDemoRecordingState(KeyValues*)::currentState._4_4_;
*(undefined4 *)(this + 0x410) = GetDemoRecordingState(KeyValues*)::currentState._8_4_;
*(undefined4 *)(this + 0x414) = GetDemoRecordingState(KeyValues*)::currentState._12_4_;
*(undefined4 *)(this + 0x418) = GetDemoRecordingState(KeyValues*)::currentState._16_4_;
*(undefined4 *)(this + 0x41c) = GetDemoRecordingState(KeyValues*)::currentState._20_4_;
*(undefined4 *)(this + 0x420) = GetDemoRecordingState(KeyValues*)::currentState._24_4_;
*(undefined4 *)(this + 0x424) = GetDemoRecordingState(KeyValues*)::currentState._28_4_;
*(undefined4 *)(this + 0x428) = GetDemoRecordingState(KeyValues*)::currentState._32_4_;
*(undefined4 *)(this + 0x42c) = GetDemoRecordingState(KeyValues*)::currentState._36_4_;
*(undefined4 *)(this + 0x430) = GetDemoRecordingState(KeyValues*)::currentState._40_4_;
*(undefined4 *)(this + 0x434) = GetDemoRecordingState(KeyValues*)::currentState._44_4_;
*(undefined4 *)(this + 0x438) = GetDemoRecordingState(KeyValues*)::currentState._48_4_;
*(undefined4 *)(this + 0x43c) = GetDemoRecordingState(KeyValues*)::currentState._52_4_;
*(undefined4 *)(this + 0x408) = 0xffffffff;
uVar7 = 1;
}
KeyValues::SetInt(param_1,"type",2);
KeyValues::SetPtr(param_1,"baseentity",this + 0x408);
iVar6 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar9 = ThreadGetCurrentId(), iVar6 == iVar9)) {
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_20 != 0) {
(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
}
return uVar7;
}
if ((*(byte *)(iVar6 + 0xd4) & 8) != 0) {
GetDemoRecordingState(KeyValues*)::currentState._20_4_ =
GetDemoRecordingState(KeyValues*)::currentState._20_4_ | 8;
goto LAB_0060b6f0;
}
uVar3 = *(uint *)(iVar6 + 0x188);
if (((uVar3 == 0xffffffff) ||
(puVar12 = puVar11 + (uVar3 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar12 + 8) != uVar3 >> 0xc)) goto LAB_0060b6f0;
iVar6 = *(int *)(puVar12 + 4);
} 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.