//
// LevelEditorLayer::onPlaytest from 0x1004045e4 to 0x100404bb8 (1492 bytes)
//
// 1 xrefs:
// > EditorUI::onPlaytest @ 0x1004714b4
//
// This function is hookable on this platform (idp: arm, 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:04:40 +0000
//
__int64 __fastcall LevelEditorLayer::onPlaytest(__int64 a1)
{
char *v2; // x21
__int64 v3; // x0
__int64 v4; // x0
float v5; // s0
double v6; // d0
__int64 v7; // x8
unsigned int *v8; // x9
__int64 v9; // x8
__int64 *v10; // x22
unsigned __int64 v11; // x23
__int64 v12; // x20
_QWORD *v13; // x0
__int64 v14; // x8
unsigned int *v15; // x9
__int64 v16; // x8
_QWORD *v17; // x23
unsigned __int64 v18; // x24
_BYTE *v19; // x20
__int64 v20; // x8
__int64 *v21; // x8
__int64 v22; // x1
__int64 v23; // x0
__int64 v24; // x8
unsigned int *v25; // x9
__int64 v26; // x8
_QWORD *v27; // x20
unsigned __int64 v28; // x22
_QWORD *v29; // x20
double *v30; // x0
__n128 v31; // q0
_QWORD *v32; // x20
double *v33; // x0
__int64 v34; // x20
double *v35; // x0
double Position; // d0
__int64 v37; // x20
double *v38; // x0
__int64 v39; // x0
__int64 result; // x0
float v41; // s0
__int64 v42; // [xsp+8h] [xbp-38h] BYREF
v2 = (char *)(a1 + 12238);
++*(_DWORD *)(a1 + 14728);
EditorBuildStats::noteAction(a1 + 14704);
v3 = cocos2d::CCDirector::sharedDirector();
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 192LL))(v3) + 132) = 1;
GJBaseGameLayer::preResumeGame(a1);
UILayer::editorPlaytest(*(_QWORD *)(a1 + 13288), 1);
UILayer::togglePlatformerMode(*(_QWORD *)(a1 + 13288), *v2);
*(_DWORD *)(a1 + 428) = -1082130432;
GJBaseGameLayer::updateZoom(a1, 0, -1, -1, 1.0, 0.0, 0.0);
GJBaseGameLayer::resetLevelVariables(a1);
*(_QWORD *)(a1 + 13320) = 0;
*(_BYTE *)(a1 + 1982) = 0;
*(_BYTE *)(a1 + 1721) = 1;
if ( (v2[1786] & 1) == 0 )
{
v2[1786] = 1;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1344LL))(a1, *(_QWORD *)(a1 + 12240));
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1344LL))(a1, *(_QWORD *)(a1 + 12248));
}
*(_DWORD *)(a1 + 14020) = 0;
GJBaseGameLayer::loadLevelSettings(a1);
GJBaseGameLayer::updateMaxGameplayY(a1);
if ( v2[1779] == 1 )
{
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::resetSmoothFixCounter(v4);
*(_BYTE *)(cocos2d::CCDirector::sharedDirector() + 178) = 1;
}
sub_100016470(*(_QWORD *)(a1 + 2152));
sub_10000F298(*(_QWORD **)(a1 + 2152));
sub_100402060(a1, *(_QWORD *)(*(_QWORD *)(a1 + 3272) + 320LL), *(_QWORD **)(a1 + 2152));
GJEffectManager::updateEffects(*(_QWORD *)(a1 + 2152), 0.0);
sub_10000F6D0(*(_QWORD *)(a1 + 2152));
sub_100402D5C((__int64 *)a1);
GJBaseGameLayer::togglePlayerVisibility(a1, 1);
*(_DWORD *)(a1 + 14240) = 0;
*(float *)(a1 + 14212) = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3920) + 168LL))(*(_QWORD *)(a1 + 3920));
v5 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3920) + 168LL))(*(_QWORD *)(a1 + 3920));
*(float *)(a1 + 14212) = v5;
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 3920) + 160LL))(*(_QWORD *)(a1 + 3920), fminf(v5, 0.7));
*(_QWORD *)(a1 + 920) = 0;
*(_QWORD *)(a1 + 14416) = *(_QWORD *)(a1 + 14408);
sub_100025DFC((__int64 *)(a1 + 14432));
*(_QWORD *)(a1 + 14464) = *(_QWORD *)(a1 + 14456);
v6 = sub_1002801B0(a1);
(*(void (__fastcall **)(_QWORD, __int64, double))(**(_QWORD **)(a1 + 3256) + 344LL))(*(_QWORD *)(a1 + 3256), 1, v6);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 3264) + 344LL))(*(_QWORD *)(a1 + 3264), 1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 14232) + 344LL))(*(_QWORD *)(a1 + 14232), 0);
GJBaseGameLayer::setActiveStartPosObject(a1, 0);
v7 = *(_QWORD *)(a1 + 3280);
if ( v7 )
{
v8 = *(unsigned int **)(v7 + 56);
v9 = *v8;
if ( (_DWORD)v9 )
{
v10 = *((__int64 **)v8 + 2);
v11 = (unsigned __int64)&v10[v9 - 1];
do
{
v12 = *v10;
if ( !*v10 )
break;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 1376LL))(*v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 1288LL))(v12);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v12 + 1776LL))(v12, 1);
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v12 + 1800LL))(v12) == 25 )
GameObject::determineSlopeDirection(v12);
else
sub_1002FED50(v12);
++v10;
}
while ( (unsigned __int64)v10 <= v11 );
}
}
sub_1003F8E30(a1, 0);
v13 = sub_100404390(a1);
GJBaseGameLayer::setActiveStartPosObject(a1, (__int64)v13);
sub_1002E7674(*(_QWORD *)(a1 + 3304));
v14 = *(_QWORD *)(a1 + 14112);
if ( v14 )
{
v15 = *(unsigned int **)(v14 + 56);
v16 = *v15;
if ( (_DWORD)v16 )
{
v17 = *((_QWORD **)v15 + 2);
v18 = (unsigned __int64)&v17[v16 - 1];
do
{
v19 = (_BYTE *)*v17;
if ( !*v17 )
break;
if ( (v19[1472] & 1) == 0 && v19[1473] != 1
|| (*(unsigned int (__fastcall **)(_QWORD))(*(_QWORD *)v19 + 1688LL))(*v17) )
{
sub_1002E74E0(*(_QWORD *)(a1 + 3304));
}
++v17;
}
while ( (unsigned __int64)v17 <= v18 );
}
}
GJBaseGameLayer::orderSpawnObjects(a1);
GJBaseGameLayer::resetSpawnChannelIndex(a1);
sub_1004033E0(a1);
sub_10000F350(*(_QWORD *)(*(_QWORD *)(a1 + 3272) + 320LL));
sub_100403764((_QWORD *)a1);
GJBaseGameLayer::updateSpecialGroupData(a1);
*(_BYTE *)(a1 + 14172) = 1;
*(_DWORD *)(a1 + 14168) = 16843009;
GJBaseGameLayer::resetGroupCounters(a1, 1);
GJBaseGameLayer::resetPlayer((_QWORD *)a1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 3264) + 912LL))(*(_QWORD *)(a1 + 3264), 0);
GJBaseGameLayer::updateCamera(a1, 0.0);
v20 = *(_QWORD *)(a1 + 12432);
if ( v20 )
v21 = (__int64 *)(v20 + 1840);
else
v21 = (__int64 *)(a1 + 3272);
GJBaseGameLayer::setupLevelStart(a1, *v21);
v22 = *(_QWORD *)(a1 + 12432);
if ( v22 )
{
GJBaseGameLayer::loadStartPosObject((__int64 *)a1, v22);
v23 = GameManager::sharedState();
if ( GameManager::getGameVariable(v23, "0151") )
{
v24 = *(_QWORD *)(a1 + 3280);
if ( v24 )
{
v25 = *(unsigned int **)(v24 + 56);
v26 = *v25;
if ( (_DWORD)v26 )
{
v27 = *((_QWORD **)v25 + 2);
v28 = (unsigned __int64)&v27[v26 - 1];
do
{
if ( !*v27 )
break;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1368LL))(a1);
++v27;
}
while ( (unsigned __int64)v27 <= v28 );
}
}
}
}
else
{
*(_BYTE *)(a1 + 1983) = 1;
GJBaseGameLayer::checkSpawnObjects(a1);
}
GJBaseGameLayer::syncBGTextures(a1);
v29 = *(_QWORD **)(a1 + 3256);
v30 = (double *)(*(__int64 (__fastcall **)(_QWORD *))(*v29 + 192LL))(v29);
sub_1000262F4(&v42, v30);
v31.n128_f64[0] = sub_10002630C(v29 + 326, (double *)&v42);
if ( *(_BYTE *)(a1 + 1010) == 1 )
{
v32 = *(_QWORD **)(a1 + 3264);
v33 = (double *)(*(__int64 (__fastcall **)(_QWORD *, double))(*v32 + 192LL))(v32, v31.n128_f64[0]);
sub_1000262F4(&v42, v33);
v31.n128_f64[0] = sub_10002630C(v32 + 326, (double *)&v42);
}
v34 = *(_QWORD *)(a1 + 3256);
v35 = (double *)(*(__int64 (__fastcall **)(__int64, __n128))(*(_QWORD *)v34 + 192LL))(v34, v31);
Position = GameObject::setLastPosition(v34, v35);
if ( *(_BYTE *)(a1 + 1010) == 1 )
{
v37 = *(_QWORD *)(a1 + 3264);
v38 = (double *)(*(__int64 (__fastcall **)(__int64, double))(*(_QWORD *)v37 + 192LL))(v37, Position);
GameObject::setLastPosition(v37, v38);
}
cocos2d::CCNode::resumeSchedulerAndActions(*(_QWORD *)(a1 + 3256));
cocos2d::CCNode::resumeSchedulerAndActions(*(_QWORD *)(a1 + 3264));
*(_DWORD *)(a1 + 1972) = 1;
sub_100401FCC(a1);
GJBaseGameLayer::stopCameraShake(a1);
if ( v2[2059] == 1 )
GJBaseGameLayer::updateLevelColors(a1);
GJBaseGameLayer::updateGradientLayers(a1);
GJBaseGameLayer::updateShaderLayer(a1, 0.0);
GJBaseGameLayer::updateCamera(a1, 0.0);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)a1 + 1192LL))(a1, 0.0);
v39 = GameManager::sharedState();
result = GameManager::getGameVariable(v39, "0002");
if ( (_DWORD)result )
{
v41 = *(double *)(a1 + 928);
GJBaseGameLayer::processActivatedAudioTriggers(a1, v41);
GJBaseGameLayer::clearActivatedAudioTriggers((_QWORD *)a1);
result = GJBaseGameLayer::processQueuedAudioTriggers(a1);
}
*(_BYTE *)(a1 + 1983) = 0;
v2[367] = 0;
return result;
}