CAutoGain::ProcessSamples
0x000ef9f0 · 384 bytes · __thiscall
_ZN9CAutoGain14ProcessSamplesEPsi
Decompiled
undefined (3 params)
/* CAutoGain::ProcessSamples(short*, int) */
void __thiscall CAutoGain::ProcessSamples(CAutoGain *this,short *param_1,int param_2)
{
int iVar1;
int iVar2;
ushort *puVar3;
ushort *puVar4;
int iVar5;
ushort uVar6;
float fVar7;
float fVar8;
float fVar9;
if (param_2 != 0) {
iVar1 = *(int *)this;
do {
iVar2 = *(int *)(this + 0xc);
iVar5 = iVar1 - iVar2;
if (param_2 < iVar1 - iVar2) {
iVar5 = param_2;
}
if (0 < iVar5) {
puVar4 = (ushort *)param_1;
do {
uVar6 = (short)*puVar4 >> 0xf;
*(int *)(this + 0x10) = *(int *)(this + 0x10) + (int)(short)((*puVar4 ^ uVar6) - uVar6);
uVar6 = *puVar4;
if ((short)uVar6 < 0) {
uVar6 = -uVar6;
}
iVar1 = *(int *)(this + 0x14);
if (*(int *)(this + 0x14) <= (int)(short)uVar6) {
iVar1 = (int)(short)uVar6;
}
*(int *)(this + 0x14) = iVar1;
*(int *)(this + 0xc) = iVar2 + 1;
iVar1 = (int)(short)*puVar4 * (*(int *)(this + 0x28) * iVar2 + *(int *)(this + 0x24)) >> 7
;
if (iVar1 < -0x8000) {
iVar1 = -0x8000;
}
if (0x7fff < iVar1) {
iVar1 = 0x7fff;
}
puVar3 = puVar4 + 1;
*puVar4 = (ushort)iVar1;
iVar2 = *(int *)(this + 0xc);
puVar4 = puVar3;
} while (puVar3 != (ushort *)(param_1 + iVar5));
iVar1 = *(int *)this;
}
param_2 = param_2 - iVar5;
param_1 = param_1 + iVar5;
if (iVar2 % iVar1 == 0) {
*(undefined4 *)(this + 0xc) = 0;
fVar8 = *(float *)(this + 0x20) * *(float *)(this + 0x18);
*(float *)(this + 0x1c) = fVar8;
*(int *)(this + 0x24) = (int)(fVar8 * 128.0);
iVar2 = *(int *)(this + 0x10);
*(undefined4 *)(this + 0x10) = 0;
iVar5 = *(int *)(this + 0x14);
*(undefined4 *)(this + 0x14) = 0;
fVar9 = 32767.0 / ((float)(iVar5 - iVar2 / iVar1) * *(float *)(this + 8) +
(float)(iVar2 / iVar1));
fVar7 = *(float *)(this + 4);
if (fVar9 <= *(float *)(this + 4)) {
fVar7 = fVar9;
}
fVar7 = fVar7 * *(float *)(this + 0x18);
*(float *)(this + 0x20) = fVar7;
*(int *)(this + 0x28) = (int)(((fVar7 - fVar8) / (float)(iVar1 + -1)) * 128.0);
}
} while (param_2 != 0);
}
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.