//
// GameLevelManager::rateStars from 0x140233da0 to 0x1402345b7 (2071 bytes)
//
// 2 xrefs:
// > RateStarsLayer::onRate @ 0x14055f0dc
// > ??> @ 0x14091bf5c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:28:31 +0000
//
// Hidden C++ exception states: #wind=16
void __fastcall GameLevelManager::rateStars(__int64 a1, unsigned int a2, int a3)
{
__int64 v6; // rdi
__int64 v7; // rbx
cocos2d::CCString *v8; // rax
int v9; // ebx
void *v10; // r8
__int64 v11; // rax
cocos2d::CCString *v12; // rax
const char *CString; // rax
size_t v14; // r15
size_t v15; // r8
__int64 v16; // rcx
void *v17; // rcx
cocos2d::CCString *v18; // rax
const char *v19; // rax
cocos2d::CCString *v20; // rax
char *v21; // rax
size_t v22; // r8
void **v23; // rdx
size_t v24; // r8
__int64 v25; // rdx
__int64 v26; // rcx
__int64 v27; // rax
int v28; // r14d
const char *v29; // rsi
__int64 v30; // rax
int v31; // edi
void **v32; // rbx
cocos2d::CCString *v33; // rax
const char *v34; // rax
cocos2d::CCString *v35; // rax
const char *v36; // rax
size_t v37; // r8
void **v38; // r8
void **v39; // r9
__int64 v40; // rdx
size_t v41; // r8
void *v42; // rcx
void **v43; // rdx
cocos2d::CCString *v44; // rax
const char *v45; // rax
size_t v46; // r8
_QWORD *v47; // rdx
void *v48; // rcx
uintptr_t Reserved; // [rsp+20h] [rbp-E0h]
__int64 v50; // [rsp+28h] [rbp-D8h]
void *v51; // [rsp+40h] [rbp-C0h]
void *v52; // [rsp+40h] [rbp-C0h]
void *v53; // [rsp+40h] [rbp-C0h]
__int128 v55; // [rsp+50h] [rbp-B0h] BYREF
__int64 v56; // [rsp+60h] [rbp-A0h]
__int64 v57; // [rsp+68h] [rbp-98h]
void *Block[2]; // [rsp+78h] [rbp-88h] BYREF
__int64 v59; // [rsp+88h] [rbp-78h]
unsigned __int64 v60; // [rsp+90h] [rbp-70h]
void *v61[2]; // [rsp+98h] [rbp-68h] BYREF
__int64 v62; // [rsp+A8h] [rbp-58h]
unsigned __int64 v63; // [rsp+B0h] [rbp-50h]
__int128 v64; // [rsp+B8h] [rbp-48h] BYREF
__int64 v65; // [rsp+C8h] [rbp-38h]
unsigned __int64 v66; // [rsp+D0h] [rbp-30h]
void *v67[2]; // [rsp+D8h] [rbp-28h] BYREF
__int64 v68; // [rsp+E8h] [rbp-18h]
unsigned __int64 v69; // [rsp+F0h] [rbp-10h]
_QWORD Src[4]; // [rsp+F8h] [rbp-8h] BYREF
void *v71[3]; // [rsp+118h] [rbp+18h] BYREF
unsigned __int64 v72; // [rsp+130h] [rbp+30h]
void *v73[4]; // [rsp+138h] [rbp+38h] BYREF
__int128 v74; // [rsp+158h] [rbp+58h] BYREF
__int64 v75; // [rsp+168h] [rbp+68h]
__int64 v76; // [rsp+170h] [rbp+70h]
v6 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v51 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v51);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v6 = qword_14090BFD0;
}
v7 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
Block[0] = sub_14003D460(0x20u);
v59 = 21;
v60 = 31;
strcpy((char *)Block[0], "geometry.ach.rateDiff");
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v7 + 352), Block);
v9 = cocos2d::CCString::intValue(v8);
if ( v60 > 0xF )
{
v10 = Block[0];
if ( v60 + 1 >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v10);
}
if ( v9 < 100 )
{
*(_OWORD *)Block = 0;
v59 = 0;
v60 = 0;
Block[0] = sub_14003D460(0x20u);
v59 = 21;
v60 = 31;
strcpy((char *)Block[0], "geometry.ach.rateDiff");
GameManager::completedAchievement(v6, Block);
v11 = AchievementManager::sharedState();
AchievementManager::reportAchievementWithID(v11, (__int64)"geometry.ach.rateDiff", 100);
}
if ( !(unsigned __int8)GameLevelManager::hasRatedLevelStars(a1, a2) )
{
if ( cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(a1 + 904)) >= 0x3E8 )
{
cocos2d::CCDictionary::getFirstKey(*(_QWORD *)(a1 + 904), &v64);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 904), &v64);
sub_14003D310((__int64)&v64);
}
v12 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, a2);
CString = cocos2d::CCString::getCString(v12);
*(_OWORD *)v61 = 0;
v62 = 0;
v63 = 0;
v14 = -1;
v15 = -1;
do
++v15;
while ( CString[v15] );
sub_14003D230(v61, CString, v15);
cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 904), *(_QWORD *)(a1 + 1648), v61);
if ( v63 > 0xF )
{
v17 = v61[0];
if ( v63 + 1 >= 0x1000 )
{
v17 = *((void **)v61[0] - 1);
if ( (unsigned __int64)((char *)v61[0] - (char *)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
GameLevelManager::getBasePostString(v16, Src);
v18 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, (const char *)&word_14070D040);
v19 = cocos2d::CCString::getCString(v18);
v20 = cocos2d::CCString::createWithFormat("&levelID=%i&stars=%i&secret=%s", a2, a3, v19);
v21 = (char *)cocos2d::CCString::getCString(v20);
v22 = -1;
do
++v22;
while ( v21[v22] );
sub_140044D80(Src, v21, v22);
sub_1402190E0(v71, 0xAu);
sub_140044D80(Src, "&rs=", 4u);
v23 = v71;
if ( v72 > 0xF )
v23 = (void **)v71[0];
v24 = -1;
do
++v24;
while ( *((_BYTE *)v23 + v24) );
sub_140044D80(Src, v23, v24);
v25 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v52 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v52);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v25 = qword_14090BFD0;
}
sub_14003F4F0((__int64)&v64, v25 + 624);
v27 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v53 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v53);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v27 = qword_14090BFD0;
}
v28 = *(_DWORD *)(v27 + 692) - *(_DWORD *)(v27 + 696);
v29 = (const char *)&v64;
if ( v66 > 0xF )
v29 = (const char *)v64;
v30 = GJAccountManager::sharedState(v26);
v31 = *(_DWORD *)(v30 + 360) - *(_DWORD *)(v30 + 364);
v32 = v71;
if ( v72 > 0xF )
v32 = (void **)v71[0];
LODWORD(v50) = 110;
LODWORD(Reserved) = 106;
v33 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 121, "sg6", "pUrt", Reserved, v50, "0J");
v34 = cocos2d::CCString::getCString(v33);
v35 = cocos2d::CCString::createWithFormat("%i%i%s%i%s%i%s", a2, a3, (const char *)v32, v31, v29, v28, v34);
v36 = cocos2d::CCString::getCString(v35);
*(_OWORD *)Block = 0;
v59 = 0;
v60 = 0;
v37 = -1;
do
++v37;
while ( v36[v37] );
sub_14003D230(Block, v36, v37);
sub_14003D310((__int64)&v64);
v38 = Block;
if ( v60 > 0xF )
v38 = (void **)Block[0];
v39 = Block;
if ( v60 > 0xF )
v39 = (void **)Block[0];
v40 = -1;
do
++v40;
while ( *((_BYTE *)v38 + v40) );
sub_14007E1A0((__int64)v39, v40, v67);
sub_14007E470((unsigned __int8 *)v67, &v74);
*(_OWORD *)v67 = 0;
v68 = 0;
v69 = 0;
v41 = -1;
do
++v41;
while ( *((_BYTE *)&v74 + v41) );
sub_14003D230(v67, &v74, v41);
v55 = 0;
v56 = 5;
v57 = 15;
strcpy((char *)&v55, "58281");
cocos2d::ZipUtils::base64EncodeEnc(v73, v67, &v55);
if ( v69 > 0xF )
{
v42 = v67[0];
if ( v69 + 1 >= 0x1000 )
{
v42 = *((void **)v67[0] - 1);
if ( (unsigned __int64)((char *)v67[0] - (char *)v42 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v42);
}
v68 = 0;
v69 = 15;
LOBYTE(v67[0]) = 0;
sub_140044D80(Src, "&chk=", 5u);
v43 = v73;
if ( v73[3] > (void *)0xF )
v43 = (void **)v73[0];
sub_140044D80(Src, v43, (size_t)v73[2]);
v44 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, a2);
v45 = cocos2d::CCString::getCString(v44);
v74 = 0;
v75 = 0;
v76 = 0;
v46 = -1;
do
++v46;
while ( v45[v46] );
sub_14003D230(&v74, v45, v46);
v47 = Src;
if ( Src[3] > 0xFu )
v47 = (_QWORD *)Src[0];
v64 = 0;
v65 = 0;
v66 = 0;
do
++v14;
while ( *((_BYTE *)v47 + v14) );
sub_14003D230(&v64, v47, v14);
*(_OWORD *)v61 = 0;
v62 = 0;
v63 = 0;
v61[0] = sub_14003D460(0x40u);
v62 = 53;
v63 = 63;
strcpy((char *)v61[0], "https://www.boomlings.com/database/rateGJStars211.php");
GameLevelManager::ProcessHttpRequest(
(cocos2d::CCActionManager **)a1,
(__int64)v61,
(const char *)&v64,
(const char *)&v74,
6u);
sub_14003D310((__int64)v73);
if ( v60 > 0xF )
{
v48 = Block[0];
if ( v60 + 1 >= 0x1000 )
{
v48 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v48 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v48);
}
sub_14003D310((__int64)v71);
sub_14003D310((__int64)Src);
}
}