//
// EndLevelLayer::onReplay from 0x7d3380 to 0x7d3520 (416 bytes)
//
// 4 xrefs:
// > EndLevelLayer::keyDown @ 0x7d3558
// > ??> @ 0x964c8
// > EndLevelLayer::customSetup @ 0x7d5f64
// > ??> @ 0x122d208
//
// 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 EndLevelLayer::onReplay(EndLevelLayer *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
FMODAudioEngine *v4; // x0
FMODAudioEngine *v5; // x22
void *v6; // x0
unsigned int *v7; // x2
int v8; // w1
__int64 v9; // [xsp+40h] [xbp+40h] BYREF
if ( !a1->m_exiting )
{
a1->m_exiting = (unsigned __int8)&dword_0 + 1;
v3 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v3, "0024") )
PlatformToolbox::hideCursor();
v4 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::clearAllAudio(v4);
v5 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v9, "playSound_01.ogg");
FMODAudioEngine::playEffect((__int64)v5, (__int64)&v9, 1.0, 0.0, 0.3);
v6 = (void *)(v9 - 24);
if ( (__int64 *)(v9 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(v9 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *(_DWORD *)(v9 - 8);
*(_DWORD *)(v9 - 8) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v6);
}
a1->exitLayer(a1, nullptr);
a1->setTouchEnabled(a1, 0);
a1->setKeyboardEnabled(a1, 0);
a1->setKeypadEnabled(a1, 0);
PlayLayer::delayedFullReset(a1->m_playLayer);
}
}