SVC_ClassInfo::WriteToBuffer
0x000ab4b0 · 537 bytes · __thiscall
_ZN13SVC_ClassInfo13WriteToBufferER8bf_write
Decompiled
undefined (2 params)
/* SVC_ClassInfo::WriteToBuffer(bf_write&) */
byte __thiscall SVC_ClassInfo::WriteToBuffer(SVC_ClassInfo *this,bf_write *param_1)
{
byte *pbVar1;
uint uVar2;
int iVar3;
int iVar4;
uint uVar5;
uint uVar6;
uint *puVar7;
int iVar8;
int iVar9;
uint *puVar10;
if (this[0x4c] == (SVC_ClassInfo)0x0) {
*(undefined4 *)(this + 100) = *(undefined4 *)(this + 0x5c);
}
uVar2 = (**(code **)(*(int *)this + 0x24))(this);
uVar5 = *(uint *)(param_1 + 0xc);
if (*(int *)(param_1 + 8) < (int)(uVar5 + 6)) {
*(int *)(param_1 + 0xc) = *(int *)(param_1 + 8);
param_1[0x10] = (bf_write)0x1;
}
else {
iVar9 = ((int)uVar5 >> 5) * 4;
uVar5 = uVar5 & 0x1f;
puVar10 = (uint *)(iVar9 + *(int *)param_1);
*puVar10 = uVar2 << (sbyte)uVar5 | *puVar10 & *(uint *)(&DAT_003f2db8 + uVar5 * 0x84);
iVar8 = 0x20 - uVar5;
if (iVar8 < 6) {
puVar10 = (uint *)(*(int *)param_1 + 4 + iVar9);
*puVar10 = uVar2 >> ((byte)iVar8 & 0x1f) | (&g_BitWriteMasks)[6 - iVar8] & *puVar10;
}
*(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 6;
}
bf_write::WriteShort(param_1,*(int *)(this + 100));
iVar9 = Q_log2(*(uint *)(this + 100));
iVar8 = *(int *)(param_1 + 0xc);
if (iVar8 < *(int *)(param_1 + 8)) {
if (param_1[0x10] == (bf_write)0x0) {
if (this[0x4c] == (SVC_ClassInfo)0x0) {
pbVar1 = (byte *)(*(int *)param_1 + (iVar8 >> 3));
*pbVar1 = *pbVar1 & ~(byte)(1 << ((byte)iVar8 & 7));
}
else {
pbVar1 = (byte *)(*(int *)param_1 + (iVar8 >> 3));
*pbVar1 = *pbVar1 | (byte)(1 << ((byte)iVar8 & 7));
}
*(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;
}
}
else {
param_1[0x10] = (bf_write)0x1;
}
if (this[0x4c] == (SVC_ClassInfo)0x0) {
iVar9 = iVar9 + 1;
iVar8 = 0;
if (0 < *(int *)(this + 100)) {
do {
puVar10 = (uint *)(iVar8 * 0x204 + *(int *)(this + 0x50));
uVar5 = *puVar10;
uVar2 = *(uint *)(param_1 + 0xc);
if (*(int *)(param_1 + 8) < (int)(iVar9 + uVar2)) {
*(int *)(param_1 + 0xc) = *(int *)(param_1 + 8);
param_1[0x10] = (bf_write)0x1;
}
else {
uVar6 = uVar2 & 0x1f;
iVar3 = ((int)uVar2 >> 5) * 4;
puVar7 = (uint *)(*(int *)param_1 + iVar3);
*puVar7 = (&g_BitWriteMasks)[uVar6 * 0x21 + iVar9] & *puVar7 | uVar5 << (sbyte)uVar6;
iVar4 = 0x20 - uVar6;
if (iVar4 < iVar9) {
puVar7 = (uint *)(*(int *)param_1 + 4 + iVar3);
*puVar7 = (&g_BitWriteMasks)[iVar9 - iVar4] & *puVar7 | uVar5 >> ((byte)iVar4 & 0x1f);
}
*(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + iVar9;
}
iVar8 = iVar8 + 1;
bf_write::WriteString(param_1,(char *)(puVar10 + 0x41));
bf_write::WriteString(param_1,(char *)(puVar10 + 1));
} while (iVar8 < *(int *)(this + 100));
}
}
return (byte)param_1[0x10] ^ 1;
}
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.