//
// GameLevelManager::getGauntletLevels from 0x71daa4 to 0x71dfa0 (1276 bytes)
//
// 2 xrefs:
// > GauntletLayer::init @ 0x91f978
// > ??> @ 0x5d9a8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void GameLevelManager::getGauntletLevels(GameLevelManager *a1, int a2)
{
char *v4; // x0
cocos2d::CCString *v5; // x0
size_t v6; // x0
cocos2d::CCString *v7; // x0
size_t v8; // x0
int *p_m_unknown2; // x0
char *v10; // x0
char *v11; // x0
void *v12; // x0
char *v13; // x0
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x2
int v17; // w1
unsigned int *v18; // x1
int v19; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
const char *CString; // [xsp+48h] [xbp+48h]
const char *v29; // [xsp+48h] [xbp+48h]
char *v30; // [xsp+78h] [xbp+78h] BYREF
char *v31; // [xsp+80h] [xbp+80h] BYREF
__int64 v32; // [xsp+88h] [xbp+88h] BYREF
const char *v33; // [xsp+90h] [xbp+90h] BYREF
const char *v34; // [xsp+98h] [xbp+98h] BYREF
cocos2d::extension::CCHttpClient *v35; // [xsp+A0h] [xbp+A0h] BYREF
GameLevelManager::getGauntletSearchKey(a1, *(const char **)&a2, (__int64)&v30);
if ( GameLevelManager::isDLActive(a1, v30) )
{
v4 = v30 - 24;
if ( v30 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v30 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v17 - 1;
}
if ( v17 <= 0 )
LABEL_14:
operator delete(v4);
}
}
else
{
GameLevelManager::addDLToActive(a1, v30);
GameLevelManager::getBasePostString(a1, (__int64)&v31);
sub_D15FD4(&v31, "&gauntlet=", 10);
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)a2);
CString = cocos2d::CCString::getCString(v5);
v6 = strlen(CString);
sub_D15FD4(&v31, CString, v6);
sub_D15FD4(&v31, "&secret=", 8);
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
v29 = cocos2d::CCString::getCString(v7);
v8 = strlen(v29);
sub_D15FD4(&v31, v29, v8);
sub_D153B8((int)&v32, "aHR0cDovL3d3dy5ib29tbGluZ3MuY29tL2RhdGFiYXNlL2dldEdKTGV2ZWxzMjEucGhw");
LevelTools::base64DecodeString((cocos2d::ZipUtils *)&v32, &v33);
sub_D153B8((int)&v34, v31);
sub_D153B8((int)&v35, v30);
GameLevelManager::ProcessHttpRequest(a1, &v33, &v34, &v35, 2);
p_m_unknown2 = &v35[-1].m_unknown2;
if ( &v35[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v35[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v35[-1]._timeoutForConnect;
v35[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v10 = (char *)(v34 - 24);
if ( v34 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v34 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v34 - 2);
*((_DWORD *)v34 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v10);
}
v11 = (char *)(v33 - 24);
if ( v33 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v33 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v33 - 2);
*((_DWORD *)v33 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v11);
}
v12 = (void *)(v32 - 24);
if ( (__int64 *)(v32 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v32 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v32 - 8);
*(_DWORD *)(v32 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v12);
}
v13 = v31 - 24;
if ( v31 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v31 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v13);
}
v4 = v30 - 24;
if ( v30 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v30 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v15 - 1;
}
if ( v15 <= 0 )
goto LABEL_14;
}
}
}