//
// LevelEditorLayer::onPlaytest from 0x1000c5a00 to 0x1000c61bf (1983 bytes)
//
// 1 xrefs:
// > EditorUI::onPlaytest @ 0x10000884c
//
// 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 12:20:36 +0000
//
__int64 __fastcall LevelEditorLayer::onPlaytest(__int64 a1, __int64 a2)
{
__int64 v3; // rdi
__int64 v4; // rax
__int64 v5; // rsi
__int64 v6; // rdi
double v7; // xmm0_8
__int64 v8; // r14
__int64 i; // r15
void *v10; // rdi
__int64 v11; // rdi
__int64 v12; // rsi
__int64 v13; // rax
unsigned int *v14; // rcx
__int64 *v15; // r15
unsigned __int64 v16; // r12
__int64 v17; // r14
unsigned int *v18; // rax
__int64 *v19; // r15
unsigned __int64 v20; // r12
__int64 v21; // r14
__int64 v22; // r14
__int64 v23; // rax
unsigned int *v24; // rax
__int64 *v25; // r15
unsigned __int64 v26; // r12
__int64 v27; // rsi
__int64 StartPosWinnerInArray; // rsi
__int64 v29; // rax
unsigned int *v30; // rax
_QWORD *v31; // r15
unsigned __int64 v32; // r12
_BYTE *v33; // r14
__int64 v34; // rax
unsigned int *v35; // rax
_QWORD *v36; // r14
unsigned __int64 v37; // r15
unsigned __int64 j; // rax
unsigned __int64 v39; // rsi
double v40; // xmm0_8
double v41; // xmm0_8
__int64 v42; // rax
_QWORD *v43; // rcx
__int64 v44; // rsi
__int64 v45; // rdx
__int64 v46; // rax
__int64 v47; // rax
unsigned int *v48; // rax
_QWORD *v49; // r14
unsigned __int64 v50; // r15
__int64 v51; // r14
__int64 v52; // rax
__int64 v53; // r14
__int64 v54; // rax
__int64 v55; // r14
__int64 v56; // rsi
__int64 v57; // r14
__int64 v58; // rdx
__int64 v59; // rdx
__int64 v60; // rax
__int64 result; // rax
float v62; // xmm0_4
_BYTE v63[40]; // [rsp+8h] [rbp-28h] BYREF
v3 = a1 + 14704;
++*(_DWORD *)(a1 + 14728);
EditorBuildStats::noteAction(v3);
v4 = cocos2d::CCDirector::sharedDirector(v3, a2);
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 192LL))(v4) + 132) = 1;
GJBaseGameLayer::preResumeGame(a1);
UILayer::editorPlaytest(*(_QWORD *)(a1 + 13288), 1);
UILayer::togglePlatformerMode(*(_QWORD *)(a1 + 13288), *(unsigned __int8 *)(a1 + 12238));
*(_DWORD *)(a1 + 428) = -1082130432;
v5 = 0;
GJBaseGameLayer::updateZoom(a1, 0, 0xFFFFFFFFLL, 0xFFFFFFFFLL, 1.0, 0.0, 0.0);
GJBaseGameLayer::resetLevelVariables(a1);
*(_QWORD *)(a1 + 13320) = 0;
*(_BYTE *)(a1 + 1982) = 0;
*(_BYTE *)(a1 + 1721) = 1;
if ( !*(_BYTE *)(a1 + 14024) )
{
*(_BYTE *)(a1 + 14024) = 1;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1344LL))(a1, *(_QWORD *)(a1 + 12240));
v5 = *(_QWORD *)(a1 + 12248);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1344LL))(a1, v5);
}
*(_DWORD *)(a1 + 14020) = 0;
GJBaseGameLayer::loadLevelSettings(a1);
GJBaseGameLayer::updateMaxGameplayY(a1);
if ( *(_BYTE *)(a1 + 14017) == 1 )
{
v6 = cocos2d::CCDirector::sharedDirector(a1, v5);
cocos2d::CCDirector::resetSmoothFixCounter(v6);
*(_BYTE *)(cocos2d::CCDirector::sharedDirector(v6, v5) + 178) = 1;
}
GJEffectManager::removePersistentFromAllItems(*(_QWORD *)(a1 + 2152));
GJEffectManager::reset(*(_QWORD *)(a1 + 2152));
LevelEditorLayer::transferDefaultColors(a1, *(_QWORD *)(*(_QWORD *)(a1 + 3272) + 320LL), *(_QWORD *)(a1 + 2152));
HIDWORD(v7) = 0;
GJEffectManager::updateEffects(*(_QWORD *)(a1 + 2152), 0.0);
GJEffectManager::processColors(*(_QWORD *)(a1 + 2152));
LevelEditorLayer::updateBlendValues((_QWORD *)a1);
GJBaseGameLayer::togglePlayerVisibility_1(a1, 1);
*(_DWORD *)(a1 + 14240) = 0;
*(float *)(a1 + 14212) = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3920) + 168LL))(*(_QWORD *)(a1 + 3920));
*(float *)&v7 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3920) + 168LL))(*(_QWORD *)(a1 + 3920));
*(_DWORD *)(a1 + 14212) = LODWORD(v7);
*(float *)&v7 = fminf(*(float *)&v7, 0.69999999);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 3920) + 160LL))(*(_QWORD *)(a1 + 3920), *(float *)&v7);
*(_QWORD *)(a1 + 920) = 0;
v8 = *(_QWORD *)(a1 + 14432);
*(_QWORD *)(a1 + 14416) = *(_QWORD *)(a1 + 14408);
for ( i = *(_QWORD *)(a1 + 14440); i != v8; i -= 24 )
{
v10 = *(void **)(i - 24);
if ( v10 )
{
*(_QWORD *)(i - 16) = v10;
operator delete(v10);
}
}
*(_QWORD *)(a1 + 14440) = v8;
*(_QWORD *)(a1 + 14464) = *(_QWORD *)(a1 + 14456);
sub_1000FF3A0(a1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 3256) + 344LL))(*(_QWORD *)(a1 + 3256), 1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 3264) + 344LL))(*(_QWORD *)(a1 + 3264), 1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 14232) + 344LL))(*(_QWORD *)(a1 + 14232), 0);
v11 = a1;
v12 = 0;
GJBaseGameLayer::setActiveStartPosObject(a1);
v13 = *(_QWORD *)(a1 + 3280);
if ( v13 )
{
v14 = *(unsigned int **)(v13 + 56);
if ( !*v14 )
goto LABEL_18;
v15 = *((__int64 **)v14 + 2);
v16 = (unsigned __int64)&v15[*v14 - 1];
while ( 1 )
{
v17 = *v15;
if ( !*v15 )
break;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 1376LL))(*v15, v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 1288LL))(v17);
v12 = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 1776LL))(v17, 1);
v11 = v17;
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v17 + 1800LL))(v17) == 25 )
{
GameObject::determineSlopeDirection(v17);
if ( (unsigned __int64)++v15 > v16 )
break;
}
else
{
GameObject::updateIsOriented(v17);
if ( (unsigned __int64)++v15 > v16 )
break;
}
}
v13 = *(_QWORD *)(a1 + 3280);
if ( v13 )
{
LABEL_18:
v18 = *(unsigned int **)(v13 + 56);
if ( *v18 )
{
v19 = *((__int64 **)v18 + 2);
v20 = (unsigned __int64)&v19[*v18 - 1];
do
{
v21 = *v19;
if ( !*v19 )
break;
v11 = *v19;
if ( (*(unsigned __int8 (__fastcall **)(__int64, __int64))(*(_QWORD *)v21 + 1728LL))(*v19, v12) )
{
v11 = v21;
v12 = 0;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v21 + 1856LL))(v21, 0);
}
++v19;
}
while ( (unsigned __int64)v19 <= v20 );
}
}
}
v22 = sub_1007FE900(v11);
v23 = *(_QWORD *)(a1 + 3280);
if ( v23 )
{
v24 = *(unsigned int **)(v23 + 56);
if ( *v24 )
{
v25 = *((__int64 **)v24 + 2);
v26 = (unsigned __int64)&v25[*v24 - 1];
do
{
v27 = *v25;
if ( !*v25 )
break;
if ( *(_DWORD *)(v27 + 1028) == 31 && !*(_BYTE *)(*(_QWORD *)(v27 + 1840) + 464LL) )
sub_1007FEBF0(v22, v27);
++v25;
}
while ( (unsigned __int64)v25 <= v26 );
}
}
StartPosWinnerInArray = GJBaseGameLayer::findStartPosWinnerInArray(v22);
GJBaseGameLayer::setActiveStartPosObject(a1);
sub_1007FF190(*(_QWORD *)(a1 + 3304));
v29 = *(_QWORD *)(a1 + 14112);
if ( v29 )
{
v30 = *(unsigned int **)(v29 + 56);
if ( *v30 )
{
v31 = *((_QWORD **)v30 + 2);
v32 = (unsigned __int64)&v31[*v30 - 1];
do
{
v33 = (_BYTE *)*v31;
if ( !*v31 )
break;
if ( !v33[1472] && v33[1473] != 1
|| (*(unsigned __int8 (__fastcall **)(_QWORD, __int64))(*(_QWORD *)v33 + 1688LL))(*v31, StartPosWinnerInArray) )
{
StartPosWinnerInArray = (__int64)v33;
sub_1007FEBF0(*(_QWORD *)(a1 + 3304), v33);
}
++v31;
}
while ( (unsigned __int64)v31 <= v32 );
}
}
GJBaseGameLayer::orderSpawnObjects(a1);
GJBaseGameLayer::resetSpawnChannelIndex(a1, v7, 0.0);
v34 = *(_QWORD *)(a1 + 3280);
if ( v34 )
{
v35 = *(unsigned int **)(v34 + 56);
if ( *v35 )
{
v36 = *((_QWORD **)v35 + 2);
v37 = (unsigned __int64)&v36[*v35 - 1];
do
{
if ( !*v36 )
break;
GameObject::resetGroupDisabled(*v36++);
}
while ( (unsigned __int64)v36 <= v37 );
}
}
for ( j = 0; j != 10000; j += 2LL )
{
*(_BYTE *)(*(_QWORD *)(a1 + 14640) + j) = 0;
v39 = j >> 6;
*(_QWORD *)(*(_QWORD *)(a1 + 14504) + 8 * v39) &= __ROL8__(-2, j & 0x3E);
*(_BYTE *)(*(_QWORD *)(a1 + 14640) + j + 1) = 0;
*(_QWORD *)(*(_QWORD *)(a1 + 14504) + 8 * v39) &= __ROL8__(-2, (unsigned __int8)j + 1);
}
GJEffectManager::resetEffects(*(_QWORD *)(*(_QWORD *)(a1 + 3272) + 320LL));
LevelEditorLayer::recreateGroups((_QWORD *)a1);
GJBaseGameLayer::updateSpecialGroupData(a1);
*(_BYTE *)(a1 + 14172) = 1;
*(_DWORD *)(a1 + 14168) = 16843009;
GJBaseGameLayer::resetGroupCounters(a1, 1);
v40 = GJBaseGameLayer::resetPlayer(a1);
(*(void (__fastcall **)(_QWORD, _QWORD, double))(**(_QWORD **)(a1 + 3264) + 912LL))(*(_QWORD *)(a1 + 3264), 0, v40);
v41 = 0.0;
GJBaseGameLayer::updateCamera(a1, 0.0);
v42 = *(_QWORD *)(a1 + 12432);
v43 = (_QWORD *)(v42 + 1840);
if ( !v42 )
v43 = (_QWORD *)(a1 + 3272);
GJBaseGameLayer::setupLevelStart(a1, *v43);
v44 = *(_QWORD *)(a1 + 12432);
if ( v44 )
{
GJBaseGameLayer::loadStartPosObject(a1);
*(_QWORD *)&v41 = GameManager::sharedState(a1, v44, v45).u64[0];
if ( (unsigned __int8)GameManager::getGameVariable(v46, "0151") )
{
v47 = *(_QWORD *)(a1 + 3280);
if ( v47 )
{
v48 = *(unsigned int **)(v47 + 56);
if ( *v48 )
{
v49 = *((_QWORD **)v48 + 2);
v50 = (unsigned __int64)&v49[*v48 - 1];
do
{
if ( !*v49 )
break;
(*(void (__fastcall **)(__int64, double))(*(_QWORD *)a1 + 1368LL))(a1, v41);
++v49;
}
while ( (unsigned __int64)v49 <= v50 );
}
}
}
}
else
{
*(_BYTE *)(a1 + 1983) = 1;
GJBaseGameLayer::checkSpawnObjects(a1);
}
GJBaseGameLayer::syncBGTextures(a1);
v51 = *(_QWORD *)(a1 + 3256);
v52 = (*(__int64 (__fastcall **)(__int64, double))(*(_QWORD *)v51 + 192LL))(v51, v41);
sub_1002782D0(v63, v52);
sub_100278300(v51 + 2608, v63);
if ( *(_BYTE *)(a1 + 1010) == 1 )
{
v53 = *(_QWORD *)(a1 + 3264);
v54 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v53 + 192LL))(v53);
sub_1002782D0(v63, v54);
sub_100278300(v53 + 2608, v63);
}
v55 = *(_QWORD *)(a1 + 3256);
v56 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v55 + 192LL))(v55);
GameObject::setLastPosition(v55, v56);
if ( *(_BYTE *)(a1 + 1010) == 1 )
{
v57 = *(_QWORD *)(a1 + 3264);
v56 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v57 + 192LL))(v57);
GameObject::setLastPosition(v57, v56);
}
cocos2d::CCNode::resumeSchedulerAndActions(*(_QWORD *)(a1 + 3256));
cocos2d::CCNode::resumeSchedulerAndActions(*(_QWORD *)(a1 + 3264));
*(_DWORD *)(a1 + 1972) = 1;
LevelEditorLayer::updatePreviewParticles(a1, v56, v58);
GJBaseGameLayer::stopCameraShake(a1);
if ( *(_BYTE *)(a1 + 14297) == 1 )
GJBaseGameLayer::updateLevelColors(a1);
GJBaseGameLayer::updateGradientLayers(a1);
GJBaseGameLayer::updateShaderLayer(a1, 0.0);
GJBaseGameLayer::updateCamera(a1, 0.0);
(*(void (__fastcall **)(__int64, double))(*(_QWORD *)a1 + 1192LL))(a1, 0.0);
GameManager::sharedState(a1, v56, v59);
result = GameManager::getGameVariable(v60, "0002");
if ( (_BYTE)result )
{
v62 = *(double *)(a1 + 928);
GJBaseGameLayer::processActivatedAudioTriggers(a1, v62);
GJBaseGameLayer::clearActivatedAudioTriggers(a1);
result = GJBaseGameLayer::processQueuedAudioTriggers(a1);
}
*(_BYTE *)(a1 + 1983) = 0;
*(_BYTE *)(a1 + 12605) = 0;
return result;
}