//
// GameLevelManager::rateDemon from 0x1000a18a8 to 0x1000a1ab4 (524 bytes)
//
// 1 xrefs:
// > RateDemonLayer::onRate @ 0x10042689c
//
// 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
//
bool __fastcall GameLevelManager::rateDemon(GameLevelManager *a1, int a2, int a3, bool a4)
{
_BOOL4 v4; // w21
cocos2d::CCString *v8; // x0
char *CString; // x20
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // x24
__int64 v11; // x0
__int64 v12; // x24
cocos2d::CCDictionary *v14; // x24
cocos2d::CCNode *v15; // x25
cocos2d::CCString *v16; // x0
const char *v17; // x0
cocos2d::CCString *v18; // x0
const char *v19; // x0
std::string *v20; // x1
void *__p[2]; // [xsp+30h] [xbp-A0h] BYREF
char v22; // [xsp+47h] [xbp-89h]
void *v23[2]; // [xsp+48h] [xbp-88h] BYREF
char v24; // [xsp+5Fh] [xbp-71h]
std::string v25; // [xsp+60h] [xbp-70h] BYREF
std::string v26; // [xsp+78h] [xbp-58h] BYREF
v4 = a4;
if ( !a4 )
{
if ( GameLevelManager::hasRatedDemon(a1, a2) )
return 0;
GameLevelManager::markLevelAsRatedDemon(a1, a2);
}
v8 = (cocos2d::CCString *)sub_100268F4C("rd_%i_%i", a2, a3);
CString = (char *)cocos2d::CCString::getCString(v8);
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
sub_100009900(&v26, CString);
v11 = cocos2d::CCDictionary::objectForKey_1(m_friendReqAndUserBlocks, &v26);
v12 = v11;
if ( SHIBYTE(v26.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v26.__r_.__value_.__l.__data_);
if ( v12 )
return 0;
}
else if ( v11 )
{
return 0;
}
v14 = a1->m_friendReqAndUserBlocks;
v15 = cocos2d::CCNode::create();
sub_100009900(&v26, CString);
cocos2d::CCDictionary::setObject_1(v14, v15, &v26);
if ( SHIBYTE(v26.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v26.__r_.__value_.__l.__data_);
GameLevelManager::getBasePostString(&v26);
v16 = (cocos2d::CCString *)sub_100268F4C("%c%s%s%c%c%s", 87, "mfp", "3879", 103, 99, "3");
v17 = cocos2d::CCString::getCString(v16);
v18 = (cocos2d::CCString *)sub_100268F4C("&levelID=%i&rating=%i&secret=%s", a2, a3, v17);
v19 = cocos2d::CCString::getCString(v18);
std::string::append(&v26, v19);
if ( v4 )
std::string::append(&v26, "&mode=1");
sub_100009900(&v25, "https://www.boomlings.com/database/rateGJDemon21.php");
if ( (v26.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v20 = &v26;
else
v20 = (std::string *)v26.__r_.__value_.__r.__words[0];
sub_100009900(v23, (char *)v20);
sub_100009900(__p, CString);
GameLevelManager::ProcessHttpRequest(a1, &v25, (char *)v23, (const std::string::value_type *)__p, 50);
if ( v22 < 0 )
operator delete(__p[0]);
if ( v24 < 0 )
operator delete(v23[0]);
if ( SHIBYTE(v25.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v25.__r_.__value_.__l.__data_);
if ( SHIBYTE(v26.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v26.__r_.__value_.__l.__data_);
return 1;
}