//
// GameLevelManager::onGetGauntletsCompleted from 0x81af14 to 0x81b27c (872 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x85c6e8
// > ??> @ 0xc4b40
//
// 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:58 +0000
//
__int64 __fastcall GameLevelManager::onGetGauntletsCompleted(GameLevelManager *this, __int64 a2, char *a3)
{
char *v5; // x23
_BOOL4 v6; // w20
const char *v7; // x1
size_t v8; // x0
cocos2d::CCArray *v9; // x19
cocos2d::CCString *v10; // x0
const char *CString; // x0
size_t v12; // x0
cocos2d::CCArray *MapPacks; // x20
int v14; // w19
unsigned int i; // w19
GJMapPack *v16; // x0
void (__fastcall ***v17)(_QWORD, cocos2d::CCArray *, char *); // x0
__int64 v18; // x0
char *v20; // [xsp+58h] [xbp+58h]
char *v21; // [xsp+58h] [xbp+58h]
__int64 v22; // [xsp+60h] [xbp+60h] BYREF
size_t v23; // [xsp+68h] [xbp+68h]
void *v24; // [xsp+70h] [xbp+70h]
__int64 v25; // [xsp+78h] [xbp+78h] BYREF
size_t v26; // [xsp+80h] [xbp+80h]
void *v27; // [xsp+88h] [xbp+88h]
__int64 v28; // [xsp+90h] [xbp+90h] BYREF
__int64 v29; // [xsp+98h] [xbp+98h]
void *v30; // [xsp+A0h] [xbp+A0h]
v5 = a3 + 1;
if ( (*a3 & 1) != 0 )
v5 = *((char **)a3 + 2);
GameLevelManager::removeDLFromActive(this, v5);
v28 = 0;
v29 = 0;
v30 = nullptr;
std::string::__init(&v28, &word_117CE08, 2u);
v6 = sub_7FEA60(a2, (__int64)&v28);
if ( (v28 & 1) != 0 )
operator delete(v30);
if ( v6 )
goto LABEL_28;
v7 = (const char *)(a2 + 1);
if ( (*(_BYTE *)a2 & 1) != 0 )
v7 = *(const char **)(a2 + 16);
v20 = (char *)v7;
v28 = 0;
v29 = 0;
v30 = nullptr;
v8 = strlen(v7);
std::string::__init(&v28, v20, v8);
v9 = sub_80CFCC((unsigned __int8 *)&v28, "#");
if ( (v28 & 1) != 0 )
{
operator delete(v30);
if ( (unsigned int)cocos2d::CCArray::count(v9) > 1 )
goto LABEL_10;
LABEL_28:
v18 = *((_QWORD *)this + 153);
if ( v18 )
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v18 + 8LL))(v18, v5);
return _stack_chk_guard;
}
if ( (unsigned int)cocos2d::CCArray::count(v9) <= 1 )
goto LABEL_28;
LABEL_10:
v10 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, 0);
CString = (const char *)cocos2d::CCString::getCString(v10);
v22 = 0;
v21 = (char *)CString;
v23 = 0;
v24 = nullptr;
v12 = strlen(CString);
std::string::__init(&v22, v21, v12);
v25 = 0;
v26 = 0;
v27 = nullptr;
if ( (v22 & 1) != 0 )
{
std::string::__init(&v25, v24, v23);
}
else
{
v27 = v24;
v25 = v22;
v26 = v23;
}
MapPacks = GameLevelManager::createAndGetMapPacks((__int64)this, (char *)&v25);
if ( (v25 & 1) != 0 )
operator delete(v27);
v14 = cocos2d::CCArray::count(MapPacks) - 1;
if ( v14 >= 0 )
{
do
{
while ( *(int *)(cocos2d::CCArray::objectAtIndex(MapPacks, v14) + 328) <= 62 )
{
if ( --v14 == -1 )
goto LABEL_19;
}
cocos2d::CCArray::removeObjectAtIndex(MapPacks, v14--, 1);
}
while ( v14 != -1 );
}
LABEL_19:
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(MapPacks); ++i )
{
v16 = (GJMapPack *)cocos2d::CCArray::objectAtIndex(MapPacks, i);
*((_BYTE *)v16 + 404) = 1;
GameLevelManager::saveGauntlet(this, v16);
}
v28 = 0;
v29 = 0;
v30 = nullptr;
std::string::__init(&v28, &byte_11B8890, 0);
GameLevelManager::storeSearchResult(this, MapPacks, (__int64)&v28, v5);
if ( (v28 & 1) != 0 )
operator delete(v30);
v17 = *((void (__fastcall ****)(_QWORD, cocos2d::CCArray *, char *))this + 153);
if ( v17 )
(**v17)(v17, MapPacks, v5);
if ( (v22 & 1) != 0 )
operator delete(v24);
return _stack_chk_guard;
}