//
// FMODAudioEngine::updateBackgroundFade from 0x3e8184 to 0x3e8232 (174 bytes)
//
// 1 xrefs:
// > sub_3F1D80 @ 0x3f1dd0
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:47:05 +0000
//
int __fastcall FMODAudioEngine::updateBackgroundFade(int this)
{
int v1; // r4
float v2; // s15
bool v3; // fnf
float v4; // s15
float v5; // s16
float v6; // s15
float v7; // s15
v1 = this;
v2 = *(float *)(this + 336);
if ( v2 != 0.0 )
{
v3 = v2 < 0.0;
v4 = *(float *)(this + 428);
if ( v3 )
*(float *)(this + 336) = v4;
v5 = v4 - *(float *)(this + 336);
v6 = *(float *)(this + 332);
if ( v6 <= 0.0 )
{
v7 = 1.0;
}
else if ( (float)(v5 / v6) >= 1.0 || (float)(v5 / v6) > 0.0 )
{
v7 = v5 / v6;
if ( v7 >= 1.0 )
v7 = 1.0;
}
else
{
v7 = 0.0;
}
this = FMOD::ChannelControl::setVolume(*(FMOD::ChannelControl **)(this + 360), v7 * *(float *)(this + 324));
if ( v5 >= *(float *)(v1 + 332) )
*(_DWORD *)(v1 + 336) = 0;
}
return this;
}