//
// PlayLayer::togglePracticeMode from 0x1403b9e50 to 0x1403ba0d6 (646 bytes)
//
// 4 xrefs:
// > PauseLayer::onPracticeMode @ 0x14037e214
// > PauseLayer::onNormalMode @ 0x14037e2ed
// > PlayLayer::fullReset @ 0x1403b8c72
// > ??> @ 0x1406d70d0
//
// 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=6
void PlayLayer::togglePracticeMode(PlayLayer *a1, bool a2)
{
__int64 v4; // rdi
__int64 v5; // rdi
MusicDownloadManager *v6; // rax
int v7; // edi
MusicDownloadManager *v8; // rax
_QWORD *v9; // rax
size_t v10; // r8
FMODAudioEngine *v11; // rcx
FMODAudioEngine *v12; // [rsp+30h] [rbp-68h]
__int128 v13; // [rsp+38h] [rbp-60h] BYREF
__int64 v14; // [rsp+48h] [rbp-50h]
__int64 v15; // [rsp+50h] [rbp-48h]
FMODAudioEngine *v16; // [rsp+58h] [rbp-40h]
_QWORD v17[4]; // [rsp+60h] [rbp-38h] BYREF
if ( a1->m_isPracticeMode != a2 )
{
a1->m_isPracticeMode = a2;
PlayLayer::toggleDebugDraw(a1);
UILayer::toggleCheckpointsMenu(a1->m_uiLayer, a2);
if ( a2 )
{
if ( !a1->m_practiceMusicSync )
{
v4 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v12 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v4 = qword_1406C2E88;
}
if ( *(_QWORD *)(v4 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v4 + 552));
sub_14005E0D0((_QWORD *)(v4 + 1064));
sub_14005E0D0((_QWORD *)(v4 + 1128));
sub_14005E0D0((_QWORD *)(v4 + 1192));
v5 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v16 = (FMODAudioEngine *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = qword_1406C2ED8;
}
if ( *(int *)(v5 + 1084) > 0 )
{
v6 = MusicDownloadManager::sharedState();
if ( !MusicDownloadManager::isSongDownloaded(v6, *(_DWORD *)(v5 + 1084)) )
*(_DWORD *)(v5 + 1084) = 0;
}
v7 = *(_DWORD *)(v5 + 1084);
if ( v7 <= 0 )
{
v13 = 0;
*(_QWORD *)&v13 = sub_14003AA10(0x20u);
v14 = 16;
v15 = 31;
strcpy((char *)v13, "StayInsideMe.mp3");
}
else
{
v8 = MusicDownloadManager::sharedState();
v9 = MusicDownloadManager::pathForSong((__int64)v8, v17, v7);
if ( v9[3] > 0xFu )
v9 = (_QWORD *)*v9;
v13 = 0;
v14 = 0;
v15 = 0;
v10 = -1;
do
++v10;
while ( *((_BYTE *)v9 + v10) );
sub_14003A930(&v13, v9, v10);
sub_14003A830((__int64)v17);
}
v11 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v16 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v11 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::playMusic(v11, (__int64)&v13, 1, 0.0);
}
}
else
{
PlayLayer::resetLevelFromStart(a1);
}
if ( a1->m_isPracticeMode )
cocos2d::CCNode::stopActionByTag(a1, 31);
}
}