//
// GameLevelManager::onUpdateThreadCompleted from 0x4c9190 to 0x4c93fe (622 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x4db7c4
//
// 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:36 +0000
//
int __fastcall GameLevelManager::onUpdateThreadCompleted(int a1, unsigned __int8 *a2, int a3)
{
const char *v3; // r9
cocos2d::CCDictionary *v5; // r10
bool v8; // nf
size_t v9; // r0
unsigned int v10; // r9
unsigned int v11; // r0
unsigned int v12; // r10
char *v13; // r0
const char *v14; // r9
char *v15; // r0
int v16; // r6
_BOOL4 v17; // r11
cocos2d::CCNotificationCenter *v18; // r0
cocos2d::CCObject *v19; // r0
int result; // r0
int v21; // r3
int v22; // r3
int v23; // r0
int v24; // r1
char *v25; // r2
const char *v26; // r0
GJAccountManager *v27; // r4
int v28; // r0
int v29; // r4
cocos2d::CCNotificationCenter *v30; // r0
int v31[3]; // [sp+Ch] [bp-20h] BYREF
int v32; // [sp+18h] [bp-14h] BYREF
int v33; // [sp+1Ch] [bp-10h]
char *v34; // [sp+20h] [bp-Ch]
v5 = *(cocos2d::CCDictionary **)(a1 + 748);
v8 = (*(_BYTE *)a3 & 1) != 0;
if ( (*(_BYTE *)a3 & 1) == 0 )
v3 = (const char *)(a3 + 1);
v32 = 0;
if ( v8 )
v3 = *(const char **)(a3 + 8);
v33 = 0;
v34 = nullptr;
v9 = strlen(v3);
std::string::__init(&v32, v3, v9);
cocos2d::CCDictionary::removeObjectForKey(v5);
std::string::~string((int)&v32);
v10 = std::string::find((unsigned __int8 *)a3, 95, 0);
v11 = std::string::rfind((unsigned __int8 *)a3, 95, 0xFFFFFFFF);
v12 = v11;
if ( v10 == -1 || v11 == -1 || v11 <= v10 )
{
v16 = 0;
v14 = nullptr;
}
else
{
std::string::basic_string(&v32, (unsigned __int8 *)a3, v10 + 1, v11 - 1 - v10);
if ( (v32 & 1) != 0 )
v13 = v34;
else
v13 = (char *)&v32 + 1;
v14 = (const char *)atoi(v13);
std::string::~string((int)&v32);
std::string::basic_string(&v32, (unsigned __int8 *)a3, v12 + 1, 0xFFFFFFFF);
if ( (v32 & 1) != 0 )
v15 = v34;
else
v15 = (char *)&v32 + 1;
v16 = atoi(v15);
std::string::~string((int)&v32);
}
v32 = 0;
v33 = 0;
v34 = nullptr;
std::string::__init(&v32, "-1", 2u);
v17 = sub_4A9CC4(a2, (unsigned __int8 *)&v32);
v18 = (cocos2d::CCNotificationCenter *)std::string::~string((int)&v32);
if ( v17 )
{
if ( v16 == 4 )
{
v19 = *(cocos2d::CCObject **)(a1 + 504);
if ( v19 )
{
cocos2d::CCObject::release(v19);
*(_DWORD *)(a1 + 504) = 0;
}
}
result = *(_DWORD *)(a1 + 840);
if ( result )
return (*(int (__fastcall **)(int, const char *, int))(*(_DWORD *)result + 36))(result, v14, v16);
}
else
{
switch ( v16 )
{
case 2:
v21 = *a2;
if ( (v21 & 1) != 0 )
v22 = *((_DWORD *)a2 + 1);
else
v22 = v21 >> 1;
if ( v22 == 1 && !std::string::compare(a2, 0, 0xFFFFFFFF, a1i2r3e45s789g, 1u) )
{
v32 = 0;
v33 = 0;
v34 = nullptr;
std::string::__init(&v32, &unk_B6B226, 0);
}
else
{
std::string::basic_string(v31, (int)a2);
LevelTools::base64DecodeString(&v32, v31);
v17 = 1;
}
if ( (*(_BYTE *)(a1 + 416) & 1) != 0 )
{
**(_BYTE **)(a1 + 424) = 0;
*(_DWORD *)(a1 + 420) = 0;
}
else
{
*(_BYTE *)(a1 + 417) = 0;
*(_BYTE *)(a1 + 416) = 0;
}
std::string::reserve((int *)(a1 + 416), 0);
v23 = v32;
v24 = v33;
v25 = v34;
v32 = 0;
v33 = 0;
v34 = nullptr;
*(_DWORD *)(a1 + 416) = v23;
*(_DWORD *)(a1 + 420) = v24;
*(_DWORD *)(a1 + 424) = v25;
v18 = (cocos2d::CCNotificationCenter *)std::string::~string((int)&v32);
if ( v17 )
v18 = (cocos2d::CCNotificationCenter *)std::string::~string((int)v31);
break;
case 3:
if ( (*a2 & 1) != 0 )
v26 = *((const char **)a2 + 2);
else
v26 = (const char *)(a2 + 1);
v27 = (GJAccountManager *)atoi(v26);
v28 = GJAccountManager::sharedState(v27);
v18 = (cocos2d::CCNotificationCenter *)GameLevelManager::userInfoForAccountID(
(cocos2d::CCDictionary **)a1,
*(_DWORD *)(v28 + 280) - *(_DWORD *)(v28 + 284));
if ( v18 && (int)v27 > 0 )
*((_DWORD *)v18 + 131) = (*((_DWORD *)v18 + 131) - (_DWORD)v27) & ~((*((_DWORD *)v18 + 131) - (int)v27) >> 31);
break;
case 4:
v18 = (cocos2d::CCNotificationCenter *)GameLevelManager::applyThreadAddReply(
(cocos2d::CCArray **)a1,
v14,
(int)a2);
break;
}
v29 = *(_DWORD *)(a1 + 840);
if ( v29 )
{
return (*(int (__fastcall **)(_DWORD, const char *, int))(*(_DWORD *)v29 + 32))(*(_DWORD *)(a1 + 840), v14, v16);
}
else
{
v30 = (cocos2d::CCNotificationCenter *)cocos2d::CCNotificationCenter::sharedNotificationCenter(v18);
return cocos2d::CCNotificationCenter::postNotification(v30, "ThreadsChangedNotification", nullptr);
}
}
return result;
}