//
// LevelListLayer::onBack from 0xbae2e4 to 0xbae510 (556 bytes)
//
// 2 xrefs:
// > ??> @ 0xcb3e0
// > ??> @ 0x14dbeb0
//
// 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 13:02:53 +0000
//
__int64 __fastcall LevelListLayer::onBack(LevelListLayer *this, cocos2d::CCObject *a2)
{
__int64 v5; // x0
GameLevelManager *v6; // x0
__int64 v7; // x21
char v8; // w0
GameLevelManager *v9; // x0
size_t v10; // x1
__int64 *v11; // x0
GameLevelManager *v12; // x0
GameLevelManager *v13; // x20
__int64 v14; // x0
size_t v15; // x1
GJSearchObject *v16; // x1
AppDelegate *SearchScene; // x20
GameLevelManager *v18; // x0
AppDelegate *v19; // x0
cocos2d::CCDirector *v20; // x21
cocos2d::CCScene *v21; // x1
cocos2d::CCScene *v22; // x0
LevelBrowserLayer *v23; // x0
GJSearchObject *v24; // x1
GameLevelManager *v25; // [xsp+40h] [xbp+40h] BYREF
size_t v26; // [xsp+48h] [xbp+48h]
GJSearchObject *v27; // [xsp+50h] [xbp+50h]
if ( *((_BYTE *)this + 952) )
return _stack_chk_guard;
(*(void (__fastcall **)(LevelListLayer *))(*(_QWORD *)this + 1072LL))(this);
v5 = *((_QWORD *)this + 120);
if ( v5 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v5 + 1160LL))(v5, 0);
v6 = (GameLevelManager *)LevelListLayer::verifyListName(this);
v7 = GameLevelManager::sharedState(v6);
v8 = *((_BYTE *)this + 888);
v25 = nullptr;
v26 = 0;
v27 = nullptr;
if ( (v8 & 1) != 0 )
{
std::string::__init((__int64 *)&v25, *((void **)this + 113), *((_QWORD *)this + 112));
}
else
{
v9 = *((GameLevelManager **)this + 111);
v10 = *((_QWORD *)this + 112);
v27 = *((GJSearchObject **)this + 113);
v25 = v9;
v26 = v10;
}
v11 = (__int64 *)(v7 + 1160);
if ( (GameLevelManager **)(v7 + 1160) != &v25 )
{
if ( ((unsigned __int8)v25 & 1) != 0 )
std::string::assign(v11, v27, v26);
else
std::string::assign(v11, (char *)&v25 + 1, (unsigned __int8)v25 >> 1);
}
if ( ((unsigned __int8)v25 & 1) != 0 )
{
operator delete(v27);
v12 = (GameLevelManager *)*(unsigned int *)(*((_QWORD *)this + 114) + 544LL);
if ( (_DWORD)v12 != 2 )
goto LABEL_12;
}
else
{
v12 = (GameLevelManager *)*(unsigned int *)(*((_QWORD *)this + 114) + 544LL);
if ( (_DWORD)v12 != 2 )
{
LABEL_12:
LevelBrowserLayer::onBack(this, a2);
return _stack_chk_guard;
}
}
v13 = (GameLevelManager *)GameLevelManager::sharedState(v12);
v14 = GameLevelManager::sharedState(v13);
v25 = nullptr;
v26 = 0;
v27 = nullptr;
if ( (*(_BYTE *)(v14 + 1160) & 1) != 0 )
{
std::string::__init((__int64 *)&v25, *(void **)(v14 + 1176), *(_QWORD *)(v14 + 1168));
}
else
{
v15 = *(_QWORD *)(v14 + 1168);
v25 = *(GameLevelManager **)(v14 + 1160);
v26 = v15;
v27 = *(GJSearchObject **)(v14 + 1176);
}
v16 = (GJSearchObject *)((char *)&v25 + 1);
if ( ((unsigned __int8)v25 & 1) != 0 )
v16 = v27;
SearchScene = GameLevelManager::getSearchScene(v13, v16);
v18 = (GameLevelManager *)(unsigned __int8)v25;
if ( ((unsigned __int8)v25 & 1) != 0 )
operator delete(v27);
v19 = (AppDelegate *)*(unsigned __int8 *)(GameLevelManager::sharedState(v18) + 1216);
if ( (_DWORD)v19 || !SearchScene )
{
*(_BYTE *)(GameLevelManager::sharedState(v19) + 1216) = 0;
v23 = (LevelBrowserLayer *)GJSearchObject::create(102);
v19 = LevelBrowserLayer::scene(v23, v24);
SearchScene = v19;
}
v20 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v19);
v22 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(SearchScene, 0.5, v21);
cocos2d::CCDirector::replaceScene(v20, v22);
return _stack_chk_guard;
}