//
// PlayLayer::prepareMusic from 0x402d50 to 0x402e28 (216 bytes)
//
// 2 xrefs:
// > PlayLayer::setupHasCompleted @ 0x40a81a
// > PlayLayer::startMusic @ 0x4120ec
//
// 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:25 +0000
//
FMOD::Channel *__fastcall PlayLayer::prepareMusic(FMOD::Channel *this, unsigned int a2)
{
FMOD::Channel *v2; // r4
unsigned int v4; // r7
int v5; // r9
int v6; // r3
double v7; // d9
unsigned int v8; // r5
float v9; // s16
FMODAudioEngine *v10; // r0
float v11; // s14
unsigned __int8 v12[12]; // [sp+18h] [bp-14h] BYREF
v2 = this;
if ( !*((_BYTE *)this + 10784) || *((_BYTE *)this + 10785) )
{
v4 = *((unsigned __int8 *)this + 10866);
if ( !*((_BYTE *)this + 10866) )
{
v5 = FMODAudioEngine::sharedEngine(this);
GJGameLevel::getAudioFileName((GJGameLevel *)v12);
FMODAudioEngine::loadMusic(
v5,
v12,
1.0,
0,
1.0,
*((_BYTE *)v2 + 10614),
v4,
v4,
*(_BYTE *)(*((_DWORD *)v2 + 521) + 290));
this = (FMOD::Channel *)std::string::~string((int)v12);
v6 = *((_DWORD *)v2 + 521);
v7 = *((double *)v2 + 99);
v8 = *(unsigned __int8 *)(v6 + 290);
v9 = *(float *)(v6 + 284);
if ( !*(_BYTE *)(v6 + 290) )
{
v10 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine(this);
v11 = (v9 + v7) * 1000.0;
this = FMODAudioEngine::setMusicTimeMS(v10, (unsigned int)v11, a2, v8);
}
*((_BYTE *)v2 + 12284) = 1;
}
}
return this;
}