//
// GameLevelManager::getGauntlets from 0x71d758 to 0x71daa4 (844 bytes)
//
// 3 xrefs:
// > GauntletSelectLayer::onRefresh @ 0x918798
// > GauntletSelectLayer::init @ 0x91ce78
// > ??> @ 0x9c510
//
// 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 GameLevelManager::getGauntlets(GameLevelManager *a1)
{
cocos2d::CCString *v2; // x0
const char *CString; // x0
cocos2d::CCString *v4; // x0
size_t v5; // x0
int *p_m_unknown2; // x0
char *v7; // x0
char *v8; // x0
char *v9; // x0
unsigned int *v10; // x1
int v11; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x1
int v17; // w2
const char *v18; // [xsp+48h] [xbp+48h]
char *v19; // [xsp+78h] [xbp+78h] BYREF
const char *v20; // [xsp+80h] [xbp+80h] BYREF
const char *v21; // [xsp+88h] [xbp+88h] BYREF
cocos2d::extension::CCHttpClient *v22; // [xsp+90h] [xbp+90h] BYREF
if ( !GameLevelManager::isDLActive(a1, "get_gauntlets") )
{
GameLevelManager::addDLToActive(a1, "get_gauntlets");
GameLevelManager::getBasePostString(a1, (__int64)&v19);
v2 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
CString = cocos2d::CCString::getCString(v2);
v4 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&secret=%s&special=1&vkey=%i",
CString,
48);
v18 = cocos2d::CCString::getCString(v4);
v5 = strlen(v18);
sub_D15FD4(&v19, v18, v5);
sub_D153B8((int)&v20, "https://www.boomlings.com/database/getGJGauntlets21.php");
sub_D153B8((int)&v21, v19);
sub_D153B8((int)&v22, "get_gauntlets");
GameLevelManager::ProcessHttpRequest(a1, &v20, &v21, &v22, 52);
p_m_unknown2 = &v22[-1].m_unknown2;
if ( &v22[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v22[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v22[-1]._timeoutForConnect;
v22[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v7 = (char *)(v21 - 24);
if ( v21 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v21 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v21 - 2);
*((_DWORD *)v21 - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v7);
}
v8 = (char *)(v20 - 24);
if ( v20 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v20 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v20 - 2);
*((_DWORD *)v20 - 2) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v8);
}
v9 = v19 - 24;
if ( v19 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v19 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *((_DWORD *)v19 - 2);
*((_DWORD *)v19 - 2) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v9);
}
}
}