//
// GameLevelManager::getGJRewards from 0x14025ce00 to 0x14025d448 (1608 bytes)
//
// 4 xrefs:
// > RewardsPage::init @ 0x140562b83
// > RewardsPage::onReward @ 0x140562d0c
// > RewardsPage::tryGetRewards @ 0x140563088
// > ??> @ 0x14091c760
//
// 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:46 +0000
//
// Hidden C++ exception states: #wind=8
char __fastcall GameLevelManager::getGJRewards(__int64 a1, int a2)
{
__int64 v3; // rbx
void *v4; // r8
__int64 v6; // rbx
__int64 v7; // rax
__int64 v8; // rcx
void *v9; // rcx
__int64 v10; // rcx
int v11; // esi
int v12; // r14d
cocos2d::CCArray *v13; // r12
__int64 v14; // rcx
signed int v15; // r15d
signed int v16; // ebx
size_t i; // rdi
cocos2d::CCString *v18; // rax
const char *CString; // rax
size_t v20; // r8
__int128 *v21; // rdx
__int64 v22; // rdx
__int64 v23; // r9
size_t v24; // r8
__int128 *v25; // rdx
void **v26; // rcx
const char *v27; // rcx
const char *v28; // rcx
void **v29; // rcx
const char *v30; // rcx
const char *v31; // rcx
char *v32; // r8
void *v33; // rcx
void *v34; // rcx
__int64 v35; // rax
const char *v36; // rbx
cocos2d::CCString *v37; // rax
const char *v38; // rax
cocos2d::CCString *v39; // rax
char *v40; // rax
size_t v41; // r8
_QWORD *v42; // rdx
void *v44; // [rsp+48h] [rbp-71h]
void *Block[2]; // [rsp+58h] [rbp-61h] BYREF
__int64 v46; // [rsp+68h] [rbp-51h]
unsigned __int64 v47; // [rsp+70h] [rbp-49h]
char *String[2]; // [rsp+78h] [rbp-41h] BYREF
__int64 v49; // [rsp+88h] [rbp-31h]
unsigned __int64 v50; // [rsp+90h] [rbp-29h]
__int128 v51; // [rsp+98h] [rbp-21h] BYREF
unsigned __int64 v52; // [rsp+A8h] [rbp-11h]
unsigned __int64 v53; // [rsp+B0h] [rbp-9h]
_QWORD Src[4]; // [rsp+B8h] [rbp-1h] BYREF
Block[1] = (void *)101;
v46 = 9;
v47 = 15;
Block[0] = (void *)0x746174735F776572LL;
v3 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 1192), Block);
if ( v47 > 0xF )
{
v4 = Block[0];
if ( v47 + 1 >= 0x1000 )
{
v4 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v4 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v4);
}
if ( v3 )
return 0;
Block[1] = (void *)101;
v46 = 9;
v47 = 15;
Block[0] = (void *)0x746174735F776572LL;
v6 = *(_QWORD *)(a1 + 1192);
v7 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject(v6, v7, Block);
if ( v47 > 0xF )
{
v9 = Block[0];
if ( v47 + 1 >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
GameLevelManager::getBasePostString(v8, Src);
v10 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v44 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v10 = qword_14090BFE0;
}
v11 = 0;
v12 = 0;
v13 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(v10 + 536));
v15 = cocos2d::CCArray::count(v13);
v16 = 0;
for ( i = -1; v16 < v15; ++v16 )
{
v18 = cocos2d::CCArray::stringAtIndex(v13, v16);
CString = cocos2d::CCString::getCString(v18);
v51 = 0;
v52 = 0;
v53 = 0;
v20 = -1;
do
++v20;
while ( CString[v20] );
sub_14003D230(&v51, CString, v20);
if ( v52 > 2 )
{
*(_OWORD *)Block = 0;
v46 = 0;
v47 = 0;
v21 = &v51;
if ( v53 > 0xF )
v21 = (__int128 *)v51;
sub_14003D230(Block, v21, v52 != 0);
v24 = v52 - 2;
*(_OWORD *)String = 0;
v49 = 0;
v50 = 0;
if ( v52 < 2 )
sub_14003F4D0(0, v22, v24, v23);
v25 = &v51;
if ( v53 > 0xF )
v25 = (__int128 *)v51;
sub_14003D230(String, (char *)v25 + 2, v24);
v26 = Block;
if ( v47 > 0xF )
v26 = (void **)Block[0];
if ( atoi((const char *)v26) == 1 )
{
v27 = (const char *)String;
if ( v50 > 0xF )
v27 = String[0];
if ( v11 <= atoi(v27) )
{
v28 = (const char *)String;
if ( v50 > 0xF )
v28 = String[0];
v11 = atoi(v28);
}
}
else
{
v29 = Block;
if ( v47 > 0xF )
v29 = (void **)Block[0];
if ( atoi((const char *)v29) == 2 )
{
v30 = (const char *)String;
if ( v50 > 0xF )
v30 = String[0];
if ( v12 <= atoi(v30) )
{
v31 = (const char *)String;
if ( v50 > 0xF )
v31 = String[0];
v12 = atoi(v31);
}
}
}
if ( v50 > 0xF )
{
v32 = String[0];
if ( v50 + 1 >= 0x1000 )
{
v32 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v32 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v32);
}
v49 = 0;
v50 = 15;
LOBYTE(String[0]) = 0;
if ( v47 > 0xF )
{
v33 = Block[0];
if ( v47 + 1 >= 0x1000 )
{
v33 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v33 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v33);
}
}
if ( v53 > 0xF )
{
v34 = (void *)v51;
if ( v53 + 1 >= 0x1000 )
{
v34 = *(void **)(v51 - 8);
if ( (unsigned __int64)(v51 - (_QWORD)v34 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v34);
}
}
v35 = GameLevelManager::rewardSessionToken(v14, Block);
v36 = (const char *)v35;
if ( *(_QWORD *)(v35 + 24) > 0xFu )
v36 = *(const char **)v35;
v37 = cocos2d::CCString::createWithFormat("%c%s%s%c%c%s", 87, "mfd", "2893", 103, 98, (const char *)&word_14070D040);
v38 = cocos2d::CCString::getCString(v37);
v39 = cocos2d::CCString::createWithFormat("&rewardType=%i&secret=%s&chk=%s&r1=%i&r2=%i", a2, v38, v36, v11, v12);
v40 = (char *)cocos2d::CCString::getCString(v39);
v41 = -1;
do
++v41;
while ( v40[v41] );
sub_140044D80(Src, v40, v41);
sub_14003D310((__int64)Block);
Block[1] = (void *)101;
v46 = 9;
v47 = 15;
Block[0] = (void *)0x746174735F776572LL;
v42 = Src;
if ( Src[3] > 0xFu )
v42 = (_QWORD *)Src[0];
*(_OWORD *)String = 0;
v49 = 0;
v50 = 0;
do
++i;
while ( *((_BYTE *)v42 + i) );
sub_14003D230(String, v42, i);
v51 = 0;
v52 = 0;
v53 = 0;
*(_QWORD *)&v51 = sub_14003D460(0x40u);
v52 = 51;
v53 = 63;
strcpy((char *)v51, "https://www.boomlings.com/database/getGJRewards.php");
GameLevelManager::ProcessHttpRequest(
(cocos2d::CCActionManager **)a1,
(__int64)&v51,
(const char *)String,
(const char *)Block,
0x34u);
sub_14003D310((__int64)Src);
return 1;
}