//
// GameLevelManager::onGetLevelListsCompleted from 0x8489d4 to 0x848f40 (1388 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x85c5f0
// > ??> @ 0xe2798
//
// 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 12:55:22 +0000
//
__int64 __fastcall GameLevelManager::onGetLevelListsCompleted(__int64 **this, __int64 a2, char *a3)
{
char *v5; // x20
_BOOL4 v6; // w24
const char *v7; // x1
size_t v8; // x0
cocos2d::CCArray *v9; // x22
__int64 v10; // x0
cocos2d::CCString *v12; // x0
const char *CString; // x0
size_t v14; // x0
cocos2d::CCString *v15; // x0
size_t v16; // x0
cocos2d::CCString *v17; // x0
size_t v18; // x0
cocos2d::CCString *v19; // x0
size_t v20; // x0
cocos2d::CCArray *LevelLists; // x25
unsigned int *v22; // x1
GJLevelList **v23; // x22
__int64 v24; // x0
char *v25; // x24
__int64 *v26; // x22
__int64 v27; // x1
void (__fastcall *v28)(__int64 *, __int64 *, char *); // x27
__int64 v29; // x0
char *v30; // [xsp+68h] [xbp+68h]
char *v31; // [xsp+68h] [xbp+68h]
char *v32; // [xsp+68h] [xbp+68h]
char *v33; // [xsp+68h] [xbp+68h]
char *v34; // [xsp+68h] [xbp+68h]
__int64 v35; // [xsp+78h] [xbp+78h] BYREF
size_t v36; // [xsp+80h] [xbp+80h]
void *v37; // [xsp+88h] [xbp+88h]
__int64 v38; // [xsp+90h] [xbp+90h] BYREF
size_t v39; // [xsp+98h] [xbp+98h]
void *v40; // [xsp+A0h] [xbp+A0h]
__int64 v41; // [xsp+A8h] [xbp+A8h] BYREF
size_t v42; // [xsp+B0h] [xbp+B0h]
void *v43; // [xsp+B8h] [xbp+B8h]
__int64 v44[2]; // [xsp+C0h] [xbp+C0h] BYREF
void *v45; // [xsp+D0h] [xbp+D0h]
__int64 v46; // [xsp+D8h] [xbp+D8h] BYREF
size_t v47; // [xsp+E0h] [xbp+E0h]
void *v48; // [xsp+E8h] [xbp+E8h]
__int64 v49; // [xsp+F0h] [xbp+F0h] BYREF
size_t v50; // [xsp+F8h] [xbp+F8h]
void *v51; // [xsp+100h] [xbp+100h]
__int64 v52; // [xsp+108h] [xbp+108h] BYREF
size_t v53; // [xsp+110h] [xbp+110h]
void *v54; // [xsp+118h] [xbp+118h]
__int64 v55; // [xsp+120h] [xbp+120h] BYREF
size_t v56; // [xsp+128h] [xbp+128h]
void *v57; // [xsp+130h] [xbp+130h]
v5 = a3 + 1;
if ( (*a3 & 1) != 0 )
v5 = *((char **)a3 + 2);
GameLevelManager::removeDLFromActive((GameLevelManager *)this, v5);
v55 = 0;
v56 = 0;
v57 = nullptr;
std::string::__init(&v55, &word_117CE08, 2u);
v6 = sub_7FEA60(a2, (__int64)&v55);
if ( (v55 & 1) != 0 )
operator delete(v57);
if ( v6 )
goto LABEL_10;
v7 = (const char *)(a2 + 1);
if ( (*(_BYTE *)a2 & 1) != 0 )
v7 = *(const char **)(a2 + 16);
v30 = (char *)v7;
v55 = 0;
v56 = 0;
v57 = nullptr;
v8 = strlen(v7);
std::string::__init(&v55, v30, v8);
v9 = sub_80CFCC((unsigned __int8 *)&v55, "#");
if ( (v55 & 1) != 0 )
{
operator delete(v57);
if ( (unsigned int)cocos2d::CCArray::count(v9) <= 3 )
{
LABEL_10:
v10 = (__int64)*(this + 153);
if ( v10 )
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)v10 + 24LL))(v10, v5, 1);
return _stack_chk_guard;
}
}
else if ( (unsigned int)cocos2d::CCArray::count(v9) <= 3 )
{
goto LABEL_10;
}
v12 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 0);
CString = (const char *)cocos2d::CCString::getCString(v12);
v35 = 0;
v31 = (char *)CString;
v36 = 0;
v37 = nullptr;
v14 = strlen(CString);
std::string::__init(&v35, v31, v14);
v15 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 1u);
v32 = (char *)cocos2d::CCString::getCString(v15);
v38 = 0;
v39 = 0;
v40 = nullptr;
v16 = strlen(v32);
std::string::__init(&v38, v32, v16);
v17 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 2u);
v33 = (char *)cocos2d::CCString::getCString(v17);
v41 = 0;
v42 = 0;
v43 = nullptr;
v18 = strlen(v33);
std::string::__init(&v41, v33, v18);
v19 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v9, 3u);
v34 = (char *)cocos2d::CCString::getCString(v19);
v44[0] = 0;
v44[1] = 0;
v45 = nullptr;
v20 = strlen(v34);
std::string::__init(v44, v34, v20);
v46 = 0;
v47 = 0;
v48 = nullptr;
if ( (v38 & 1) != 0 )
{
std::string::__init(&v46, v40, v39);
}
else
{
v48 = v40;
v46 = v38;
v47 = v39;
}
GameLevelManager::storeUserNames(this, (unsigned __int8 *)&v46);
if ( (v46 & 1) != 0 )
operator delete(v48);
v49 = 0;
v50 = 0;
v51 = nullptr;
if ( (v35 & 1) != 0 )
{
std::string::__init(&v49, v37, v36);
}
else
{
v51 = v37;
v49 = v35;
v50 = v36;
}
LevelLists = GameLevelManager::createAndGetLevelLists((__int64)this, (char *)&v49);
if ( (v49 & 1) != 0 )
operator delete(v51);
if ( LevelLists )
{
v22 = *((unsigned int **)LevelLists + 7);
if ( *v22 )
{
v23 = *((GJLevelList ***)v22 + 2);
v24 = 8LL * *v22 - 8;
v25 = (char *)v23 + v24;
if ( v23 <= (GJLevelList **)((char *)v23 + v24) )
{
do
{
if ( !*v23 )
break;
GameLevelManager::updateSavedLevelList((GameLevelManager *)this, *v23++);
}
while ( v25 >= (char *)v23 );
}
}
}
v26 = *(this + 153);
if ( v26 )
{
v27 = *v26;
v52 = 0;
v53 = 0;
v54 = nullptr;
v28 = *(void (__fastcall **)(__int64 *, __int64 *, char *))(v27 + 32);
if ( (v41 & 1) != 0 )
{
std::string::__init(&v52, v43, v42);
}
else
{
v54 = v43;
v52 = v41;
v53 = v42;
}
v28(v26, &v52, v5);
if ( (v52 & 1) != 0 )
operator delete(v54);
}
v55 = 0;
v56 = 0;
v57 = nullptr;
if ( (v41 & 1) != 0 )
{
std::string::__init(&v55, v43, v42);
}
else
{
v57 = v43;
v55 = v41;
v56 = v42;
}
GameLevelManager::storeSearchResult((GameLevelManager *)this, LevelLists, (__int64)&v55, v5);
if ( (v55 & 1) != 0 )
operator delete(v57);
v29 = (__int64)*(this + 153);
if ( v29 )
(*(void (__fastcall **)(__int64, cocos2d::CCArray *, char *, __int64))(*(_QWORD *)v29 + 16LL))(
v29,
LevelLists,
v5,
1);
if ( (v44[0] & 1) != 0 )
operator delete(v45);
if ( (v41 & 1) != 0 )
operator delete(v43);
if ( (v38 & 1) != 0 )
operator delete(v40);
if ( (v35 & 1) != 0 )
operator delete(v37);
return _stack_chk_guard;
}