//
// GameLevelManager::onSearchThreadMessagesCompleted from 0x4c83a8 to 0x4c857e (470 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x4db794
//
// 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:33 +0000
//
int __fastcall GameLevelManager::onSearchThreadMessagesCompleted(int a1, int a2, _DWORD *a3)
{
const char *v3; // r9
cocos2d::CCDictionary *v6; // r10
char v8; // r2
size_t v9; // r0
cocos2d::CCArray *v10; // r0
cocos2d::CCArray *v11; // r9
cocos2d::CCString *v12; // r0
int v13; // r6
cocos2d::CCString *v14; // r0
const char *CString; // r0
_BOOL4 v16; // r9
int result; // r0
bool v18; // nf
size_t v19; // r0
cocos2d::CCArray *v20; // r5
cocos2d::CCString *v21; // r0
const char *v22; // r9
size_t v23; // r0
cocos2d::CCString *v24; // r0
_BOOL4 v25; // r9
cocos2d::CCArray *v26; // r11
cocos2d::CCArray *v27; // r10
signed int i; // r5
cocos2d::CCObject *v29; // r0
int v30; // r0
int v31; // [sp+0h] [bp-14h] BYREF
int v32; // [sp+4h] [bp-10h]
int v33; // [sp+8h] [bp-Ch]
v6 = *(cocos2d::CCDictionary **)(a1 + 748);
v8 = *(_BYTE *)a3;
v31 = 0;
v32 = 0;
if ( (v8 & 1) == 0 )
v3 = (char *)a3 + 1;
v33 = 0;
if ( (v8 & 1) != 0 )
v3 = (const char *)a3[2];
v9 = strlen(v3);
std::string::__init(&v31, v3, v9);
cocos2d::CCDictionary::removeObjectForKey(v6);
std::string::~string((int)&v31);
v10 = sub_4C1A88(a3, "_");
v11 = v10;
if ( v10 && cocos2d::CCArray::count(v10) > 2u )
{
v12 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v11, 1u);
v13 = cocos2d::CCString::intValue(v12);
v14 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v11, 2u);
CString = (const char *)cocos2d::CCString::getCString(v14);
*(_QWORD *)(a1 + 408) = atoll(CString);
}
else
{
v13 = 0;
}
v31 = 0;
v32 = 0;
v33 = 0;
std::string::__init(&v31, "-1", 2u);
v16 = sub_4A9CC4((unsigned __int8 *)a2, (unsigned __int8 *)&v31);
std::string::~string((int)&v31);
if ( v16 )
{
result = *(_DWORD *)(a1 + 840);
if ( result )
return (*(int (__fastcall **)(int, int))(*(_DWORD *)result + 20))(result, v13);
}
else
{
v18 = (*(_BYTE *)a2 & 1) != 0;
if ( (*(_BYTE *)a2 & 1) == 0 )
++a2;
v31 = 0;
if ( v18 )
a2 = *(_DWORD *)(a2 + 8);
v32 = 0;
v33 = 0;
v19 = strlen((const char *)a2);
std::string::__init(&v31, (const void *)a2, v19);
v20 = sub_4C1A88(&v31, "#");
std::string::~string((int)&v31);
if ( cocos2d::CCArray::count(v20) )
{
v21 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v20, 0);
v22 = (const char *)cocos2d::CCString::getCString(v21);
}
else
{
v22 = (const char *)&unk_B6B226;
}
v31 = 0;
v32 = 0;
v33 = 0;
v23 = strlen(v22);
std::string::__init(&v31, v22, v23);
if ( cocos2d::CCArray::count(v20) <= 1u )
{
v25 = 0;
}
else
{
v24 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v20, 1u);
v25 = cocos2d::CCString::intValue(v24) != 0;
}
v26 = sub_4C81AC((char *)&v31);
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v26);
for ( i = cocos2d::CCArray::count(v26) - 1; i >= 0; --i )
{
v29 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v26, i);
cocos2d::CCArray::addObject(v27, v29);
}
v30 = *(_DWORD *)(a1 + 840);
if ( v30 )
(*(void (__fastcall **)(int, int, cocos2d::CCArray *, _BOOL4, int, int, int))(*(_DWORD *)v30 + 16))(
v30,
v13,
v27,
v25,
v31,
v32,
v33);
return std::string::~string((int)&v31);
}
return result;
}