CFrameSnapshotManager::BuildSnapshotList
0x001f1930 · 493 bytes · __thiscall
_ZN21CFrameSnapshotManager17BuildSnapshotListEP14CFrameSnapshotS1_R23CReferencedSnapshotList
Decompiled
undefined (4 params)
/* CFrameSnapshotManager::BuildSnapshotList(CFrameSnapshot*, CFrameSnapshot*,
CReferencedSnapshotList&) */
uint __thiscall
CFrameSnapshotManager::BuildSnapshotList
(CFrameSnapshotManager *this,CFrameSnapshot *param_1,CFrameSnapshot *param_2,
CReferencedSnapshotList *param_3)
{
uint uVar1;
int iVar2;
int iVar3;
CFrameSnapshotManager *pCVar4;
uint uVar5;
CFrameSnapshot *pCVar6;
int iVar7;
size_t __size;
void *pvVar8;
int iVar9;
int local_20;
pCVar4 = this + 4;
uVar5 = ThreadGetCurrentId();
if (uVar5 != *(uint *)(this + 4)) {
LOCK();
uVar1 = *(uint *)pCVar4;
if (uVar1 == 0) {
*(uint *)pCVar4 = uVar5;
}
UNLOCK();
if (uVar1 != 0) {
CThreadFastMutex::Lock((uint)pCVar4,uVar5);
goto LAB_001f1976;
}
}
*(int *)(this + 8) = *(int *)(this + 8) + 1;
LAB_001f1976:
pCVar6 = param_1;
if (param_2 != (CFrameSnapshot *)0x0) {
pCVar6 = (CFrameSnapshot *)NextSnapshot(this,param_2);
}
local_20 = 0;
for (; pCVar6 != (CFrameSnapshot *)0x0; pCVar6 = (CFrameSnapshot *)NextSnapshot(this,pCVar6)) {
LOCK();
*(int *)(pCVar6 + 0x38) = *(int *)(pCVar6 + 0x38) + 1;
UNLOCK();
iVar2 = *(int *)(param_3 + 0xc);
iVar3 = *(int *)(param_3 + 4);
iVar9 = iVar2 + 1;
if (iVar3 < iVar9) {
iVar7 = *(int *)(param_3 + 8);
if (iVar7 < 0) goto LAB_001f19b2;
if (iVar7 == 0) {
if (iVar3 == 0) {
if (iVar9 < 9) {
iVar7 = 8;
goto LAB_001f1a5f;
}
iVar3 = 8;
}
do {
iVar7 = iVar3;
iVar3 = iVar7 * 2;
} while (iVar3 < iVar9);
pvVar8 = *(void **)param_3;
*(int *)(param_3 + 4) = iVar3;
__size = iVar7 << 3;
if (pvVar8 == (void *)0x0) goto LAB_001f1af9;
LAB_001f1a72:
pvVar8 = realloc(pvVar8,__size);
*(void **)param_3 = pvVar8;
iVar9 = *(int *)(param_3 + 0xc) + 1;
}
else {
for (iVar7 = (iVar2 / iVar7 + 1) * iVar7; iVar7 < iVar9; iVar7 = (iVar7 + iVar9) / 2) {
}
LAB_001f1a5f:
pvVar8 = *(void **)param_3;
*(int *)(param_3 + 4) = iVar7;
__size = iVar7 << 2;
if (pvVar8 != (void *)0x0) goto LAB_001f1a72;
LAB_001f1af9:
pvVar8 = malloc(__size);
*(void **)param_3 = pvVar8;
}
}
else {
LAB_001f19b2:
pvVar8 = *(void **)param_3;
}
*(int *)(param_3 + 0xc) = iVar9;
iVar9 = (iVar9 - iVar2) + -1;
*(void **)(param_3 + 0x10) = pvVar8;
iVar2 = iVar2 * 4;
if (0 < iVar9) {
/* try { // try from 001f1aa5 to 001f1ac3 has its CatchHandler @ 001f1b38 */
_V_memmove((void *)((int)pvVar8 + iVar2 + 4),(void *)((int)pvVar8 + iVar2),iVar9 * 4);
pvVar8 = *(void **)param_3;
}
if ((undefined4 *)(iVar2 + (int)pvVar8) != (undefined4 *)0x0) {
*(undefined4 *)(iVar2 + (int)pvVar8) = pCVar6;
}
local_20 = local_20 + 1;
if (100000 < local_20) {
Error("CFrameSnapshotManager::BuildSnapshotList: infinite loop building list!!!");
}
if (param_1 == pCVar6) break;
}
*(int *)(this + 8) = *(int *)(this + 8) + -1;
uVar5 = *(uint *)(this + 8);
if (uVar5 == 0) {
LOCK();
uVar5 = *(uint *)pCVar4;
*(uint *)pCVar4 = 0;
UNLOCK();
}
return uVar5;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.