//
// LevelEditorLayer::onStopPlaytest from 0x1000f2d60 to 0x1000f3311 (1457 bytes)
//
// 2 xrefs:
// > EditorUI::onStopPlaytest @ 0x10000c760
// > LevelEditorLayer::postUpdate @ 0x1000f3571
//
// 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)
{
cocos2d::CCDirector *v1; // rax
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer begin; // rax
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer end; // rcx
unsigned __int64 v4; // rsi
std::vector *, std::allocator *>> *v5; // rdx
__int64 v6; // rbx
__int64 v7; // r15
std::vector *v8; // r12
__int64 v9; // r13
__int64 i; // r14
LevelEditorLayer *v11; // rbx
cocos2d::CCDirector *v12; // rax
PlayerObject *m_player1; // rdi
cocos2d::CCSprite *m_playtestDeathSprite; // r14
__int64 v15; // rax
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer v16; // rax
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer v17; // rcx
unsigned __int64 v18; // rsi
std::vector *, std::allocator *>> *v19; // rdx
unsigned __int64 v20; // rdi
__int64 v21; // rbx
std::vector *v22; // r13
__int64 v23; // r14
__int64 j; // r15
GameObject *v25; // r12
double v26; // xmm0_8
unsigned __int64 k; // rax
unsigned __int64 v28; // rsi
cocos2d::CCArray *m_objects; // r14
unsigned int v30; // r15d
GameObject *v31; // r13
cocos2d::CCArray *v32; // rax
cocos2d::ccArray *data; // rax
cocos2d::CCObject **arr; // rbx
unsigned __int64 v35; // r15
cocos2d::CCObject *v36; // r14
LevelEditorLayer *v37; // rbx
FMODAudioEngine *v38; // rax
FMODAudioEngine *v39; // rax
FMODAudioEngine *v40; // rax
EditorUI *m_editorUI; // rdi
float v42[2]; // [rsp+8h] [rbp-48h] BYREF
float v43[2]; // [rsp+10h] [rbp-40h] BYREF
unsigned __int64 v44; // [rsp+18h] [rbp-38h]
LevelEditorLayer *v45; // [rsp+20h] [rbp-30h]
v1 = cocos2d::CCDirector::sharedDirector();
*(_BYTE *)(((__int64 (__fastcall *)(cocos2d::CCDirector *))v1->getKeyboardDispatcher)(v1) + 92) = 0;
UILayer::editorPlaytest(a1->m_uiLayer, 0);
GJBaseGameLayer::restoreAllUIObjects(a1);
GJBaseGameLayer::resetStoppedAreaObjects(a1);
begin = a1->m_sections.__begin_;
v45 = a1;
end = a1->m_sections.__end_;
if ( end != begin )
{
v4 = 0;
do
{
v5 = begin[v4];
if ( v5 && (int)((unsigned __int64)((char *)v5->__end_ - (char *)v5->__begin_) >> 3) > 0 )
{
v6 = ((unsigned __int64)((char *)v5->__end_ - (char *)v5->__begin_) >> 3) & 0x7FFFFFFF;
v7 = 0;
v44 = v4;
do
{
v8 = v45->m_sections.__begin_[v4]->__begin_[v7];
if ( v8 )
{
v9 = v45->m_sectionSizes.__begin_[v44]->__begin_[v7];
if ( v9 > 0 )
{
for ( i = 0; i != v9; ++i )
GameObject::quickUpdatePosition(v8->__begin_[i]);
}
}
++v7;
v4 = v44;
}
while ( v7 != v6 );
begin = v45->m_sections.__begin_;
end = v45->m_sections.__end_;
}
++v4;
}
while ( end - begin > v4 );
}
v11 = v45;
GJBaseGameLayer::resetLevelVariables(v45);
GJBaseGameLayer::syncBGTextures(v45);
if ( v45->m_collisionBlocksAdded )
{
v45->m_collisionBlocksAdded = 0;
GJBaseGameLayer::removeObjectFromSection(v11, v11->m_player1CollisionBlock);
GJBaseGameLayer::removeObjectFromSection(v11, v11->m_player2CollisionBlock);
}
if ( v11->m_playTestSmoothFix )
{
v12 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::resetSmoothFixCounter(v12);
cocos2d::CCDirector::sharedDirector()->m_bSmoothFixCheck = 0;
}
GJBaseGameLayer::setStartPosObject(v11, nullptr);
v11->m_playtestTimeWarp = 1.0;
((void (__fastcall *)(LevelEditorLayer *, float))v11->updateTimeWarp)(v11, 1.0);
v11->m_playtestCameraZoom = 1.0;
v11->m_playbackMode = Not;
PlayerObject::releaseAllButtons(v11->m_player1);
cocos2d::CCNode::pauseSchedulerAndActions(v11->m_player1);
LevelEditorLayer::updatePreviewParticles(v11);
GJBaseGameLayer::toggleDualMode(v11, nullptr, 0, v11->m_player1, 1);
m_player1 = v11->m_player1;
if ( m_player1->m_isDead || v11->m_gameState.m_isDualMode && (m_player1 = v11->m_player2, m_player1->m_isDead) )
{
m_playtestDeathSprite = v11->m_playtestDeathSprite;
v15 = ((__int64 (__fastcall *)(PlayerObject *))m_player1->getPosition)(m_player1);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_playtestDeathSprite->setPosition)(m_playtestDeathSprite, v15);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v11->m_playtestDeathSprite->setVisible)(
v11->m_playtestDeathSprite,
1);
}
((void (__fastcall *)(PlayerObject *, _QWORD))v11->m_player1->setVisible)(v11->m_player1, 0);
((void (__fastcall *)(PlayerObject *, _QWORD))v11->m_player2->setVisible)(v11->m_player2, 0);
v16 = v11->m_sections.__begin_;
v17 = v11->m_sections.__end_;
if ( v17 != v16 )
{
v18 = 0;
do
{
v19 = v16[v18];
if ( v19 )
{
v20 = (unsigned __int64)((char *)v19->__end_ - (char *)v19->__begin_) >> 3;
if ( (int)v20 > 0 )
{
v21 = 0;
v44 = v18;
do
{
v22 = v45->m_sections.__begin_[v18]->__begin_[v21];
if ( v22 )
{
v23 = v45->m_sectionSizes.__begin_[v44]->__begin_[v21];
if ( v23 > 0 )
{
for ( j = 0; j != v23; ++j )
{
v25 = v22->__begin_[j];
((void (__fastcall *)(GameObject *))v25->updateStartValues)(v25);
((void (__fastcall *)(GameObject *))v25->resetObject)(v25);
((void (__fastcall *)(GameObject *))v25->getPosition)(v25);
v26 = sub_10028CC60(v42);
((void (__fastcall *)(float *, GameObject *, double))v25->getRealPosition)(v43, v25, v26);
if ( v42[0] != v43[0] || v42[1] != v43[1] )
((void (__fastcall *)(GameObject *, float *))v25->setPosition)(v25, v43);
*(_WORD *)&v25->m_isObjectRectDirty = 257;
v25->m_isDirty = 1;
}
}
}
++v21;
v18 = v44;
}
while ( v21 != (v20 & 0x7FFFFFFF) );
v11 = v45;
v16 = v45->m_sections.__begin_;
v17 = v45->m_sections.__end_;
}
}
++v18;
}
while ( v17 - v16 > v18 );
}
for ( k = 0; k != 10000; k += 2LL )
{
v11->m_toggledGroupStates.__begin_[k] = 0;
v28 = k >> 6;
*(_QWORD *)&v11->m_toggledGroups.__begin_[8 * v28] &= __ROL8__(-2, k & 0x3E);
v11->m_toggledGroupStates.__begin_[k + 1] = 0;
*(_QWORD *)&v11->m_toggledGroups.__begin_[8 * v28] &= __ROL8__(-2, (unsigned __int8)k + 1);
}
m_objects = v11->m_objects;
if ( (unsigned int)sub_100720070(m_objects) )
{
v30 = 0;
do
{
v31 = (GameObject *)sub_1007200C0(m_objects, v30);
GameObject::resetMoveOffset(v31);
((void (__fastcall *)(float *, GameObject *))v31->getRealPosition)(v42, v31);
((void (__fastcall *)(GameObject *, float *))v31->setPosition)(v31, v42);
((void (__fastcall *)(LevelEditorLayer *, GameObject *))v11->updateObjectSection)(v11, v31);
++v30;
}
while ( v30 < (unsigned int)sub_100720070(m_objects) );
}
v32 = v11->m_objects;
if ( v32 )
{
data = v32->data;
if ( data->num )
{
arr = data->arr;
v35 = (unsigned __int64)&arr[data->num - 1];
do
{
v36 = *arr;
if ( !*arr )
break;
if ( ((unsigned __int8 (__fastcall *)(cocos2d::CCObject *))v36->__vftable[21].acceptVisitor)(*arr) )
((void (__fastcall *)(cocos2d::CCObject *, __int64))v36->__vftable[23].copyWithZone)(v36, 1);
++arr;
}
while ( (unsigned __int64)arr <= v35 );
}
}
v37 = v45;
GJEffectManager::reset(v45->m_effectManager);
GJBaseGameLayer::resetGroupCounters(v37, 0);
v38 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::resumeAllAudio(v38);
v39 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v39, 1);
v40 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllEffects(v40);
if ( v37->m_playtestOrderChanged )
v37->m_spawnOrderObjectsChanged = 1;
m_editorUI = v37->m_editorUI;
if ( m_editorUI )
EditorUI::updateSlider(m_editorUI);
v37->m_skipArtReload = 0;
}