//
// GameLevelManager::getLevelLeaderboard from 0x4bda44 to 0x4be156 (1810 bytes)
//
// 6 xrefs:
// > PlayLayer::levelComplete @ 0x408204
// > PlayLayer::levelComplete @ 0x40821e
// > LevelInfoLayer::init @ 0x49f06c
// > LevelInfoLayer::init @ 0x49f08a
// > LevelLeaderboard::onUpdate @ 0x614b3e
// > LevelLeaderboard::loadScores @ 0x61514a
//
// 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:20 +0000
//
int __fastcall GameLevelManager::getLevelLeaderboard(int result, int a2, int a3, int a4)
{
int *v4; // r11
const char *LevelLeaderboardKey; // r0
const char *v7; // r6
size_t v8; // r0
GJAccountManager *v9; // r0
int v10; // r0
int v11; // r0
char *v12; // r1
const char *v13; // r1
int v14; // r2
const char *v15; // r1
int v16; // r9
int v17; // r10
int v18; // r2
const char *v19; // r5
float v20; // s16
unsigned int v21; // r0
int v22; // s16
GameStatsManager *hasPendingUserCoin; // r0
int v24; // r2
int v25; // r3
int v26; // r8
int v27; // r6
GameStatsManager *v28; // r7
const char *v29; // r0
GameStatsManager *v30; // r7
const char *CoinKey; // r0
char *v32; // r6
cocos2d::CCString *v33; // r0
char *v34; // r3
int v35; // r2
int v36; // r3
char *v37; // r1
char *v38; // r2
char *v39; // r3
cocos2d::CCString *v40; // r0
char *v41; // r0
GJAccountManager *v42; // r0
int v43; // r0
int v44; // r7
int v45; // r6
int v46; // r10
int v47; // r9
char *v48; // r3
cocos2d::CCString *v49; // r0
const char *v50; // r6
size_t v51; // r0
cocos2d::CCString *v52; // r0
char *v53; // r0
cocos2d::CCString *v54; // r0
char *v55; // r0
char *v56; // r1
size_t v57; // r2
char *v58; // r5
const void *v59; // r0
unsigned __int8 *v60; // r3
char *v61; // r2
size_t v62; // r0
char *v63; // r1
size_t v64; // r2
const char *v65; // r7
size_t v66; // r0
char *v67; // [sp+68h] [bp-17Ch]
char *v68; // [sp+68h] [bp-17Ch]
int v69; // [sp+6Ch] [bp-178h]
int v70; // [sp+6Ch] [bp-178h]
int v71; // [sp+70h] [bp-174h]
int v72; // [sp+74h] [bp-170h]
int v73; // [sp+78h] [bp-16Ch]
_BOOL4 isPlatformer; // [sp+7Ch] [bp-168h]
int v75; // [sp+80h] [bp-164h]
int v77; // [sp+88h] [bp-15Ch]
int v78; // [sp+8Ch] [bp-158h]
char *v79; // [sp+94h] [bp-150h]
int v81; // [sp+9Ch] [bp-148h]
int v82; // [sp+A0h] [bp-144h]
int v83; // [sp+A4h] [bp-140h]
int CString; // [sp+A8h] [bp-13Ch]
char *v85; // [sp+ACh] [bp-138h]
int v86; // [sp+B0h] [bp-134h]
int v87; // [sp+B4h] [bp-130h]
int v88; // [sp+B8h] [bp-12Ch]
int v89[2]; // [sp+C4h] [bp-120h] BYREF
const char *v90; // [sp+CCh] [bp-118h]
_DWORD v91[3]; // [sp+D0h] [bp-114h] BYREF
int v92[2]; // [sp+DCh] [bp-108h] BYREF
char *v93; // [sp+E4h] [bp-100h]
int v94[2]; // [sp+E8h] [bp-FCh] BYREF
char *v95; // [sp+F0h] [bp-F4h]
char v96; // [sp+F4h] [bp-F0h] BYREF
char v97; // [sp+F5h] [bp-EFh] BYREF
char *v98; // [sp+FCh] [bp-E8h]
int v99[3]; // [sp+100h] [bp-E4h] BYREF
int v100[3]; // [sp+10Ch] [bp-D8h] BYREF
int v101[2]; // [sp+118h] [bp-CCh] BYREF
char *v102; // [sp+120h] [bp-C4h]
int v103[3]; // [sp+124h] [bp-C0h] BYREF
int v104[2]; // [sp+130h] [bp-B4h] BYREF
char *v105; // [sp+138h] [bp-ACh]
int v106[3]; // [sp+13Ch] [bp-A8h] BYREF
unsigned __int8 v107; // [sp+148h] [bp-9Ch] BYREF
char v108; // [sp+149h] [bp-9Bh] BYREF
size_t v109; // [sp+14Ch] [bp-98h]
char *v110; // [sp+150h] [bp-94h]
int v111[3]; // [sp+154h] [bp-90h] BYREF
int v112[3]; // [sp+160h] [bp-84h] BYREF
int v113[3]; // [sp+16Ch] [bp-78h] BYREF
int v114[3]; // [sp+178h] [bp-6Ch] BYREF
int v115[3]; // [sp+184h] [bp-60h] BYREF
int v116[3]; // [sp+190h] [bp-54h] BYREF
unsigned __int8 v117[20]; // [sp+19Ch] [bp-48h] BYREF
unsigned __int8 v118[44]; // [sp+1B0h] [bp-34h] BYREF
v4 = (int *)result;
if ( a2 )
{
LevelLeaderboardKey = (const char *)GameLevelManager::getLevelLeaderboardKey(
result,
(const char *)(*(_DWORD *)(a2 + 268) - *(_DWORD *)(a2 + 272)));
v89[0] = 0;
v89[1] = 0;
v90 = nullptr;
v7 = LevelLeaderboardKey;
v8 = strlen(LevelLeaderboardKey);
v9 = (GJAccountManager *)std::string::__init(v89, v7, v8);
v10 = GJAccountManager::sharedState(v9);
if ( *(_DWORD *)(v10 + 280) - *(_DWORD *)(v10 + 284) > 0 )
{
if ( (v89[0] & 1) != 0 )
v13 = v90;
else
v13 = (char *)v89 + 1;
if ( !GameLevelManager::isDLActive((GameLevelManager *)v4, v13) )
{
if ( (v89[0] & 1) != 0 )
v15 = v90;
else
v15 = (char *)v89 + 1;
GameLevelManager::addDLToActive((GameLevelManager *)v4, v15, v14, LOBYTE(v89[0]));
if ( a3 == 4 )
cocos2d::CCDictionary::setObject(v4[195], (cocos2d::CCObject *)a2);
GameLevelManager::getBasePostString((GameLevelManager *)v91);
v92[0] = 0;
v92[1] = 0;
v93 = nullptr;
std::string::__init(v92, &unk_B6B226, 0);
v94[0] = 0;
v94[1] = 0;
v95 = nullptr;
std::string::__init(v94, &unk_B6B226, 0);
v73 = *(_DWORD *)(a2 + 668);
isPlatformer = GJGameLevel::isPlatformer((GJGameLevel *)a2);
v72 = *(_DWORD *)(a2 + 1040);
if ( v72 <= 0 )
{
v19 = nullptr;
v78 = 0;
v17 = 0;
v16 = 0;
v71 = 0;
v77 = 0;
v69 = 0;
v67 = nullptr;
v72 = 0;
}
else
{
v67 = (char *)(*(_DWORD *)(a2 + 1044) + 46533);
v69 = *(_DWORD *)(a2 + 1048) + 7684;
v16 = *(_DWORD *)(a2 + 1052) + 6433;
if ( !a4 )
std::string::operator=((unsigned __int8 *)v92, (unsigned __int8 *)(a2 + 1056));
v77 = *(_DWORD *)(a2 + 1068);
v71 = *(_DWORD *)(a2 + 1072) + 25645;
v78 = *(_DWORD *)(a2 + 1076) + 3453;
v17 = *(_DWORD *)(a2 + 1080) + 6323;
if ( a4 == 1 )
std::string::operator=((unsigned __int8 *)v94, (unsigned __int8 *)(a2 + 1084));
v18 = v73;
if ( isPlatformer )
{
v18 = *(_DWORD *)(a2 + 1096);
v19 = nullptr;
}
else
{
v19 = *(const char **)(a2 + 1096);
}
v73 = v18;
}
v20 = 0.0;
v75 = *(_DWORD *)(a2 + 620) - *(_DWORD *)(a2 + 624) + 8354;
v81 = *(_DWORD *)(a2 + 644) - *(_DWORD *)(a2 + 648) + 3991;
v82 = *(_DWORD *)(a2 + 656) - *(_DWORD *)(a2 + 660) + 4085;
v83 = *(_DWORD *)(a2 + 668) + 1482;
v21 = rand();
if ( *(_BYTE *)(a2 + 672) )
v20 = 2000.0;
v22 = (int)(float)(v20 + (float)(vcvts_n_f32_s32(v21, 0x1Fu) * 1999.0));
std::string::basic_string(v99, a2 + 988);
memset(v100, 0, sizeof(v100));
std::string::__init(v100, "41274", 5u);
cocos2d::ZipUtils::base64EncodeEnc(&v96, v99, v100);
std::string::~string((int)v100);
hasPendingUserCoin = (GameStatsManager *)std::string::~string((int)v99);
v25 = *(_DWORD *)(a2 + 788);
if ( v25 > 0 )
{
v27 = 1;
v26 = 0;
while ( 1 )
{
v24 = *(_DWORD *)(a2 + 788);
v25 = v27 - 1;
if ( v27 - 1 >= v24 )
break;
if ( *(_DWORD *)(a2 + 792) == *(_DWORD *)(a2 + 796) )
{
v30 = (GameStatsManager *)GameStatsManager::sharedState(hasPendingUserCoin);
CoinKey = (const char *)GJGameLevel::getCoinKey((GJGameLevel *)a2, v27);
hasPendingUserCoin = (GameStatsManager *)GameStatsManager::hasPendingUserCoin(v30, CoinKey);
}
else
{
v28 = (GameStatsManager *)GameStatsManager::sharedState(hasPendingUserCoin);
v29 = (const char *)GJGameLevel::getCoinKey((GJGameLevel *)a2, v27);
hasPendingUserCoin = (GameStatsManager *)GameStatsManager::hasUserCoin(v28, v29);
}
if ( hasPendingUserCoin )
++v26;
++v27;
}
}
else
{
v26 = 0;
}
gen_random(v101, 10, v24, v25);
v32 = (_BYTE *)(&dword_60 + 2);
v85 = (char *)(*(_DWORD *)(a2 + 268) - *(_DWORD *)(a2 + 272));
v86 = *(_DWORD *)(a2 + 700) - *(_DWORD *)(a2 + 704);
v33 = (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(v33);
if ( (v96 & 1) != 0 )
v34 = v98;
else
v34 = &v97;
v79 = v34;
if ( (v101[0] & 1) == 0 )
v32 = (char *)v101 + 1;
v35 = *(_DWORD *)(a2 + 744);
v87 = *(_DWORD *)(a2 + 620) - *(_DWORD *)(a2 + 624);
v36 = *(_DWORD *)(a2 + 748);
if ( (v101[0] & 1) != 0 )
v32 = v102;
v88 = v35 - v36;
gen_random(v103, 5, v35, v35 - v36);
if ( (v103[0] & 1) != 0 )
v37 = (char *)v103[2];
else
v37 = (char *)v103 + 1;
if ( (v92[0] & 1) != 0 )
v38 = v93;
else
v38 = (char *)v92 + 1;
if ( (v94[0] & 1) != 0 )
v39 = v95;
else
v39 = (char *)v94 + 1;
v40 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&levelID=%i&percent=%i&time=%i&points=%i&plat=%i&secret=%s&typ"
"e=%i&mode=%i&s1=%i&s2=%i&s3=%i&s4=%i&s5=%i&s6=%s&s7=%s&s8=%i&s"
"9=%i&s10=%i&s11=%i&s12=%i&s13=%i&s14=%i&s15=%i&s16=%s&s17=%s&s"
"18=%i&s19=%i&s20=%i",
v85,
v86,
v72,
v77,
isPlatformer,
CString,
a3,
a4,
v75,
v81,
v82,
v83,
v22,
v79,
v32,
v87,
v26 + 5819,
v88,
v67,
v71,
v37,
v69,
v78,
v38,
v39,
v16,
v17,
*(_DWORD *)(a2 + 612));
v41 = (char *)cocos2d::CCString::getCString(v40);
std::string::append(v91, v41);
v42 = (GJAccountManager *)std::string::~string((int)v103);
v43 = GJAccountManager::sharedState(v42);
v68 = (char *)(*(_DWORD *)(v43 + 280) - *(_DWORD *)(v43 + 284));
v44 = *(_DWORD *)(a2 + 268) - *(_DWORD *)(a2 + 272);
v45 = *(_DWORD *)(a2 + 700) - *(_DWORD *)(a2 + 704);
v70 = *(_DWORD *)(a2 + 656) - *(_DWORD *)(a2 + 660);
v46 = *(_DWORD *)(a2 + 644) - *(_DWORD *)(a2 + 648);
v47 = *(_DWORD *)(a2 + 620) - *(_DWORD *)(a2 + 624);
std::string::basic_string(v106, a2 + 988);
if ( (v106[0] & 1) != 0 )
v48 = (char *)v106[2];
else
v48 = (char *)v106 + 1;
v49 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i%i%i%i%i%i%i%s%i%i%i",
v68,
v44,
v45,
v70,
v46,
v47,
v73,
v48,
*(unsigned __int8 *)(a2 + 672),
v26,
*(_DWORD *)(a2 + 744) - *(_DWORD *)(a2 + 748));
v50 = (const char *)cocos2d::CCString::getCString(v49);
v104[0] = 0;
v104[1] = 0;
v105 = nullptr;
v51 = strlen(v50);
std::string::__init(v104, v50, v51);
std::string::~string((int)v106);
if ( (int)v19 > 0 )
{
v54 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v19);
v55 = (char *)cocos2d::CCString::getCString(v54);
std::string::append(v104, v55);
}
v52 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)&dword_78 + 1,
"Pg6",
"pUrt",
87,
110,
"0J");
v53 = (char *)cocos2d::CCString::getCString(v52);
std::string::append(v104, v53);
if ( (v101[0] & 1) != 0 )
{
v56 = v102;
v57 = v101[1];
}
else
{
v57 = (int)LOBYTE(v101[0]) >> 1;
v56 = (char *)v101 + 1;
}
std::string::append(v104, v56, v57);
if ( (v104[0] & 1) != 0 )
v58 = v105;
else
v58 = (char *)v104 + 1;
v59 = (const void *)strlen(v58);
rtsha1::calc((rtsha1 *)v58, v59, (int)v117, v60);
rtsha1::toHexString((rtsha1 *)v117, v118, v61);
memset(v111, 0, sizeof(v111));
v62 = strlen((const char *)v118);
std::string::__init(v111, v118, v62);
memset(v112, 0, sizeof(v112));
std::string::__init(v112, "39673", 5u);
cocos2d::ZipUtils::base64EncodeEnc(&v107, v111, v112);
std::string::~string((int)v112);
std::string::~string((int)v111);
std::string::append(v91, "&chk=");
if ( (v107 & 1) != 0 )
{
v63 = v110;
v64 = v109;
}
else
{
v64 = (int)v107 >> 1;
v63 = &v108;
}
std::string::append(v91, v63, v64);
if ( isPlatformer )
v65 = "https://www.boomlings.com/database/getGJLevelScoresPlat.php";
else
v65 = "https://www.boomlings.com/database/getGJLevelScores211.php";
memset(v113, 0, sizeof(v113));
v66 = strlen(v65);
std::string::__init(v113, v65, v66);
std::string::basic_string(v114, (int)v113);
std::string::basic_string(v115, (int)v91);
std::string::basic_string(v116, (int)v89);
GameLevelManager::ProcessHttpRequest((GameManager *)v4, v114, (int)v115, (int)v116, 57);
std::string::~string((int)v116);
std::string::~string((int)v115);
std::string::~string((int)v114);
std::string::~string((int)v113);
std::string::~string((int)&v107);
std::string::~string((int)v104);
std::string::~string((int)v101);
std::string::~string((int)&v96);
std::string::~string((int)v94);
std::string::~string((int)v92);
std::string::~string((int)v91);
}
}
else
{
v11 = v4[214];
if ( v11 )
{
if ( (v89[0] & 1) != 0 )
v12 = (char *)v90;
else
v12 = (char *)v89 + 1;
(*(void (__fastcall **)(int, char *, int))(*(_DWORD *)v11 + 12))(v11, v12, LOBYTE(v89[0]) << 31);
}
}
return std::string::~string((int)v89);
}
return result;
}