CBitRead::Seek
0x00b76120 · 359 bytes · __thiscall
_ZN8CBitRead4SeekEi
Decompiled
undefined (2 params)
/* CBitRead::Seek(int) */
undefined1 __thiscall CBitRead::Seek(CBitRead *this,int param_1)
{
byte bVar1;
byte *pbVar2;
ushort uVar3;
byte *pbVar4;
uint uVar5;
uint uVar6;
uint *puVar7;
int iVar8;
int iVar9;
uint uVar10;
undefined1 local_11;
if (param_1 < 0) {
uVar6 = *(uint *)(this + 8);
}
else {
uVar6 = *(uint *)(this + 8);
local_11 = 1;
if (param_1 <= (int)uVar6) goto LAB_00b7614c;
}
this[4] = (CBitRead)0x1;
local_11 = 0;
param_1 = uVar6;
LAB_00b7614c:
uVar6 = *(uint *)(this + 0xc) & 3;
if (3 < *(uint *)(this + 0xc)) {
uVar10 = param_1 + 7;
if (-1 < param_1) {
uVar10 = param_1;
}
if (((int)uVar6 <= (int)uVar10 >> 3) || (uVar6 == 0)) {
uVar5 = param_1 + uVar6 * -8;
uVar10 = uVar5 + 0x1f;
if (-1 < (int)uVar5) {
uVar10 = uVar5;
}
puVar7 = (uint *)(uVar6 + ((int)uVar10 >> 5) * 4 + *(int *)(this + 0x20));
*(uint **)(this + 0x18) = puVar7;
if (*(int *)(this + 0x20) == 0) {
iVar9 = 1;
uVar6 = 0;
}
else {
*(undefined4 *)(this + 0x14) = 0x20;
if (puVar7 == *(uint **)(this + 0x1c)) {
iVar9 = 1;
*(uint **)(this + 0x18) = puVar7 + 1;
uVar6 = 0;
}
else if (*(uint **)(this + 0x1c) < puVar7) {
this[4] = (CBitRead)0x1;
iVar9 = 0x20;
uVar6 = 0;
}
else {
*(uint **)(this + 0x18) = puVar7 + 1;
iVar9 = 0x20;
uVar6 = *puVar7 >> ((byte)uVar5 & 0x1f);
}
}
*(uint *)(this + 0x10) = uVar6;
iVar8 = 0x20 - (uVar5 & 0x1f);
if (iVar9 < iVar8) {
iVar8 = iVar9;
}
*(int *)(this + 0x14) = iVar8;
return local_11;
}
}
pbVar2 = *(byte **)(this + 0x20);
if (pbVar2 == (byte *)0x0) {
uVar10 = *(uint *)(this + 0x10);
pbVar4 = (byte *)0x0;
}
else {
bVar1 = *pbVar2;
uVar10 = (uint)bVar1;
*(uint *)(this + 0x10) = uVar10;
if (uVar6 < 2) {
pbVar4 = pbVar2 + 1;
}
else {
uVar3 = CONCAT11(pbVar2[1],bVar1);
uVar10 = (uint)uVar3;
*(uint *)(this + 0x10) = uVar10;
if (uVar6 == 3) {
pbVar4 = pbVar2 + 3;
uVar10 = (uint)CONCAT12(pbVar2[2],uVar3);
}
else {
pbVar4 = pbVar2 + 2;
}
}
}
*(byte **)(this + 0x18) = pbVar4;
*(uint *)(this + 0x10) = uVar10 >> (sbyte)(param_1 & 0x1fU);
*(uint *)(this + 0x14) = uVar6 * 8 - (param_1 & 0x1fU);
return local_11;
}
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.