//
// LevelEditorLayer::updateEditorMode from 0x78dabc to 0x78dd90 (724 bytes)
//
// 5 xrefs:
// > LevelEditorLayer::init @ 0x7af3bc
// > EditorPauseLayer::toggleEditorColorMode @ 0x8b6ac8
// > MapSelectLayer::init @ 0xac44ac
// > EditorUI::toggleViewOption @ 0xbfeb54
// > ??> @ 0xb4a18
//
// 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 12:53:27 +0000
//
__int64 __fastcall LevelEditorLayer::updateEditorMode(LevelEditorLayer *this)
{
char *v2; // x27
GameManager *v3; // x0
unsigned int v4; // w21
char *v5; // x24
GJGroundLayer *v6; // x19
__int64 v7; // x0
void (__fastcall *v8)(__int64, __int64 *); // x2
char shouldBlend; // w1
__int64 v10; // x0
__int64 v11; // x19
unsigned __int64 v12; // x26
__int64 v13; // x2
_QWORD *v14; // x1
__int64 v15; // x1
__int64 v16; // x22
__int64 v17; // x24
_QWORD *v18; // x28
int v19; // w21
__int64 v20; // x20
__int64 v21; // x21
__int64 v22; // x19
unsigned int v24; // w19
cocos2d::CCArray *i; // x20
unsigned int v26; // w1
GameManager *v27; // x0
int v28; // [xsp+68h] [xbp+68h]
__int64 v29; // [xsp+70h] [xbp+70h] BYREF
v2 = (char *)this + 12288;
v3 = (GameManager *)*((unsigned __int8 *)this + 14298);
if ( !(_DWORD)v3 )
{
v27 = (GameManager *)GameManager::sharedState(v3);
LOBYTE(v3) = GameManager::getGameVariable(v27, "0036");
}
v2[2009] = (char)v3;
v2[2008] = 1;
v4 = 0;
v5 = v2 + 2009;
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 493) + 960LL))(*((_QWORD *)this + 493));
v6 = *((GJGroundLayer **)this + 495);
while ( 1 )
{
GJGroundLayer::updateGround01Color(v6, 10921638);
GJGroundLayer::updateGround02Color(v6, 10921638);
v7 = *((_QWORD *)v6 + 54);
v8 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v7 + 960LL);
LOWORD(v29) = -7711;
BYTE2(v29) = -31;
v8(v7, &v29);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)v6 + 54) + 912LL))(*((_QWORD *)v6 + 54), 0xFFFFFFFFLL);
shouldBlend = *v5;
if ( *v5 )
shouldBlend = LevelEditorLayer::shouldBlend(this, 1002);
GJGroundLayer::updateLineBlend(v6, shouldBlend);
if ( v4 )
break;
v6 = *((GJGroundLayer **)this + 496);
v4 = 1;
}
v10 = *((_QWORD *)this + 497);
if ( v10 )
{
LOWORD(v28) = 25700;
BYTE2(v28) = 100;
GJMGLayer::updateGroundColor(v10, v28, v4);
LOWORD(v29) = -26986;
BYTE2(v29) = -106;
GJMGLayer::updateGroundColor(*((_QWORD *)this + 497), v29, 0);
}
v11 = *((_QWORD *)this + 1671);
v12 = 0;
v13 = *((_QWORD *)this + 1672);
if ( (v13 - v11) >> 3 )
{
do
{
v14 = *(_QWORD **)(v11 + 8 * v12);
if ( v14 )
{
v15 = (__int64)(v14[1] - *v14) >> 3;
if ( (int)v15 > 0 )
{
v16 = 0;
v17 = 4 * ((unsigned int)(v15 - 1) + 1LL);
do
{
v18 = *(_QWORD **)(**(_QWORD **)(v11 + 8 * v12) + 2 * v16);
if ( v18 )
{
v19 = *(_DWORD *)(**(_QWORD **)(*((_QWORD *)this + 1692) + 8 * v12) + v16);
if ( v19 > 0 )
{
v20 = 0;
v21 = 8 * ((unsigned int)(v19 - 1) + 1LL);
do
{
v22 = *(_QWORD *)(*v18 + v20);
v20 += 8;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v22 + 1376LL))(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v22 + 1288LL))(v22);
}
while ( v20 != v21 );
v11 = *((_QWORD *)this + 1671);
}
}
v16 += 4;
}
while ( v16 != v17 );
v13 = *((_QWORD *)this + 1672);
}
}
++v12;
}
while ( v12 < (v13 - v11) >> 3 );
}
if ( !v2[2009] )
{
v24 = 0;
for ( i = (cocos2d::CCArray *)LevelEditorLayer::getAllObjects(this);
v24 < (unsigned int)cocos2d::CCArray::count(i);
*(_BYTE *)(cocos2d::CCArray::objectAtIndex(i, v26) + 1149) = 1 )
{
v26 = v24++;
}
}
LevelEditorLayer::resetToggledGroups((__int64)this);
LevelEditorLayer::updatePreviewParticles((cocos2d::CCArray **)this);
return _stack_chk_guard;
}