//
// FMODAudioEngine::loadMusic from 0x3efb4c to 0x3efefe (946 bytes)
//
// 16 xrefs:
// > FMODAudioEngine::loadAndPlayMusic @ 0x3eff3c
// > FMODAudioEngine::playMusic @ 0x3effc8
// > FMODAudioEngine::loadMusic @ 0x3f005e
// > FMODAudioEngine::updateQueuedMusic @ 0x3f0214
// > PlayLayer::prepareMusic @ 0x402dba
// > PlayLayer::setupHasCompleted @ 0x40a208
// > LevelInfoLayer::playStep2 @ 0x49a32e
// > LevelInfoLayer::onEdit @ 0x49b1d0
// > EditLevelLayer::playStep2 @ 0x49f6d6
// > EditLevelLayer::onEdit @ 0x4a04c4
// > EditorPauseLayer::playStep2 @ 0x50923e
// > LevelPage::playStep2 @ 0x51366a
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x5b2e76
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x5b2f3c
// > GJWorldNode::playStep2 @ 0x62d482
// > SetupSongTriggerPopup::onPlayback @ 0x65868e
//
// 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:12 +0000
//
int __fastcall FMODAudioEngine::loadMusic(
int a1,
unsigned __int8 *a2,
float a3,
int a4,
float a5,
char a6,
unsigned int a7,
unsigned int a8,
char a9)
{
int v9; // r5
int v13; // r11
int v14; // r3
int isPersistentMatchPlaying; // r8
FMOD::Sound *v17; // r11
int *v18; // r0
int v19; // r0
int *v20; // r0
unsigned int v21; // r7
unsigned int v22; // r6
unsigned int v23; // r7
unsigned int v24; // r11
_DWORD *v25; // r3
unsigned int v26; // r0
int v27; // r1
float v28; // s13
float v29; // s15
bool v30; // r5
unsigned int v31; // r5
unsigned int v32; // r1
void **v33; // r3
unsigned int v34; // r0
int v35; // r1
int *v36; // r0
int v37; // r1
float *v38; // r0
_DWORD *v39; // r4
float v40; // r1
FMOD::ChannelControl *v41; // r6
float *v42; // r0
int v43; // r1
char v44; // [sp+Ch] [bp-E8h]
unsigned int v45; // [sp+10h] [bp-E4h]
FMOD::ChannelControl *v47; // [sp+24h] [bp-D0h] BYREF
int v48[3]; // [sp+28h] [bp-CCh] BYREF
void *v49; // [sp+34h] [bp-C0h] BYREF
int v50[6]; // [sp+40h] [bp-B4h] BYREF
char v51; // [sp+58h] [bp-9Ch]
unsigned int v52; // [sp+5Ch] [bp-98h]
int v53; // [sp+60h] [bp-94h]
int v54; // [sp+98h] [bp-5Ch]
int v55; // [sp+9Ch] [bp-58h]
int v56; // [sp+A0h] [bp-54h]
int v57; // [sp+A4h] [bp-50h]
int v58; // [sp+A8h] [bp-4Ch]
int v59; // [sp+B0h] [bp-44h]
int v60; // [sp+B4h] [bp-40h]
int v61; // [sp+B8h] [bp-3Ch]
int v62; // [sp+BCh] [bp-38h]
int v63; // [sp+C0h] [bp-34h]
char v64; // [sp+DCh] [bp-18h]
unsigned int v65; // [sp+E0h] [bp-14h]
v13 = *a2;
v44 = a9;
if ( (v13 & 1) != 0 )
v14 = *((_DWORD *)a2 + 1);
else
v14 = v13 >> 1;
if ( !v14 )
return 0;
if ( a9 )
{
std::string::basic_string(v50, (int)a2);
isPersistentMatchPlaying = FMODAudioEngine::isPersistentMatchPlaying(
(FMODAudioEngine *)a1,
(unsigned __int8 *)v50,
a7);
std::string::~string((int)v50);
if ( isPersistentMatchPlaying )
return 0;
}
std::string::basic_string(v50, (int)a2);
v17 = FMODAudioEngine::preloadMusic((FMODAudioEngine *)a1, (unsigned __int8 *)v50, 0, a7);
std::string::~string((int)v50);
if ( v17 )
{
v18 = std::unordered_map::operator[](a1 + 264, &a7);
v47 = (FMOD::ChannelControl *)FMODAudioEngine::channelForChannelID((FMODAudioEngine *)a1, *v18);
if ( v47 )
{
LABEL_38:
v36 = std::unordered_map::operator[](a1 + 264, &a7);
v37 = a7;
*((_BYTE *)v36 + 21) = v44;
FMODAudioEngine::stopChannelTweens(a1, v37, 2);
*(float *)std::unordered_map::operator[](a1 + 588, &a7) = a5;
v38 = (float *)std::unordered_map::operator[](a1 + 628, &a7);
v39 = (_DWORD *)(a1 + 608);
*v38 = a3;
if ( !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
v39,
&a7) )
*std::unordered_map::operator[]((int)v39, &a7) = 1065353216;
if ( a3 > 0.0 )
v40 = a3;
else
v40 = 1.0;
FMOD::ChannelControl::setPitch(v47, v40);
v41 = v47;
v42 = (float *)std::unordered_map::operator[]((int)v39, &a7);
FMOD::ChannelControl::setVolume(v41, a5 * *v42);
if ( a6 )
v43 = -1;
else
v43 = 0;
FMOD::Channel::setLoopCount(v47, v43);
return 1;
}
v19 = FMOD::System::playSound(*(FMOD::System **)(a1 + 364), v17, *(FMOD::ChannelGroup **)(a1 + 360), 1, &v47);
*(_DWORD *)(a1 + 388) = v19;
if ( !v19 )
{
a8 = (unsigned int)FMODAudioEngine::registerChannel((FMODAudioEngine *)a1, v47, (void *)a8, 0);
v20 = std::unordered_map::operator[](a1 + 264, &a7);
*v20 = a8;
FMOD::ChannelControl::setCallback();
FMOD::ChannelControl::setVolumeRamp(v47, 0);
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__erase_unique(
(int *)(a1 + 708),
&a8);
std::string::basic_string(v48, (int)a2);
v21 = a7;
v45 = a8;
std::string::basic_string(v50, (int)v48);
v22 = *(_DWORD *)(a1 + 712);
v65 = v21;
v52 = v45;
*(float *)&v50[3] = a3;
v53 = 0;
v56 = 0;
v57 = 0;
v58 = 0;
v63 = 0;
v50[4] = a4;
v51 = a6;
v54 = 0;
v55 = 0;
*(float *)&v50[5] = a5;
v59 = 0;
v60 = 0;
v61 = 0;
v62 = 0;
v64 = 1;
v23 = a8;
if ( v22 )
{
v24 = v22 - 1;
v9 = ((v22 - 1) & v22) != 0 ? a8 % v22 : v24 & a8;
v25 = *(_DWORD **)(*(_DWORD *)(a1 + 708) + 4 * v9);
if ( v25 )
{
while ( 1 )
{
v25 = (_DWORD *)*v25;
if ( !v25 )
break;
v26 = v25[1];
v27 = ((v22 - 1) & v22) != 0 ? v26 % v22 : v24 & v26;
if ( v27 != v9 )
break;
if ( v25[2] == a8 )
goto LABEL_37;
}
}
}
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__construct_node_hash(
(int)&v49,
a1 + 708,
a8,
&a8,
(int)v50);
v28 = *(float *)(a1 + 724);
v29 = (float)(unsigned int)(*(_DWORD *)(a1 + 720) + 1);
if ( v29 > (float)((float)v22 * v28) )
{
v30 = v22 > 2 && ((v22 - 1) & v22) == 0;
}
else
{
if ( v22 )
goto LABEL_29;
v30 = 0;
}
v31 = 2 * v22 + !v30;
v32 = (unsigned int)ceilf(v29 / v28);
if ( v32 < v31 )
v32 = v31;
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::rehash(
a1 + 708,
v32);
v22 = *(_DWORD *)(a1 + 712);
if ( ((v22 - 1) & v22) != 0 )
v9 = v23 % v22;
else
v9 = (v22 - 1) & v23;
LABEL_29:
v33 = *(void ***)(*(_DWORD *)(a1 + 708) + 4 * v9);
if ( v33 )
{
*(_DWORD *)v49 = *v33;
*v33 = v49;
}
else
{
*(_DWORD *)v49 = *(_DWORD *)(a1 + 716);
*(_DWORD *)(a1 + 716) = v49;
*(_DWORD *)(*(_DWORD *)(a1 + 708) + 4 * v9) = a1 + 716;
if ( *(_DWORD *)v49 )
{
v34 = *(_DWORD *)(*(_DWORD *)v49 + 4);
if ( ((v22 - 1) & v22) != 0 )
v35 = v34 % v22;
else
v35 = (v22 - 1) & v34;
*(_DWORD *)(*(_DWORD *)(a1 + 708) + 4 * v35) = v49;
}
}
++*(_DWORD *)(a1 + 720);
LABEL_37:
std::string::~string((int)v50);
std::string::~string((int)v48);
goto LABEL_38;
}
return 0;
}
return 1;
}