CDispInfo::AllocateShadowDecalFragment
0x00138650 · 728 bytes · __thiscall
_ZN9CDispInfo27AllocateShadowDecalFragmentEti
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CDispInfo::AllocateShadowDecalFragment(unsigned short, int) */
int * __thiscall CDispInfo::AllocateShadowDecalFragment(CDispInfo *this,ushort param_1,int param_2)
{
ushort uVar1;
ushort uVar2;
uint uVar3;
void *pvVar4;
ushort uVar5;
uint uVar6;
int iVar7;
uint uVar8;
int iVar9;
int *piVar10;
uint uVar11;
uint uVar12;
bool bVar13;
uVar3 = ThreadGetCurrentId();
if (uVar3 == s_ShadowFragmentAllocLock) {
LAB_0013867c:
uVar3 = (uint)DAT_0039eca0;
DAT_0039ec54 = DAT_0039ec54 + 1;
if (DAT_0039eca0 != 0xffff) goto LAB_0013869a;
LAB_001387bb:
if ((int)(uint)DAT_0039eca6 < DAT_0039ec94) {
uVar11 = DAT_0039eca6 + 1;
uVar8 = 0xffff;
uVar12 = uVar11 & 0xffff;
uVar6 = uVar3;
if ((int)uVar12 < DAT_0039ec94) {
uVar6 = uVar11;
uVar8 = uVar12;
}
}
else {
uVar8 = 0;
if (DAT_0039ec94 < 1) {
uVar8 = 0xffff;
}
uVar6 = (0 < DAT_0039ec94) - 1;
}
if (DAT_0039ec94 <= (int)uVar8) {
CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>::Grow
((CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>
*)&s_DispShadowFragments,1);
_DAT_0039eca8 = s_DispShadowFragments;
if ((int)(uint)DAT_0039eca6 < DAT_0039ec94) {
uVar11 = DAT_0039eca6 + 1;
uVar8 = uVar11 & 0xffff;
uVar6 = uVar3;
uVar3 = 0xffff;
if ((int)uVar8 < DAT_0039ec94) {
uVar6 = uVar11;
uVar3 = uVar8;
}
}
else {
uVar3 = 0;
if (DAT_0039ec94 < 1) {
uVar3 = 0xffff;
}
uVar6 = (0 < DAT_0039ec94) - 1;
}
if ((int)uVar3 < DAT_0039ec94) goto LAB_0013883d;
if (CUtlLinkedList<CDispShadowFragment,unsigned_short,true,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount < 10) {
CUtlLinkedList<CDispShadowFragment,unsigned_short,true,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount =
CUtlLinkedList<CDispShadowFragment,unsigned_short,true,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount + 1;
iVar9 = 0xbfff4;
uVar5 = 0xffff;
Warning("CUtlLinkedList overflow! (exhausted memory allocator)\n");
uVar2 = 0xffff;
goto LAB_001386c8;
}
LAB_001388ca:
iVar9 = 0xbfff4;
uVar2 = 0xffff;
uVar5 = 0xffff;
goto LAB_001386c8;
}
LAB_0013883d:
uVar5 = (ushort)uVar6;
if (uVar5 == 0xffff) {
if (CUtlLinkedList<CDispShadowFragment,unsigned_short,true,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount < 10) {
CUtlLinkedList<CDispShadowFragment,unsigned_short,true,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount =
CUtlLinkedList<CDispShadowFragment,unsigned_short,true,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount + 1;
Warning("CUtlLinkedList overflow! (exhausted index range)\n");
}
goto LAB_001388ca;
}
uVar3 = uVar6 & 0xffff;
_DAT_0039eca4 = _DAT_0039eca4 + 1;
iVar9 = uVar3 * 0xc;
iVar7 = s_DispShadowFragments + iVar9;
DAT_0039eca6 = uVar5;
}
else {
LOCK();
bVar13 = s_ShadowFragmentAllocLock == 0;
uVar6 = uVar3;
if (!bVar13) {
uVar6 = s_ShadowFragmentAllocLock;
}
s_ShadowFragmentAllocLock = uVar6;
UNLOCK();
if (bVar13) goto LAB_0013867c;
CThreadFastMutex::Lock(0x39ec50,uVar3);
uVar3 = (uint)DAT_0039eca0;
if (DAT_0039eca0 == 0xffff) goto LAB_001387bb;
LAB_0013869a:
uVar5 = (ushort)uVar3;
iVar9 = uVar3 * 0xc;
iVar7 = s_DispShadowFragments + iVar9;
DAT_0039eca0 = *(ushort *)(iVar7 + 10);
}
uVar2 = (ushort)uVar3;
*(undefined2 *)(iVar7 + 10) = 0xffff;
*(undefined2 *)(iVar7 + 8) = 0xffff;
LAB_001386c8:
uVar1 = *(ushort *)(s_DispShadowDecals + 0x14 + (uint)param_1 * 0x1c);
CUtlLinkedList<CDispShadowFragment,unsigned_short,true,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>>
::Unlink((CUtlLinkedList<CDispShadowFragment,unsigned_short,true,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CDispShadowFragment,unsigned_short>,unsigned_short>>
*)&s_DispShadowFragments,uVar2);
iVar7 = s_DispShadowFragments;
piVar10 = (int *)(iVar9 + s_DispShadowFragments);
*(ushort *)((int)piVar10 + 10) = uVar1;
if (uVar1 == 0xffff) {
*(ushort *)(piVar10 + 2) = DAT_0039ec9e;
uVar1 = uVar5;
uVar2 = DAT_0039ec9e;
}
else {
iVar9 = iVar7 + (uint)uVar1 * 0xc;
uVar2 = *(ushort *)(iVar9 + 8);
*(ushort *)(piVar10 + 2) = uVar2;
*(ushort *)(iVar9 + 8) = uVar5;
uVar1 = DAT_0039ec9e;
}
DAT_0039ec9e = uVar1;
uVar1 = uVar5;
if (uVar2 != 0xffff) {
*(ushort *)(iVar7 + 10 + (uint)uVar2 * 0xc) = uVar5;
uVar1 = _DAT_0039ec9c;
}
_DAT_0039ec9c = uVar1;
_DAT_0039eca2 = _DAT_0039eca2 + 1;
*(ushort *)(s_DispShadowDecals + 0x14 + (uint)param_1 * 0x1c) = uVar5;
*piVar10 = param_2;
uVar3 = 0xffffffff;
if ((uint)param_2 < 0x5500001) {
uVar3 = param_2 * 0x18;
}
pvVar4 = operator_new__(uVar3);
piVar10[1] = (int)pvVar4;
DAT_0039ec54 = DAT_0039ec54 + -1;
if (DAT_0039ec54 == 0) {
LOCK();
UNLOCK();
s_ShadowFragmentAllocLock = 0;
}
return piVar10;
}
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.