//
// GameLevelManager::rateStars from 0x71eb0c to 0x71f300 (2036 bytes)
//
// 2 xrefs:
// > RateStarsLayer::onRate @ 0x824748
// > ??> @ 0x474d8
//
// 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::rateStars(GameLevelManager *a1, int a2, int a3)
{
GameManager *v6; // x0
cocos2d::CCString *v7; // x0
const char *CString; // x0
cocos2d::CCString *v9; // x0
size_t v10; // x0
size_t v11; // x0
char *v12; // x27
GJAccountManager *v13; // x0
unsigned int v14; // w25
__int64 v15; // x26
GameManager *v16; // x0
unsigned int v17; // w24
cocos2d::CCString *v18; // x0
const char *v19; // x0
cocos2d::CCString *v20; // x0
char *v21; // x0
void *v22; // x0
char *v23; // x25
unsigned int v24; // w0
unsigned __int8 *v25; // x3
char *v26; // x2
char *v27; // x0
void *v28; // x0
cocos2d::CCString *v29; // x0
char *v30; // x0
int *p_m_unknown2; // x0
char *v32; // x0
char *v33; // x0
void *v34; // x0
char *v35; // x0
char *v36; // x0
char *v37; // x0
unsigned int *v38; // x1
int v39; // w2
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v48; // x1
int v49; // w2
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x1
int v57; // w2
const char *v58; // [xsp+68h] [xbp+68h]
char *v59; // [xsp+68h] [xbp+68h]
char *v60; // [xsp+80h] [xbp+80h] BYREF
char *v61; // [xsp+88h] [xbp+88h] BYREF
char *v62; // [xsp+90h] [xbp+90h] BYREF
__int64 v63; // [xsp+98h] [xbp+98h] BYREF
__int64 v64; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v65; // [xsp+A8h] [xbp+A8h] BYREF
std::string v66; // [xsp+B0h] [xbp+B0h] BYREF
const char *v67; // [xsp+B8h] [xbp+B8h] BYREF
const char *v68; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::extension::CCHttpClient *v69; // [xsp+C8h] [xbp+C8h] BYREF
unsigned __int8 v70[24]; // [xsp+D0h] [xbp+D0h] BYREF
unsigned __int8 v71[48]; // [xsp+E8h] [xbp+E8h] BYREF
std::string v72; // 0:x2.8
v6 = GameManager::sharedState();
GameManager::reportAchievementWithID(v6, "geometry.ach.rateDiff", 100, 0);
if ( !GameLevelManager::hasRatedLevelStars(a1, a2) )
{
GameLevelManager::markLevelAsRatedStars(a1, a2);
GameLevelManager::getBasePostString(a1, (__int64)&v60);
v7 = (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(v7);
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&levelID=%i&stars=%i&secret=%s",
(const char *)(unsigned int)a2,
(unsigned int)a3,
CString);
v58 = cocos2d::CCString::getCString(v9);
v10 = strlen(v58);
sub_D15FD4(&v60, v58, v10);
gen_random(10, (__int64)&v61);
sub_D15FD4(&v60, "&rs=", 4);
v59 = v61;
v11 = strlen(v61);
sub_D15FD4(&v60, v59, v11);
v12 = v61;
v13 = GJAccountManager::sharedState();
v14 = v13->m_accountID - v13->m_unkInt1;
GameManager::sharedState();
sub_D18D28(&v63);
v15 = v63;
v16 = GameManager::sharedState();
v17 = v16->m_playerUserID.random - v16->m_playerUserID.seed;
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78 + 1,
"sg6",
"pUrt",
106,
110,
"0J");
v19 = cocos2d::CCString::getCString(v18);
v20 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i%i%s%i%s%i%s",
(const char *)(unsigned int)a2,
(unsigned int)a3,
v12,
v14,
v15,
v17,
v19);
v21 = (char *)cocos2d::CCString::getCString(v20);
sub_D153B8((int)&v62, v21);
v22 = (void *)(v63 - 24);
if ( (__int64 *)(v63 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v63 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *(_DWORD *)(v63 - 8);
*(_DWORD *)(v63 - 8) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v22);
}
v23 = v62;
v24 = strlen(v62);
rtsha1::calc((rtsha1 *)v23, (const void *)v24, (__int64)v70, v25);
rtsha1::toHexString((rtsha1 *)v70, v71, v26);
sub_D153B8((int)&v65, (char *)v71);
sub_D153B8((int)&v66, "58281");
cocos2d::ZipUtils::base64EncodeEnc((cocos2d::ZipUtils *)&v65, &v66, v72);
v27 = (char *)v66.m_data.m_data - 24;
if ( (__int64 *)v66.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)((char *)v66.m_data.m_data - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v66.m_data.m_data - 2);
*((_DWORD *)v66.m_data.m_data - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v27);
}
v28 = (void *)(v65 - 24);
if ( (__int64 *)(v65 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)(v65 - 8);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *(_DWORD *)(v65 - 8);
*(_DWORD *)(v65 - 8) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v28);
}
sub_D15FD4(&v60, "&chk=", 5);
sub_D15E14(&v60, &v64);
sub_D153B8((int)&v67, "https://www.boomlings.com/database/rateGJStars211.php");
sub_D153B8((int)&v68, v60);
v29 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)a2);
v30 = (char *)cocos2d::CCString::getCString(v29);
sub_D153B8((int)&v69, v30);
GameLevelManager::ProcessHttpRequest(a1, &v67, &v68, &v69, 6);
p_m_unknown2 = &v69[-1].m_unknown2;
if ( &v69[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v69[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v69[-1]._timeoutForConnect;
v69[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v32 = (char *)(v68 - 24);
if ( v68 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(v68 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *((_DWORD *)v68 - 2);
*((_DWORD *)v68 - 2) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v32);
}
v33 = (char *)(v67 - 24);
if ( v67 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v67 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *((_DWORD *)v67 - 2);
*((_DWORD *)v67 - 2) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v33);
}
v34 = (void *)(v64 - 24);
if ( (__int64 *)(v64 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)(v64 - 8);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *(_DWORD *)(v64 - 8);
*(_DWORD *)(v64 - 8) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v34);
}
v35 = v62 - 24;
if ( v62 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(v62 - 8);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v35);
}
v36 = v61 - 24;
if ( v61 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(v61 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *((_DWORD *)v61 - 2);
*((_DWORD *)v61 - 2) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v36);
}
v37 = v60 - 24;
if ( v60 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)(v60 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *((_DWORD *)v60 - 2);
*((_DWORD *)v60 - 2) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v37);
}
}
}