//
// PlayLayer::startMusic from 0x1403baa60 to 0x1403baba2 (322 bytes)
//
// 4 xrefs:
// > PlayLayer::startGame @ 0x1403a7a69
// > PlayLayer::startGameDelayed @ 0x1403a7a77
// > PlayLayer::resetLevel @ 0x1403b9906
// > ??> @ 0x1406d710c
//
// 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=2
void PlayLayer::startMusic(PlayLayer *a1)
{
bool v1; // dl
GJBaseGameLayer *v3; // rcx
int v4; // r8d
FMODAudioEngine *v5; // rcx
CheckpointObject *Checkpoint; // rax
FMODAudioEngine *v7; // [rsp+30h] [rbp+8h]
FMODAudioEngine *v8; // [rsp+30h] [rbp+8h]
if ( !a1->m_playerDied && a1->m_started && !a1->m_currentCheckpoint )
{
if ( !qword_1406C2E88 )
{
v7 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v7);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
}
if ( !a1->m_musicPrepared )
PlayLayer::prepareMusic(a1, v1);
GJBaseGameLayer::processQueuedAudioTriggers(a1);
GJBaseGameLayer::updateProximityVolumeEffects(a1);
if ( a1->m_gameState.m_levelTime <= 0.0 && a1->m_levelSettings->m_fadeIn )
{
v5 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v8 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v8);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v5 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::fadeInMusic(v5, 2.0, v4);
}
if ( a1->m_startPosObject )
{
GJBaseGameLayer::pauseAudio(v3);
GJBaseGameLayer::processActivatedAudioTriggers(a1, a1->m_gameState.m_levelTime);
if ( !a1->m_currentCheckpoint )
{
Checkpoint = PlayLayer::createCheckpoint(a1);
a1->m_currentCheckpoint = Checkpoint;
cocos2d::CCObject::retain(Checkpoint);
}
}
a1->m_musicPrepared = 0;
a1->m_audioPaused = 1;
}
}