//
// GameLevelManager::onGetMapPacksCompleted from 0x4c426c to 0x4c45f2 (902 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x4da6aa
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:50:28 +0000
//
int __fastcall GameLevelManager::onGetMapPacksCompleted(GameLevelManager *a1, unsigned __int8 *a2, int a3)
{
char *v5; // r5
_BOOL4 v6; // r7
int v7; // r3
const char *v8; // r7
size_t v9; // r0
cocos2d::CCArray *v10; // r8
int result; // r0
cocos2d::CCString *v12; // r0
const char *CString; // r9
size_t v14; // r0
cocos2d::CCString *v15; // r0
const char *v16; // r9
size_t v17; // r0
cocos2d::CCString *v18; // r0
const char *v19; // r9
size_t v20; // r0
unsigned int i; // r11
const char **v22; // r10
cocos2d::CCString *v23; // r0
const char *v24; // r9
size_t v25; // r0
cocos2d::CCString *v26; // r0
char *v27; // r0
char *v28; // r3
char *v29; // r2
int v30; // r3
cocos2d::CCString *v31; // r0
char *v32; // r0
cocos2d::CCString *v33; // r0
char *v34; // r0
char *v35; // r10
const void *v36; // r0
unsigned __int8 *v37; // r3
char *v38; // r2
size_t v39; // r0
_BOOL4 v40; // r10
int v41; // r0
int v42; // r10
void (__fastcall *v43)(int, int *, char *); // r11
void (__fastcall ***v44)(_DWORD, cocos2d::CCArray *, char *); // r0
cocos2d::CCArray *MapPacks; // [sp+14h] [bp-C8h]
int v46[3]; // [sp+34h] [bp-A8h] BYREF
int v47[3]; // [sp+40h] [bp-9Ch] BYREF
int v48[3]; // [sp+4Ch] [bp-90h] BYREF
int v49[3]; // [sp+58h] [bp-84h] BYREF
int v50[2]; // [sp+64h] [bp-78h] BYREF
char *v51; // [sp+6Ch] [bp-70h]
int v52[3]; // [sp+70h] [bp-6Ch] BYREF
int v53[3]; // [sp+7Ch] [bp-60h] BYREF
int v54; // [sp+88h] [bp-54h] BYREF
int v55; // [sp+8Ch] [bp-50h]
char *v56; // [sp+90h] [bp-4Ch]
unsigned __int8 v57[20]; // [sp+94h] [bp-48h] BYREF
unsigned __int8 v58[44]; // [sp+A8h] [bp-34h] BYREF
if ( (*(_BYTE *)a3 & 1) != 0 )
v5 = *(char **)(a3 + 8);
else
v5 = (char *)(a3 + 1);
GameLevelManager::removeDLFromActive(a1, v5);
v54 = 0;
v55 = 0;
v56 = nullptr;
std::string::__init(&v54, "-1", 2u);
v6 = sub_4A9CC4(a2, (unsigned __int8 *)&v54);
std::string::~string((int)&v54);
if ( v6 )
goto LABEL_10;
v7 = *a2;
v8 = (const char *)(v7 << 31);
if ( (v7 & 1) == 0 )
v8 = (const char *)(a2 + 1);
v54 = 0;
if ( (v7 & 1) != 0 )
v8 = *((const char **)a2 + 2);
v55 = 0;
v56 = nullptr;
v9 = strlen(v8);
std::string::__init(&v54, v8, v9);
v10 = sub_4C1A88(&v54, "#");
std::string::~string((int)&v54);
if ( cocos2d::CCArray::count(v10) <= 2u )
{
LABEL_10:
result = *((_DWORD *)a1 + 205);
if ( result )
return (*(int (__fastcall **)(int, char *))(*(_DWORD *)result + 4))(result, v5);
return result;
}
v12 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v10, 0);
memset(v46, 0, sizeof(v46));
CString = (const char *)cocos2d::CCString::getCString(v12);
v14 = strlen(CString);
std::string::__init(v46, CString, v14);
v15 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v10, 1u);
v16 = (const char *)cocos2d::CCString::getCString(v15);
memset(v47, 0, sizeof(v47));
v17 = strlen(v16);
std::string::__init(v47, v16, v17);
v18 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v10, 2u);
v19 = (const char *)cocos2d::CCString::getCString(v18);
memset(v48, 0, sizeof(v48));
v20 = strlen(v19);
std::string::__init(v48, v19, v20);
std::string::basic_string(v49, (int)v46);
MapPacks = GameLevelManager::createAndGetMapPacks(a1, (int)v49);
std::string::~string((int)v49);
v50[0] = 0;
v50[1] = 0;
v51 = nullptr;
std::string::__init(v50, &unk_B6B226, 0);
for ( i = 0; i < cocos2d::CCArray::count(MapPacks); ++i )
{
v22 = (const char **)cocos2d::CCArray::objectAtIndex(MapPacks, i);
v23 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v22[67]);
v24 = (const char *)cocos2d::CCString::getCString(v23);
v54 = 0;
v55 = 0;
v56 = nullptr;
v25 = strlen(v24);
std::string::__init(&v54, v24, v25);
if ( (v54 & 1) != 0 )
{
if ( !v55 )
goto LABEL_16;
v28 = v56;
}
else
{
if ( !((unsigned __int8)v54 >> 1) )
goto LABEL_16;
v28 = (char *)&v54 + 1;
}
std::string::push_back(v50, *v28);
if ( (v54 & 1) != 0 )
{
v29 = v56;
v30 = v55;
}
else
{
v30 = (int)(unsigned __int8)v54 >> 1;
v29 = (char *)&v54 + 1;
}
std::string::push_back(v50, v29[v30 - 1]);
LABEL_16:
v26 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v22[69]);
v27 = (char *)cocos2d::CCString::getCString(v26);
std::string::append(v50, v27);
v31 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v22[70]);
v32 = (char *)cocos2d::CCString::getCString(v31);
std::string::append(v50, v32);
std::string::~string((int)&v54);
}
v33 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78,
"I25",
"fpAa",
112,
67,
"Qg");
v34 = (char *)cocos2d::CCString::getCString(v33);
std::string::append(v50, v34);
if ( (v50[0] & 1) != 0 )
v35 = v51;
else
v35 = (char *)v50 + 1;
v36 = (const void *)strlen(v35);
rtsha1::calc((rtsha1 *)v35, v36, (int)v57, v37);
rtsha1::toHexString((rtsha1 *)v57, v58, v38);
memset(v52, 0, sizeof(v52));
v39 = strlen((const char *)v58);
std::string::__init(v52, v58, v39);
v40 = sub_4A9CC4((unsigned __int8 *)v48, (unsigned __int8 *)v52);
std::string::~string((int)v52);
if ( v40 )
{
GameLevelManager::saveFetchedMapPacks(a1, MapPacks);
v42 = *((_DWORD *)a1 + 205);
if ( v42 )
{
v43 = *(void (__fastcall **)(int, int *, char *))(*(_DWORD *)v42 + 16);
std::string::basic_string(v53, (int)v47);
v43(v42, v53, v5);
std::string::~string((int)v53);
}
std::string::basic_string(&v54, (int)v47);
GameLevelManager::storeSearchResult(a1, MapPacks, COERCE_FLOAT(&v54), v5);
std::string::~string((int)&v54);
v44 = *((void (__fastcall ****)(_DWORD, cocos2d::CCArray *, char *))a1 + 205);
if ( v44 )
(**v44)(v44, MapPacks, v5);
}
else
{
v41 = *((_DWORD *)a1 + 205);
if ( v41 )
(*(void (__fastcall **)(int, char *))(*(_DWORD *)v41 + 4))(v41, v5);
}
std::string::~string((int)v50);
std::string::~string((int)v48);
std::string::~string((int)v47);
return std::string::~string((int)v46);
}