//
// LevelListLayer::onBack from 0x140307130 to 0x140307542 (1042 bytes)
//
// 2 xrefs:
// > ??> @ 0x140589d70
// > ??> @ 0x1406d44cc
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=9
void LevelListLayer::onBack(LevelListLayer *a1, cocos2d::CCObject *a2)
{
struct cocos2d::CCScene *v3; // rsi
CCTextInputNode *m_titleInput; // rcx
bool v5; // bl
bool v6; // bl
std::string *p_m_listName; // rcx
void **v8; // rdx
void **v9; // rcx
std::string *v10; // rcx
size_t *v11; // rbx
__int64 v12; // rax
void *v13; // rdx
__int64 v14; // rcx
__int64 v15; // rdx
const char *v16; // rbx
GJSearchObject *v17; // rax
__int64 v18; // rax
GJSearchObject *v19; // rbx
__int64 v20; // rcx
__int64 v21; // rdx
__int64 v22; // rcx
LevelBrowserLayer *v23; // rax
struct cocos2d::CCTransitionFade *v24; // rbx
__int64 v25; // rcx
cocos2d::CCDirector *v26; // rax
__int64 v27; // rax
cocos2d::CCTouchDispatcher *v28; // rax
_BOOL8 v29; // rdx
GameManager *v30; // rcx
void *v31; // [rsp+28h] [rbp-41h]
void *v32; // [rsp+28h] [rbp-41h]
void *v33; // [rsp+28h] [rbp-41h]
void *v34; // [rsp+28h] [rbp-41h]
void *v35; // [rsp+28h] [rbp-41h]
char v36[8]; // [rsp+30h] [rbp-39h] BYREF
__int64 v37; // [rsp+38h] [rbp-31h]
__int64 v38; // [rsp+40h] [rbp-29h]
__int64 v39; // [rsp+48h] [rbp-21h]
void *Src[5]; // [rsp+50h] [rbp-19h] BYREF
_BYTE v41[32]; // [rsp+78h] [rbp+Fh] BYREF
_QWORD v42[2]; // [rsp+98h] [rbp+2Fh] BYREF
__int64 v43; // [rsp+A8h] [rbp+3Fh]
unsigned __int64 v44; // [rsp+B0h] [rbp+47h]
v3 = nullptr;
if ( !a1->m_exiting )
{
a1->setKeypadEnabled(a1, 0);
m_titleInput = a1->m_titleInput;
if ( m_titleInput )
m_titleInput->onClickTrackNode(m_titleInput, 0);
sub_14003BDB0((__int64)v42, (__int64)&a1->m_levelList->m_listName);
v5 = v43 == 0;
sub_14003A830((__int64)v42);
if ( v5 )
{
sub_14003BDB0((__int64)v42, (__int64)&a1->m_levelList->m_unkString);
v6 = v43 != 0;
sub_14003A830((__int64)v42);
if ( v6 )
{
sub_14003BDB0((__int64)Src, (__int64)&a1->m_levelList->m_unkString);
p_m_listName = &a1->m_levelList->m_listName;
if ( p_m_listName != (std::string *)Src )
{
v8 = Src;
if ( Src[3] > (void *)0xF )
v8 = (void **)Src[0];
sub_14003CCE0((void **)p_m_listName, v8, (size_t)Src[2]);
}
v9 = Src;
}
else
{
v37 = 0;
v38 = 7;
v39 = 15;
strcpy(v36, "Unknown");
v10 = &a1->m_levelList->m_listName;
if ( v10 != (std::string *)v36 )
sub_14003CCE0((void **)v10, v36, 7u);
v9 = (void **)v36;
}
sub_14003A830((__int64)v9);
}
v11 = (size_t *)sub_14003BDB0((__int64)v41, (__int64)&a1->m_searchKey1);
Src[4] = v11;
v12 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v31 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v31);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v12 = qword_1406C2EC0;
}
if ( (size_t *)(v12 + 640) != v11 )
{
v13 = v11;
if ( v11[3] > 0xF )
v13 = (void *)*v11;
sub_14003CCE0((void **)(v12 + 640), v13, v11[2]);
}
sub_14003A830((__int64)v11);
if ( a1->m_levelList->m_listType == Editor )
{
v15 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v32 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v15 = qword_1406C2EC0;
}
sub_14003BDB0((__int64)v42, v15 + 640);
v16 = (const char *)v42;
if ( v44 > 0xF )
v16 = (const char *)v42[0];
if ( !qword_1406C2EC0 )
{
v33 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v33);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
}
v17 = GJSearchObject::createFromKey(v16);
if ( v17 )
v3 = LevelBrowserLayer::scene(v17);
sub_14003A830((__int64)v42);
v18 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v34 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v34);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v18 = qword_1406C2EC0;
}
if ( *(_BYTE *)(v18 + 712) || !v3 )
{
*(_BYTE *)(v18 + 712) = 0;
v19 = GJSearchObject::create_2(MyLists);
v3 = (struct cocos2d::CCScene *)cocos2d::CCScene::create(v20);
*(_QWORD *)(cocos2d::CCApplication::sharedApplication(v22, v21) + 224) = v3;
v23 = LevelBrowserLayer::create(v19);
v3->addChild_1(v3, v23);
}
v24 = cocos2d::CCTransitionFade::create(0.5, v3);
v26 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v25);
cocos2d::CCDirector::replaceScene(v26, v24);
}
else if ( a1->m_isOverlay )
{
v27 = cocos2d::CCDirector::sharedDirector(v14);
v28 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 144LL))(v27);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v28, a1);
LOBYTE(v29) = 1;
a1->removeFromParentAndCleanup(a1, v29);
}
else
{
a1->setKeypadEnabled(a1, 0);
if ( !qword_1406C2ED8 )
{
v35 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
GameManager::safePopScene(v30);
}
}
}