//
// LevelEditorLayer::onStopPlaytest from 0x100363204 to 0x100363584 (896 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::postUpdate @ 0x100363790
// > EditorUI::onStopPlaytest @ 0x1003c7a48
//
// 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 __fastcall LevelEditorLayer::onStopPlaytest(LevelEditorLayer *a1)
{
int *p_m_activeGradients; // x20
cocos2d::CCDirector *v3; // x0
cocos2d::CCDirector *v4; // x0
PlayerObject *m_player1; // x0
cocos2d::CCSprite *m_playtestDeathSprite; // x20
__int64 v7; // x0
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer end; // x8
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer begin; // x9
unsigned __int64 v10; // x22
std::vector *, std::allocator *>> *v11; // x10
unsigned __int64 v12; // x10
__int64 v13; // x25
__int64 v14; // x26
std::vector *v15; // x27
__int64 v16; // x8
unsigned __int64 v17; // x28
__int64 v18; // x21
GameObject *v19; // x20
__int64 *v20; // x0
float v21; // s0
__n128 v22; // q0
unsigned __int64 i; // x8
FMODAudioEngine *v24; // x0
FMODAudioEngine *v25; // x0
FMODAudioEngine *v26; // x0
EditorUI *m_editorUI; // x0
int *v28; // [xsp+8h] [xbp-68h]
__int64 v29; // [xsp+10h] [xbp-60h] BYREF
__int64 v30; // [xsp+18h] [xbp-58h] BYREF
p_m_activeGradients = &a1->m_activeGradients;
v3 = cocos2d::CCDirector::sharedDirector();
*(_BYTE *)(((__int64 (__fastcall *)(cocos2d::CCDirector *))v3->getKeyboardDispatcher)(v3) + 92) = 0;
UILayer::editorPlaytest(a1->m_uiLayer, 0);
GJBaseGameLayer::restoreAllUIObjects(a1);
GJBaseGameLayer::resetStoppedAreaObjects(a1);
LevelEditorLayer::quickUpdateAllPositions(a1);
GJBaseGameLayer::resetLevelVariables(a1);
GJBaseGameLayer::syncBGTextures(a1);
LevelEditorLayer::removePlayerCollisionBlock(a1);
if ( *((_BYTE *)p_m_activeGradients + 1464) == 1 )
{
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::resetSmoothFixCounter(v4);
cocos2d::CCDirector::sharedDirector()->m_bSmoothFixCheck = 0;
}
v28 = p_m_activeGradients;
GJBaseGameLayer::setStartPosObject(a1, nullptr);
a1->m_playtestTimeWarp = 1.0;
((void (__fastcall *)(LevelEditorLayer *, float))a1->updateTimeWarp)(a1, 1.0);
a1->m_playtestCameraZoom = 1.0;
a1->m_playbackMode = Not;
PlayerObject::releaseAllButtons(a1->m_player1);
cocos2d::CCNode::pauseSchedulerAndActions(a1->m_player1);
LevelEditorLayer::updatePreviewParticles(a1);
GJBaseGameLayer::toggleDualMode(a1, nullptr, 0, a1->m_player1, 1);
m_player1 = a1->m_player1;
if ( m_player1->m_isDead || a1->m_gameState.m_isDualMode && (m_player1 = a1->m_player2, m_player1->m_isDead) )
{
m_playtestDeathSprite = a1->m_playtestDeathSprite;
v7 = ((__int64 (__fastcall *)(PlayerObject *))m_player1->getPosition)(m_player1);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_playtestDeathSprite->setPosition)(m_playtestDeathSprite, v7);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))a1->m_playtestDeathSprite->setVisible)(
a1->m_playtestDeathSprite,
1);
}
((void (__fastcall *)(PlayerObject *, _QWORD))a1->m_player1->setVisible)(a1->m_player1, 0);
((void (__fastcall *)(PlayerObject *, _QWORD))a1->m_player2->setVisible)(a1->m_player2, 0);
end = a1->m_sections.__end_;
begin = a1->m_sections.__begin_;
if ( end != begin )
{
v10 = 0;
do
{
v11 = begin[v10];
if ( v11 )
{
v12 = (char *)v11->__end_ - (char *)v11->__begin_;
if ( (int)(v12 >> 3) >= 1 )
{
v13 = 0;
v14 = (v12 >> 3) & 0x7FFFFFFF;
do
{
v15 = a1->m_sections.__begin_[v10]->__begin_[v13];
if ( v15 )
{
v16 = (unsigned int)a1->m_sectionSizes.__begin_[v10]->__begin_[v13];
if ( (int)v16 >= 1 )
{
v17 = 0;
v18 = 8 * v16;
do
{
v19 = v15->__begin_[v17 / 8];
((void (__fastcall *)(GameObject *))v19->updateStartValues)(v19);
((void (__fastcall *)(GameObject *))v19->resetObject)(v19);
v20 = (__int64 *)((__int64 (__fastcall *)(GameObject *))v19->getPosition)(v19);
v21 = sub_1000229B8(&v30, v20);
((void (__fastcall *)(__int64 *__return_ptr, GameObject *, float))v19->getRealPosition)(
&v29,
v19,
v21);
v22.n128_u32[0] = v30;
if ( *(float *)&v30 != *(float *)&v29
|| (v22.n128_u32[0] = HIDWORD(v30), *((float *)&v30 + 1) != *((float *)&v29 + 1)) )
{
((void (__fastcall *)(GameObject *, __int64 *, __n128))v19->setPosition)(v19, &v29, v22);
}
*(_WORD *)&v19->m_isObjectRectDirty = 257;
v19->m_isDirty = 1;
v17 += 8LL;
}
while ( v18 != v17 );
}
}
++v13;
}
while ( v13 != v14 );
end = a1->m_sections.__end_;
begin = a1->m_sections.__begin_;
}
}
++v10;
}
while ( v10 < end - begin );
}
for ( i = 0; i != 10000; ++i )
{
a1->m_toggledGroupStates.__begin_[i] = 0;
*(_QWORD *)&a1->m_toggledGroups.__begin_[(i >> 3) & 0x1FFFFFFFFFFFFFF8LL] &= ~(1LL << i);
}
LevelEditorLayer::resetMovingObjects(a1);
LevelEditorLayer::updateAnimateOnTriggerObjects(a1, 1);
GJEffectManager::reset(a1->m_effectManager);
GJBaseGameLayer::resetGroupCounters(a1, 0);
v24 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::resumeAllAudio(v24);
v25 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v25, 1);
v26 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllEffects(v26);
if ( (*((_BYTE *)v28 + 1458) & 1) != 0 )
*((_BYTE *)v28 + 1632) = 1;
m_editorUI = a1->m_editorUI;
if ( m_editorUI )
EditorUI::updateSlider(m_editorUI);
*((_BYTE *)v28 + 181) = 0;
}