//
// RewardsPage::init from 0x1001fd7a0 to 0x1001fe3f1 (3153 bytes)
//
// 2 xrefs:
// > RewardsPage::create @ 0x1001fd746
// > ??> @ 0x100ae3d60
//
// 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 12:26:51 +0000
//
__int64 __fastcall RewardsPage::init(_QWORD *a1)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // r14
__int64 v6; // r14
__int64 v7; // r12
__int64 v8; // r12
__int64 v9; // r12
__int64 v10; // r15
__int64 v11; // rax
__int64 v12; // r14
int v13; // edx
int v14; // ecx
int v15; // r8d
int v16; // r9d
__int64 v17; // r15
char *v18; // rsi
__int64 v19; // rdi
__int64 v20; // rdx
bool v21; // r14
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // r14
bool isSpecialChestUnlocked; // al
__int64 v28; // r14
double v29; // xmm0_8
__int64 v30; // rax
__int64 v31; // r15
__int64 v32; // r12
__int64 v33; // rax
int v34; // r14d
__int64 v35; // rax
int v36; // eax
int v37; // ecx
int v38; // r8d
int v39; // r9d
__int64 v40; // rax
__int64 v41; // rax
__int64 v42; // rax
__int64 v43; // r13
__int64 v44; // rax
__int64 v45; // r14
__int64 v46; // rax
__int64 CString; // rax
__int64 v48; // r14
__int64 v49; // rax
__int64 v50; // r15
__int64 v51; // r13
__int64 v52; // rax
__int64 v53; // rax
__int64 v54; // r14
__int64 v55; // rax
std::string *v56; // rdi
__int64 v57; // r14
__int64 v58; // r12
double v59; // xmm0_8
__int64 v60; // rax
double v61; // xmm0_8
__int64 v62; // rax
char v63[8]; // [rsp+0h] [rbp-150h] BYREF
_BYTE v64[8]; // [rsp+8h] [rbp-148h] BYREF
void *v65[2]; // [rsp+10h] [rbp-140h] BYREF
void *v66; // [rsp+20h] [rbp-130h]
void *v67[2]; // [rsp+28h] [rbp-128h] BYREF
void *__p; // [rsp+38h] [rbp-118h]
char v69; // [rsp+40h] [rbp-110h] BYREF
char v70[15]; // [rsp+41h] [rbp-10Fh] BYREF
void *v71; // [rsp+50h] [rbp-100h]
char v72; // [rsp+58h] [rbp-F8h] BYREF
char v73[15]; // [rsp+59h] [rbp-F7h] BYREF
void *v74; // [rsp+68h] [rbp-E8h]
char v75; // [rsp+70h] [rbp-E0h] BYREF
char v76[15]; // [rsp+71h] [rbp-DFh] BYREF
void *v77; // [rsp+80h] [rbp-D0h]
char v78; // [rsp+88h] [rbp-C8h] BYREF
char v79[15]; // [rsp+89h] [rbp-C7h] BYREF
void *v80; // [rsp+98h] [rbp-B8h]
char v81; // [rsp+A0h] [rbp-B0h] BYREF
char v82[15]; // [rsp+A1h] [rbp-AFh] BYREF
void *v83; // [rsp+B0h] [rbp-A0h]
std::string __str; // [rsp+B8h] [rbp-98h] BYREF
std::string v85; // [rsp+D0h] [rbp-80h] BYREF
_BYTE v86[8]; // [rsp+E8h] [rbp-68h] BYREF
__int64 v87; // [rsp+F0h] [rbp-60h]
_BYTE v88[8]; // [rsp+F8h] [rbp-58h] BYREF
_DWORD v89[4]; // [rsp+100h] [rbp-50h] BYREF
__int64 v90; // [rsp+110h] [rbp-40h]
unsigned __int8 v91; // [rsp+11Fh] [rbp-31h]
float v92; // [rsp+120h] [rbp-30h] BYREF
float v93; // [rsp+124h] [rbp-2Ch]
FLAlertLayer::incrementForcePrio();
v89[0] = -1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, v89);
if ( (_BYTE)result )
{
v91 = result;
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 1000LL))(a1, 1);
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 1072LL))(a1, 1);
v3 = cocos2d::CCDirector::sharedDirector(a1, 1);
cocos2d::CCDirector::getWinSize(&v92, v3);
v4 = cocos2d::CCLayer::create();
a1[73] = v4;
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 456LL))(a1, v4);
sub_100278270(v89, 0.0, 0.0, COERCE_DOUBLE(1117782016), COERCE_DOUBLE(1117782016));
v5 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square02.png", v89);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v5 + 912LL))(v5, 255);
sub_100278260(v89, COERCE_DOUBLE(1135214592), COERCE_DOUBLE(1130102784));
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v5 + 320LL))(v5, v89);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v5, 0xFFFFFFFFLL);
sub_100278250(v89, v92 * 0.5, v93 * 0.5);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v5 + 184LL))(v5, v89);
v6 = cocos2d::CCSprite::createWithSpriteFrameName("rewardsLabel_001.png");
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v6, 20);
sub_100278250(v89, v92 * 0.5, (float)((float)(v93 * 0.5) + 110.0) + -32.0);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v6 + 184LL))(v6, v89);
v7 = cocos2d::CCSprite::createWithSpriteFrameName("rewardCorner_001.png");
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v7, 8);
sub_100278250(v89, (float)(v92 * 0.5) + -145.0, (float)(v93 * 0.5) + -85.0);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v7 + 184LL))(v7, v89);
v8 = cocos2d::CCSprite::createWithSpriteFrameName("rewardCorner_001.png");
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v8, 8);
cocos2d::CCSprite::setFlipY(v8, 1);
sub_100278250(v89, (float)(v92 * 0.5) + -145.0, (float)(v93 * 0.5) + 85.0);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v8 + 184LL))(v8, v89);
v9 = cocos2d::CCSprite::createWithSpriteFrameName("rewardCorner_001.png");
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v9, 8);
cocos2d::CCSprite::setFlipX(v9, 1);
cocos2d::CCSprite::setFlipY(v9, 1);
sub_100278250(v89, (float)(v92 * 0.5) + 145.0, (float)(v93 * 0.5) + 85.0);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v9 + 184LL))(v9, v89);
v10 = cocos2d::CCSprite::createWithSpriteFrameName("rewardCorner_001.png");
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v10, 8);
cocos2d::CCSprite::setFlipX(v10, 1);
sub_100278250(v89, (float)(v92 * 0.5) + 145.0, (float)(v93 * 0.5) + -85.0);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v10 + 184LL))(v10, v89);
*((_DWORD *)a1 + 160) = -1;
v11 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v12 = CCMenuItemSpriteExtra::create(v11, 0, a1, RewardsPage::onClose, 0);
CCMenuItemSpriteExtra::setSizeMult(v12, 1.6);
v17 = sub_1008735E0(v12, 0, v13, v14, v15, v16);
a1[69] = v17;
sub_100278250(v88, (float)((float)(v92 * 0.5) + -170.0) + 10.0, (float)((float)(v93 * 0.5) + 110.0) + -10.0);
cocos2d::CCNode::convertToNodeSpace(v89, v17, v88);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v12 + 184LL))(v12, v89);
v69 = 8;
strcpy(v70, "0007");
v18 = &v69;
v19 = GameStatsManager::sharedState();
v21 = 1;
if ( GameStatsManager::isSpecialChestUnlocked(v19, (__int64)&v69) )
{
v22 = GameStatsManager::sharedState();
v72 = 8;
strcpy(v73, "0008");
v18 = &v72;
v19 = v22;
if ( GameStatsManager::isSpecialChestUnlocked(v22, (__int64)&v72) )
{
v23 = GameStatsManager::sharedState();
v75 = 8;
strcpy(v76, "0009");
v18 = &v75;
v19 = v23;
if ( GameStatsManager::isSpecialChestUnlocked(v23, (__int64)&v75) )
{
v24 = GameStatsManager::sharedState();
v78 = 8;
strcpy(v79, "0010");
v18 = &v78;
v19 = v24;
if ( GameStatsManager::isSpecialChestUnlocked(v24, (__int64)&v78) )
{
v25 = GameStatsManager::sharedState();
v81 = 8;
strcpy(v82, "0011");
v18 = &v81;
v19 = v25;
if ( GameStatsManager::isSpecialChestUnlocked(v25, (__int64)&v81) )
{
v26 = GameStatsManager::sharedState();
sub_10000E4E0(v65, "0024");
v18 = (char *)v65;
v19 = v26;
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v26, (__int64)v65);
v21 = 1;
if ( isSpecialChestUnlocked )
{
v28 = GameStatsManager::sharedState();
sub_10000E4E0(v67, "0025");
v18 = (char *)v67;
v19 = v28;
v21 = !GameStatsManager::isSpecialChestUnlocked(v28, (__int64)v67);
if ( ((__int64)v67[0] & 1) != 0 )
{
v19 = (__int64)__p;
operator delete(__p);
}
}
if ( ((__int64)v65[0] & 1) != 0 )
{
v19 = (__int64)v66;
operator delete(v66);
}
}
if ( (v81 & 1) != 0 )
{
v19 = (__int64)v83;
operator delete(v83);
}
}
if ( (v78 & 1) != 0 )
{
v19 = (__int64)v80;
operator delete(v80);
}
}
if ( (v75 & 1) != 0 )
{
v19 = (__int64)v77;
operator delete(v77);
}
}
if ( (v72 & 1) != 0 )
{
v19 = (__int64)v74;
operator delete(v74);
}
}
if ( (v69 & 1) != 0 )
{
v19 = (__int64)v71;
operator delete(v71);
}
*(_QWORD *)&v29 = GameManager::sharedState(v19, v18, v20).u64[0];
if ( !(unsigned __int8)GameManager::safeModeEnabled(v30, v29) && v21 )
{
v90 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_freeChestBtn_001.png");
v31 = CCMenuItemSpriteExtra::create(v90, 0, a1, RewardsPage::onFreeStuff, 0);
CCMenuItemSpriteExtra::setSizeMult(v31, 1.6);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)a1[69] + 456LL))(a1[69], v31);
v32 = a1[69];
sub_100278250(v88, (float)((float)(v92 * 0.5) + 170.0) + -10.0, (float)((float)(v93 * 0.5) + 110.0) + -10.0);
cocos2d::CCNode::convertToNodeSpace(v89, v32, v88);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v31 + 184LL))(v31, v89);
v33 = cocos2d::CCScaleTo::create_1(0.5, 1.1);
v34 = cocos2d::CCEaseInOut::create(v33, 2.0);
v35 = cocos2d::CCScaleTo::create_1(0.5, 1.0);
v36 = cocos2d::CCEaseInOut::create(v35, 2.0);
v40 = sub_10039EB60(v34, v36, 0, v37, v38, v39);
v41 = cocos2d::CCRepeatForever::create(v40);
cocos2d::CCNode::runAction(v90, v41);
}
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], a1[69], 10);
sub_100278250(v89, v92 * 0.5, (float)(v93 * 0.5) + -24.0);
v42 = cocos2d::CCLabelBMFont::create_3("00:00:00", "bigFont.fnt");
a1[85] = v42;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v42, 20);
(*(void (__fastcall **)(_QWORD, float))(*(_QWORD *)a1[85] + 160LL))(a1[85], 0.5);
v43 = a1[85];
sub_100278250(v86, -70.0, -50.0);
sub_100278350(v88, v89, v86);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v43 + 184LL))(v43, v88);
v44 = cocos2d::CCLabelBMFont::create_3("00:00:00", "bigFont.fnt");
a1[86] = v44;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v44, 20);
(*(void (__fastcall **)(_QWORD, float))(*(_QWORD *)a1[86] + 160LL))(a1[86], 0.5);
v45 = a1[86];
sub_100278250(v86, 70.0, -50.0);
sub_100278350(v88, v89, v86);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v45 + 184LL))(v45, v88);
v46 = sub_10088E820("chest_%02d_%02d_001.png", v63[0]);
CString = cocos2d::CCString::getCString(v46);
v48 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
v49 = CCMenuItemSpriteExtra::create(v48, 0, a1, RewardsPage::onReward, 0);
a1[88] = v49;
__str.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)28;
strcpy(__str.__r_.__value_.__s.__data_, "chestClick.ogg");
std::string::operator=((std::string *)(v49 + 440), &__str);
v90 = v48;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)a1[88] + 72LL))(a1[88], 2);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)a1[69] + 456LL))(a1[69], a1[88]);
v50 = a1[88];
v87 = a1[69];
v51 = a1[73];
sub_100278250(v64, 70.0, 14.0);
sub_100278350(v63, v89, v64);
cocos2d::CCNode::convertToWorldSpace(v86, v51, v63);
cocos2d::CCNode::convertToNodeSpace(v88, v87, v86);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v50 + 184LL))(v50, v88);
*(_DWORD *)(a1[88] + 400LL) = 1066024305;
v52 = sub_10088E820("chest_%02d_%02d_001.png", v63[0]);
v53 = cocos2d::CCString::getCString(v52);
v54 = cocos2d::CCSprite::createWithSpriteFrameName(v53);
LODWORD(v90) = *(_DWORD *)((*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v90 + 328LL))(v90, 1) + 4);
v55 = CCMenuItemSpriteExtra::create(v54, 0, a1, RewardsPage::onReward, 0);
a1[87] = v55;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v55 + 72LL))(v55, 1);
v56 = (std::string *)(a1[87] + 440LL);
v85.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)28;
strcpy(v85.__r_.__value_.__s.__data_, "chestClick.ogg");
std::string::operator=(v56, &v85);
*(float *)&v90 = *(float *)&v90 * 0.19999999;
if ( (*(_BYTE *)&v85.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v85.__r_.__value_.__l.__data_);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)a1[69] + 456LL))(a1[69], a1[87]);
v57 = a1[87];
v87 = a1[69];
v58 = a1[73];
sub_100278250(v64, -70.0, (float)(*(float *)&v90 * -0.5) + 14.0);
sub_100278350(v63, v89, v64);
cocos2d::CCNode::convertToWorldSpace(v86, v58, v63);
cocos2d::CCNode::convertToNodeSpace(v88, v87, v86);
v59 = (*(double (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v57 + 184LL))(v57, v88);
*(_DWORD *)(a1[87] + 400LL) = 1066024305;
*(_QWORD *)(GameLevelManager::sharedState(v59) + 1408) = a1 + 84;
v60 = GameStatsManager::sharedState();
if ( GameStatsManager::areRewardsLoaded(v60) )
{
RewardsPage::updateTimers(a1);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)a1[85] + 344LL))(a1[85], 0);
v61 = (*(double (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)a1[86] + 344LL))(a1[86], 0);
v62 = GameLevelManager::sharedState(v61);
GameLevelManager::getGJRewards(v62, 0);
}
cocos2d::CCNode::schedule_1(a1, RewardsPage::updateTimers, 0, COERCE_DOUBLE(1065353216));
return v91;
}
return result;
}