//
// LevelEditorLayer::onStopPlaytest from 0x1403ffeb0 to 0x1404006e6 (2102 bytes)
//
// 5 xrefs:
// > EditorUI::onPause @ 0x1401acd99
// > EditorUI::onStopPlaytest @ 0x1401b49cf
// > EditorUI::handleAction @ 0x1401c1dd7
// > LevelEditorLayer::postUpdate @ 0x140400ab4
// > ??> @ 0x1409259d0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:31:54 +0000
//
// Hidden C++ exception states: #wind=4
__int64 __fastcall LevelEditorLayer::onStopPlaytest(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rbx
__int64 v4; // rdx
__int64 v5; // rcx
__int64 v6; // r8
__int64 v7; // r9
__int64 v8; // rdi
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
unsigned int v12; // r13d
unsigned int *v13; // r14
__int64 v14; // rax
__int64 **v15; // r14
__int64 **i; // rbp
__int64 *v17; // rdi
__int64 v18; // rax
__int64 v19; // rbx
__int64 v20; // rax
__int64 v21; // rdx
__int64 v22; // rax
int v23; // ebp
__int64 v24; // rdi
__int64 v25; // rbx
__int64 v26; // rcx
cocos2d::CCDirector *v27; // rax
__int64 v28; // rcx
cocos2d::CCObject *v29; // rcx
_BYTE *v30; // rcx
__int64 v31; // rdi
__int64 v32; // rbx
__int64 v33; // rax
__int64 v34; // rdx
__int64 v35; // r8
__int64 v36; // rdx
__int64 v37; // r12
_QWORD *v38; // rcx
__int64 v39; // rax
__int64 v40; // r14
_QWORD *v41; // r15
__int64 v42; // rdi
__int64 v43; // rbp
__int64 v44; // rbx
const struct cocos2d::CCPoint *v45; // rax
__int64 v46; // r10
unsigned __int64 v47; // r9
__int64 v48; // r11
cocos2d::CCArray *v49; // rbp
__int64 v50; // rdx
struct cocos2d::CCObject *v51; // rdi
__int64 v52; // rbx
__int64 v53; // rax
_QWORD *v54; // r14
_QWORD *j; // rbx
_QWORD *v56; // rdi
_QWORD *k; // rbp
_QWORD *v58; // r14
_QWORD *m; // rbx
_QWORD *v60; // rdi
_QWORD *n; // rbp
__int64 v62; // rbx
__int64 v63; // rcx
_QWORD *v64; // rcx
__int64 result; // rax
__int64 v66; // rcx
_BYTE v67[16]; // [rsp+30h] [rbp-68h] BYREF
void *v68; // [rsp+A0h] [rbp+8h] BYREF
float v69; // [rsp+A8h] [rbp+10h] BYREF
float v70; // [rsp+ACh] [rbp+14h]
float v71; // [rsp+B0h] [rbp+18h] BYREF
float v72; // [rsp+B4h] [rbp+1Ch]
__int64 v73; // [rsp+B8h] [rbp+20h]
v2 = cocos2d::CCDirector::sharedDirector(a1);
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v2 + 176LL))(v2) + 156) = 0;
v3 = *(_QWORD *)(a1 + 13888);
*(_QWORD *)(v3 + 584) = -1;
*(_WORD *)(v3 + 578) = 0;
*(_BYTE *)(v3 + 580) = 0;
UILayer::resetUINodeState(v3);
UILayer::toggleMenuVisibility(v3, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v3 + 336LL))(v3, 0);
*(_BYTE *)(cocos2d::CCEGLView::sharedOpenGLView(v5, v4, v6, v7) + 237) = 0;
*(_BYTE *)(v3 + 627) = 0;
if ( !*(_BYTE *)(v3 + 626)
&& *(_BYTE *)(v3 + 596)
&& (v8 = *(_QWORD *)(v3 + 640)) != 0
&& (*(_QWORD *)(v8 + 88) || *(_QWORD *)(v8 + 120)) )
{
v9 = GJKeybindManager::sharedState();
GJKeybindManager::applyMovementOverride(v9, v8 + 72, v8 + 104);
}
else
{
v10 = GJKeybindManager::sharedState();
GJKeybindManager::clearMovementOverride(v10);
}
v11 = *(_QWORD *)(a1 + 13896);
v12 = 0;
if ( v11 )
{
v13 = *(unsigned int **)(v11 + 56);
v14 = *v13;
if ( (_DWORD)v14 )
{
v15 = *((__int64 ***)v13 + 2);
for ( i = &v15[v14 - 1]; v15 <= i; ++v15 )
{
v17 = *v15;
if ( !*v15 )
break;
LODWORD(v68) = *((_DWORD *)v17 + 231);
v18 = sub_140357DC0((_QWORD *)(a1 + 2344), (__int64)v67, (unsigned __int8 *)&v68);
v19 = *v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, (const struct cocos2d::CCPoint *)(*(_QWORD *)v18 + 20LL));
(*(void (__fastcall **)(__int64 *, __int64))(v19 + 1216))(v17, v20);
LOBYTE(v21) = 1;
(*(void (__fastcall **)(__int64 *, __int64))(*v17 + 1160))(v17, v21);
*((_DWORD *)v17 + 158) = 0;
*((_BYTE *)v17 + 1353) = 0;
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)a1 + 1192LL))(a1, v17);
cocos2d::CCDictionary::setObject(
*(cocos2d::CCDictionary **)(a1 + 4368),
(struct cocos2d::CCObject *)v17,
*((unsigned int *)v17 + 231));
*((_BYTE *)v17 + 1006) = 1;
}
}
}
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 13896));
sub_140066610((_QWORD *)(a1 + 2344));
v22 = *(_QWORD *)(a1 + 14112);
if ( v22 != *(_QWORD *)(a1 + 14120) )
*(_QWORD *)(a1 + 14120) = v22;
*(_DWORD *)(a1 + 14136) = 0;
v23 = 0;
if ( *(int *)(a1 + 3844) > 0 )
{
v24 = 0;
do
{
v25 = *(_QWORD *)(v24 + *(_QWORD *)(a1 + 3656));
*(_BYTE *)(v25 + 848) = 1;
*(_WORD *)(v25 + 872) = 257;
if ( GJBaseGameLayer::resetAreaObjectValues(a1, v25, 0) )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1216LL))(a1, v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v25 + 1328LL))(v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v25 + 1304LL))(v25);
++v23;
v24 += 8;
}
while ( v23 < *(_DWORD *)(a1 + 3844) );
}
LevelEditorLayer::quickUpdateAllPositions((_QWORD *)a1);
GJBaseGameLayer::resetLevelVariables(a1);
GJBaseGameLayer::syncBGTextures(a1);
if ( *(_BYTE *)(a1 + 14680) )
{
*(_BYTE *)(a1 + 14680) = 0;
GJBaseGameLayer::removeObjectFromSection(a1, *(_QWORD *)(a1 + 12672));
GJBaseGameLayer::removeObjectFromSection(a1, *(_QWORD *)(a1 + 12680));
}
if ( *(_BYTE *)(a1 + 14673) )
{
v27 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v26);
cocos2d::CCDirector::resetSmoothFixCounter(v27);
*(_BYTE *)(cocos2d::CCDirector::sharedDirector(v28) + 178) = 0;
}
v29 = *(cocos2d::CCObject **)(a1 + 12912);
if ( v29 )
{
cocos2d::CCObject::release(v29);
*(_QWORD *)(a1 + 12912) = 0;
*(_BYTE *)(a1 + 13096) = 0;
}
*(_DWORD *)(a1 + 14880) = 1065353216;
*(_BYTE *)(a1 + 2214) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1312LL))(a1);
*(_DWORD *)(a1 + 14884) = 1065353216;
*(_DWORD *)(a1 + 2204) = 0;
PlayerObject::releaseAllButtons(*(_QWORD *)(a1 + 3512));
cocos2d::CCNode::pauseSchedulerAndActions(*(cocos2d::CCNode **)(a1 + 3512));
LevelEditorLayer::updatePreviewParticles(a1);
GJBaseGameLayer::toggleDualMode(a1, 0, 0, *(_QWORD *)(a1 + 3512), 1);
v30 = *(_BYTE **)(a1 + 3512);
if ( v30[2504] || *(_BYTE *)(a1 + 1058) && (v30 = *(_BYTE **)(a1 + 3520), v30[2504]) )
{
v31 = **(_QWORD **)(a1 + 14888);
v32 = *(_QWORD *)(a1 + 14888);
v33 = (*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v30 + 200LL))(v30);
(*(void (__fastcall **)(__int64, __int64))(v31 + 184))(v32, v33);
LOBYTE(v34) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 14888) + 336LL))(*(_QWORD *)(a1 + 14888), v34);
}
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 3512) + 336LL))(*(_QWORD *)(a1 + 3512), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 3520) + 336LL))(*(_QWORD *)(a1 + 3520), 0);
v35 = 0;
LODWORD(v68) = 0;
v36 = *(_QWORD *)(a1 + 13976);
if ( (*(_QWORD *)(a1 + 13984) - v36) >> 3 )
{
v37 = 0;
do
{
v38 = *(_QWORD **)(v37 + v36);
if ( v38 )
v39 = (__int64)(v38[1] - *v38) >> 3;
else
LODWORD(v39) = -1;
v40 = 0;
v73 = (int)v39;
if ( (int)v39 > 0 )
{
do
{
v41 = *(_QWORD **)(**(_QWORD **)(v37 + *(_QWORD *)(a1 + 13976)) + 8 * v40);
if ( v41 )
{
v42 = 0;
v43 = *(int *)(**(_QWORD **)(v37 + *(_QWORD *)(a1 + 14144)) + 4 * v40);
if ( v43 > 0 )
{
do
{
v44 = *(_QWORD *)(*v41 + 8 * v42);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v44 + 1224LL))(v44, v36, v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v44 + 1136LL))(v44);
v45 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v44 + 200LL))(v44);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v71, v45);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v44 + 1208LL))(v44, &v69);
if ( v71 != v69 || v72 != v70 )
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v44 + 184LL))(v44, &v69);
*(_WORD *)(v44 + 872) = 257;
*(_BYTE *)(v44 + 848) = 1;
++v42;
}
while ( v42 < v43 );
}
}
++v40;
}
while ( v40 < v73 );
LODWORD(v35) = (_DWORD)v68;
}
v35 = (unsigned int)(v35 + 1);
LODWORD(v68) = v35;
v37 += 8;
v36 = *(_QWORD *)(a1 + 13976);
}
while ( (int)v35 < (unsigned __int64)((*(_QWORD *)(a1 + 13984) - v36) >> 3) );
}
v46 = 0;
v47 = 0;
v48 = 10000;
do
{
*(_BYTE *)(v46 + *(_QWORD *)(a1 + 15344)) = 0;
*(_DWORD *)(*(_QWORD *)(a1 + 15176) + 4 * (v47 >> 5)) &= ~(1 << (v47 & 0x1F));
++v47;
++v46;
--v48;
}
while ( v48 );
v49 = *(cocos2d::CCArray **)(a1 + 3536);
if ( cocos2d::CCArray::count(v49) )
{
do
{
v51 = cocos2d::CCArray::objectAtIndex(v49, v12);
*(__m128d *)((char *)v51 + 952) = _mm_cvtps_pd(*(__m64 *)((char *)v51 + 968));
v52 = *(_QWORD *)v51;
v53 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *, void **))(*(_QWORD *)v51 + 1208LL))(v51, &v68);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v52 + 184))(v51, v53);
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *))(*(_QWORD *)a1 + 1216LL))(a1, v51);
++v12;
}
while ( v12 < cocos2d::CCArray::count(v49) );
}
LOBYTE(v50) = 1;
LevelEditorLayer::updateAnimateOnTriggerObjects(a1, v50);
GJEffectManager::reset(*(_QWORD *)(a1 + 2408));
v54 = *(_QWORD **)(a1 + 4384);
for ( j = (_QWORD *)*v54; j != v54; j = (_QWORD *)*j )
{
v56 = (_QWORD *)j[3];
for ( k = (_QWORD *)j[4]; v56 != k; ++v56 )
LabelGameObject::updatePreviewLabel(*v56);
}
v58 = *(_QWORD **)(a1 + 4448);
for ( m = (_QWORD *)*v58; m != v58; m = (_QWORD *)*m )
{
v60 = (_QWORD *)m[3];
for ( n = (_QWORD *)m[4]; v60 != n; ++v60 )
LabelGameObject::updatePreviewLabel(*v60);
}
v62 = qword_14090BF60;
if ( !qword_14090BF60 )
{
v68 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v68);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v62 = qword_14090BF60;
}
if ( *(_BYTE *)(v62 + 617) )
{
*(_BYTE *)(v62 + 617) = 0;
FMOD::ChannelControl::setPaused(*(_QWORD *)(v62 + 552), 0);
FMOD::ChannelControl::setPaused(*(_QWORD *)(v62 + 584), 0);
v62 = qword_14090BF60;
}
if ( !v62 )
{
v68 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v68);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v62 = qword_14090BF60;
}
v63 = *(_QWORD *)(v62 + 552);
if ( v63 )
FMOD::ChannelControl::stop(v63);
sub_14003EB60((_QWORD *)(v62 + 1096));
sub_14003EB60((_QWORD *)(v62 + 1160));
sub_14003EB60((_QWORD *)(v62 + 1224));
v64 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v68 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v68);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v64 = (_QWORD *)qword_14090BF60;
}
result = FMODAudioEngine::stopAllEffects(v64);
if ( *(_BYTE *)(a1 + 14667) )
*(_BYTE *)(a1 + 14840) = 1;
v66 = *(_QWORD *)(a1 + 14904);
if ( v66 )
result = EditorUI::updateSlider(v66);
*(_BYTE *)(a1 + 13085) = 0;
return result;
}