//
// GameLevelManager::levelControlInstances from 0x8138f0 to 0x813b34 (580 bytes)
//
// 3 xrefs:
// > GameLevelManager::setLevelControlsTemplate @ 0x81c9c8
// > GameLevelManager::onGetLevelControlsCompleted @ 0x833eec
// > ??> @ 0x43948
//
// 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:53 +0000
//
_QWORD *__usercall GameLevelManager::levelControlInstances@(
GameLevelManager *this@,
const char *a2@,
_QWORD *a3@)
{
unsigned int v4; // w22
__int64 SavedLevel; // x0
__int64 *v7; // x1
__int64 SavedGauntletLevel; // x0
__int64 *v9; // x1
__int64 v10; // x0
__int64 i; // x19
__int64 *v12; // x1
cocos2d::CCArray *v13; // x21
unsigned int v14; // w19
__int64 v15; // x0
__int64 *v16; // x1
__int64 v18; // [xsp+40h] [xbp+40h] BYREF
__int64 v19; // [xsp+48h] [xbp+48h] BYREF
__int64 v20; // [xsp+50h] [xbp+50h] BYREF
a3[1] = 0;
v4 = (unsigned int)a2;
a3[2] = 0;
*a3 = 0;
if ( (int)a2 > 0 )
{
SavedLevel = GameLevelManager::getSavedLevel(this, a2);
v18 = SavedLevel;
if ( SavedLevel )
{
v7 = (__int64 *)a3[1];
if ( v7 == (__int64 *)a3[2] )
{
std::vector::__push_back_slow_path((__int64)a3, &v18);
}
else
{
if ( v7 )
{
*v7 = SavedLevel;
v7 = (__int64 *)a3[1];
}
a3[1] = v7 + 1;
}
}
SavedGauntletLevel = GameLevelManager::getSavedGauntletLevel(this, (const char *)v4);
v19 = SavedGauntletLevel;
if ( SavedGauntletLevel )
{
v9 = (__int64 *)a3[1];
if ( v9 == (__int64 *)a3[2] )
{
std::vector::__push_back_slow_path((__int64)a3, &v19);
}
else
{
if ( v9 )
{
*v9 = SavedGauntletLevel;
v9 = (__int64 *)a3[1];
}
a3[1] = v9 + 1;
}
}
v10 = *((_QWORD *)this + 106);
if ( v10 )
{
v10 = *(_QWORD *)(v10 + 56);
if ( v10 )
{
for ( i = *(_QWORD *)(v10 + 288); ; i = *(_QWORD *)(i + 288) )
{
v10 = *(_QWORD *)(v10 + 264);
v20 = v10;
if ( !v10 || v4 != *(_DWORD *)(v10 + 328) - *(_DWORD *)(v10 + 332) )
goto LABEL_17;
v12 = (__int64 *)a3[1];
if ( v12 == (__int64 *)a3[2] )
break;
if ( v12 )
{
*v12 = v10;
v12 = (__int64 *)a3[1];
}
a3[1] = v12 + 1;
if ( !i )
goto LABEL_23;
LABEL_18:
v10 = i;
}
std::vector::__push_back_slow_path((__int64)a3, &v20);
LABEL_17:
if ( !i )
goto LABEL_23;
goto LABEL_18;
}
}
LABEL_23:
v13 = *(cocos2d::CCArray **)(LocalLevelManager::sharedState((LocalLevelManager *)v10) + 360);
v14 = 0;
while ( v14 < (unsigned int)cocos2d::CCArray::count(v13) )
{
v15 = cocos2d::CCArray::objectAtIndex(v13, v14);
v20 = v15;
if ( v4 == *(_DWORD *)(v15 + 328) - *(_DWORD *)(v15 + 332) )
{
v16 = (__int64 *)a3[1];
if ( v16 == (__int64 *)a3[2] )
{
std::vector::__push_back_slow_path((__int64)a3, &v20);
++v14;
}
else
{
if ( v16 )
{
*v16 = v15;
v16 = (__int64 *)a3[1];
}
++v14;
a3[1] = v16 + 1;
}
}
else
{
++v14;
}
}
}
return a3;
}