bf_write::WriteUBitVar
0x00097e30 · 745 bytes · __thiscall
_ZN8bf_write12WriteUBitVarEj
Decompiled
undefined (2 params)
/* bf_write::WriteUBitVar(unsigned int) */
void __thiscall bf_write::WriteUBitVar(bf_write *this,uint param_1)
{
int iVar1;
uint uVar2;
int iVar3;
uint uVar4;
uint uVar5;
uint *puVar6;
sbyte local_14;
if (param_1 < 0x10) {
uVar2 = *(uint *)(this + 0xc);
if (*(int *)(this + 8) < (int)(uVar2 + 6)) {
*(int *)(this + 0xc) = *(int *)(this + 8);
this[0x10] = (bf_write)0x1;
return;
}
iVar3 = ((int)uVar2 >> 5) * 4;
uVar2 = uVar2 & 0x1f;
puVar6 = (uint *)(*(int *)this + iVar3);
*puVar6 = *puVar6 & *(uint *)(&DAT_000d6ad8 + uVar2 * 0x84) | param_1 << (sbyte)uVar2;
iVar1 = 0x20 - uVar2;
if (iVar1 < 6) {
puVar6 = (uint *)(*(int *)this + 4 + iVar3);
*puVar6 = (&g_BitWriteMasks)[6 - iVar1] & *puVar6 | param_1 >> ((byte)iVar1 & 0x1f);
}
*(int *)(this + 0xc) = *(int *)(this + 0xc) + 6;
return;
}
if (param_1 < 0x100) {
uVar5 = *(uint *)(this + 0xc);
uVar2 = *(uint *)(this + 8);
if ((int)(uVar5 + 10) <= (int)uVar2) {
uVar2 = uVar5 & 0x1f;
uVar4 = param_1 & 0xf | 0x10 | (param_1 & 0xf0) << 2;
iVar3 = ((int)uVar5 >> 5) * 4;
puVar6 = (uint *)(*(int *)this + iVar3);
iVar1 = 0x20 - uVar2;
*puVar6 = uVar4 << (sbyte)uVar2 | *puVar6 & *(uint *)(&DAT_000d6ae8 + uVar2 * 0x84);
if (iVar1 < 10) {
puVar6 = (uint *)(*(int *)this + 4 + iVar3);
*puVar6 = uVar4 >> ((byte)iVar1 & 0x1f) | (&g_BitWriteMasks)[10 - iVar1] & *puVar6;
}
*(int *)(this + 0xc) = *(int *)(this + 0xc) + 10;
return;
}
}
else if (param_1 < 0x1000) {
uVar5 = *(uint *)(this + 0xc);
uVar2 = *(uint *)(this + 8);
if ((int)(uVar5 + 0xe) <= (int)uVar2) {
iVar3 = ((int)uVar5 >> 5) * 4;
uVar5 = uVar5 & 0x1f;
uVar2 = param_1 & 0xf | 0x20 | (param_1 & 0xff0) << 2;
puVar6 = (uint *)(*(int *)this + iVar3);
iVar1 = 0x20 - uVar5;
*puVar6 = uVar2 << (sbyte)uVar5 | *puVar6 & *(uint *)(&DAT_000d6af8 + uVar5 * 0x84);
if (iVar1 < 0xe) {
puVar6 = (uint *)(*(int *)this + 4 + iVar3);
*puVar6 = uVar2 >> ((byte)iVar1 & 0x1f) | (&g_BitWriteMasks)[0xe - iVar1] & *puVar6;
}
*(int *)(this + 0xc) = *(int *)(this + 0xc) + 0xe;
return;
}
}
else {
uVar5 = *(uint *)(this + 0xc);
uVar2 = *(uint *)(this + 8);
if ((int)uVar2 < (int)(uVar5 + 6)) {
*(uint *)(this + 0xc) = uVar2;
this[0x10] = (bf_write)0x1;
uVar5 = uVar2;
}
else {
iVar3 = ((int)uVar5 >> 5) * 4;
uVar5 = uVar5 & 0x1f;
puVar6 = (uint *)(iVar3 + *(int *)this);
uVar2 = param_1 & 0xf | 0x30;
local_14 = (sbyte)uVar5;
*puVar6 = uVar2 << local_14 | *puVar6 & *(uint *)(&DAT_000d6ad8 + uVar5 * 0x84);
iVar1 = 0x20 - uVar5;
if (iVar1 < 6) {
puVar6 = (uint *)(*(int *)this + 4 + iVar3);
*puVar6 = (&g_BitWriteMasks)[6 - iVar1] & *puVar6 | uVar2 >> ((byte)iVar1 & 0x1f);
}
iVar3 = *(int *)(this + 0xc);
uVar2 = *(uint *)(this + 8);
*(uint *)(this + 0xc) = iVar3 + 6U;
uVar5 = iVar3 + 6U;
}
if ((int)(uVar5 + 0x1c) <= (int)uVar2) {
iVar1 = ((int)uVar5 >> 5) * 4;
uVar5 = uVar5 & 0x1f;
puVar6 = (uint *)(*(int *)this + iVar1);
*puVar6 = *puVar6 & *(uint *)(&DAT_000d6b30 + uVar5 * 0x84) | (param_1 >> 4) << (sbyte)uVar5;
iVar3 = 0x20 - uVar5;
if (iVar3 < 0x1c) {
puVar6 = (uint *)(*(int *)this + 4 + iVar1);
*puVar6 = (&g_BitWriteMasks)[0x1c - iVar3] & *puVar6 |
(param_1 >> 4) >> ((byte)iVar3 & 0x1f);
}
*(int *)(this + 0xc) = *(int *)(this + 0xc) + 0x1c;
return;
}
}
*(uint *)(this + 0xc) = uVar2;
this[0x10] = (bf_write)0x1;
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.