//
// LevelListLayer::cloneList from 0x1404300b0 to 0x140430338 (648 bytes)
//
// 2 xrefs:
// > LevelListLayer::FLAlert_Clicked @ 0x14042f39c
// > ??> @ 0x140926c3c
//
// This function is hookable on this platform (idp: pc, 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:32:15 +0000
//
// Hidden C++ exception states: #wind=5
void __fastcall LevelListLayer::cloneList(__int64 a1)
{
unsigned int v2; // ebx
__int64 v3; // rax
struct cocos2d::CCObject *NewLevelList; // rbp
__int64 v5; // rax
void **v6; // r8
void *v7; // rdx
cocos2d::CCArray *ListLevelsArray; // rsi
struct cocos2d::CCObject *v9; // rax
__int64 v10; // rax
__int64 v11; // rbx
void *v12; // rdx
__int64 v13; // rdx
__int64 v14; // r8
__int64 v15; // r9
__int64 v16; // rcx
int v17; // eax
struct cocos2d::CCScene *v18; // rax
struct cocos2d::CCScene *v19; // rbx
__int64 v20; // rcx
cocos2d::CCDirector *v21; // rax
void *v22; // [rsp+20h] [rbp-58h]
void *v23; // [rsp+20h] [rbp-58h]
void *v24; // [rsp+20h] [rbp-58h]
_BYTE v25[32]; // [rsp+28h] [rbp-50h] BYREF
_QWORD Src[4]; // [rsp+48h] [rbp-30h] BYREF
v2 = 0;
if ( !*(_BYTE *)(a1 + 968) )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 992LL))(a1, 0);
*(_BYTE *)(a1 + 968) = 1;
v3 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v22 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v3 = qword_14090BFD0;
}
*(_DWORD *)(v3 + 740) = 14;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v23 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v23);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
}
NewLevelList = GameLevelManager::createNewLevelList();
v5 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v24 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v24);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v5 = *(_QWORD *)&qword_14090BFB0;
}
*(_BYTE *)(v5 + 1344) = 1;
*((_DWORD *)NewLevelList + 90) = *(_DWORD *)(*(_QWORD *)(a1 + 920) + 360LL);
v6 = (void **)(*(_QWORD *)(a1 + 920) + 536LL);
if ( (void **)((char *)NewLevelList + 536) != v6 )
{
v7 = (void *)(*(_QWORD *)(a1 + 920) + 536LL);
if ( *(_QWORD *)(*(_QWORD *)(a1 + 920) + 560LL) > 0xFu )
v7 = *v6;
sub_1400405A0((void **)NewLevelList + 67, v7, *(_QWORD *)(*(_QWORD *)(a1 + 920) + 552LL));
}
ListLevelsArray = GJLevelList::getListLevelsArray(*(_QWORD *)(a1 + 920), 0);
if ( cocos2d::CCArray::count(ListLevelsArray) )
{
do
{
v9 = cocos2d::CCArray::objectAtIndex(ListLevelsArray, v2);
GJLevelList::addLevelToList((__int64)NewLevelList, (__int64)v9);
++v2;
}
while ( v2 < cocos2d::CCArray::count(ListLevelsArray) );
}
sub_14003F4F0((__int64)Src, *(_QWORD *)(a1 + 920) + 440LL);
if ( Src[2] <= 0x17u )
sub_140044D80(Src, " 2", 2u);
v10 = sub_14003F4F0((__int64)v25, (__int64)Src);
v11 = v10;
if ( (struct cocos2d::CCObject *)((char *)NewLevelList + 440) != (struct cocos2d::CCObject *)v10 )
{
v12 = (void *)v10;
if ( *(_QWORD *)(v10 + 24) > 0xFu )
v12 = *(void **)v10;
sub_1400405A0((void **)NewLevelList + 55, v12, *(_QWORD *)(v10 + 16));
}
sub_14003D310(v11);
v16 = *(_QWORD *)(a1 + 920);
v17 = *(_DWORD *)(v16 + 380);
if ( !v17 )
v17 = *(_DWORD *)(v16 + 344);
*((_DWORD *)NewLevelList + 95) = v17;
v18 = (struct cocos2d::CCScene *)LevelListLayer::scene((__int64)NewLevelList, v13, v14, v15);
v19 = cocos2d::CCTransitionFade::create(0.5, v18);
v21 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v20);
cocos2d::CCDirector::replaceScene(v21, v19);
sub_14003D310((__int64)Src);
}
}