SV_EnsureInstanceBaseline
0x00205620 · 307 bytes · __cdecl
_Z25SV_EnsureInstanceBaselineP11ServerClassiPKvi
Decompiled
undefined (4 params)
/* SV_EnsureInstanceBaseline(ServerClass*, int, void const*, int) */
void SV_EnsureInstanceBaseline(ServerClass *param_1,int param_2,void *param_3,int param_4)
{
uint uVar1;
uint uVar2;
int *piVar3;
undefined4 uVar4;
int iVar5;
int in_GS_OFFSET;
bool bVar6;
char local_40 [32];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar5 = param_2 * 0x10 + DAT_003b8174;
piVar3 = *(int **)(iVar5 + 8);
if (piVar3 == (int *)0x0) {
Error("SV_EnsureInstanceBaseline: edict %d missing ent",param_2);
piVar3 = *(int **)(iVar5 + 8);
}
iVar5 = (**(code **)(*piVar3 + 4))(piVar3);
if (*(int *)(iVar5 + 0x10) != 0xffff) goto LAB_00205661;
V_snprintf(local_40,0x20,"%d",*(undefined4 *)(iVar5 + 0xc));
uVar2 = ThreadGetCurrentId();
if (uVar2 == g_svInstanceBaselineMutex) {
LAB_00205730:
DAT_00350d4c = DAT_00350d4c + 1;
}
else {
LOCK();
bVar6 = g_svInstanceBaselineMutex == 0;
uVar1 = uVar2;
if (!bVar6) {
uVar1 = g_svInstanceBaselineMutex;
}
g_svInstanceBaselineMutex = uVar1;
UNLOCK();
if (bVar6) goto LAB_00205730;
CThreadFastMutex::Lock(0x350d48,uVar2);
}
/* try { // try from 002056df to 00205702 has its CatchHandler @ 00205760 */
piVar3 = (int *)CBaseServer::GetInstanceBaselineTable((CBaseServer *)&sv);
uVar4 = (**(code **)(*piVar3 + 0x24))(piVar3,1,local_40,param_4,param_3);
*(undefined4 *)(iVar5 + 0x10) = uVar4;
DAT_00350d4c = DAT_00350d4c + -1;
if (DAT_00350d4c == 0) {
LOCK();
UNLOCK();
g_svInstanceBaselineMutex = 0;
}
LAB_00205661:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.