//
// FMODAudioEngine::updateBackgroundFade from 0x6cadf8 to 0x6caec4 (204 bytes)
//
// 2 xrefs:
// > sub_6DC4D0 @ 0x6dc550
// > ??> @ 0xabcb8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:51:23 +0000
//
__int64 __fastcall FMODAudioEngine::updateBackgroundFade(__int64 this)
{
float v1; // s1
float v2; // s8
float v3; // s0
float v4; // s8
bool v5; // cc
float v6; // s0
__int64 v7; // x19
v1 = *(float *)(this + 452);
if ( v1 != 0.0 )
{
v2 = *(float *)(this + 588);
if ( v1 < 0.0 )
{
v3 = *(float *)(this + 448);
v5 = v3 <= 0.0;
*(float *)(this + 452) = v2;
v4 = v2 - v2;
if ( v3 > 0.0 )
{
LABEL_4:
v6 = v4 / v3;
if ( v6 < 1.0 )
{
if ( v6 <= 0.0 )
v6 = 0.0;
goto LABEL_7;
}
goto LABEL_12;
}
}
else
{
v3 = *(float *)(this + 448);
v4 = v2 - v1;
v5 = v3 <= 0.0;
if ( v3 > 0.0 )
goto LABEL_4;
}
if ( v5 )
{
v6 = 1.0;
LABEL_7:
v7 = this;
this = FMOD::ChannelControl::setVolume(*(FMOD::ChannelControl **)(this + 480), v6 * *(float *)(this + 440));
if ( v4 >= *(float *)(v7 + 448) )
*(_DWORD *)(v7 + 452) = 0;
return this;
}
v6 = v4 / v3;
LABEL_12:
if ( v6 >= 1.0 )
v6 = 1.0;
goto LABEL_7;
}
return this;
}