SV_CreateBaseline
0x001fce80 · 1010 bytes · unknown
_Z17SV_CreateBaselinev
Decompiled
undefined (0 params)
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* SV_CreateBaseline() */
void SV_CreateBaseline(void)
{
int *piVar1;
SendTable *pSVar2;
char cVar3;
ServerClass *pSVar4;
uchar *puVar5;
byte *pbVar6;
int iVar7;
int iVar8;
int in_GS_OFFSET;
int local_40c0;
undefined **local_40b0;
undefined1 local_40ac;
undefined4 local_40a8;
int local_40a4;
undefined4 local_40a0;
undefined8 local_409c;
undefined4 local_4094;
undefined4 local_4090;
undefined8 local_408c;
undefined4 local_4084;
undefined4 local_4080;
undefined1 local_407c;
undefined8 local_4078;
undefined4 local_4070;
undefined4 local_406c;
undefined4 local_405c;
undefined1 local_4058;
undefined4 local_4054;
undefined4 local_4050;
bf_write local_4038 [24];
undefined1 local_4020 [16384];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
SV_WriteVoiceCodec((bf_write *)&DAT_003b8034);
pSVar4 = (ServerClass *)(**(code **)(*serverGameDLL + 0x28))(serverGameDLL);
if (*(int *)(sv_sendtables._28_4_ + 0x30) != 0) {
iVar8 = DAT_003b81b8;
if ((DAT_003b81b8 < 0x37aa0) && (-1 < DAT_003b81bc)) {
DAT_003b81b8 = 0x37aa0;
if (DAT_003b81b4 == (void *)0x0) {
DAT_003b81b4 = malloc(0x37aa0);
iVar8 = 0x37aa0;
}
else {
DAT_003b81b4 = realloc(DAT_003b81b4,0x37aa0);
iVar8 = DAT_003b81b8;
}
}
bf_write::StartWriting((bf_write *)&DAT_003b819c,DAT_003b81b4,iVar8,0,-1);
SV_WriteSendTables(pSVar4,(bf_write *)&DAT_003b819c);
if (DAT_003b81ac != '\0') {
Host_Error("SV_CreateBaseline: WriteSendTables overflow.\n");
goto LAB_001fcff3;
}
SV_WriteClassInfos(pSVar4,(bf_write *)&DAT_003b819c);
if (DAT_003b81ac != '\0') {
Host_Error("SV_CreateBaseline: WriteClassInfos overflow.\n");
goto LAB_001fcff3;
}
}
if (g_pLocalNetworkBackdoor == 0) {
if (DAT_003b816c < 1) {
local_40c0 = 0;
iVar8 = 0;
}
else {
local_40c0 = 0;
iVar8 = 0;
iVar7 = 0;
do {
pbVar6 = (byte *)(iVar7 * 0x10 + DAT_003b8174);
if (((((*pbVar6 & 2) == 0) && (*(int *)(pbVar6 + 0xc) != 0)) &&
(piVar1 = *(int **)(pbVar6 + 8), piVar1 != (int *)0x0)) &&
((pSVar4 = (ServerClass *)(**(code **)(*piVar1 + 4))(piVar1),
pSVar4 != (ServerClass *)0x0 && (*(int *)(pSVar4 + 0x10) == 0xffff)))) {
pSVar2 = *(SendTable **)(pSVar4 + 4);
bf_write::bf_write((bf_write *)&local_40b0,"SV_CreateBaseline->writeBuf",local_4020,0x4000
,-1);
cVar3 = SendTable_Encode(pSVar2,*(void **)(pbVar6 + 0xc),(bf_write *)&local_40b0,iVar7,
(CUtlMemory *)0x0,false);
if (cVar3 == '\0') {
Host_Error("SV_CreateBaseline: SendTable_Encode returned false (ent %d).\n",iVar7);
}
SV_EnsureInstanceBaseline(pSVar4,iVar7,local_4020,local_40a4 + 7 >> 3);
local_40c0 = local_40c0 + 1;
iVar8 = iVar8 + (local_40a4 + 7 >> 3);
}
iVar7 = iVar7 + 1;
} while (iVar7 < DAT_003b816c);
}
DevMsg("Created class baseline: %i classes, %i bytes.\n",local_40c0,iVar8);
}
CGameEventManager::ReloadEventDefinitions((CGameEventManager *)&s_GameEventManager);
local_40a4 = 0;
local_409c = 0;
local_408c = 0;
local_4078 = 0;
local_40a0 = 0;
local_4094 = 0;
local_4090 = 0;
local_4084 = 0;
local_4080 = 0;
local_407c = 0;
local_4070 = 0;
local_406c = 0;
local_40ac = 1;
local_40a8 = 0;
local_40b0 = &PTR__SVC_GameEventList_002a2128;
local_4058 = 0;
local_405c = 0;
local_4054 = 0xffffffff;
local_4050 = 0;
bf_write::bf_write(local_4038);
puVar5 = (uchar *)NET_AllocPayload();
/* try { // try from 001fcfc4 to 001fcfea has its CatchHandler @ 001fd287 */
bf_write::StartWriting(local_4038,puVar5,0x37aa0,0,-1);
CGameEventManager::WriteEventList
((CGameEventManager *)&s_GameEventManager,(SVC_GameEventList *)&local_40b0);
SVC_GameEventList::WriteToBuffer((SVC_GameEventList *)&local_40b0,(bf_write *)&DAT_003b8034);
NET_FreePayload(puVar5);
LAB_001fcff3:
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.