//
// GameOptionsLayer::onPracticeMusicSync from 0x1402a0270 to 0x1402a03e4 (372 bytes)
//
// 3 xrefs:
// > GameOptionsLayer::setupOptions @ 0x14029f542
// > ??> @ 0x1406d1f34
// > ??> @ 0x1406d1f40
//
// 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=4
void GameOptionsLayer::onPracticeMusicSync(GameOptionsLayer *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // rcx
__int64 v4; // rbx
__int64 v5; // rcx
bool v6; // bl
cocos2d::CCString *v7; // rax
bool v8; // bl
GameStatsManager *v9; // rcx
void *v10; // [rsp+20h] [rbp-38h]
void *v11; // [rsp+20h] [rbp-38h]
void *v12; // [rsp+20h] [rbp-38h]
_QWORD v13[4]; // [rsp+28h] [rbp-30h] BYREF
if ( !qword_1406C2EE8 )
{
v10 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
if ( GameStatsManager::isItemUnlocked((GameStatsManager *)a1, GJItem, 17) )
{
v4 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v11 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v4 = qword_1406C2EE8;
}
if ( GameStatsManager::isItemUnlocked(v3, GJItem, 17) )
{
GameStatsManager::getItemKey(v5, v13, 0x11u, 0xCu);
v7 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v4 + 888), v13);
v6 = cocos2d::CCString::boolValue(v7);
sub_14003A830((__int64)v13);
}
else
{
v6 = 0;
}
v8 = !v6;
v9 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v12 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v9 = (GameStatsManager *)qword_1406C2EE8;
}
GameStatsManager::toggleEnableItem(v9, GJItem, 17, v8);
a1->m_baseGameLayer->toggleMusicInPractice(a1->m_baseGameLayer);
}
else
{
GameOptionsLayer::showPracticeMusicSyncUnlockInfo(a1);
}
}