//
// PlayLayer::togglePracticeMode from 0x5d23bc to 0x5d2528 (364 bytes)
//
// 4 xrefs:
// > PlayLayer::fullReset @ 0x5d2618
// > PauseLayer::onNormalMode @ 0x6c6a88
// > PauseLayer::onPracticeMode @ 0x6c6ac8
// > ??> @ 0x43608
//
// 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
//
void PlayLayer::togglePracticeMode(PlayLayer *a1, bool a2)
{
_BOOL4 v2; // w20
float *v3; // x21
FMODAudioEngine *v5; // x0
FMODAudioEngine *v6; // x23
GameManager *v7; // x0
void *v8; // x0
unsigned int *v9; // x2
int v10; // w1
__int64 v11; // [xsp+60h] [xbp+60h] BYREF
v2 = a2;
v3 = &a1->m_varianceValues.__elems_[1975];
if ( a1->m_isPracticeMode != a2 )
{
a1->m_isPracticeMode = a2;
PlayLayer::toggleDebugDraw(a1);
UILayer::toggleCheckpointsMenu(a1->m_uiLayer, v2);
if ( v2 )
{
if ( !*((_BYTE *)v3 + 593) )
{
v5 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v5, 1);
v6 = FMODAudioEngine::sharedEngine();
v7 = GameManager::sharedState();
GameManager::getPracticeMusicFile(&v11, v7);
FMODAudioEngine::playMusic(v6, (__int64)&v11, 1u, 0, 0.0);
v8 = (void *)(v11 - 24);
if ( (__int64 *)(v11 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v11 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v11 - 8);
*(_DWORD *)(v11 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v8);
}
}
}
else
{
PlayLayer::resetLevelFromStart(a1);
}
if ( *((_BYTE *)v3 + 592) )
PlayLayer::stopRecording(a1);
}
}