//
// GameLevelManager::getMapPacks from 0x71d3fc to 0x71d758 (860 bytes)
//
// 2 xrefs:
// > LevelBrowserLayer::loadPage @ 0x6ea848
// > ??> @ 0x560b8
//
// 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::getMapPacks(GameLevelManager *a1, GJSearchObject *a2)
{
char *Key; // x21
unsigned int m_page; // w22
cocos2d::CCString *v6; // x0
const char *CString; // x0
cocos2d::CCString *v8; // x0
size_t v9; // x0
int *p_m_unknown2; // x0
char *v11; // x0
char *v12; // x0
char *v13; // x0
unsigned int *v14; // x1
int v15; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
const char *v22; // [xsp+48h] [xbp+48h]
char *v23; // [xsp+78h] [xbp+78h] BYREF
const char *v24; // [xsp+80h] [xbp+80h] BYREF
const char *v25; // [xsp+88h] [xbp+88h] BYREF
cocos2d::extension::CCHttpClient *v26; // [xsp+90h] [xbp+90h] BYREF
Key = (char *)GJSearchObject::getKey(a2);
if ( !GameLevelManager::isDLActive(a1, Key) )
{
GameLevelManager::addDLToActive(a1, Key);
GameLevelManager::getBasePostString(a1, (__int64)&v23);
m_page = a2->m_page;
v6 = (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(v6);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&page=%i&secret=%s",
(const char *)m_page,
CString);
v22 = cocos2d::CCString::getCString(v8);
v9 = strlen(v22);
sub_D15FD4(&v23, v22, v9);
sub_D153B8((int)&v24, "https://www.boomlings.com/database/getGJMapPacks21.php");
sub_D153B8((int)&v25, v23);
sub_D153B8((int)&v26, Key);
GameLevelManager::ProcessHttpRequest(a1, &v24, &v25, &v26, 3);
p_m_unknown2 = &v26[-1].m_unknown2;
if ( &v26[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v26[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v26[-1]._timeoutForConnect;
v26[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v11 = (char *)(v25 - 24);
if ( v25 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v25 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v25 - 2);
*((_DWORD *)v25 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v11);
}
v12 = (char *)(v24 - 24);
if ( v24 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v24 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v24 - 2);
*((_DWORD *)v24 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v12);
}
v13 = v23 - 24;
if ( v23 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v23 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v23 - 2);
*((_DWORD *)v23 - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v13);
}
}
}