CBitRead::ReadBits
0x0009e410 · 1219 bytes · __thiscall
_ZN8CBitRead8ReadBitsEPvi
Decompiled
undefined (3 params)
/* CBitRead::ReadBits(void*, int) */
void __thiscall CBitRead::ReadBits(CBitRead *this,void *param_1,int param_2)
{
uint *puVar1;
int iVar2;
uint *puVar3;
undefined4 uVar4;
uint uVar5;
undefined4 *puVar6;
uint uVar7;
byte bVar8;
uint uVar9;
int iVar10;
byte local_1c;
byte local_18;
byte local_14;
for (; ((uint)param_1 & 3) != 0; param_1 = (void *)((int)param_1 + 1)) {
if (param_2 < 8) goto LAB_0009e5db;
iVar2 = *(int *)(this + 0x14);
bVar8 = (byte)*(uint *)(this + 0x10);
if (iVar2 < 8) {
puVar1 = *(uint **)(this + 0x18);
if (puVar1 == *(uint **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(uint **)(this + 0x18) = puVar1 + 1;
bVar8 = 0;
*(undefined4 *)(this + 0x10) = 0;
this[4] = (CBitRead)0x1;
}
else {
if (*(uint **)(this + 0x1c) < puVar1) {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
}
else {
*(uint **)(this + 0x18) = puVar1 + 1;
uVar9 = *puVar1;
*(uint *)(this + 0x10) = uVar9;
if (this[4] == (CBitRead)0x0) {
uVar7 = (&CBitBuffer::s_nMaskTable)[8 - iVar2];
*(int *)(this + 0x14) = iVar2 + 0x18;
local_18 = (byte)(8 - iVar2);
bVar8 = (byte)((uVar7 & uVar9) << ((byte)iVar2 & 0x1f)) | bVar8;
*(uint *)(this + 0x10) = uVar9 >> (local_18 & 0x1f);
goto LAB_0009e443;
}
}
bVar8 = 0;
}
}
else {
*(int *)(this + 0x14) = iVar2 + -8;
if (iVar2 + -8 == 0) {
puVar6 = *(undefined4 **)(this + 0x18);
*(undefined4 *)(this + 0x14) = 0x20;
if (puVar6 == *(undefined4 **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(undefined4 *)(this + 0x10) = 0;
*(undefined4 **)(this + 0x18) = puVar6 + 1;
}
else if (*(undefined4 **)(this + 0x1c) < puVar6) {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
}
else {
*(undefined4 **)(this + 0x18) = puVar6 + 1;
*(undefined4 *)(this + 0x10) = *puVar6;
}
}
else {
*(uint *)(this + 0x10) = *(uint *)(this + 0x10) >> 8;
}
}
LAB_0009e443:
param_2 = param_2 + -8;
*(byte *)param_1 = bVar8;
}
if (0x1f < param_2) {
uVar9 = param_2 - 0x20U >> 5;
puVar1 = (uint *)((int)param_1 + (uVar9 + 1) * 4);
do {
while (iVar2 = *(int *)(this + 0x14), 0x1f < iVar2) {
uVar7 = *(uint *)(this + 0x10);
*(int *)(this + 0x14) = iVar2 + -0x20;
if (iVar2 + -0x20 == 0) {
puVar6 = *(undefined4 **)(this + 0x18);
*(undefined4 *)(this + 0x14) = 0x20;
if (puVar6 == *(undefined4 **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(undefined4 *)(this + 0x10) = 0;
*(undefined4 **)(this + 0x18) = puVar6 + 1;
}
else {
if (*(undefined4 **)(this + 0x1c) < puVar6) {
this[4] = (CBitRead)0x1;
goto LAB_0009e582;
}
*(undefined4 **)(this + 0x18) = puVar6 + 1;
*(undefined4 *)(this + 0x10) = *puVar6;
}
}
else {
LAB_0009e582:
*(undefined4 *)(this + 0x10) = 0;
}
LAB_0009e589:
*(uint *)param_1 = uVar7;
param_1 = (void *)((int)param_1 + 4);
if (param_1 == puVar1) goto LAB_0009e5ca;
}
puVar3 = *(uint **)(this + 0x18);
uVar7 = *(uint *)(this + 0x10);
if (puVar3 == *(uint **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(uint **)(this + 0x18) = puVar3 + 1;
*(undefined4 *)(this + 0x10) = 0;
this[4] = (CBitRead)0x1;
}
else if (*(uint **)(this + 0x1c) < puVar3) {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
}
else {
*(uint **)(this + 0x18) = puVar3 + 1;
uVar5 = *puVar3;
*(uint *)(this + 0x10) = uVar5;
if (this[4] == (CBitRead)0x0) {
*(int *)(this + 0x14) = iVar2;
local_1c = (byte)(0x20 - iVar2);
uVar7 = ((&CBitBuffer::s_nMaskTable)[0x20 - iVar2] & uVar5) << ((byte)iVar2 & 0x1f) |
uVar7;
*(uint *)(this + 0x10) = uVar5 >> (local_1c & 0x1f);
goto LAB_0009e589;
}
}
*(uint *)param_1 = 0;
param_1 = (void *)((int)param_1 + 4);
} while (param_1 != puVar1);
LAB_0009e5ca:
param_2 = (param_2 - 0x20U) + uVar9 * -0x20;
param_1 = puVar1;
}
LAB_0009e5db:
if (7 < param_2) {
uVar9 = param_2 - 8U >> 3;
puVar1 = (uint *)((int)param_1 + uVar9 + 1);
do {
while( true ) {
iVar2 = *(int *)(this + 0x14);
bVar8 = (byte)*(uint *)(this + 0x10);
if (7 < iVar2) break;
puVar3 = *(uint **)(this + 0x18);
if (puVar3 == *(uint **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(uint **)(this + 0x18) = puVar3 + 1;
*(undefined4 *)(this + 0x10) = 0;
this[4] = (CBitRead)0x1;
}
else if (*(uint **)(this + 0x1c) < puVar3) {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
}
else {
*(uint **)(this + 0x18) = puVar3 + 1;
uVar7 = *puVar3;
*(uint *)(this + 0x10) = uVar7;
if (this[4] == (CBitRead)0x0) {
uVar5 = (&CBitBuffer::s_nMaskTable)[8 - iVar2];
*(int *)(this + 0x14) = iVar2 + 0x18;
local_1c = (byte)(8 - iVar2);
bVar8 = (byte)((uVar5 & uVar7) << ((byte)iVar2 & 0x1f)) | bVar8;
*(uint *)(this + 0x10) = uVar7 >> (local_1c & 0x1f);
goto LAB_0009e617;
}
}
*(byte *)param_1 = 0;
param_1 = (void *)((int)param_1 + 1);
if (param_1 == puVar1) goto LAB_0009e658;
}
*(int *)(this + 0x14) = iVar2 + -8;
if (iVar2 + -8 == 0) {
puVar6 = *(undefined4 **)(this + 0x18);
*(undefined4 *)(this + 0x14) = 0x20;
if (puVar6 == *(undefined4 **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(undefined4 *)(this + 0x10) = 0;
*(undefined4 **)(this + 0x18) = puVar6 + 1;
}
else if (*(undefined4 **)(this + 0x1c) < puVar6) {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
}
else {
*(undefined4 **)(this + 0x18) = puVar6 + 1;
*(undefined4 *)(this + 0x10) = *puVar6;
}
}
else {
*(uint *)(this + 0x10) = *(uint *)(this + 0x10) >> 8;
}
LAB_0009e617:
*(byte *)param_1 = bVar8;
param_1 = (void *)((int)param_1 + 1);
} while (param_1 != puVar1);
LAB_0009e658:
param_2 = (param_2 - 8U) + uVar9 * -8;
param_1 = puVar1;
}
if (param_2 != 0) {
iVar2 = *(int *)(this + 0x14);
if (iVar2 < param_2) {
puVar1 = *(uint **)(this + 0x18);
uVar4 = *(undefined4 *)(this + 0x10);
if (puVar1 == *(uint **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(undefined4 *)(this + 0x10) = 0;
*(uint **)(this + 0x18) = puVar1 + 1;
this[4] = (CBitRead)0x1;
}
else if (puVar1 < *(uint **)(this + 0x1c)) {
*(uint **)(this + 0x18) = puVar1 + 1;
uVar9 = *puVar1;
*(uint *)(this + 0x10) = uVar9;
if (this[4] == (CBitRead)0x0) {
iVar10 = param_2 - iVar2;
uVar7 = (&CBitBuffer::s_nMaskTable)[iVar10];
*(int *)(this + 0x14) = 0x20 - iVar10;
*(uint *)(this + 0x10) = uVar9 >> ((byte)iVar10 & 0x1f);
local_14 = (byte)uVar4;
*(byte *)param_1 = local_14 | (byte)((uVar7 & uVar9) << ((byte)iVar2 & 0x1f));
return;
}
}
else {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
}
*(byte *)param_1 = 0;
}
else {
uVar4 = (&CBitBuffer::s_nMaskTable)[param_2];
*(int *)(this + 0x14) = iVar2 - param_2;
bVar8 = (byte)uVar4 & (byte)*(uint *)(this + 0x10);
if (iVar2 - param_2 == 0) {
puVar6 = *(undefined4 **)(this + 0x18);
*(undefined4 *)(this + 0x14) = 0x20;
if (puVar6 == *(undefined4 **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(undefined4 *)(this + 0x10) = 0;
*(undefined4 **)(this + 0x18) = puVar6 + 1;
*(byte *)param_1 = bVar8;
}
else if (*(undefined4 **)(this + 0x1c) < puVar6) {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
*(byte *)param_1 = bVar8;
}
else {
*(undefined4 **)(this + 0x18) = puVar6 + 1;
*(undefined4 *)(this + 0x10) = *puVar6;
*(byte *)param_1 = bVar8;
}
}
else {
*(uint *)(this + 0x10) = *(uint *)(this + 0x10) >> ((byte)param_2 & 0x1f);
*(byte *)param_1 = bVar8;
}
}
}
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.