//
// PlayLayer::startMusic from 0x100080940 to 0x100080a92 (338 bytes)
//
// 4 xrefs:
// > PlayLayer::startGame @ 0x100080422
// > PlayLayer::startGameDelayed @ 0x100080aac
// > PlayLayer::switchToStartPosObject @ 0x10008c0eb
// > PlayLayer::resetLevel @ 0x10008d322
//
// This function is hookable on this platform (idp: pc, 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:20:02 +0000
//
__int64 __fastcall PlayLayer::startMusic(__int64 a1, double a2)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rax
float v5; // xmm0_4
__int64 v6; // rsi
__int64 Checkpoint; // rax
if ( !*(_BYTE *)(a1 + 12650)
&& *(_BYTE *)(a1 + 12664) == 1
&& (!*(_QWORD *)(a1 + 12432) || (result = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 14240))) == 0) )
{
v3 = FMODAudioEngine::sharedEngine(a2);
*(float *)&a2 = FMODAudioEngine::getBackgroundMusicVolume(v3);
if ( !*(_BYTE *)(a1 + 14880) )
PlayLayer::prepareMusic(a1, 0, a2);
GJBaseGameLayer::processQueuedAudioTriggers(a1);
GJBaseGameLayer::updateProximityVolumeEffects(a1);
if ( *(double *)(a1 + 928) <= 0.0
&& *(_BYTE *)(*(_QWORD *)(a1 + 3272) + 348LL) == 1
&& (*(_BYTE *)(a1 + 12544) != 1 || *(_BYTE *)(a1 + 12545) == 1) )
{
v4 = FMODAudioEngine::sharedEngine(0.0);
FMODAudioEngine::fadeInMusic(v4, 0, 2.0);
}
result = *(_QWORD *)(a1 + 12432);
if ( result )
{
if ( *(_BYTE *)(a1 + 12544) != 1 || *(_BYTE *)(a1 + 12545) == 1 )
{
GJBaseGameLayer::pauseAudio(a1);
v5 = *(double *)(a1 + 928);
GJBaseGameLayer::processActivatedAudioTriggers(a1, v5);
result = *(_QWORD *)(a1 + 12432);
}
v6 = *(unsigned int *)(result + 916);
result = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 14240));
if ( !result )
{
Checkpoint = PlayLayer::createCheckpoint(a1, v6);
result = cocos2d::CCDictionary::setObject_1(
*(_QWORD *)(a1 + 14240),
Checkpoint,
*(unsigned int *)(*(_QWORD *)(a1 + 12432) + 916LL));
}
}
*(_BYTE *)(a1 + 14880) = 0;
*(_BYTE *)(a1 + 13806) = 1;
}
return result;
}