X360GammaToLinear
0x0026e580 · 310 bytes · __cdecl
_Z17X360GammaToLinearf
Decompiled
undefined (1 param)
/* X360GammaToLinear(float) */
longdouble X360GammaToLinear(float param_1)
{
float fVar1;
float fVar2;
if (param_1 <= 0.0) {
param_1 = 0.0;
}
if (1.0 <= param_1) {
param_1 = 1.0;
}
if (0.3764706 <= param_1) {
if (0.7529412 <= param_1) {
fVar1 = param_1 * 2040.0 - 1024.0;
fVar2 = fVar1 * 0.0078125;
goto LAB_0026e5f9;
}
fVar1 = param_1 * 1020.0 - 256.0;
fVar2 = fVar1 * 0.00390625;
if (ABS(fVar2) < 8388608.0) {
fVar2 = (float)(int)fVar2 - (float)(-(uint)(fVar2 < (float)(int)fVar2) & 0x3f800000);
}
}
else {
if (param_1 < 0.2509804) {
fVar1 = param_1 * 255.0;
goto LAB_0026e632;
}
fVar1 = param_1 * 510.0 - 64.0;
fVar2 = fVar1 * 0.001953125;
LAB_0026e5f9:
if (ABS(fVar2) < 8388608.0) {
fVar2 = (float)(int)fVar2 - (float)(-(uint)(fVar2 < (float)(int)fVar2) & 0x3f800000);
}
}
fVar1 = fVar1 + fVar2;
LAB_0026e632:
fVar1 = fVar1 * 0.0009775171;
if (fVar1 <= 0.0) {
fVar1 = 0.0;
}
if (1.0 <= fVar1) {
fVar1 = 1.0;
}
return (longdouble)fVar1;
}
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.