//
// GameLevelManager::rateStars from 0x140153ac0 to 0x14015414d (1677 bytes)
//
// 2 xrefs:
// > RateStarsLayer::onRate @ 0x1403cacd1
// > ??> @ 0x1406ca8cc
//
// 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
//
// Hidden C++ exception states: #wind=15
void GameLevelManager::rateStars(GameLevelManager *a1, int a2, int a3)
{
bool v3; // r9
GameManager *v7; // rcx
cocos2d::CCString *v8; // rax
const char *CString; // rax
size_t v10; // r15
size_t v11; // r8
__int64 v12; // rcx
void *v13; // rcx
cocos2d::CCString *v14; // rax
const char *v15; // rax
cocos2d::CCString *v16; // rax
char *v17; // rax
size_t v18; // r8
void **v19; // rdx
size_t v20; // r8
__int64 v21; // rdx
__int64 v22; // rax
int v23; // r14d
const char *v24; // rsi
GJAccountManager *v25; // rax
int v26; // edi
void **v27; // rbx
cocos2d::CCString *v28; // rax
const char *v29; // rax
cocos2d::CCString *v30; // rax
const char *v31; // rax
size_t v32; // r8
void **v33; // rax
void **v34; // rcx
__int64 v35; // rdx
size_t v36; // r8
void *v37; // rcx
void **v38; // rdx
cocos2d::CCString *v39; // rax
const char *v40; // rax
size_t v41; // r8
_QWORD *v42; // rdx
void *v43; // rcx
__int64 v44; // [rsp+20h] [rbp-E0h]
__int64 v45; // [rsp+28h] [rbp-D8h]
void *v46; // [rsp+40h] [rbp-C0h]
void *v47; // [rsp+40h] [rbp-C0h]
void *v48; // [rsp+40h] [rbp-C0h]
__int128 v50; // [rsp+50h] [rbp-B0h] BYREF
__int64 v51; // [rsp+60h] [rbp-A0h]
__int64 v52; // [rsp+68h] [rbp-98h]
void *Block[2]; // [rsp+78h] [rbp-88h] BYREF
__int64 v54; // [rsp+88h] [rbp-78h]
unsigned __int64 v55; // [rsp+90h] [rbp-70h]
__int128 v56; // [rsp+98h] [rbp-68h] BYREF
__int64 v57; // [rsp+A8h] [rbp-58h]
unsigned __int64 v58; // [rsp+B0h] [rbp-50h]
void *v59[2]; // [rsp+B8h] [rbp-48h] BYREF
__int64 v60; // [rsp+C8h] [rbp-38h]
unsigned __int64 v61; // [rsp+D0h] [rbp-30h]
void *v62[2]; // [rsp+D8h] [rbp-28h] BYREF
__int64 v63; // [rsp+E8h] [rbp-18h]
unsigned __int64 v64; // [rsp+F0h] [rbp-10h]
_QWORD Src[4]; // [rsp+F8h] [rbp-8h] BYREF
void *v66[3]; // [rsp+118h] [rbp+18h] BYREF
unsigned __int64 v67; // [rsp+130h] [rbp+30h]
void *v68[4]; // [rsp+138h] [rbp+38h] BYREF
__int128 v69; // [rsp+158h] [rbp+58h] BYREF
__int64 v70; // [rsp+168h] [rbp+68h]
__int64 v71; // [rsp+170h] [rbp+70h]
v7 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v46 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v46);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = (GameManager *)qword_1406C2ED8;
}
GameManager::reportAchievementWithID(v7, "geometry.ach.rateDiff", 100, v3);
if ( !GameLevelManager::hasRatedLevelStars(a1, a2) )
{
if ( cocos2d::CCDictionary::count(a1->m_ratedLevels) >= 0x3E8 )
{
cocos2d::CCDictionary::getFirstKey(a1->m_ratedLevels, &v56);
cocos2d::CCDictionary::removeObjectForKey(a1->m_ratedLevels, &v56);
sub_14003A830((__int64)&v56);
}
v8 = cocos2d::CCString::createWithFormat("%i", a2);
CString = cocos2d::CCString::getCString(v8);
*(_OWORD *)Block = 0;
v54 = 0;
v55 = 0;
v10 = -1;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003A930(Block, CString, v11);
cocos2d::CCDictionary::setObject(a1->m_ratedLevels, a1->m_trueString, Block);
if ( v55 > 0xF )
{
v13 = Block[0];
if ( v55 + 1 >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v13);
}
GameLevelManager::getBasePostString(v12, Src);
v14 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, (const char *)&word_140531E88);
v15 = cocos2d::CCString::getCString(v14);
v16 = cocos2d::CCString::createWithFormat("&levelID=%i&stars=%i&secret=%s", a2, a3, v15);
v17 = (char *)cocos2d::CCString::getCString(v16);
v18 = -1;
do
++v18;
while ( v17[v18] );
sub_140041270(Src, v17, v18);
sub_140142B90(v66, 0xAu);
sub_140041270(Src, "&rs=", 4u);
v19 = v66;
if ( v67 > 0xF )
v19 = (void **)v66[0];
v20 = -1;
do
++v20;
while ( *((_BYTE *)v19 + v20) );
sub_140041270(Src, v19, v20);
v21 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v47 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v47);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v21 = qword_1406C2ED8;
}
sub_14003BDB0((__int64)&v56, v21 + 584);
v22 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v48 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v48);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v22 = qword_1406C2ED8;
}
v23 = *(_DWORD *)(v22 + 652) - *(_DWORD *)(v22 + 656);
v24 = (const char *)&v56;
if ( v58 > 0xF )
v24 = (const char *)v56;
v25 = GJAccountManager::sharedState();
v26 = v25->m_accountID - v25->m_unkInt1;
v27 = v66;
if ( v67 > 0xF )
v27 = (void **)v66[0];
LODWORD(v45) = 110;
LODWORD(v44) = 106;
v28 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 121, "sg6", "pUrt", v44, v45, "0J");
v29 = cocos2d::CCString::getCString(v28);
v30 = cocos2d::CCString::createWithFormat("%i%i%s%i%s%i%s", a2, a3, (const char *)v27, v26, v24, v23, v29);
v31 = cocos2d::CCString::getCString(v30);
*(_OWORD *)v62 = 0;
v63 = 0;
v64 = 0;
v32 = -1;
do
++v32;
while ( v31[v32] );
sub_14003A930(v62, v31, v32);
sub_14003A830((__int64)&v56);
v33 = v62;
if ( v64 <= 0xF )
{
v34 = v62;
}
else
{
v34 = (void **)v62[0];
v33 = (void **)v62[0];
}
v35 = -1;
do
++v35;
while ( *((_BYTE *)v33 + v35) );
sub_140070860((__int64)v34, v35, v59);
sub_140070B30((unsigned __int8 *)v59, &v69);
*(_OWORD *)v59 = 0;
v60 = 0;
v61 = 0;
v36 = -1;
do
++v36;
while ( *((_BYTE *)&v69 + v36) );
sub_14003A930(v59, &v69, v36);
v50 = 0;
v51 = 5;
v52 = 15;
strcpy((char *)&v50, "58281");
cocos2d::ZipUtils::base64EncodeEnc(v68, v59, &v50);
if ( v61 > 0xF )
{
v37 = v59[0];
if ( v61 + 1 >= 0x1000 )
{
v37 = *((void **)v59[0] - 1);
if ( (unsigned __int64)((char *)v59[0] - (char *)v37 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v37);
}
v60 = 0;
v61 = 15;
LOBYTE(v59[0]) = 0;
sub_140041270(Src, "&chk=", 5u);
v38 = v68;
if ( v68[3] > (void *)0xF )
v38 = (void **)v68[0];
sub_140041270(Src, v38, (size_t)v68[2]);
v39 = cocos2d::CCString::createWithFormat("%i", a2);
v40 = cocos2d::CCString::getCString(v39);
v69 = 0;
v70 = 0;
v71 = 0;
v41 = -1;
do
++v41;
while ( v40[v41] );
sub_14003A930(&v69, v40, v41);
v42 = Src;
if ( Src[3] > 0xFu )
v42 = (_QWORD *)Src[0];
v56 = 0;
v57 = 0;
v58 = 0;
do
++v10;
while ( *((_BYTE *)v42 + v10) );
sub_14003A930(&v56, v42, v10);
*(_OWORD *)Block = 0;
v54 = 0;
v55 = 15;
Block[0] = sub_14003AA10(0x40u);
v54 = 53;
v55 = 63;
strcpy((char *)Block[0], "https://www.boomlings.com/database/rateGJStars211.php");
GameLevelManager::ProcessHttpRequest(a1, (__int64)Block, (const char *)&v56, (const char *)&v69, 6);
sub_14003A830((__int64)v68);
if ( v64 > 0xF )
{
v43 = v62[0];
if ( v64 + 1 >= 0x1000 )
{
v43 = *((void **)v62[0] - 1);
if ( (unsigned __int64)((char *)v62[0] - (char *)v43 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v43);
}
sub_14003A830((__int64)v66);
sub_14003A830((__int64)Src);
}
}