//
// GameLevelManager::rateStars from 0x4bd6f0 to 0x4bda00 (784 bytes)
//
// 1 xrefs:
// > RateStarsLayer::onRate @ 0x569432
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:50:19 +0000
//
int __fastcall GameLevelManager::rateStars(GameLevelManager *this, const char *a2, int a3)
{
GameManager *v6; // r0
int result; // r0
cocos2d::CCString *v8; // r0
int CString; // r0
cocos2d::CCString *v10; // r0
char *v11; // r0
int v12; // r2
int v13; // r3
char *v14; // r1
GJAccountManager *v15; // r0
char *v16; // r9
GameManager *v17; // r0
int v18; // r8
int v19; // r0
int *v20; // r0
const char *v21; // r11
int v22; // r0
int v23; // r7
cocos2d::CCString *v24; // r0
int v25; // r0
cocos2d::CCString *v26; // r0
const char *v27; // r8
size_t v28; // r0
char *v29; // r8
const void *v30; // r0
unsigned __int8 *v31; // r3
char *v32; // r2
size_t v33; // r0
char *v34; // r1
size_t v35; // r2
size_t v36; // r0
cocos2d::CCString *v37; // r0
const char *v38; // r11
size_t v39; // r0
char *v40[3]; // [sp+1Ch] [bp-C0h] BYREF
int v41[2]; // [sp+28h] [bp-B4h] BYREF
char *v42; // [sp+30h] [bp-ACh]
int v43[2]; // [sp+34h] [bp-A8h] BYREF
char *v44; // [sp+3Ch] [bp-A0h]
int v45[3]; // [sp+40h] [bp-9Ch] BYREF
unsigned __int8 v46; // [sp+4Ch] [bp-90h] BYREF
char v47; // [sp+4Dh] [bp-8Fh] BYREF
size_t v48; // [sp+50h] [bp-8Ch]
char *v49; // [sp+54h] [bp-88h]
int v50[3]; // [sp+58h] [bp-84h] BYREF
int v51[3]; // [sp+64h] [bp-78h] BYREF
int v52[3]; // [sp+70h] [bp-6Ch] BYREF
int v53[3]; // [sp+7Ch] [bp-60h] BYREF
int v54[3]; // [sp+88h] [bp-54h] BYREF
unsigned __int8 v55[20]; // [sp+94h] [bp-48h] BYREF
unsigned __int8 v56[44]; // [sp+A8h] [bp-34h] BYREF
v6 = (GameManager *)GameManager::sharedState(this);
GameManager::reportAchievementWithID(v6, "geometry.ach.rateDiff", (const char *)&dword_64, 0);
result = GameLevelManager::hasRatedLevelStars(this, a2);
if ( !result )
{
GameLevelManager::markLevelAsRatedStars((cocos2d::CCDictionary **)this, a2);
GameLevelManager::getBasePostString((GameLevelManager *)v40);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_54 + 3,
"mfd",
"2893",
103,
98,
&a1i2r3e45s789g[9]);
CString = cocos2d::CCString::getCString(v8);
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&levelID=%i&stars=%i&secret=%s",
a2,
a3,
CString);
v11 = (char *)cocos2d::CCString::getCString(v10);
std::string::append(v40, v11);
gen_random(v41, 10, v12, v13);
std::string::append(v40, "&rs=");
if ( (v41[0] & 1) != 0 )
v14 = v42;
else
v14 = (char *)v41 + 1;
v15 = (GJAccountManager *)std::string::append(v40, v14);
if ( (v41[0] & 1) != 0 )
v16 = v42;
else
v16 = (char *)v41 + 1;
v17 = (GameManager *)GJAccountManager::sharedState(v15);
v18 = *((_DWORD *)v17 + 70) - *((_DWORD *)v17 + 71);
v19 = GameManager::sharedState(v17);
v20 = std::string::basic_string(v45, v19 + 436);
if ( (v45[0] & 1) != 0 )
v21 = (const char *)v45[2];
else
v21 = (char *)v45 + 1;
v22 = GameManager::sharedState((GameManager *)v20);
v23 = *(_DWORD *)(v22 + 464) - *(_DWORD *)(v22 + 468);
v24 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78 + 1,
"sg6",
"pUrt",
106,
110,
"0J");
v25 = cocos2d::CCString::getCString(v24);
v26 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i%i%s%i%s%i%s",
a2,
a3,
v16,
v18,
v21,
v23,
v25);
v27 = (const char *)cocos2d::CCString::getCString(v26);
v43[0] = 0;
v43[1] = 0;
v44 = nullptr;
v28 = strlen(v27);
std::string::__init(v43, v27, v28);
std::string::~string((int)v45);
if ( (v43[0] & 1) != 0 )
v29 = v44;
else
v29 = (char *)v43 + 1;
v30 = (const void *)strlen(v29);
rtsha1::calc((rtsha1 *)v29, v30, (int)v55, v31);
rtsha1::toHexString((rtsha1 *)v55, v56, v32);
memset(v50, 0, sizeof(v50));
v33 = strlen((const char *)v56);
std::string::__init(v50, v56, v33);
memset(v51, 0, sizeof(v51));
std::string::__init(v51, "58281", 5u);
cocos2d::ZipUtils::base64EncodeEnc(&v46, v50, v51);
std::string::~string((int)v51);
std::string::~string((int)v50);
std::string::append(v40, "&chk=");
if ( (v46 & 1) != 0 )
{
v34 = v49;
v35 = v48;
}
else
{
v35 = (int)v46 >> 1;
v34 = &v47;
}
std::string::append(v40, v34, v35);
memset(v52, 0, sizeof(v52));
std::string::__init(v52, "https://www.boomlings.com/database/rateGJStars211.php", 0x35u);
if ( ((int)v40[0] & 1) == 0 )
v21 = (char *)v40 + 1;
v53[0] = 0;
if ( ((int)v40[0] & 1) != 0 )
v21 = v40[2];
v53[1] = 0;
v53[2] = 0;
v36 = strlen(v21);
std::string::__init(v53, v21, v36);
v37 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", a2);
v38 = (const char *)cocos2d::CCString::getCString(v37);
memset(v54, 0, sizeof(v54));
v39 = strlen(v38);
std::string::__init(v54, v38, v39);
GameLevelManager::ProcessHttpRequest(this, v52, (int)v53, (int)v54, 6);
std::string::~string((int)v54);
std::string::~string((int)v53);
std::string::~string((int)v52);
std::string::~string((int)&v46);
std::string::~string((int)v43);
std::string::~string((int)v41);
return std::string::~string((int)v40);
}
return result;
}