//
// LevelEditorLayer::onPlaytest from 0x1403fe7e0 to 0x1403ff1e9 (2569 bytes)
//
// 2 xrefs:
// > EditorUI::onPlaytest @ 0x1401b484c
// > ??> @ 0x140925964
//
// 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=2
const void *__fastcall LevelEditorLayer::onPlaytest(__int64 a1)
{
__int64 v2; // rcx
int v3; // eax
__int64 v4; // rax
__int64 v5; // rbx
__int64 v6; // rdx
__int64 v7; // rdx
__int64 v8; // rdx
__int64 v9; // rcx
__int64 v10; // r8
__int64 v11; // r9
__int64 v12; // rdi
__int64 v13; // rax
__int64 v14; // rax
__int64 v15; // rcx
cocos2d::CCDirector *v16; // rax
__int64 v17; // rcx
__int64 v18; // rdx
__int64 v19; // rdx
double v20; // xmm0_8
__int64 v21; // rdx
__int64 v22; // rax
_QWORD *v23; // rbx
_QWORD *v24; // rdi
__int64 v25; // rax
__int64 v26; // rax
__int64 v27; // rax
__int64 v28; // rdx
cocos2d::CCObject *v29; // rcx
__int64 v30; // rax
unsigned int *v31; // rdi
__int64 v32; // rax
__int64 **v33; // rdi
__int64 **i; // rbp
__int64 *v35; // rbx
__int64 v36; // rdx
__int64 v37; // rcx
cocos2d::CCArray *v38; // rbp
__int64 v39; // rax
unsigned int *v40; // rbx
__int64 v41; // rax
__int64 *v42; // rbx
__int64 *j; // rdi
__int64 v44; // rdx
cocos2d::CCObject *StartPosWinnerInArray; // rax
cocos2d::CCObject *v46; // rbx
cocos2d::CCObject *v47; // rcx
__int64 v48; // rax
unsigned int *v49; // rdi
__int64 v50; // rax
struct cocos2d::CCObject **v51; // rdi
struct cocos2d::CCObject **k; // rbp
struct cocos2d::CCObject *v53; // rbx
_QWORD *v54; // r14
_QWORD *m; // rbx
_QWORD *v56; // rdi
_QWORD *n; // rbp
_QWORD *v58; // r15
_QWORD *ii; // rbx
__int64 *v60; // rdi
__int64 *jj; // r14
__int64 v62; // rbp
const char *v63; // rdx
size_t v64; // r8
__int64 v65; // rdx
__int64 v66; // rdx
__int64 v67; // rdx
__int64 v68; // rcx
__int64 v69; // rax
unsigned int *v70; // rbx
__int64 v71; // rax
_QWORD *v72; // rbx
_QWORD *kk; // rdi
const struct cocos2d::CCPoint *v74; // rax
__int64 v75; // rax
const struct cocos2d::CCPoint *v76; // rax
__int64 v77; // rax
__int64 v78; // rax
__int64 v79; // rax
__int64 v80; // rcx
const void *result; // rax
__int64 v82; // rax
__int128 v83; // [rsp+40h] [rbp-58h] BYREF
__int64 v84; // [rsp+50h] [rbp-48h]
__int64 v85; // [rsp+58h] [rbp-40h]
void *v86; // [rsp+A0h] [rbp+8h] BYREF
++*(_DWORD *)(a1 + 15432);
v2 = *(unsigned int *)(a1 + 15504);
if ( (int)v2 >= 0 )
{
v3 = *(_DWORD *)(a1 + 15440) - v2;
v2 = 0;
if ( v3 > 1 )
{
do
{
if ( (int)v2 >= 7 )
break;
v3 = (unsigned int)v3 >> 1;
v2 = (unsigned int)(v2 + 1);
}
while ( (unsigned int)v3 > 1 );
}
++*(_DWORD *)(a1 + 4LL * (int)v2 + 15472);
}
*(_DWORD *)(a1 + 15504) = *(_DWORD *)(a1 + 15440);
v4 = cocos2d::CCDirector::sharedDirector(v2);
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 176LL))(v4) + 156) = 1;
*(_DWORD *)(a1 + 13220) = 2;
v5 = *(_QWORD *)(a1 + 13888);
*(_QWORD *)(v5 + 584) = -1;
*(_WORD *)(v5 + 578) = 0;
*(_BYTE *)(v5 + 580) = 0;
UILayer::resetUINodeState(v5);
LOBYTE(v6) = 1;
UILayer::toggleMenuVisibility(v5, v6);
LOBYTE(v7) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v5 + 336LL))(v5, v7);
*(_BYTE *)(cocos2d::CCEGLView::sharedOpenGLView(v9, v8, v10, v11) + 237) = 1;
*(_BYTE *)(v5 + 627) = 1;
UILayer::resolveLevelControls(v5);
if ( (!*(_BYTE *)(v5 + 626) || *(_BYTE *)(v5 + 627))
&& *(_BYTE *)(v5 + 596)
&& (v12 = *(_QWORD *)(v5 + 640)) != 0
&& (*(_QWORD *)(v12 + 88) || *(_QWORD *)(v12 + 120)) )
{
v13 = GJKeybindManager::sharedState();
GJKeybindManager::applyMovementOverride(v13, v12 + 72, v12 + 104);
}
else
{
v14 = GJKeybindManager::sharedState();
GJKeybindManager::clearMovementOverride(v14);
}
UILayer::togglePlatformerMode(*(_QWORD *)(a1 + 13888), *(unsigned __int8 *)(a1 + 12670));
*(_DWORD *)(a1 + 428) = -1082130432;
GJBaseGameLayer::updateZoom(a1, 1.0, 0.0, 0, 0, -1, -1);
GJBaseGameLayer::resetLevelVariables(a1);
*(_QWORD *)(a1 + 13920) = 0;
*(_BYTE *)(a1 + 2214) = 0;
*(_BYTE *)(a1 + 1889) = 1;
if ( !*(_BYTE *)(a1 + 14680) )
{
*(_BYTE *)(a1 + 14680) = 1;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1192LL))(a1, *(_QWORD *)(a1 + 12672));
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1192LL))(a1, *(_QWORD *)(a1 + 12680));
}
*(_DWORD *)(a1 + 14676) = 0;
GJBaseGameLayer::loadLevelSettings(a1);
GJBaseGameLayer::updateMaxGameplayY(a1);
if ( *(_BYTE *)(a1 + 14673) )
{
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
cocos2d::CCDirector::resetSmoothFixCounter(v16);
*(_BYTE *)(cocos2d::CCDirector::sharedDirector(v17) + 178) = 1;
}
sub_14003EB60((_QWORD *)(*(_QWORD *)(a1 + 2408) + 880LL));
GJEffectManager::reset(*(_QWORD *)(a1 + 2408));
LevelEditorLayer::transferDefaultColors(a1, *(_QWORD *)(*(_QWORD *)(a1 + 3528) + 320LL), *(_QWORD *)(a1 + 2408));
GJEffectManager::updateEffects(*(_QWORD **)(a1 + 2408), 0.0);
GJEffectManager::processColors(*(_QWORD *)(a1 + 2408));
LevelEditorLayer::updateBlendValues((_QWORD *)a1);
LOBYTE(v18) = 1;
PlayerObject::toggleVisibility(*(_QWORD *)(a1 + 3512), v18);
if ( *(_BYTE *)(a1 + 1058) )
{
LOBYTE(v19) = 1;
PlayerObject::toggleVisibility(*(_QWORD *)(a1 + 3520), v19);
}
*(_DWORD *)(a1 + 14896) = 0;
*(float *)(a1 + 14868) = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4296) + 168LL))(*(_QWORD *)(a1 + 4296));
v20 = (*(double (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4296) + 168LL))(*(_QWORD *)(a1 + 4296));
*(_DWORD *)(a1 + 14868) = LODWORD(v20);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4296) + 160LL))(*(_QWORD *)(a1 + 4296));
*(_QWORD *)(a1 + 968) = 0;
v22 = *(_QWORD *)(a1 + 15072);
if ( v22 != *(_QWORD *)(a1 + 15080) )
*(_QWORD *)(a1 + 15080) = v22;
v23 = *(_QWORD **)(a1 + 15096);
v24 = *(_QWORD **)(a1 + 15104);
if ( v23 != v24 )
{
do
{
sub_14003EA90(v23);
v23 += 3;
}
while ( v23 != v24 );
*(_QWORD *)(a1 + 15104) = *(_QWORD *)(a1 + 15096);
}
v25 = *(_QWORD *)(a1 + 15120);
if ( v25 != *(_QWORD *)(a1 + 15128) )
*(_QWORD *)(a1 + 15128) = v25;
v26 = *(_QWORD *)(a1 + 14480);
if ( v26 != *(_QWORD *)(a1 + 14488) )
*(_QWORD *)(a1 + 14488) = v26;
v27 = *(_QWORD *)(a1 + 14504);
if ( v27 != *(_QWORD *)(a1 + 14512) )
*(_QWORD *)(a1 + 14512) = v27;
*(_QWORD *)(a1 + 14528) = 0;
*(_BYTE *)(a1 + 14536) = 1;
LOBYTE(v21) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 3512) + 336LL))(*(_QWORD *)(a1 + 3512), v21);
LOBYTE(v28) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 3520) + 336LL))(*(_QWORD *)(a1 + 3520), v28);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 14888) + 336LL))(*(_QWORD *)(a1 + 14888), 0);
v29 = *(cocos2d::CCObject **)(a1 + 12912);
if ( v29 )
{
cocos2d::CCObject::release(v29);
*(_QWORD *)(a1 + 12912) = 0;
*(_BYTE *)(a1 + 13096) = 0;
}
v30 = *(_QWORD *)(a1 + 3536);
if ( v30 )
{
v31 = *(unsigned int **)(v30 + 56);
v32 = *v31;
if ( (_DWORD)v32 )
{
v33 = *((__int64 ***)v31 + 2);
for ( i = &v33[v32 - 1]; v33 <= i; ++v33 )
{
v35 = *v33;
if ( !*v33 )
break;
(*(void (__fastcall **)(__int64 *))(*v35 + 1224))(*v33);
(*(void (__fastcall **)(__int64 *))(*v35 + 1136))(v35);
LOBYTE(v36) = 1;
(*(void (__fastcall **)(__int64 *, __int64))(*v35 + 1624))(v35, v36);
if ( (*(unsigned int (__fastcall **)(__int64 *))(*v35 + 1648))(v35) == 25 )
GameObject::determineSlopeDirection((__int64)v35);
else
GameObject::updateIsOriented(v35);
}
}
}
LevelEditorLayer::updateAnimateOnTriggerObjects(a1, 0);
v38 = (cocos2d::CCArray *)cocos2d::CCArray::create(v37);
v39 = *(_QWORD *)(a1 + 3536);
if ( v39 )
{
v40 = *(unsigned int **)(v39 + 56);
v41 = *v40;
if ( (_DWORD)v41 )
{
v42 = *((__int64 **)v40 + 2);
for ( j = &v42[v41 - 1]; v42 <= j; ++v42 )
{
v44 = *v42;
if ( !*v42 )
break;
if ( *(_DWORD *)(v44 + 1036) == 31 && !*(_BYTE *)(*(_QWORD *)(v44 + 1856) + 472LL) )
cocos2d::CCArray::addObject(v38, (struct cocos2d::CCObject *)v44);
}
}
}
StartPosWinnerInArray = (cocos2d::CCObject *)GJBaseGameLayer::findStartPosWinnerInArray((__int64)v38);
v46 = StartPosWinnerInArray;
if ( *(cocos2d::CCObject **)(a1 + 12912) != StartPosWinnerInArray )
{
if ( StartPosWinnerInArray )
cocos2d::CCObject::retain(StartPosWinnerInArray);
v47 = *(cocos2d::CCObject **)(a1 + 12912);
if ( v47 )
cocos2d::CCObject::release(v47);
*(_QWORD *)(a1 + 12912) = v46;
*(_BYTE *)(a1 + 13096) = v46 != nullptr;
}
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 3560));
v48 = *(_QWORD *)(a1 + 14768);
if ( v48 )
{
v49 = *(unsigned int **)(v48 + 56);
v50 = *v49;
if ( (_DWORD)v50 )
{
v51 = *((struct cocos2d::CCObject ***)v49 + 2);
for ( k = &v51[v50 - 1]; v51 <= k; ++v51 )
{
v53 = *v51;
if ( !*v51 )
break;
if ( !*((_BYTE *)v53 + 1488) && !*((_BYTE *)v53 + 1489)
|| (*(unsigned __int8 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v53 + 1536LL))(*v51) )
{
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 3560), v53);
}
}
}
}
GJBaseGameLayer::orderSpawnObjects(a1);
GJBaseGameLayer::resetSpawnChannelIndex(a1);
LevelEditorLayer::resetToggledGroupsAndObjects((_QWORD *)a1);
GJEffectManager::resetEffects(*(_QWORD *)(*(_QWORD *)(a1 + 3528) + 320LL));
LevelEditorLayer::recreateGroups(a1);
GJBaseGameLayer::updateSpecialGroupData(a1);
*(_DWORD *)(a1 + 14824) = 16843009;
*(_BYTE *)(a1 + 14828) = 1;
v54 = *(_QWORD **)(a1 + 4384);
for ( m = (_QWORD *)*v54; m != v54; m = (_QWORD *)*m )
{
v56 = (_QWORD *)m[3];
for ( n = (_QWORD *)m[4]; v56 != n; ++v56 )
{
v83 = 0;
v84 = 1;
v85 = 15;
LOWORD(v83) = (unsigned __int8)a0[0];
LabelGameObject::updateLabel(*v56, &v83);
}
}
v58 = *(_QWORD **)(a1 + 4448);
for ( ii = (_QWORD *)*v58; ii != v58; ii = (_QWORD *)*ii )
{
v60 = (__int64 *)ii[3];
for ( jj = (__int64 *)ii[4]; v60 != jj; ++v60 )
{
v62 = *v60;
v63 = "0.00";
if ( *(_BYTE *)(*v60 + 1912) )
v63 = "0";
v83 = 0;
v84 = 0;
v85 = 0;
v64 = -1;
do
++v64;
while ( v63[v64] );
sub_14003D230(&v83, v63, v64);
LabelGameObject::updateLabel(v62, &v83);
}
}
GJBaseGameLayer::resetPlayer((_QWORD *)a1);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)(*(_QWORD *)(a1 + 3520) + 320LL) + 40LL))(
*(_QWORD *)(a1 + 3520) + 320LL,
0);
GJBaseGameLayer::updateCamera(a1, 0.0);
v65 = *(_QWORD *)(a1 + 12912);
if ( v65 )
v66 = *(_QWORD *)(v65 + 1856);
else
v66 = *(_QWORD *)(a1 + 3528);
GJBaseGameLayer::setupLevelStart(a1, v66);
v67 = *(_QWORD *)(a1 + 12912);
if ( v67 )
{
GJBaseGameLayer::loadStartPosObject(a1, v67);
v68 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v86 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v86);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v68 = qword_14090BFD0;
}
if ( GameManager::getGameVariable(v68, "0151") )
{
v69 = *(_QWORD *)(a1 + 3536);
if ( v69 )
{
v70 = *(unsigned int **)(v69 + 56);
v71 = *v70;
if ( (_DWORD)v71 )
{
v72 = *((_QWORD **)v70 + 2);
for ( kk = &v72[v71 - 1]; v72 <= kk; ++v72 )
{
if ( !*v72 )
break;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1216LL))(a1);
}
}
}
}
}
else
{
*(_BYTE *)(a1 + 2215) = 1;
GJBaseGameLayer::checkSpawnObjects(a1);
}
GJBaseGameLayer::syncBGTextures(a1);
v74 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3512) + 200LL))(*(_QWORD *)(a1 + 3512));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v86, v74);
cocos2d::CCPoint::operator=(*(_QWORD *)(a1 + 3512) + 2712LL, v75);
if ( *(_BYTE *)(a1 + 1058) )
{
v76 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3520) + 200LL))(*(_QWORD *)(a1 + 3520));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v86, v76);
cocos2d::CCPoint::operator=(*(_QWORD *)(a1 + 3520) + 2712LL, v77);
}
v78 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3512) + 200LL))(*(_QWORD *)(a1 + 3512));
cocos2d::CCPoint::operator=(*(_QWORD *)(a1 + 3512) + 1232LL, v78);
if ( *(_BYTE *)(a1 + 1058) )
{
v79 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3520) + 200LL))(*(_QWORD *)(a1 + 3520));
cocos2d::CCPoint::operator=(*(_QWORD *)(a1 + 3520) + 1232LL, v79);
}
cocos2d::CCNode::resumeSchedulerAndActions(*(cocos2d::CCNode **)(a1 + 3512));
cocos2d::CCNode::resumeSchedulerAndActions(*(cocos2d::CCNode **)(a1 + 3520));
*(_DWORD *)(a1 + 2204) = 1;
LevelEditorLayer::updatePreviewParticles(a1);
*(_BYTE *)(a1 + 1309) = 0;
*(_DWORD *)(a1 + 1312) = 0;
if ( *(_BYTE *)(a1 + 14953) )
GJBaseGameLayer::updateLevelColors((_QWORD *)a1);
GJBaseGameLayer::updateGradientLayers(a1);
GJBaseGameLayer::updateShaderLayer((__int64 *)a1, 0.0);
GJBaseGameLayer::updateCamera(a1, 0.0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1072LL))(a1);
v80 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v86 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v86);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v80 = qword_14090BFD0;
}
result = (const void *)GameManager::getGameVariable(v80, "0002");
if ( (_BYTE)result )
{
GJBaseGameLayer::processActivatedAudioTriggers((_QWORD *)a1, *(double *)(a1 + 976));
sub_1403547B0((_QWORD *)(a1 + 1976));
sub_1403546E0((_QWORD *)(a1 + 2040));
v82 = *(_QWORD *)(a1 + 2104);
if ( v82 != *(_QWORD *)(a1 + 2112) )
*(_QWORD *)(a1 + 2112) = v82;
result = GJBaseGameLayer::processQueuedAudioTriggers(a1);
}
*(_BYTE *)(a1 + 13085) = 0;
*(_BYTE *)(a1 + 2215) = 0;
return result;
}