CFrameSnapshotManager::CreateEmptySnapshot
0x001f2550 · 392 bytes · __thiscall
_ZN21CFrameSnapshotManager19CreateEmptySnapshotEii
Decompiled
undefined (3 params)
/* CFrameSnapshotManager::CreateEmptySnapshot(int, int) */
CFrameSnapshot * __thiscall
CFrameSnapshotManager::CreateEmptySnapshot(CFrameSnapshotManager *this,int param_1,int param_2)
{
CFrameSnapshotManager *pCVar1;
uint uVar2;
uint uVar3;
CFrameSnapshot *this_00;
void *pvVar4;
undefined4 *puVar5;
int iVar6;
CFrameSnapshot *local_20 [4];
local_20[0] = (CFrameSnapshot *)0x0;
uVar3 = ThreadGetCurrentId();
pCVar1 = this + 4;
if (uVar3 == *(uint *)(this + 4)) {
LAB_001f2583:
*(int *)(this + 8) = *(int *)(this + 8) + 1;
}
else {
LOCK();
uVar2 = *(uint *)pCVar1;
if (uVar2 == 0) {
*(uint *)pCVar1 = uVar3;
}
UNLOCK();
if (uVar2 == 0) goto LAB_001f2583;
CThreadFastMutex::Lock((uint)pCVar1,uVar3);
}
/* try { // try from 001f259b to 001f259f has its CatchHandler @ 001f26e7 */
this_00 = (CFrameSnapshot *)
CUtlMemoryPool::Alloc((CUtlMemoryPool *)CFrameSnapshot::s_Allocator,0x3c);
CFrameSnapshot::CFrameSnapshot(this_00);
LOCK();
*(int *)(this_00 + 0x38) = *(int *)(this_00 + 0x38) + 1;
UNLOCK();
*(int *)(this + 8) = *(int *)(this + 8) + -1;
if (*(int *)(this + 8) == 0) {
LOCK();
*(uint *)pCVar1 = 0;
UNLOCK();
}
*(int *)(this_00 + 0xc) = param_2;
*(int *)(this_00 + 4) = param_1;
uVar3 = 0xffffffff;
*(undefined4 *)(this_00 + 0x14) = 0;
*(undefined4 *)(this_00 + 0x10) = 0;
*(undefined4 *)(this_00 + 0x18) = 0;
if ((uint)param_2 < 0xaa00001) {
uVar3 = param_2 * 0xc;
}
local_20[0] = this_00;
pvVar4 = operator_new__(uVar3);
*(void **)(this_00 + 8) = pvVar4;
iVar6 = 0;
puVar5 = *(undefined4 **)(local_20[0] + 8);
if (0 < param_2) {
do {
iVar6 = iVar6 + 1;
*puVar5 = 0;
puVar5[1] = 0xffffffff;
puVar5[2] = 0;
puVar5 = puVar5 + 3;
} while (iVar6 != param_2);
}
uVar3 = ThreadGetCurrentId();
if (uVar3 != *(uint *)(this + 4)) {
LOCK();
uVar2 = *(uint *)pCVar1;
if (uVar2 == 0) {
*(uint *)pCVar1 = uVar3;
}
UNLOCK();
if (uVar2 != 0) {
CThreadFastMutex::Lock((uint)pCVar1,uVar3);
goto LAB_001f265d;
}
}
*(int *)(this + 8) = *(int *)(this + 8) + 1;
LAB_001f265d:
/* try { // try from 001f2672 to 001f2676 has its CatchHandler @ 001f2701 */
uVar3 = CUtlLinkedList<CFrameSnapshot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CFrameSnapshot*,unsigned_short>,unsigned_short>>
::InsertBefore((CUtlLinkedList<CFrameSnapshot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CFrameSnapshot*,unsigned_short>,unsigned_short>>
*)(this + 0xc),0xffff,local_20);
LOCK();
*(uint *)local_20[0] = uVar3 & 0xffff;
UNLOCK();
*(int *)(this + 8) = *(int *)(this + 8) + -1;
if (*(int *)(this + 8) == 0) {
LOCK();
*(uint *)pCVar1 = 0;
UNLOCK();
}
return local_20[0];
}
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.