CBitRead::ReadWString
0x002577d0 · 394 bytes · __thiscall
_ZN8CBitRead11ReadWStringEPwibPi
Decompiled
undefined (5 params)
/* CBitRead::ReadWString(wchar_t*, int, bool, int*) */
byte __thiscall
CBitRead::ReadWString(CBitRead *this,wchar_t *param_1,int param_2,bool param_3,int *param_4)
{
int iVar1;
undefined4 uVar2;
uint *puVar3;
undefined4 *puVar4;
uint uVar5;
uint uVar6;
byte bVar7;
ushort uVar8;
wchar_t wVar9;
int iVar10;
byte local_20;
byte local_11;
iVar10 = 0;
local_11 = 0;
do {
iVar1 = *(int *)(this + 0x14);
if (iVar1 < 0x10) {
uVar2 = *(undefined4 *)(this + 0x10);
puVar3 = *(uint **)(this + 0x18);
if (puVar3 == *(uint **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(undefined4 *)(this + 0x10) = 0;
*(uint **)(this + 0x18) = puVar3 + 1;
this[4] = (CBitRead)0x1;
LAB_00257864:
param_1[iVar10] = L'\0';
if (param_4 != (int *)0x0) {
*param_4 = iVar10;
}
bVar7 = 0;
if (this[4] == (CBitRead)0x0) {
bVar7 = local_11 ^ 1;
}
return bVar7;
}
if (*(uint **)(this + 0x1c) < puVar3) {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
goto LAB_00257864;
}
*(uint **)(this + 0x18) = puVar3 + 1;
uVar5 = *puVar3;
*(uint *)(this + 0x10) = uVar5;
if (this[4] != (CBitRead)0x0) goto LAB_00257864;
uVar6 = (&CBitBuffer::s_nMaskTable)[0x10 - iVar1];
*(int *)(this + 0x14) = iVar1 + 0x10;
local_20 = (byte)(0x10 - iVar1);
uVar8 = (ushort)((uVar6 & uVar5) << ((byte)iVar1 & 0x1f)) | (ushort)uVar2;
*(uint *)(this + 0x10) = uVar5 >> (local_20 & 0x1f);
}
else {
*(int *)(this + 0x14) = iVar1 + -0x10;
uVar8 = (ushort)*(uint *)(this + 0x10);
if (iVar1 + -0x10 == 0) {
puVar4 = *(undefined4 **)(this + 0x18);
*(undefined4 *)(this + 0x14) = 0x20;
if (puVar4 == *(undefined4 **)(this + 0x1c)) {
*(undefined4 *)(this + 0x14) = 1;
*(undefined4 *)(this + 0x10) = 0;
*(undefined4 **)(this + 0x18) = puVar4 + 1;
}
else if (*(undefined4 **)(this + 0x1c) < puVar4) {
this[4] = (CBitRead)0x1;
*(undefined4 *)(this + 0x10) = 0;
}
else {
*(undefined4 **)(this + 0x18) = puVar4 + 1;
*(undefined4 *)(this + 0x10) = *puVar4;
}
}
else {
*(uint *)(this + 0x10) = *(uint *)(this + 0x10) >> 0x10;
}
}
wVar9 = (wchar_t)(short)uVar8;
if ((wVar9 == L'\0') || ((wVar9 == L'\n' && (param_3)))) goto LAB_00257864;
if (iVar10 < param_2 + -1) {
param_1[iVar10] = wVar9;
iVar10 = iVar10 + 1;
}
else {
local_11 = 1;
}
} while( true );
}
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.