//
// GameLevelManager::onGetOnlineLevelsCompleted from 0x8480c8 to 0x8489d4 (2316 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x85cb50
// > ??> @ 0x420a0
//
// 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::onGetOnlineLevelsCompleted(__int64 **this, __int64 a2, char *a3)
{
char *v5; // x25
_BOOL4 v6; // w21
const char *v7; // x1
size_t v8; // x0
cocos2d::CCArray *v9; // x20
__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::CCString *v21; // x0
size_t v22; // x0
MusicDownloadManager *v23; // x0
size_t v24; // x1
cocos2d::CCArray *Levels; // x24
unsigned int i; // w21
_DWORD *v27; // x20
cocos2d::CCString *v28; // x0
const char *v29; // x0
size_t v30; // x0
char *v31; // x1
char *v32; // x1
size_t v33; // x0
cocos2d::CCString *v34; // x0
size_t v35; // x0
cocos2d::CCString *v36; // x0
size_t v37; // x0
cocos2d::CCString *v38; // x0
size_t v39; // x0
char *v40; // x22
unsigned int v41; // w0
unsigned __int8 *v42; // x3
char *v43; // x2
__int64 *v44; // x20
__int64 v45; // x1
void (__fastcall *v46)(__int64 *, __int64 *, char *); // x22
void (__fastcall ***v47)(_QWORD, cocos2d::CCArray *, char *); // x0
__int64 v48; // x21
char *v49; // [xsp+88h] [xbp+88h]
char *v50; // [xsp+88h] [xbp+88h]
char *v51; // [xsp+88h] [xbp+88h]
char *v52; // [xsp+88h] [xbp+88h]
char *v53; // [xsp+88h] [xbp+88h]
char *v54; // [xsp+88h] [xbp+88h]
char *v55; // [xsp+88h] [xbp+88h]
char *v56; // [xsp+88h] [xbp+88h]
char *v57; // [xsp+88h] [xbp+88h]
char *v58; // [xsp+88h] [xbp+88h]
__int64 v59; // [xsp+90h] [xbp+90h] BYREF
size_t v60; // [xsp+98h] [xbp+98h]
void *v61; // [xsp+A0h] [xbp+A0h]
__int64 v62; // [xsp+A8h] [xbp+A8h] BYREF
size_t v63; // [xsp+B0h] [xbp+B0h]
void *v64; // [xsp+B8h] [xbp+B8h]
__int64 v65; // [xsp+C0h] [xbp+C0h] BYREF
size_t v66; // [xsp+C8h] [xbp+C8h]
void *v67; // [xsp+D0h] [xbp+D0h]
__int64 v68; // [xsp+D8h] [xbp+D8h] BYREF
size_t v69; // [xsp+E0h] [xbp+E0h]
void *v70; // [xsp+E8h] [xbp+E8h]
__int64 v71[2]; // [xsp+F0h] [xbp+F0h] BYREF
void *v72; // [xsp+100h] [xbp+100h]
__int64 v73; // [xsp+108h] [xbp+108h] BYREF
size_t v74; // [xsp+110h] [xbp+110h]
void *v75; // [xsp+118h] [xbp+118h]
__int64 v76[2]; // [xsp+120h] [xbp+120h] BYREF
void *v77; // [xsp+130h] [xbp+130h]
__int64 v78; // [xsp+138h] [xbp+138h] BYREF
size_t v79; // [xsp+140h] [xbp+140h]
void *v80; // [xsp+148h] [xbp+148h]
__int64 v81; // [xsp+150h] [xbp+150h] BYREF
size_t v82; // [xsp+158h] [xbp+158h]
void *v83; // [xsp+160h] [xbp+160h]
__int64 v84[2]; // [xsp+168h] [xbp+168h] BYREF
void *v85; // [xsp+178h] [xbp+178h]
__int64 v86; // [xsp+180h] [xbp+180h] BYREF
size_t v87; // [xsp+188h] [xbp+188h]
void *v88; // [xsp+190h] [xbp+190h]
__int64 v89; // [xsp+198h] [xbp+198h] BYREF
size_t v90; // [xsp+1A0h] [xbp+1A0h]
void *v91; // [xsp+1A8h] [xbp+1A8h]
unsigned __int8 v92[24]; // [xsp+1B0h] [xbp+1B0h] BYREF
unsigned __int8 v93[48]; // [xsp+1C8h] [xbp+1C8h] BYREF
v5 = a3 + 1;
if ( (*a3 & 1) != 0 )
v5 = *((char **)a3 + 2);
GameLevelManager::removeDLFromActive((GameLevelManager *)this, v5);
v89 = 0;
v90 = 0;
v91 = nullptr;
std::string::__init(&v89, &word_117CE08, 2u);
v6 = sub_7FEA60(a2, (__int64)&v89);
if ( (v89 & 1) != 0 )
operator delete(v91);
if ( v6 )
goto LABEL_10;
v7 = (const char *)(a2 + 1);
if ( (*(_BYTE *)a2 & 1) != 0 )
v7 = *(const char **)(a2 + 16);
v49 = (char *)v7;
v89 = 0;
v90 = 0;
v91 = nullptr;
v8 = strlen(v7);
std::string::__init(&v89, v49, v8);
v9 = sub_80CFCC((unsigned __int8 *)&v89, "#");
if ( (v89 & 1) != 0 )
{
operator delete(v91);
if ( (unsigned int)cocos2d::CCArray::count(v9) <= 4 )
{
LABEL_10:
v10 = (__int64)*(this + 153);
if ( v10 )
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v10 + 8LL))(v10, v5);
return _stack_chk_guard;
}
}
else if ( (unsigned int)cocos2d::CCArray::count(v9) <= 4 )
{
goto LABEL_10;
}
v12 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 0);
CString = (const char *)cocos2d::CCString::getCString(v12);
v59 = 0;
v60 = 0;
v61 = nullptr;
v50 = (char *)CString;
v14 = strlen(CString);
std::string::__init(&v59, v50, v14);
v15 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 1u);
v51 = (char *)cocos2d::CCString::getCString(v15);
v62 = 0;
v63 = 0;
v64 = nullptr;
v16 = strlen(v51);
std::string::__init(&v62, v51, v16);
v17 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 2u);
v52 = (char *)cocos2d::CCString::getCString(v17);
v65 = 0;
v66 = 0;
v67 = nullptr;
v18 = strlen(v52);
std::string::__init(&v65, v52, v18);
v19 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 3u);
v53 = (char *)cocos2d::CCString::getCString(v19);
v68 = 0;
v69 = 0;
v70 = nullptr;
v20 = strlen(v53);
std::string::__init(&v68, v53, v20);
v21 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v9, 4u);
v54 = (char *)cocos2d::CCString::getCString(v21);
v72 = nullptr;
v71[0] = 0;
v71[1] = 0;
v22 = strlen(v54);
std::string::__init(v71, v54, v22);
v23 = (MusicDownloadManager *)(unsigned __int8)v65;
v24 = (unsigned __int8)v65 >> 1;
if ( (v65 & 1) != 0 )
{
v23 = (MusicDownloadManager *)&v65;
v24 = v66;
}
if ( v24 )
{
v48 = MusicDownloadManager::sharedState(v23);
v73 = 0;
v74 = 0;
v75 = nullptr;
if ( (v65 & 1) != 0 )
{
std::string::__init(&v73, v67, v66);
}
else
{
v75 = v67;
v73 = v65;
v74 = v66;
}
v76[0] = 0;
v76[1] = 0;
v77 = nullptr;
std::string::__init(v76, &byte_11B8890, 0);
MusicDownloadManager::createSongsInfo(v48, &v73, v76);
if ( (v76[0] & 1) != 0 )
operator delete(v77);
if ( (v73 & 1) != 0 )
operator delete(v75);
}
v78 = 0;
v79 = 0;
v80 = nullptr;
if ( (v62 & 1) != 0 )
{
std::string::__init(&v78, v64, v63);
}
else
{
v80 = v64;
v78 = v62;
v79 = v63;
}
GameLevelManager::storeUserNames(this, (unsigned __int8 *)&v78);
if ( (v78 & 1) != 0 )
operator delete(v80);
v81 = 0;
v82 = 0;
v83 = nullptr;
if ( (v59 & 1) != 0 )
{
std::string::__init(&v81, v61, v60);
}
else
{
v83 = v61;
v81 = v59;
v82 = v60;
}
Levels = GameLevelManager::createAndGetLevels((__int64)this, (char *)&v81);
if ( (v81 & 1) != 0 )
operator delete(v83);
v84[0] = 0;
v84[1] = 0;
v85 = nullptr;
std::string::__init(v84, &byte_11B8890, 0);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(Levels); ++i )
{
v27 = (_DWORD *)cocos2d::CCArray::objectAtIndex(Levels, i);
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)(v27[82] - v27[83]));
v29 = (const char *)cocos2d::CCString::getCString(v28);
v89 = 0;
v90 = 0;
v91 = nullptr;
v55 = (char *)v29;
v30 = strlen(v29);
std::string::__init(&v89, v55, v30);
if ( (v89 & 1) != 0 )
{
if ( v90 )
{
v31 = (char *)v91;
LABEL_29:
std::string::push_back(v84, *v31);
if ( (v89 & 1) != 0 )
{
v32 = (char *)v91;
v33 = v90;
}
else
{
v33 = (unsigned __int8)v89 >> 1;
v32 = (char *)&v89 + 1;
}
std::string::push_back(v84, v32[v33 - 1]);
}
}
else
{
v31 = (char *)&v89 + 1;
if ( (int)(unsigned __int8)v89 >> 1 )
goto LABEL_29;
}
v34 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)(v27[237] - v27[238]));
v56 = (char *)cocos2d::CCString::getCString(v34);
v35 = strlen(v56);
std::string::append((__int64)v84, v56, v35);
v36 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)(v27[242] - v27[243]));
v57 = (char *)cocos2d::CCString::getCString(v36);
v37 = strlen(v57);
std::string::append((__int64)v84, v57, v37);
if ( (v89 & 1) != 0 )
operator delete(v91);
}
v38 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78,
"I25",
"fpAa",
112,
67,
"Qg");
v58 = (char *)cocos2d::CCString::getCString(v38);
v39 = strlen(v58);
std::string::append((__int64)v84, v58, v39);
v40 = (char *)v84 + 1;
if ( (v84[0] & 1) != 0 )
v40 = (char *)v85;
v41 = strlen(v40);
rtsha1::calc((rtsha1 *)v40, (const void *)v41, (__int64)v92, v42);
rtsha1::toHexString((rtsha1 *)v92, v93, v43);
v44 = *(this + 153);
if ( v44 )
{
v45 = *v44;
v86 = 0;
v87 = 0;
v88 = nullptr;
v46 = *(void (__fastcall **)(__int64 *, __int64 *, char *))(v45 + 32);
if ( (v68 & 1) != 0 )
{
std::string::__init(&v86, v70, v69);
}
else
{
v88 = v70;
v86 = v68;
v87 = v69;
}
v46(v44, &v86, v5);
if ( (v86 & 1) != 0 )
operator delete(v88);
}
GameLevelManager::saveFetchedLevels((GameLevelManager *)this, Levels);
v89 = 0;
v90 = 0;
v91 = nullptr;
if ( (v68 & 1) != 0 )
{
std::string::__init(&v89, v70, v69);
}
else
{
v91 = v70;
v89 = v68;
v90 = v69;
}
GameLevelManager::storeSearchResult((GameLevelManager *)this, Levels, (__int64)&v89, v5);
if ( (v89 & 1) != 0 )
operator delete(v91);
v47 = (void (__fastcall ***)(_QWORD, cocos2d::CCArray *, char *))*(this + 153);
if ( v47 )
(**v47)(v47, Levels, v5);
if ( (v84[0] & 1) != 0 )
operator delete(v85);
if ( (v71[0] & 1) != 0 )
operator delete(v72);
if ( (v68 & 1) != 0 )
operator delete(v70);
if ( (v65 & 1) != 0 )
operator delete(v67);
if ( (v62 & 1) != 0 )
operator delete(v64);
if ( (v59 & 1) != 0 )
operator delete(v61);
return _stack_chk_guard;
}