CCaptionRepeatMgr::RemoveCaptionsBefore
0x004b38a0 · 782 bytes · __thiscall
_ZN17CCaptionRepeatMgr20RemoveCaptionsBeforeEf
Decompiled
undefined (2 params)
/* CCaptionRepeatMgr::RemoveCaptionsBefore(float) */
void __thiscall CCaptionRepeatMgr::RemoveCaptionsBefore(CCaptionRepeatMgr *this,float param_1)
{
float *pfVar1;
short sVar2;
ushort uVar3;
ushort *puVar4;
int iVar5;
uint uVar6;
int iVar7;
int iVar8;
int iVar9;
undefined4 local_38 [2];
void *local_30;
int local_2c;
int local_28;
int local_24;
void *local_20;
local_30 = (void *)0x0;
local_2c = 0;
local_28 = 0;
local_24 = 0;
local_20 = (void *)0x0;
uVar3 = *(ushort *)(this + 0x10);
while( true ) {
if ((CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar5 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar5 != 0)) {
CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = -1;
DAT_00f19322 = 0xffff;
DAT_00f19324 = 0xffff;
__cxa_guard_release(&CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
sVar2 = CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel;
if (uVar3 != 0xffff) {
sVar2 = *(short *)((uint)uVar3 * 0x10 + *(int *)(this + 4));
}
if (sVar2 == -1) break;
if (CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') {
iVar5 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
if (iVar5 != 0) {
CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = -1;
DAT_00f19322 = 0xffff;
DAT_00f19324 = 0xffff;
__cxa_guard_release(&CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
if (uVar3 != 0xffff) goto LAB_004b3916;
LAB_004b3a85:
puVar4 = (ushort *)
&CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel;
}
else {
if (uVar3 == 0xffff) goto LAB_004b3a85;
LAB_004b3916:
puVar4 = (ushort *)((uint)uVar3 * 0x10 + *(int *)(this + 4));
}
uVar3 = *puVar4;
}
uVar6 = (uint)uVar3;
iVar5 = local_24;
do {
local_24 = iVar5;
if (uVar6 == 0xffff) {
if (0 < iVar5) {
iVar5 = 0;
do {
local_38[0] = *(undefined4 *)((int)local_30 + iVar5 * 4);
uVar3 = CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Find((CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)this,(Node_t *)local_38);
if (uVar3 != 0xffff) {
CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Unlink((CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)this,uVar3);
*(ushort *)(*(int *)(this + 4) + (uint)uVar3 * 0x10) = uVar3;
*(undefined2 *)(*(int *)(this + 4) + 2 + (uint)uVar3 * 0x10) =
*(undefined2 *)(this + 0x14);
*(short *)(this + 0x12) = *(short *)(this + 0x12) + -1;
*(ushort *)(this + 0x14) = uVar3;
}
iVar5 = iVar5 + 1;
} while (iVar5 < local_24);
}
local_24 = 0;
CUtlMemory<unsigned_int,int>::Purge((CUtlMemory<unsigned_int,int> *)&local_30);
local_20 = local_30;
CUtlMemory<unsigned_int,int>::Purge((CUtlMemory<unsigned_int,int> *)&local_30);
return;
}
iVar8 = uVar6 * 0x10 + *(int *)(this + 4);
pfVar1 = (float *)(iVar8 + 0xc);
if (*pfVar1 <= param_1 && param_1 != *pfVar1) {
iVar9 = iVar5 + 1;
if ((local_2c < iVar9) && (-1 < local_28)) {
if (local_28 == 0) {
iVar7 = local_2c;
if (local_2c == 0) {
if (iVar9 < 9) {
local_2c = 8;
goto LAB_004b3a2f;
}
iVar7 = 8;
}
do {
local_2c = iVar7 * 2;
if (iVar9 <= local_2c) break;
local_2c = iVar7 * 4;
iVar7 = local_2c;
} while (local_2c < iVar9);
}
else {
for (local_2c = (iVar5 / local_28 + 1) * local_28; local_2c < iVar9;
local_2c = (local_2c + iVar9) / 2) {
}
}
LAB_004b3a2f:
if (local_30 == (void *)0x0) {
local_30 = malloc(local_2c << 2);
}
else {
local_30 = realloc(local_30,local_2c << 2);
iVar9 = local_24 + 1;
}
}
iVar7 = (iVar9 - iVar5) + -1;
iVar5 = iVar5 * 4;
local_24 = iVar9;
local_20 = local_30;
if (0 < iVar7) {
/* try { // try from 004b3aa5 to 004b3adf has its CatchHandler @ 004b3bcd */
_V_memmove((void *)((int)local_30 + iVar5 + 4),(void *)((int)local_30 + iVar5),iVar7 * 4);
}
if ((undefined4 *)(iVar5 + (int)local_30) != (undefined4 *)0x0) {
*(undefined4 *)(iVar5 + (int)local_30) = *(undefined4 *)(iVar8 + 8);
}
}
uVar6 = CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::NextInorder((CUtlRBTree<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,float,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,float,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)this,(ushort)uVar6);
uVar6 = uVar6 & 0xffff;
iVar5 = local_24;
} 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.