//
// GameManager::returnToLastScene from 0x71e344 to 0x71e674 (816 bytes)
//
// 3 xrefs:
// > PlayLayer::onQuit @ 0x70371c
// > EditorPauseLayer::onExitEditor @ 0x8b6e5c
// > ??> @ 0xc5c68
//
// 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:52:22 +0000
//
__int64 __fastcall GameManager::returnToLastScene(unsigned __int64 this, GJGameLevel *a2)
{
CreatorLayer *v2; // x20
cocos2d::CCTransitionFade *v3; // x0
cocos2d::CCScene *v4; // x1
cocos2d::CCScene *v5; // x0
GameManager *v6; // x0
GameManager *v7; // x0
cocos2d::CCDirector *v9; // x20
__int64 v10; // x0
LevelBrowserLayer *v11; // x0
GJSearchObject *v12; // x1
cocos2d::CCTransitionFade *v13; // x0
cocos2d::CCScene *v14; // x1
cocos2d::CCScene *v15; // x0
bool v16; // w1
cocos2d::CCDirector *v17; // x0
cocos2d::CCTransitionFade *v18; // x21
cocos2d::CCDirector *v19; // x20
cocos2d::CCScene *v20; // x1
cocos2d::CCScene *v21; // x0
GameLevelManager *v22; // x21
__int64 v23; // x2
__int64 v24; // x1
GJSearchObject *v25; // x1
cocos2d::CCTransitionFade *SearchScene; // x20
cocos2d::CCDirector *v27; // x21
cocos2d::CCScene *v28; // x1
cocos2d::CCScene *v29; // x0
unsigned int v30; // w20
cocos2d::CCDirector *v31; // x21
int v32; // w1
cocos2d::CCTransitionFade *v33; // x0
cocos2d::CCScene *v34; // x1
cocos2d::CCScene *v35; // x0
SecretLayer2 *v36; // x20
cocos2d::CCTransitionFade *v37; // x0
cocos2d::CCScene *v38; // x1
cocos2d::CCScene *v39; // x0
GameLevelManager *v40; // x21
__int64 v41; // x2
__int64 v42; // x1
GJSearchObject *v43; // x1
cocos2d::CCDirector *v44; // [xsp+30h] [xbp+30h] BYREF
__int64 v45; // [xsp+38h] [xbp+38h]
GJSearchObject *v46; // [xsp+40h] [xbp+40h]
switch ( *(_DWORD *)(this + 708) )
{
case 1:
v2 = (CreatorLayer *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v3 = (cocos2d::CCTransitionFade *)CreatorLayer::scene(v2);
goto LABEL_3;
case 2:
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v10 = 98;
goto LABEL_8;
case 3:
if ( !a2 )
{
if ( *(_BYTE *)(this + 712) )
{
*(_BYTE *)(this + 712) = 0;
v40 = (GameLevelManager *)GameLevelManager::sharedState((GameLevelManager *)this);
v44 = nullptr;
v45 = 0;
v41 = GameLevelManager::sharedState(v40) + 1160;
v46 = nullptr;
if ( (*(_BYTE *)v41 & 1) != 0 )
{
std::string::__init((__int64 *)&v44, *(void **)(v41 + 16), *(_QWORD *)(v41 + 8));
}
else
{
v42 = *(_QWORD *)(v41 + 8);
v44 = *(cocos2d::CCDirector **)v41;
v45 = v42;
v46 = *(GJSearchObject **)(v41 + 16);
}
v43 = (GJSearchObject *)((char *)&v44 + 1);
if ( ((unsigned __int8)v44 & 1) != 0 )
v43 = v46;
SearchScene = (cocos2d::CCTransitionFade *)GameLevelManager::getSearchScene(v40, v43);
this = (unsigned __int8)v44;
if ( ((unsigned __int8)v44 & 1) != 0 )
{
operator delete(v46);
if ( SearchScene )
goto LABEL_24;
}
else if ( SearchScene )
{
goto LABEL_24;
}
}
this = CreatorLayer::scene((CreatorLayer *)this);
SearchScene = (cocos2d::CCTransitionFade *)this;
LABEL_24:
v27 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v29 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(SearchScene, 0.5, v28);
v6 = (GameManager *)cocos2d::CCDirector::replaceScene(v27, v29);
goto LABEL_4;
}
if ( *((_DWORD *)a2 + 285) == 2 )
v17 = (cocos2d::CCDirector *)EditLevelLayer::scene(a2, a2);
else
v17 = (cocos2d::CCDirector *)LevelInfoLayer::scene(a2, nullptr, *(_BYTE *)(this + 708) - 1);
v18 = v17;
v19 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v17);
v21 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v18, 0.5, v20);
v6 = (GameManager *)cocos2d::CCDirector::replaceScene(v19, v21);
LABEL_4:
v7 = (GameManager *)GameManager::sharedState(v6);
GameManager::fadeInMenuMusic(v7);
return _stack_chk_guard;
case 7:
v22 = (GameLevelManager *)GameLevelManager::sharedState((GameLevelManager *)this);
v44 = nullptr;
v45 = 0;
v23 = GameLevelManager::sharedState(v22) + 1160;
v46 = nullptr;
if ( (*(_BYTE *)v23 & 1) != 0 )
{
std::string::__init((__int64 *)&v44, *(void **)(v23 + 16), *(_QWORD *)(v23 + 8));
}
else
{
v24 = *(_QWORD *)(v23 + 8);
v44 = *(cocos2d::CCDirector **)v23;
v45 = v24;
v46 = *(GJSearchObject **)(v23 + 16);
}
v25 = (GJSearchObject *)((char *)&v44 + 1);
if ( ((unsigned __int8)v44 & 1) != 0 )
v25 = v46;
SearchScene = (cocos2d::CCTransitionFade *)GameLevelManager::getSearchScene(v22, v25);
this = (unsigned __int8)v44;
if ( ((unsigned __int8)v44 & 1) != 0 )
operator delete(v46);
if ( !SearchScene )
{
this = (unsigned __int64)MenuLayer::scene(nullptr);
SearchScene = (cocos2d::CCTransitionFade *)this;
}
goto LABEL_24;
case 9:
if ( a2 && (this = (unsigned int)(*((_DWORD *)a2 + 82) - *((_DWORD *)a2 + 83)), (int)this > 1) )
v30 = this - 1;
else
v30 = 0;
v31 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v33 = (cocos2d::CCTransitionFade *)LevelSelectLayer::scene((LevelSelectLayer *)v30, v32);
v35 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v33, 0.5, v34);
v6 = (GameManager *)cocos2d::CCDirector::replaceScene(v31, v35);
goto LABEL_4;
case 0xC:
v36 = (SecretLayer2 *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v37 = (cocos2d::CCTransitionFade *)SecretLayer2::scene(v36);
v39 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v37, 0.5, v38);
cocos2d::CCDirector::replaceScene(v36, v39);
return _stack_chk_guard;
case 0xE:
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v10 = 102;
LABEL_8:
v11 = (LevelBrowserLayer *)GJSearchObject::create(v10);
v13 = (cocos2d::CCTransitionFade *)LevelBrowserLayer::scene(v11, v12);
v15 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v13, 0.5, v14);
v6 = (GameManager *)cocos2d::CCDirector::pushScene(v9, v15);
goto LABEL_4;
case 0xF:
v2 = (CreatorLayer *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v3 = (cocos2d::CCTransitionFade *)LevelAreaInnerLayer::scene((LevelAreaInnerLayer *)((char *)&dword_0 + 1), v16);
goto LABEL_3;
default:
v2 = (CreatorLayer *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v3 = (cocos2d::CCTransitionFade *)MenuLayer::scene(nullptr);
LABEL_3:
v5 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v3, 0.5, v4);
v6 = (GameManager *)cocos2d::CCDirector::replaceScene(v2, v5);
goto LABEL_4;
}
}