//
// GameManager::returnToLastScene from 0x1003bb1c8 to 0x1003bb488 (704 bytes)
//
// 2 xrefs:
// > PlayLayer::onQuit @ 0x100142274
// > EditorPauseLayer::onExitEditor @ 0x100444b64
//
// 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:03:59 +0000
//
void __fastcall GameManager::returnToLastScene(__int64 a1, _DWORD *a2)
{
int v2; // w8
__int64 v3; // x19
void *v4; // x0
__int64 v5; // x19
__int64 v6; // x0
int v7; // w19
__int64 v8; // x0
int v9; // w8
bool v10; // vf
int v11; // w8
__int64 v12; // x19
char *v13; // x1
__int64 v14; // x0
__int64 v15; // x0
__int64 v16; // x19
_QWORD *v17; // x0
char *v18; // x0
char *v19; // x0
__int64 v20; // x0
char *v21; // x0
char *v22; // x1
__int64 v23; // x19
__int64 v24; // x20
__int64 v25; // x0
float v26; // s0
int v27; // w19
__int64 v28; // x0
char *v29; // x1
__int64 v30; // x0
void *__p[2]; // [xsp+0h] [xbp-30h] BYREF
__int64 v32; // [xsp+10h] [xbp-20h]
v2 = *(_DWORD *)(a1 + 708);
if ( v2 <= 7 )
{
if ( v2 <= 2 )
{
if ( v2 == 1 )
{
v3 = cocos2d::CCDirector::sharedDirector();
v4 = CreatorLayer::scene();
goto LABEL_22;
}
if ( v2 != 2 )
goto LABEL_20;
v5 = cocos2d::CCDirector::sharedDirector();
v6 = 98;
goto LABEL_28;
}
if ( v2 == 3 )
{
if ( a2 )
{
if ( a2[285] == 2 )
v15 = EditLevelLayer::scene((__int64)a2);
else
v15 = LevelInfoLayer::scene((__int64)a2, 0);
}
else
{
if ( *(_BYTE *)(a1 + 712) == 1 )
{
*(_BYTE *)(a1 + 712) = 0;
v27 = GameLevelManager::sharedState();
v28 = GameLevelManager::sharedState();
if ( *(char *)(v28 + 1183) < 0 )
{
sub_1000097D0(__p, *(void **)(v28 + 1160), *(_QWORD *)(v28 + 1168));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v28 + 1160);
v32 = *(_QWORD *)(v28 + 1176);
}
if ( v32 >= 0 )
v29 = (char *)__p;
else
v29 = (char *)__p[0];
v23 = sub_1000ADF18(v27, v29);
if ( SHIBYTE(v32) < 0 )
operator delete(__p[0]);
if ( v23 )
goto LABEL_52;
}
v15 = (__int64)CreatorLayer::scene();
}
}
else
{
if ( v2 != 7 )
goto LABEL_20;
v7 = GameLevelManager::sharedState();
v8 = GameLevelManager::sharedState();
if ( *(char *)(v8 + 1183) < 0 )
{
sub_1000097D0(__p, *(void **)(v8 + 1160), *(_QWORD *)(v8 + 1168));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v8 + 1160);
v32 = *(_QWORD *)(v8 + 1176);
}
if ( v32 >= 0 )
v22 = (char *)__p;
else
v22 = (char *)__p[0];
v23 = sub_1000ADF18(v7, v22);
if ( SHIBYTE(v32) < 0 )
operator delete(__p[0]);
if ( v23 )
goto LABEL_52;
v15 = (__int64)MenuLayer::scene(0);
}
v23 = v15;
LABEL_52:
v24 = cocos2d::CCDirector::sharedDirector();
v26 = 0.5;
v25 = v23;
goto LABEL_53;
}
if ( v2 <= 11 )
{
if ( v2 != 9 )
goto LABEL_20;
if ( a2 )
{
v9 = a2[82] - a2[83];
v10 = __OFSUB__(v9, 1);
v11 = v9 - 1;
if ( (v11 < 0) ^ v10 | (v11 == 0) )
v12 = 0;
else
v12 = (unsigned int)v11;
}
else
{
v12 = 0;
}
v24 = cocos2d::CCDirector::sharedDirector();
v25 = LevelSelectLayer::scene(v12);
v26 = 0.5;
LABEL_53:
v13 = cocos2d::CCTransitionFade::create_1(v25, v26);
v14 = v24;
goto LABEL_54;
}
if ( v2 == 12 )
{
v16 = cocos2d::CCDirector::sharedDirector();
v17 = sub_1003A63C4();
v18 = cocos2d::CCTransitionFade::create_1((__int64)v17, 0.5);
cocos2d::CCDirector::replaceScene(v16, v18);
return;
}
if ( v2 != 14 )
{
if ( v2 == 15 )
{
v3 = cocos2d::CCDirector::sharedDirector();
v4 = (void *)LevelAreaInnerLayer::scene(1);
LABEL_22:
v13 = cocos2d::CCTransitionFade::create_1((__int64)v4, 0.5);
v14 = v3;
LABEL_54:
cocos2d::CCDirector::replaceScene(v14, v13);
goto LABEL_55;
}
LABEL_20:
v3 = cocos2d::CCDirector::sharedDirector();
v4 = MenuLayer::scene(0);
goto LABEL_22;
}
v5 = cocos2d::CCDirector::sharedDirector();
v6 = 102;
LABEL_28:
v19 = GJSearchObject::create_2(v6);
v20 = LevelBrowserLayer::scene(v19);
v21 = cocos2d::CCTransitionFade::create_1(v20, 0.5);
cocos2d::CCDirector::pushScene(v5, v21);
LABEL_55:
v30 = GameManager::sharedState();
GameManager::fadeInMenuMusic(v30);
}