//
// GameLevelManager::onGetGauntletsCompleted from 0x100090a74 to 0x100090e30 (956 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x1000888a8
//
// 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
//
void __fastcall GameLevelManager::onGetGauntletsCompleted(GameLevelManager *a1, char *a2, __int64 a3)
{
const char *v3; // x19
_BOOL4 v6; // w0
_BOOL4 v7; // w22
LevelManagerDelegate *m_levelManagerDelegate; // x0
_QWORD *v9; // x0
cocos2d::CCArray *v10; // x21
cocos2d::CCString *v11; // x0
char *CString; // x0
cocos2d::CCString *v13; // x0
char *v14; // x0
void *v15; // x0
__int64 MapPacks; // x21
__int64 i; // x22
__int64 v18; // x24
cocos2d::CCString *v19; // x0
const char *v20; // x0
const std::string::value_type *p_dst; // x1
std::string::size_type v22; // x2
cocos2d::CCString *v23; // x0
const char *v24; // x0
std::string *v25; // x22
size_t v26; // x0
__int64 j; // x22
GJMapPack *v28; // x0
LevelManagerDelegate *v29; // x0
void *v30[2]; // [xsp+30h] [xbp-110h] BYREF
char v31; // [xsp+47h] [xbp-F9h]
std::string v32; // [xsp+48h] [xbp-F8h] BYREF
void *__p[2]; // [xsp+60h] [xbp-E0h] BYREF
__int64 v34; // [xsp+70h] [xbp-D0h]
void *v35; // [xsp+80h] [xbp-C0h] BYREF
char v36; // [xsp+97h] [xbp-A9h]
void *v37[2]; // [xsp+98h] [xbp-A8h] BYREF
__int64 v38; // [xsp+A8h] [xbp-98h]
__int128 __dst; // [xsp+B0h] [xbp-90h] BYREF
__int64 v40; // [xsp+C0h] [xbp-80h]
_BYTE v41[20]; // [xsp+E4h] [xbp-5Ch] BYREF
v3 = (const char *)a3;
if ( *(char *)(a3 + 23) < 0 )
v3 = *(const char **)a3;
GameLevelManager::removeDLFromActive(a1, v3);
sub_100009900(&__dst, "-1");
v6 = sub_1000045BC(a2, &__dst);
v7 = v6;
if ( SHIBYTE(v40) < 0 )
{
operator delete((void *)__dst);
if ( v7 )
{
LABEL_5:
m_levelManagerDelegate = a1->m_levelManagerDelegate;
if ( !m_levelManagerDelegate )
return;
goto LABEL_6;
}
}
else if ( v6 )
{
goto LABEL_5;
}
if ( a2[23] < 0 )
a2 = *(char **)a2;
v9 = sub_100009900(&__dst, a2);
v10 = (cocos2d::CCArray *)sub_100093338(v9, "#");
if ( SHIBYTE(v40) < 0 )
operator delete((void *)__dst);
if ( (unsigned int)sub_10024A36C(v10) > 1 )
{
v11 = (cocos2d::CCString *)sub_10024A388(v10, 0);
CString = (char *)cocos2d::CCString::getCString(v11);
sub_100009900(v37, CString);
v13 = cocos2d::CCArray::stringAtIndex(v10, 1u);
v14 = (char *)cocos2d::CCString::getCString(v13);
v15 = sub_100009900(&v35, v14);
if ( SHIBYTE(v38) < 0 )
{
v15 = sub_1000097D0(__p, v37[0], (unsigned __int64)v37[1]);
}
else
{
*(_OWORD *)__p = *(_OWORD *)v37;
v34 = v38;
}
MapPacks = GameLevelManager::createAndGetMapPacks(v15, __p);
if ( SHIBYTE(v34) < 0 )
operator delete(__p[0]);
sub_100009900(&v32, "");
for ( i = 0; (unsigned int)i < (unsigned int)sub_10024A36C(MapPacks); i = (unsigned int)(i + 1) )
{
v18 = sub_10024A388(MapPacks, i);
v19 = (cocos2d::CCString *)sub_100268F4C("%i", *(_DWORD *)(v18 + 328));
v20 = cocos2d::CCString::getCString(v19);
std::string::append(&v32, v20);
if ( *(char *)(v18 + 391) < 0 )
{
sub_1000097D0(&__dst, *(void **)(v18 + 368), *(_QWORD *)(v18 + 376));
}
else
{
__dst = *(_OWORD *)(v18 + 368);
v40 = *(_QWORD *)(v18 + 384);
}
if ( v40 >= 0 )
p_dst = (const std::string::value_type *)&__dst;
else
p_dst = (const std::string::value_type *)__dst;
if ( v40 >= 0 )
v22 = HIBYTE(v40);
else
v22 = *((_QWORD *)&__dst + 1);
std::string::append(&v32, p_dst, v22);
if ( SHIBYTE(v40) < 0 )
operator delete((void *)__dst);
}
v23 = (cocos2d::CCString *)sub_100268F4C("%c%s%s%c%c%s", 120, "I25", "fpAa", 112, 67, "Qg");
v24 = cocos2d::CCString::getCString(v23);
v25 = &v32;
std::string::append(&v32, v24);
if ( (v32.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v25 = (std::string *)v32.__r_.__value_.__r.__words[0];
v26 = strlen((const char *)v25);
sub_1000F7448(v25, v26, v41);
sub_1000F78E0(v41, &__dst);
for ( j = 0; (unsigned int)j < (unsigned int)sub_10024A36C(MapPacks); j = (unsigned int)(j + 1) )
{
v28 = (GJMapPack *)sub_10024A388(MapPacks, j);
v28->m_isGauntlet = 1;
GameLevelManager::saveGauntlet(a1, v28);
}
sub_100009900(v30, "");
GameLevelManager::storeSearchResult(a1, MapPacks, v30, v3);
if ( v31 < 0 )
operator delete(v30[0]);
v29 = a1->m_levelManagerDelegate;
if ( v29 )
((void (__fastcall *)(LevelManagerDelegate *, __int64, const char *))v29->loadLevelsFinished)(v29, MapPacks, v3);
if ( SHIBYTE(v32.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v32.__r_.__value_.__l.__data_);
if ( v36 < 0 )
operator delete(v35);
if ( SHIBYTE(v38) < 0 )
operator delete(v37[0]);
}
else
{
m_levelManagerDelegate = a1->m_levelManagerDelegate;
if ( m_levelManagerDelegate )
LABEL_6:
((void (__fastcall *)(LevelManagerDelegate *, const char *))m_levelManagerDelegate->loadLevelsFailed)(
m_levelManagerDelegate,
v3);
}
}