//
// GameLevelManager::getLevelRateInfo from 0x7257a4 to 0x725be4 (1088 bytes)
//
// 2 xrefs:
// > GJRateLevelLayer::init @ 0x8232ec
// > ??> @ 0x90258
//
// 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::getLevelRateInfo(GameLevelManager *a1, int a2)
{
cocos2d::CCString *v4; // x0
char *CString; // x0
char *v6; // x0
cocos2d::CCString *v7; // x0
const char *v8; // x0
cocos2d::CCString *v9; // x0
size_t v10; // x0
int *p_m_unknown2; // x0
char *v12; // x0
char *v13; // x0
char *v14; // x0
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x2
int v18; // w1
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
unsigned int *v25; // x1
int v26; // w2
const char *v27; // [xsp+48h] [xbp+48h]
char *v28; // [xsp+70h] [xbp+70h] BYREF
char *v29; // [xsp+78h] [xbp+78h] BYREF
const char *v30; // [xsp+80h] [xbp+80h] BYREF
const char *v31; // [xsp+88h] [xbp+88h] BYREF
cocos2d::extension::CCHttpClient *v32; // [xsp+90h] [xbp+90h] BYREF
v4 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"rinfo_%i", *(const char **)&a2);
CString = (char *)cocos2d::CCString::getCString(v4);
sub_D153B8((int)&v28, CString);
if ( GameLevelManager::isDLActive(a1, v28) )
{
v6 = v28 - 24;
if ( v28 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v28 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *((_DWORD *)v28 - 2);
*((_DWORD *)v28 - 2) = v18 - 1;
}
if ( v18 <= 0 )
LABEL_18:
operator delete(v6);
}
}
else
{
GameLevelManager::addDLToActive(a1, v28);
GameLevelManager::getBasePostString(a1, (__int64)&v29);
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
v8 = cocos2d::CCString::getCString(v7);
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&levelID=%i&secret=%s",
(const char *)(unsigned int)a2,
v8);
v27 = cocos2d::CCString::getCString(v9);
v10 = strlen(v27);
sub_D15FD4(&v29, v27, v10);
sub_D153B8((int)&v30, "https://www.boomlings.com/database/getLevelRateInfo.php");
sub_D153B8((int)&v31, v29);
sub_D18D28(&v32);
GameLevelManager::ProcessHttpRequest(a1, &v30, &v31, &v32, 65);
p_m_unknown2 = &v32[-1].m_unknown2;
if ( &v32[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v32[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v32[-1]._timeoutForConnect;
v32[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v12 = (char *)(v31 - 24);
if ( v31 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v31 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v12);
}
v13 = (char *)(v30 - 24);
if ( v30 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v30 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v13);
}
v14 = v29 - 24;
if ( v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v29 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v14);
}
v6 = v28 - 24;
if ( v28 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v28 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v28 - 2);
*((_DWORD *)v28 - 2) = v16 - 1;
}
if ( v16 <= 0 )
goto LABEL_18;
}
}
}