//
// LevelBrowserLayer::onSafeMode from 0x1403eafa0 to 0x1403eb1d6 (566 bytes)
//
// 6 xrefs:
// > LevelBrowserLayer::init @ 0x1403e3a64
// > LevelBrowserLayer::init @ 0x1403e3af9
// > LevelBrowserLayer::init @ 0x1403e3b91
// > ??> @ 0x1408c51a0
// > ??> @ 0x1408c51dc
// > ??> @ 0x14092516c
//
// 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:45 +0000
//
__int64 __fastcall LevelBrowserLayer::onSafeMode(_QWORD *a1, __int64 a2)
{
__int64 result; // rax
int v4; // ebx
bool v5; // si
__int64 v6; // r14
__int64 v7; // r15
__int64 v8; // r14
__int64 v9; // r14
bool v10; // si
__int64 v11; // r15
__int64 v12; // r14
__int64 v13; // r14
bool v14; // si
__int64 v15; // r15
__int64 v16; // r14
int v17; // ecx
int v18; // ecx
int v19; // eax
__int64 v20; // rax
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
if ( (_DWORD)result != dword_1408FE4A4 )
{
v4 = 2;
v5 = (_DWORD)result == 0;
v6 = a1[101];
dword_1408FE4A4 = result;
if ( v6 )
{
v7 = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v6 + 472LL))(v6, 1);
v8 = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v6 + 472LL))(v6, 2);
if ( v7 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v7 + 336LL))(v7, v5);
if ( v8 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v8 + 336LL))(v8, !v5);
}
v9 = a1[102];
v10 = dword_1408FE4A4 == 1;
if ( v9 )
{
v11 = (*(__int64 (__fastcall **)(_QWORD, __int64))(*(_QWORD *)v9 + 472LL))(a1[102], 1);
v12 = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v9 + 472LL))(v9, 2);
if ( v11 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v11 + 336LL))(v11, v10);
if ( v12 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v12 + 336LL))(v12, !v10);
}
v13 = a1[103];
v14 = dword_1408FE4A4 == 2;
if ( v13 )
{
v15 = (*(__int64 (__fastcall **)(_QWORD, __int64))(*(_QWORD *)v13 + 472LL))(a1[103], 1);
v16 = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v13 + 472LL))(v13, 2);
if ( v15 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v15 + 336LL))(v15, v14);
if ( v16 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v16 + 336LL))(v16, !v14);
}
v17 = *(_DWORD *)(a1[83] + 320LL);
if ( v17 == 33 || v17 == 22 )
{
v4 = 1;
}
else if ( v17 != 34 && v17 != 23 )
{
v4 = 0;
}
if ( dword_1408FE4A4 == 2 )
{
if ( v4 == 1 )
{
v18 = 22;
LABEL_32:
v20 = GJSearchObject::create_2(v18);
*(_BYTE *)(v20 + 436) = dword_1408FE4A4 == 1;
LevelBrowserLayer::loadPage((__int64)a1, (int *)v20);
return LevelBrowserLayer::updateBackgroundColor(a1);
}
v18 = 21;
v19 = 23;
}
else
{
if ( v4 == 1 )
{
v18 = 33;
goto LABEL_32;
}
v18 = 32;
v19 = 34;
}
if ( v4 == 2 )
v18 = v19;
goto LABEL_32;
}
return result;
}