//
// CreatorLayer::onSavedLevels from 0x14009d520 to 0x14009d71a (506 bytes)
//
// 2 xrefs:
// > CreatorLayer::init @ 0x14009c457
// > ??> @ 0x1406c7584
//
// 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=5
void CreatorLayer::onSavedLevels(CreatorLayer *a1, cocos2d::CCObject *a2)
{
__int64 v2; // rcx
SearchType v3; // ecx
GJSearchObject *v4; // rdi
GameManager *v5; // rcx
int IntGameVariable; // ebx
GameManager *v7; // rcx
GameManager *v8; // rcx
GameManager *v9; // rcx
struct cocos2d::CCScene *v10; // rbx
__int64 v11; // rdx
__int64 v12; // rcx
LevelBrowserLayer *v13; // rax
struct cocos2d::CCTransitionFade *v14; // rbx
__int64 v15; // rcx
cocos2d::CCDirector *v16; // rax
void *v17; // [rsp+40h] [rbp+18h]
void *v18; // [rsp+40h] [rbp+18h]
void *v19; // [rsp+40h] [rbp+18h]
void *v20; // [rsp+40h] [rbp+18h]
void *v21; // [rsp+40h] [rbp+18h]
v2 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v17 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v2 = qword_1406C2ED8;
}
v3 = *(_DWORD *)(v2 + 1204);
if ( v3 != FavouriteLists )
v3 = SavedLevels;
v4 = GJSearchObject::create_2(v3);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v18 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
IntGameVariable = 999;
if ( GameManager::getIntGameVariable(v5, "0092") > 999 )
goto LABEL_12;
v7 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v19 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getIntGameVariable(v7, "0092") >= 0 )
{
LABEL_12:
v8 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v20 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getIntGameVariable(v8, "0092") <= 999 )
{
v9 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v21 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = (GameManager *)qword_1406C2ED8;
}
IntGameVariable = GameManager::getIntGameVariable(v9, "0092");
}
}
else
{
IntGameVariable = 0;
}
v4->m_folder = IntGameVariable;
v10 = (struct cocos2d::CCScene *)cocos2d::CCScene::create();
*(_QWORD *)(cocos2d::CCApplication::sharedApplication(v12, v11) + 224) = v10;
v13 = LevelBrowserLayer::create(v4);
v10->addChild_1(v10, v13);
v14 = cocos2d::CCTransitionFade::create(0.5, v10);
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
cocos2d::CCDirector::pushScene(v16, v14);
}