//
// PlayLayer::prepareMusic from 0x1403ba8e0 to 0x1403baa51 (369 bytes)
//
// 3 xrefs:
// > PlayLayer::setupHasCompleted @ 0x1403a76fa
// > PlayLayer::startMusic @ 0x1403baacf
// > ??> @ 0x1406d7100
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=3
void PlayLayer::prepareMusic(PlayLayer *a1, bool a2)
{
_QWORD *AudioFileName; // rdi
__int64 v4; // rcx
LevelSettingsObject *m_levelSettings; // rax
float v6; // xmm6_4
FMODAudioEngine *v7; // rcx
_QWORD v8[4]; // [rsp+50h] [rbp-38h] BYREF
FMODAudioEngine *v9; // [rsp+90h] [rbp+8h]
FMODAudioEngine *v10; // [rsp+A0h] [rbp+18h]
if ( (!a1->m_isPracticeMode || a1->m_practiceMusicSync) && !a1->m_playerDied )
{
AudioFileName = GJGameLevel::getAudioFileName((__int64)a1->m_level, v8);
v4 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v10 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v4 = qword_1406C2E88;
}
FMODAudioEngine::loadMusic(
v4,
(__int64)AudioFileName,
1.0,
0.0,
1.0,
a1->m_isPlatformer,
0,
0,
a1->m_levelSettings->m_dontReset);
m_levelSettings = a1->m_levelSettings;
v6 = (m_levelSettings->m_songOffset + a1->m_gameState.m_levelTime) * 1000.0;
if ( !m_levelSettings->m_dontReset )
{
v7 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v9 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v7 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::setMusicTimeMS(v7, (int)v6, 0, 0);
}
a1->m_musicPrepared = 1;
}
}