//
// GameLevelManager::onGetMapPacksCompleted from 0x81de7c to 0x81e55c (1760 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x85ca84
// > ??> @ 0x55000
//
// 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:54:59 +0000
//
__int64 __fastcall GameLevelManager::onGetMapPacksCompleted(__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::CCArray *MapPacks; // x24
unsigned int i; // w20
unsigned int *v21; // x21
cocos2d::CCString *v22; // x0
const char *v23; // x0
size_t v24; // x0
char *v25; // x1
char *v26; // x1
size_t v27; // x0
cocos2d::CCString *v28; // x0
size_t v29; // x0
cocos2d::CCString *v30; // x0
size_t v31; // x0
cocos2d::CCString *v32; // x0
size_t v33; // x0
char *v34; // x22
unsigned int v35; // w0
unsigned __int8 *v36; // x3
char *v37; // x2
size_t v38; // x0
_BOOL4 v39; // w20
__int64 v40; // x0
__int64 *v41; // x20
__int64 v42; // x1
void (__fastcall *v43)(__int64 *, __int64 *, char *); // x22
void (__fastcall ***v44)(_QWORD, cocos2d::CCArray *, char *); // x0
char *v45; // [xsp+78h] [xbp+78h]
char *v46; // [xsp+78h] [xbp+78h]
char *v47; // [xsp+78h] [xbp+78h]
char *v48; // [xsp+78h] [xbp+78h]
char *v49; // [xsp+78h] [xbp+78h]
char *v50; // [xsp+78h] [xbp+78h]
char *v51; // [xsp+78h] [xbp+78h]
char *v52; // [xsp+78h] [xbp+78h]
__int64 v53; // [xsp+80h] [xbp+80h] BYREF
size_t v54; // [xsp+88h] [xbp+88h]
void *v55; // [xsp+90h] [xbp+90h]
__int64 v56; // [xsp+98h] [xbp+98h] BYREF
size_t v57; // [xsp+A0h] [xbp+A0h]
void *v58; // [xsp+A8h] [xbp+A8h]
__int64 v59[2]; // [xsp+B0h] [xbp+B0h] BYREF
void *v60; // [xsp+C0h] [xbp+C0h]
__int64 v61; // [xsp+C8h] [xbp+C8h] BYREF
size_t v62; // [xsp+D0h] [xbp+D0h]
void *v63; // [xsp+D8h] [xbp+D8h]
__int64 v64[2]; // [xsp+E0h] [xbp+E0h] BYREF
void *v65; // [xsp+F0h] [xbp+F0h]
__int64 v66[2]; // [xsp+F8h] [xbp+F8h] BYREF
void *v67; // [xsp+108h] [xbp+108h]
__int64 v68; // [xsp+110h] [xbp+110h] BYREF
size_t v69; // [xsp+118h] [xbp+118h]
void *v70; // [xsp+120h] [xbp+120h]
__int64 v71; // [xsp+128h] [xbp+128h] BYREF
size_t v72; // [xsp+130h] [xbp+130h]
void *v73; // [xsp+138h] [xbp+138h]
unsigned __int8 v74[24]; // [xsp+140h] [xbp+140h] BYREF
unsigned __int8 v75[48]; // [xsp+158h] [xbp+158h] BYREF
v5 = a3 + 1;
if ( (*a3 & 1) != 0 )
v5 = *((char **)a3 + 2);
GameLevelManager::removeDLFromActive((GameLevelManager *)this, v5);
v71 = 0;
v72 = 0;
v73 = nullptr;
std::string::__init(&v71, &word_117CE08, 2u);
v6 = sub_7FEA60(a2, (__int64)&v71);
if ( (v71 & 1) != 0 )
operator delete(v73);
if ( v6 )
goto LABEL_10;
v7 = (const char *)(a2 + 1);
if ( (*(_BYTE *)a2 & 1) != 0 )
v7 = *(const char **)(a2 + 16);
v45 = (char *)v7;
v71 = 0;
v72 = 0;
v73 = nullptr;
v8 = strlen(v7);
std::string::__init(&v71, v45, v8);
v9 = sub_80CFCC((unsigned __int8 *)&v71, "#");
if ( (v71 & 1) != 0 )
{
operator delete(v73);
if ( (unsigned int)cocos2d::CCArray::count(v9) <= 2 )
{
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) <= 2 )
{
goto LABEL_10;
}
v12 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 0);
CString = (const char *)cocos2d::CCString::getCString(v12);
v53 = 0;
v46 = (char *)CString;
v54 = 0;
v55 = nullptr;
v14 = strlen(CString);
std::string::__init(&v53, v46, v14);
v15 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 1u);
v47 = (char *)cocos2d::CCString::getCString(v15);
v56 = 0;
v57 = 0;
v58 = nullptr;
v16 = strlen(v47);
std::string::__init(&v56, v47, v16);
v17 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v9, 2u);
v48 = (char *)cocos2d::CCString::getCString(v17);
v59[0] = 0;
v59[1] = 0;
v60 = nullptr;
v18 = strlen(v48);
std::string::__init(v59, v48, v18);
v61 = 0;
v62 = 0;
v63 = nullptr;
if ( (v53 & 1) != 0 )
{
std::string::__init(&v61, v55, v54);
}
else
{
v63 = v55;
v61 = v53;
v62 = v54;
}
MapPacks = GameLevelManager::createAndGetMapPacks((__int64)this, (char *)&v61);
if ( (v61 & 1) != 0 )
operator delete(v63);
v64[0] = 0;
v64[1] = 0;
v65 = nullptr;
std::string::__init(v64, &byte_11B8890, 0);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(MapPacks); ++i )
{
v21 = (unsigned int *)cocos2d::CCArray::objectAtIndex(MapPacks, i);
v22 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v21[82]);
v23 = (const char *)cocos2d::CCString::getCString(v22);
v71 = 0;
v72 = 0;
v73 = nullptr;
v49 = (char *)v23;
v24 = strlen(v23);
std::string::__init(&v71, v49, v24);
if ( (v71 & 1) != 0 )
{
if ( v72 )
{
v25 = (char *)v73;
LABEL_22:
std::string::push_back(v64, *v25);
if ( (v71 & 1) != 0 )
{
v26 = (char *)v73;
v27 = v72;
}
else
{
v27 = (unsigned __int8)v71 >> 1;
v26 = (char *)&v71 + 1;
}
std::string::push_back(v64, v26[v27 - 1]);
}
}
else
{
v25 = (char *)&v71 + 1;
if ( (int)(unsigned __int8)v71 >> 1 )
goto LABEL_22;
}
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v21[84]);
v50 = (char *)cocos2d::CCString::getCString(v28);
v29 = strlen(v50);
std::string::append((__int64)v64, v50, v29);
v30 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v21[85]);
v51 = (char *)cocos2d::CCString::getCString(v30);
v31 = strlen(v51);
std::string::append((__int64)v64, v51, v31);
if ( (v71 & 1) != 0 )
operator delete(v73);
}
v32 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78,
"I25",
"fpAa",
112,
67,
"Qg");
v52 = (char *)cocos2d::CCString::getCString(v32);
v33 = strlen(v52);
std::string::append((__int64)v64, v52, v33);
v34 = (char *)v64 + 1;
if ( (v64[0] & 1) != 0 )
v34 = (char *)v65;
v35 = strlen(v34);
rtsha1::calc((rtsha1 *)v34, (const void *)v35, (__int64)v74, v36);
rtsha1::toHexString((rtsha1 *)v74, v75, v37);
v66[0] = 0;
v66[1] = 0;
v67 = nullptr;
v38 = strlen((const char *)v75);
std::string::__init(v66, v75, v38);
v39 = sub_7FEA60((__int64)v59, (__int64)v66);
if ( (v66[0] & 1) != 0 )
operator delete(v67);
if ( v39 )
{
GameLevelManager::saveFetchedMapPacks((GameLevelManager *)this, MapPacks);
v41 = *(this + 153);
if ( v41 )
{
v42 = *v41;
v68 = 0;
v69 = 0;
v70 = nullptr;
v43 = *(void (__fastcall **)(__int64 *, __int64 *, char *))(v42 + 32);
if ( (v56 & 1) != 0 )
{
std::string::__init(&v68, v58, v57);
}
else
{
v70 = v58;
v68 = v56;
v69 = v57;
}
v43(v41, &v68, v5);
if ( (v68 & 1) != 0 )
operator delete(v70);
}
v71 = 0;
v72 = 0;
v73 = nullptr;
if ( (v56 & 1) != 0 )
{
std::string::__init(&v71, v58, v57);
}
else
{
v73 = v58;
v71 = v56;
v72 = v57;
}
GameLevelManager::storeSearchResult((GameLevelManager *)this, MapPacks, (__int64)&v71, v5);
if ( (v71 & 1) != 0 )
operator delete(v73);
v44 = (void (__fastcall ***)(_QWORD, cocos2d::CCArray *, char *))*(this + 153);
if ( v44 )
(**v44)(v44, MapPacks, v5);
}
else
{
v40 = (__int64)*(this + 153);
if ( v40 )
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v40 + 8LL))(v40, v5);
}
if ( (v64[0] & 1) != 0 )
operator delete(v65);
if ( (v59[0] & 1) != 0 )
operator delete(v60);
if ( (v56 & 1) != 0 )
operator delete(v58);
if ( (v53 & 1) != 0 )
operator delete(v55);
return _stack_chk_guard;
}