//
// PlayLayer::startMusic from 0x100142674 to 0x1001427a4 (304 bytes)
//
// 4 xrefs:
// > PlayLayer::startGame @ 0x1001421a4
// > sub_1001427A4 @ 0x1001427b0
// > PlayLayer::switchToStartPosObject @ 0x10014b038
// > PlayLayer::resetLevel @ 0x10014be60
//
// This function is hookable on this platform (idp: arm, 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 10:59:32 +0000
//
__int64 __fastcall PlayLayer::startMusic(__int64 result)
{
_BYTE *v1; // x20
__int64 v2; // x19
__int64 v3; // x8
__int64 v4; // x0
__n128 v5; // q0
__int64 v6; // x0
__int64 v7; // x8
float v8; // s0
__int64 Checkpoint; // x0
v1 = (_BYTE *)(result + 12288);
if ( (*(_BYTE *)(result + 12650) & 1) == 0 && *(_BYTE *)(result + 12664) == 1 )
{
v2 = result;
v3 = *(_QWORD *)(result + 12432);
if ( !v3
|| (result = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(result + 14240), *(unsigned int *)(v3 + 916))) == 0 )
{
v4 = FMODAudioEngine::sharedEngine(result);
v5.n128_f64[0] = FMODAudioEngine::getBackgroundMusicVolume(v4);
if ( (v1[2592] & 1) == 0 )
PlayLayer::prepareMusic(v2, 0);
GJBaseGameLayer::processQueuedAudioTriggers(v2, v5);
result = GJBaseGameLayer::updateProximityVolumeEffects(v2);
if ( *(double *)(v2 + 928) <= 0.0
&& *(_BYTE *)(*(_QWORD *)(v2 + 3272) + 348LL) == 1
&& (v1[256] != 1 || v1[257] == 1) )
{
v6 = FMODAudioEngine::sharedEngine(result);
result = FMODAudioEngine::fadeInMusic(v6, 0, 2.0);
}
v7 = *(_QWORD *)(v2 + 12432);
if ( v7 )
{
if ( v1[256] != 1 || v1[257] == 1 )
{
GJBaseGameLayer::pauseAudio(v2);
v8 = *(double *)(v2 + 928);
GJBaseGameLayer::processActivatedAudioTriggers(v2, v8);
v7 = *(_QWORD *)(v2 + 12432);
}
result = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(v2 + 14240), *(unsigned int *)(v7 + 916));
if ( !result )
{
Checkpoint = PlayLayer::createCheckpoint(v2);
result = cocos2d::CCDictionary::setObject_1(
*(_QWORD *)(v2 + 14240),
Checkpoint,
*(unsigned int *)(*(_QWORD *)(v2 + 12432) + 916LL));
}
}
v1[2592] = 0;
v1[1518] = 1;
}
}
return result;
}