//
// LevelEditorLayer::updateEditorMode from 0x1403fa010 to 0x1403fa62f (1567 bytes)
//
// 3 xrefs:
// > EditorUI::toggleViewOption @ 0x1401f8703
// > LevelEditorLayer::init @ 0x1403eee0a
// > ??> @ 0x140925670
//
// 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:51 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall LevelEditorLayer::updateEditorMode(__int64 a1)
{
__int64 v2; // rcx
bool GameVariable; // al
__int64 v4; // r14
cocos2d::CCArray *v5; // rax
cocos2d::CCArray *v6; // rsi
__int64 v7; // rdi
unsigned int v8; // ebx
struct cocos2d::CCObject *v9; // rax
__int64 v10; // rcx
cocos2d::CCArray *v11; // rax
cocos2d::CCArray *v12; // rsi
unsigned int v13; // ebx
struct cocos2d::CCObject *v14; // rax
__int64 v15; // rdx
char v16; // cl
__int64 v17; // r8
void (__fastcall **v18)(__int64, __int64); // rax
bool v19; // zf
__int64 v20; // rcx
__int64 v21; // r14
cocos2d::CCArray *v22; // rax
cocos2d::CCArray *v23; // rsi
unsigned int v24; // ebx
struct cocos2d::CCObject *v25; // rax
__int64 v26; // rcx
cocos2d::CCArray *v27; // rax
cocos2d::CCArray *v28; // rsi
unsigned int v29; // ebx
struct cocos2d::CCObject *v30; // rax
__int64 v31; // rdx
char v32; // cl
__int64 v33; // r8
void (__fastcall **v34)(__int64, __int64); // rax
__int64 v35; // rcx
__int64 v36; // rcx
__int64 v37; // rcx
cocos2d::CCArray *v38; // rsi
unsigned int i; // ebx
struct cocos2d::CCObject *v40; // rax
__int64 v41; // rcx
cocos2d::CCArray *v42; // rsi
unsigned int j; // ebx
struct cocos2d::CCObject *v44; // rax
__int64 v45; // r8
__int64 v46; // rdx
__int64 v47; // r12
_QWORD *v48; // rcx
__int64 v49; // rax
__int64 v50; // rsi
_QWORD *v51; // r14
__int64 v52; // rbx
__int64 v53; // r15
__int64 v54; // rdi
cocos2d::CCArray *v55; // rsi
unsigned int k; // ebx
unsigned __int64 v57; // r8
__int64 v58; // r9
_DWORD *v59; // rdx
void *v61; // [rsp+80h] [rbp+48h] BYREF
__int64 v62; // [rsp+88h] [rbp+50h]
__int16 v63; // [rsp+90h] [rbp+58h] BYREF
char v64; // [rsp+92h] [rbp+5Ah]
__int16 v65; // [rsp+98h] [rbp+60h] BYREF
char v66; // [rsp+9Ah] [rbp+62h]
if ( *(_BYTE *)(a1 + 14954) )
goto LABEL_5;
v2 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v61 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090BFD0;
}
GameVariable = GameManager::getGameVariable(v2, "0036");
if ( GameVariable )
LABEL_5:
GameVariable = 1;
*(_BYTE *)(a1 + 14953) = GameVariable;
*(_BYTE *)(a1 + 14952) = 1;
(**(void (__fastcall ***)(__int64, __int16 *))(*(_QWORD *)(a1 + 4320) + 320LL))(
*(_QWORD *)(a1 + 4320) + 320LL,
&word_140703B8C);
v4 = *(_QWORD *)(a1 + 4336);
LOWORD(v61) = -22874;
BYTE2(v61) = -90;
v5 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v4 + 408) + 480LL))(*(_QWORD *)(v4 + 408));
v6 = v5;
v7 = 0;
if ( v5 )
{
v8 = 0;
if ( cocos2d::CCArray::count(v5) )
{
do
{
v9 = cocos2d::CCArray::objectAtIndex(v6, v8);
(**((void (__fastcall ***)(__int64, void **))v9 + 40))((__int64)v9 + 320, &v61);
++v8;
}
while ( v8 < cocos2d::CCArray::count(v6) );
}
}
v63 = -22874;
v64 = -90;
v10 = *(_QWORD *)(v4 + 416);
if ( v10 )
{
v11 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 480LL))(v10);
v12 = v11;
if ( v11 )
{
v13 = 0;
if ( cocos2d::CCArray::count(v11) )
{
do
{
v14 = cocos2d::CCArray::objectAtIndex(v12, v13);
(**((void (__fastcall ***)(__int64, __int16 *))v14 + 40))((__int64)v14 + 320, &v63);
++v13;
}
while ( v13 < cocos2d::CCArray::count(v12) );
}
}
}
LOWORD(v62) = -7711;
v65 = -7711;
v66 = -31;
(**(void (__fastcall ***)(__int64, __int16 *))(*(_QWORD *)(v4 + 432) + 320LL))(*(_QWORD *)(v4 + 432) + 320LL, &v65);
LOBYTE(v15) = -1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(*(_QWORD *)(v4 + 432) + 320LL) + 40LL))(
*(_QWORD *)(v4 + 432) + 320LL,
v15);
if ( *(_BYTE *)(a1 + 14953) )
v16 = (*(_DWORD *)(*(_QWORD *)(a1 + 15280) + 124LL) & 0x400) != 0;
else
v16 = 0;
if ( *(_BYTE *)(v4 + 441) != v16 )
{
*(_BYTE *)(v4 + 441) = v16;
v17 = *(_QWORD *)(v4 + 432);
v18 = *(void (__fastcall ***)(__int64, __int64))(v17 + 344);
v19 = v16 == 0;
v20 = v17 + 344;
if ( v19 )
(*v18)(v20, 0x30300000001LL);
else
(*v18)(v20, 0x100000302LL);
}
v21 = *(_QWORD *)(a1 + 4344);
LOWORD(v61) = -22874;
BYTE2(v61) = -90;
v22 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v21 + 408) + 480LL))(*(_QWORD *)(v21 + 408));
v23 = v22;
if ( v22 )
{
v24 = 0;
if ( cocos2d::CCArray::count(v22) )
{
do
{
v25 = cocos2d::CCArray::objectAtIndex(v23, v24);
(**((void (__fastcall ***)(__int64, void **))v25 + 40))((__int64)v25 + 320, &v61);
++v24;
}
while ( v24 < cocos2d::CCArray::count(v23) );
}
}
v63 = -22874;
v64 = -90;
v26 = *(_QWORD *)(v21 + 416);
if ( v26 )
{
v27 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v26 + 480LL))(v26);
v28 = v27;
if ( v27 )
{
v29 = 0;
if ( cocos2d::CCArray::count(v27) )
{
do
{
v30 = cocos2d::CCArray::objectAtIndex(v28, v29);
(**((void (__fastcall ***)(__int64, __int16 *))v30 + 40))((__int64)v30 + 320, &v63);
++v29;
}
while ( v29 < cocos2d::CCArray::count(v28) );
}
}
}
LOWORD(v62) = -7711;
v65 = -7711;
v66 = -31;
(**(void (__fastcall ***)(__int64, __int16 *))(*(_QWORD *)(v21 + 432) + 320LL))(*(_QWORD *)(v21 + 432) + 320LL, &v65);
LOBYTE(v31) = -1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(*(_QWORD *)(v21 + 432) + 320LL) + 40LL))(
*(_QWORD *)(v21 + 432) + 320LL,
v31);
if ( *(_BYTE *)(a1 + 14953) )
v32 = (*(_DWORD *)(*(_QWORD *)(a1 + 15280) + 124LL) & 0x400) != 0;
else
v32 = 0;
if ( *(_BYTE *)(v21 + 441) != v32 )
{
*(_BYTE *)(v21 + 441) = v32;
v33 = *(_QWORD *)(v21 + 432);
v34 = *(void (__fastcall ***)(__int64, __int64))(v33 + 344);
v19 = v32 == 0;
v35 = v33 + 344;
if ( v19 )
(*v34)(v35, 0x30300000001LL);
else
(*v34)(v35, 0x100000302LL);
}
v36 = *(_QWORD *)(a1 + 4352);
if ( v36 )
{
memset(&v61, 100, 3);
v37 = *(_QWORD *)(v36 + 408);
if ( v37 )
{
v38 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v37 + 480LL))(v37);
for ( i = 0; i < cocos2d::CCArray::count(v38); ++i )
{
v40 = cocos2d::CCArray::objectAtIndex(v38, i);
(**((void (__fastcall ***)(__int64, void **))v40 + 40))((__int64)v40 + 320, &v61);
}
}
LOWORD(v61) = -26986;
BYTE2(v61) = -106;
v41 = *(_QWORD *)(*(_QWORD *)(a1 + 4352) + 416LL);
if ( v41 )
{
v42 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v41 + 480LL))(v41);
for ( j = 0; j < cocos2d::CCArray::count(v42); ++j )
{
v44 = cocos2d::CCArray::objectAtIndex(v42, j);
(**((void (__fastcall ***)(__int64, void **))v44 + 40))((__int64)v44 + 320, &v61);
}
}
}
v45 = 0;
LODWORD(v61) = 0;
v46 = *(_QWORD *)(a1 + 13976);
if ( (*(_QWORD *)(a1 + 13984) - v46) >> 3 )
{
v47 = 0;
do
{
v48 = *(_QWORD **)(v47 + v46);
if ( v48 )
v49 = (__int64)(v48[1] - *v48) >> 3;
else
LODWORD(v49) = -1;
v50 = 0;
v62 = (int)v49;
if ( (int)v49 > 0 )
{
do
{
v51 = *(_QWORD **)(**(_QWORD **)(v47 + *(_QWORD *)(a1 + 13976)) + 8 * v50);
if ( v51 )
{
v52 = 0;
v53 = *(int *)(**(_QWORD **)(v47 + *(_QWORD *)(a1 + 14144)) + 4 * v50);
if ( v53 > 0 )
{
do
{
v54 = *(_QWORD *)(*v51 + 8 * v52);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v54 + 1224LL))(v54, v46, v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v54 + 1136LL))(v54);
++v52;
}
while ( v52 < v53 );
v7 = 0;
}
}
++v50;
}
while ( v50 < v62 );
LODWORD(v45) = (_DWORD)v61;
}
v45 = (unsigned int)(v45 + 1);
LODWORD(v61) = v45;
v47 += 8;
v46 = *(_QWORD *)(a1 + 13976);
}
while ( (int)v45 < (unsigned __int64)((*(_QWORD *)(a1 + 13984) - v46) >> 3) );
}
if ( !*(_BYTE *)(a1 + 14953) )
{
v55 = *(cocos2d::CCArray **)(a1 + 3536);
for ( k = 0; k < cocos2d::CCArray::count(v55); ++k )
*((_BYTE *)cocos2d::CCArray::objectAtIndex(v55, k) + 1157) = 1;
}
v57 = 0;
v58 = 10000;
do
{
*(_BYTE *)(v7 + *(_QWORD *)(a1 + 15344)) = 0;
v59 = (_DWORD *)(*(_QWORD *)(a1 + 15176) + 4 * (v57 >> 5));
*v59 &= ~(1 << (v57++ & 0x1F));
++v7;
--v58;
}
while ( v58 );
return LevelEditorLayer::updatePreviewParticles(a1);
}