//
// GameLevelManager::onUploadLevelListCompleted from 0x10052abf0 to 0x10052adda (490 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051d383
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall GameLevelManager::onUploadLevelListCompleted(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD *v4; // r13
__int64 v5; // r12
_QWORD *v6; // rcx
_QWORD *v7; // rax
_QWORD *v8; // rcx
bool v9; // zf
const char *v10; // r15
int v11; // r15d
const char *v12; // r14
__int64 v13; // rax
unsigned int v14; // r14d
cocos2d::CCArray *v15; // r13
__int64 v16; // rsi
unsigned int v17; // r12d
__int64 (__fastcall ***v18)(_QWORD, __int64); // rdi
__int64 v19; // rbx
cocos2d::CCArray *m_localLists; // r13
__int64 v21; // rsi
unsigned int v22; // r12d
__int64 v23; // rax
v4 = (_QWORD *)(a1 + 320);
v5 = sub_10031E0A0(a1 + 320, (unsigned __int8 *)a3);
if ( v5 != a1 + 328 )
{
v6 = *(_QWORD **)(v5 + 8);
if ( v6 )
{
do
{
v7 = v6;
v6 = (_QWORD *)*v6;
}
while ( v6 );
}
else
{
v8 = (_QWORD *)v5;
do
{
v7 = (_QWORD *)v8[2];
v9 = *v7 == (_QWORD)v8;
v8 = v7;
}
while ( !v9 );
}
if ( *v4 == v5 )
*v4 = v7;
--*(_QWORD *)(a1 + 336);
sub_100165F60(*(__int64 **)(a1 + 328), (__int64 *)v5);
if ( (*(_BYTE *)(v5 + 32) & 1) != 0 )
operator delete(*(void **)(v5 + 48));
operator delete((void *)v5);
}
if ( (*(_BYTE *)a3 & 1) != 0 )
v10 = *(const char **)(a3 + 16);
else
v10 = (const char *)(a3 + 1);
v11 = atoi(v10);
if ( (*(_BYTE *)a2 & 1) != 0 )
v12 = *(const char **)(a2 + 16);
else
v12 = (const char *)(a2 + 1);
LODWORD(v13) = atoi(v12);
v14 = v13;
if ( (int)v13 < 0 )
{
v19 = *(_QWORD *)(a1 + 760);
if ( v19 )
{
m_localLists = LocalLevelManager::sharedState()->m_localLists;
v21 = 0;
if ( (unsigned int)sub_100720070(m_localLists) )
{
v22 = 0;
while ( 1 )
{
v23 = sub_1007200C0(m_localLists, v22);
if ( *(_DWORD *)(v23 + 540) == v11 )
break;
if ( ++v22 >= (unsigned int)sub_100720070(m_localLists) )
{
v21 = 0;
goto LABEL_36;
}
}
v21 = v23;
}
LABEL_36:
LODWORD(v13) = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v19 + 8LL))(v19, v21, v14);
}
}
else
{
v15 = LocalLevelManager::sharedState()->m_localLists;
LODWORD(v13) = sub_100720070(v15);
v16 = 0;
if ( !(_DWORD)v13 )
{
LABEL_24:
v18 = *(__int64 (__fastcall ****)(_QWORD, __int64))(a1 + 760);
if ( !v18 )
return v13;
goto LABEL_33;
}
v17 = 0;
while ( 1 )
{
v13 = sub_1007200C0(v15, v17);
if ( *(_DWORD *)(v13 + 540) == v11 )
break;
++v17;
LODWORD(v13) = sub_100720070(v15);
if ( v17 >= (unsigned int)v13 )
{
v16 = 0;
goto LABEL_24;
}
}
*(_DWORD *)(v13 + 344) = v14;
*(_BYTE *)(v13 + 395) = 1;
v16 = v13;
v18 = *(__int64 (__fastcall ****)(_QWORD, __int64))(a1 + 760);
if ( v18 )
LABEL_33:
LODWORD(v13) = (**v18)(v18, v16);
}
return v13;
}