//
// LevelListLayer::loadLevelsFinished from 0x1403068d0 to 0x140306c2a (858 bytes)
//
// 3 xrefs:
// > ??> @ 0x14058a2a8
// > ??> @ 0x1406d449c
// > ??> @ 0x1406d44a8
//
// 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=2
void LevelListLayer::loadLevelsFinished(LevelListLayer *a1, cocos2d::CCArray *a2, const char *a3, int a4)
{
__int64 v8; // rdx
const char *v9; // rcx
int v10; // ebp
GameLevelManager *v11; // rcx
cocos2d::CCAccelerometerDelegate_vtbl *v12; // rax
size_t v13; // r8
char **v14; // rdx
unsigned __int64 v15; // r15
bool v16; // r12
char *v17; // rsi
const void *v18; // rcx
cocos2d::CCMouseDelegate_vtbl *v19; // rbp
size_t v20; // r8
size_t v21; // r14
__int64 v22; // rdi
char *v23; // rax
GameLevelManager *v24; // rdi
const char *Key; // rax
cocos2d::CCObject *v26; // rcx
GJSearchObject *v27; // rcx
__int64 v28; // rcx
char v29; // r8
int v30; // ecx
int v31; // ecx
int v32; // ecx
__int64 v33; // rax
unsigned int *v34; // rdx
__int64 v35; // rax
__int64 *v36; // rdx
__int64 *i; // r9
__int64 v38; // rax
__int64 v39; // rdx
__int64 v40; // rcx
void *v41; // [rsp+20h] [rbp-58h]
void *v42; // [rsp+20h] [rbp-58h]
char *String[2]; // [rsp+28h] [rbp-50h] BYREF
size_t Size; // [rsp+38h] [rbp-40h]
unsigned __int64 v45; // [rsp+40h] [rbp-38h]
v8 = *(_QWORD *)&a1->m_sAdditionalTransform.b;
if ( v8 && *(_DWORD *)(v8 + 320) == 25 )
{
sub_14003BDB0((__int64)String, v8 + 328);
v9 = (const char *)String;
if ( v45 > 0xF )
v9 = String[0];
v10 = atoi(v9);
sub_14003A830((__int64)String);
v11 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v41 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v41);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v11 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::markLevelAsDownloaded(v11, -v10);
v12 = a1->LevelBrowserLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable;
if ( v10 == LODWORD(v12[43].didAccelerate) )
BYTE6(v12[49].didAccelerate) = 1;
}
if ( a4 == 1 )
{
*(_OWORD *)String = 0;
Size = 0;
v45 = 0;
v13 = -1;
do
++v13;
while ( a3[v13] );
sub_14003A930(String, a3, v13);
v14 = String;
v15 = v45;
v16 = v45 > 0xF;
v17 = String[0];
if ( v45 > 0xF )
v14 = (char **)String[0];
v18 = &a1->cocos2d::CCKeypadDelegate;
if ( *(_QWORD *)&a1->m_bTouchEnabled > 0xFu )
v18 = a1->LevelBrowserLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable;
v19 = a1->LevelBrowserLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable;
v20 = (size_t)v19;
v21 = Size;
if ( Size < (unsigned __int64)v19 )
v20 = Size;
LODWORD(v22) = memcmp(v18, v14, v20);
if ( !(_DWORD)v22 )
{
if ( (unsigned __int64)v19 >= v21 )
v22 = (unsigned __int64)v19 > v21;
else
LODWORD(v22) = -1;
}
if ( v16 )
{
v23 = v17;
if ( v15 + 1 >= 0x1000 )
{
v17 = *((char **)v17 - 1);
if ( (unsigned __int64)(v23 - v17 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v17);
}
if ( !(_DWORD)v22 )
{
LevelListLayer::updateStatsArt((LevelListLayer *)((char *)a1 - 544));
v24 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v42 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v42);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v24 = (GameLevelManager *)qword_1406C2EC0;
}
Key = GJSearchObject::getKey(*(GJSearchObject **)&a1->m_sAdditionalTransform.b);
GameLevelManager::resetTimerForKey(v24, Key);
LevelBrowserLayer::loadPage(
(LevelListLayer *)((char *)a1 - 544),
*(GJSearchObject **)&a1->m_sAdditionalTransform.b);
}
}
else if ( LevelBrowserLayer::isCorrect((LevelListLayer *)((char *)a1 - 544), a3) )
{
v26 = *(cocos2d::CCObject **)&a1->m_obContentSize.height;
if ( v26 )
cocos2d::CCObject::release(v26);
*(_QWORD *)&a1->m_obContentSize.height = a2;
cocos2d::CCObject::retain(a2);
v27 = *(GJSearchObject **)&a1->m_sAdditionalTransform.b;
if ( v27 && GJSearchObject::isLevelSearchObject(v27) )
{
v29 = 0;
if ( *(_QWORD *)&a1->m_sInverse.b )
{
v30 = *(_DWORD *)(v28 + 320) - 98;
if ( !v30 || (v31 = v30 - 1) == 0 || (v32 = v31 - 1) == 0 || (unsigned int)(v32 - 2) <= 1 )
v29 = 1;
}
v33 = *(_QWORD *)&a1->m_obContentSize.height;
if ( v33 )
{
v34 = *(unsigned int **)(v33 + 56);
v35 = *v34;
if ( (_DWORD)v35 )
{
v36 = *((__int64 **)v34 + 2);
for ( i = &v36[v35 - 1]; v36 <= i; ++v36 )
{
v38 = *v36;
if ( !*v36 )
break;
*(_BYTE *)(v38 + 727) = 0;
*(_BYTE *)(v38 + 728) = v29;
}
}
}
}
LevelBrowserLayer::setupLevelBrowser(
(LevelListLayer *)((char *)a1 - 544),
*(cocos2d::CCArray **)&a1->m_obContentSize.height);
((void (__fastcall *)(cocos2d::CCCamera *, _QWORD))a1->m_pCamera->LevelBrowserLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::__vftable[4].update)(
a1->m_pCamera,
0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)&a1->m_fRotationX + 320LL))(*(_QWORD *)&a1->m_fRotationX, 0);
v40 = *(_QWORD *)&a1->m_obAnchorPoint.y;
if ( v40 )
{
LOBYTE(v39) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v40 + 320LL))(v40, v39);
}
}
}