CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::Sort
0x003ea570 · 171 bytes · __thiscall
_ZN10CUtlVectorIP16CBaseAchievement10CUtlMemoryIS1_iEE4SortEPFiPKS1_S6_E
Decompiled
undefined (2 params)
/* CUtlVector<CBaseAchievement*, CUtlMemory<CBaseAchievement*, int> >::Sort(int
(*)(CBaseAchievement* const*, CBaseAchievement* const*)) */
void __thiscall
CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>>::Sort
(CUtlVector<CBaseAchievement*,CUtlMemory<CBaseAchievement*,int>> *this,
_func_int_CBaseAchievement_ptr_ptr_CBaseAchievement_ptr_ptr *param_1)
{
int iVar1;
size_t __nmemb;
undefined4 uVar2;
int iVar3;
int iVar4;
undefined4 *puVar5;
undefined4 *puVar6;
int local_24;
__nmemb = *(size_t *)(this + 0xc);
if (1 < (int)__nmemb) {
if (*(void **)this == (void *)0x0) {
local_24 = __nmemb - 1;
do {
if (0 < local_24) {
iVar4 = 1;
do {
while( true ) {
iVar1 = iVar4 * 4;
iVar3 = (*param_1)((CBaseAchievement **)(*(int *)this + iVar1 + -4),
(CBaseAchievement **)(*(int *)this + iVar1));
if (-1 < iVar3) break;
iVar4 = iVar4 + 1;
puVar5 = (undefined4 *)(iVar1 + *(int *)this);
puVar6 = (undefined4 *)(iVar1 + -4 + *(int *)this);
uVar2 = *puVar6;
*puVar6 = *puVar5;
*puVar5 = uVar2;
if (local_24 < iVar4) goto LAB_003ea613;
}
iVar4 = iVar4 + 1;
} while (iVar4 <= local_24);
}
LAB_003ea613:
local_24 = local_24 + -1;
if (local_24 == -1) {
return;
}
} while( true );
}
qsort(*(void **)this,__nmemb,4,(__compar_fn_t)param_1);
}
return;
}
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.