//
// RewardsPage::init from 0x4e6f68 to 0x4e77f0 (2184 bytes)
//
// 1 xrefs:
// > RewardsPage::create @ 0x4e6ce4
//
// 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 RewardsPage::init(RewardsPage *a1)
{
cocos2d::CCDirector *v2; // r0
cocos2d::CCLayer *v3; // r0
RewardsPage_vtbl *v4; // r3
cocos2d::CCNode *v5; // r5
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
cocos2d::CCSprite *v8; // r5
void (__fastcall *v9)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
int v10; // r6
cocos2d::CCSprite *v11; // r5
float v12; // s15
float v13; // s14
void (__fastcall *v14)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCSprite *v15; // r0
CCMenuItemSpriteExtra *v16; // r6
cocos2d::CCMenu *v17; // r0
CCMenuItemSpriteExtra_vtbl *v18; // r3
float v19; // s14
float v20; // s13
cocos2d::CCNode *v21; // r5
void (__fastcall *v22)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
GameStatsManager *v23; // r5
stl::StringData::Internal *v24; // r2
stl::StringData::Internal *v25; // r3
int isSpecialChestUnlocked; // r6
GameStatsManager *v27; // r8
stl::StringData::Internal *v28; // r2
stl::StringData::Internal *v29; // r3
int v30; // r5
GameStatsManager *v31; // r8
stl::StringData::Internal *v32; // r2
stl::StringData::Internal *v33; // r3
int v34; // r8
GameStatsManager *v35; // r5
stl::StringData::Internal *v36; // r2
stl::StringData::Internal *v37; // r3
int v38; // r9
GameStatsManager *v39; // r5
stl::StringData::Internal *v40; // r2
stl::StringData::Internal *v41; // r3
GameStatsManager *v42; // r5
stl::StringData::Internal *v43; // r2
stl::StringData::Internal *v44; // r3
int v45; // r8
cocos2d::CCSprite *v46; // r0
cocos2d::CCNode *v47; // r8
CCMenuItemSpriteExtra *v48; // r6
cocos2d::CCMenu *m_buttonMenu; // r10
void (__fastcall *v50)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
float v51; // r2
cocos2d::CCActionInterval *v52; // r0
cocos2d::CCEaseInOut *v53; // r6
float v54; // r2
cocos2d::CCActionInterval *v55; // r0
cocos2d::CCEaseInOut *v56; // r0
cocos2d::CCActionInterval *v57; // r0
cocos2d::CCRepeatForever *v58; // r0
cocos2d::CCLabelBMFont *v59; // r0
cocos2d::CCLabelBMFont *m_leftLabel; // r11
void (__fastcall *v61)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCLabelBMFont *v62; // r0
cocos2d::CCLabelBMFont *m_rightLabel; // r6
void (__fastcall *v64)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
const char *RewardFrame; // r0
cocos2d::CCSprite *v66; // r0
cocos2d::CCSprite *v67; // r8
CCMenuItemSpriteExtra *v68; // r9
CCMenuItemSpriteExtra *m_rightChest; // r9
cocos2d::CCLayer *m_mainLayer; // r10
const char *v71; // r0
cocos2d::CCSprite *v72; // r9
float height; // s15
CCMenuItemSpriteExtra *v74; // r0
CCMenuItemSpriteExtra_vtbl *v75; // r3
CCMenuItemSpriteExtra *m_leftChest; // r6
CCMenuItemSpriteExtra *v77; // r6
cocos2d::CCLayer *v78; // r10
cocos2d::CCMenu *v79; // r9
void (__fastcall *v80)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
GameStatsManager *v81; // r0
GameLevelManager *v82; // r0
float v84; // r2
float v85; // r3
void (__fastcall *v86)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+10h] [bp-74h]
int v87; // [sp+14h] [bp-70h]
cocos2d::CCMenu *v88; // [sp+18h] [bp-6Ch]
char *v89; // [sp+30h] [bp-54h] BYREF
char *v90; // [sp+34h] [bp-50h] BYREF
char *v91; // [sp+38h] [bp-4Ch] BYREF
cocos2d::CCSize v92; // [sp+3Ch] [bp-48h] BYREF
cocos2d::CCPoint v93; // [sp+44h] [bp-40h] BYREF
cocos2d::CCPoint v94; // [sp+4Ch] [bp-38h] BYREF
cocos2d::CCPoint v95; // [sp+54h] [bp-30h] BYREF
cocos2d::CCPoint v96; // [sp+5Ch] [bp-28h] BYREF
void (*v97)(RewardsPage *, cocos2d::CCObject *); // [sp+64h] [bp-20h]
int v98; // [sp+68h] [bp-1Ch]
void (*v99)(RewardsPage *, cocos2d::CCObject *); // [sp+6Ch] [bp-18h]
int v100; // [sp+70h] [bp-14h]
char *v101[2]; // [sp+74h] [bp-10h] BYREF
cocos2d::CCPoint v102; // [sp+7Ch] [bp-8h] BYREF
cocos2d::CCRect v103; // [sp+84h] [bp+0h] BYREF
cocos2d::CCSize v104; // 0:^0.8
cocos2d::CCRect v105; // 0:kr00_16.16
FLAlertLayer::incrementForcePrio(a1);
v103.origin.x = -1.034e-25;
v87 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v103);
if ( !v87 )
return v87;
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v92, v2);
v3 = cocos2d::CCLayer::create();
v4 = a1->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_mainLayer = v3;
v4->addChild(a1, v3);
cocos2d::CCRect::CCRect(&v103, 0.0, 0.0, 80.0, 80.0);
v105.origin.x = v84;
v105.origin.y = v85;
v105.size = v104;
v5 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square02.png",
(const char *)&v103,
v105);
((void (__fastcall *)(cocos2d::CCNode *, int))v5->__vftable[1].~CCNode_0)(v5, 255);
setContentSize = v5->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v103, 340.0, 220.0);
setContentSize(v5, (const cocos2d::CCSize *)&v103);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v5, -1);
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint(&v103.origin, v92.width * 0.5, v92.height * 0.5);
setPosition(v5, &v103.origin);
v8 = cocos2d::CCSprite::createWithSpriteFrameName("rewardsLabel_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v8, 20);
v9 = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v103.origin, v92.width * 0.5, (float)((float)(v92.height * 0.5) + 110.0) - 32.0);
v9(v8, &v103.origin);
v10 = 0;
do
{
v11 = cocos2d::CCSprite::createWithSpriteFrameName("rewardCorner_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v11, 8);
switch ( v10 )
{
case 2:
cocos2d::CCSprite::setFlipX(v11, 1);
cocos2d::CCSprite::setFlipY(v11, 1);
v12 = 85.0;
LABEL_9:
v13 = 145.0;
goto LABEL_12;
case 3:
cocos2d::CCSprite::setFlipX(v11, 1);
v12 = -85.0;
goto LABEL_9;
case 1:
cocos2d::CCSprite::setFlipY(v11, 1);
v12 = 85.0;
break;
default:
v12 = -85.0;
break;
}
v13 = -145.0;
LABEL_12:
++v10;
v14 = v11->setPosition;
cocos2d::CCPoint::CCPoint(&v103.origin, v13 + (float)(v92.width * 0.5), v12 + (float)(v92.height * 0.5));
v14(v11, &v103.origin);
}
while ( v10 != 4 );
a1->m_joystickConnected = -1;
v15 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v98 = 0;
v97 = RewardsPage::onClose;
v16 = CCMenuItemSpriteExtra::create(
v15,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(RewardsPage::onClose, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v16, 1.6);
v17 = (cocos2d::CCMenu *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v16, nullptr);
v18 = v16->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v19 = (float)(v92.width * 0.5) - 170.0;
v20 = (float)(v92.height * 0.5) + 110.0;
a1->m_buttonMenu = v17;
v21 = v17;
v22 = v18->setPosition;
cocos2d::CCPoint::CCPoint(&v102, v19 + 10.0, v20 - 10.0);
cocos2d::CCNode::convertToNodeSpace(&v103.origin, v21, &v102);
v22(v16, &v103.origin);
v23 = GameStatsManager::sharedState();
sub_776584((int)v101, "0007");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((int)v23, v101, v24, v25);
if ( !isSpecialChestUnlocked )
{
v30 = 0;
goto LABEL_37;
}
v27 = GameStatsManager::sharedState();
sub_776584((int)&v89, "0008");
v30 = GameStatsManager::isSpecialChestUnlocked((int)v27, &v89, v28, v29);
if ( !v30 )
{
LABEL_37:
v45 = 1;
goto LABEL_24;
}
v31 = GameStatsManager::sharedState();
sub_776584((int)&v90, "0009");
v34 = GameStatsManager::isSpecialChestUnlocked((int)v31, &v90, v32, v33);
if ( !v34 )
{
isSpecialChestUnlocked = v30;
goto LABEL_37;
}
v35 = GameStatsManager::sharedState();
sub_776584((int)&v91, "0010");
v38 = GameStatsManager::isSpecialChestUnlocked((int)v35, &v91, v36, v37);
if ( v38 )
{
v39 = GameStatsManager::sharedState();
sub_776584((int)&v102, "0011");
if ( GameStatsManager::isSpecialChestUnlocked((int)v39, (char **)&v102, v40, v41) )
{
v42 = GameStatsManager::sharedState();
sub_776584((int)&v103, "0024");
v45 = (unsigned __int8)GameStatsManager::isSpecialChestUnlocked((int)v42, (char **)&v103, v43, v44) ^ 1;
sub_774008(&v103);
}
else
{
v45 = 1;
}
v30 = v38;
sub_774008(&v102);
isSpecialChestUnlocked = v38;
}
else
{
v30 = v34;
isSpecialChestUnlocked = v34;
v45 = 1;
}
sub_774008(&v91);
LABEL_24:
if ( v30 )
sub_774008(&v90);
if ( isSpecialChestUnlocked )
sub_774008(&v89);
sub_774008(v101);
if ( v45 )
{
v46 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_freeChestBtn_001.png");
v100 = 0;
v99 = RewardsPage::onFreeStuff;
v47 = v46;
v48 = CCMenuItemSpriteExtra::create(
v46,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(RewardsPage::onFreeStuff, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v48, 1.6);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v48);
m_buttonMenu = a1->m_buttonMenu;
v50 = v48->setPosition;
cocos2d::CCPoint::CCPoint(
&v102,
(float)((float)(v92.width * 0.5) + 170.0) - 10.0,
(float)((float)(v92.height * 0.5) + 110.0) - 10.0);
cocos2d::CCNode::convertToNodeSpace(&v103.origin, m_buttonMenu, &v102);
v50(v48, &v103.origin);
v52 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F000000, 1.1, v51);
v53 = cocos2d::CCEaseInOut::create(v52, 2.0);
v55 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F000000, 1.0, v54);
v56 = cocos2d::CCEaseInOut::create(v55, 2.0);
v57 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v53, v56, 0);
v58 = cocos2d::CCRepeatForever::create(v57);
cocos2d::CCNode::runAction(v47, v58);
}
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_buttonMenu, 10);
cocos2d::CCPoint::CCPoint(&v93, v92.width * 0.5, (float)(v92.height * 0.5) - 24.0);
v59 = cocos2d::CCLabelBMFont::create();
a1->m_leftLabel = v59;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v59, 20);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_leftLabel->setScale)(a1->m_leftLabel, 1056964608);
m_leftLabel = a1->m_leftLabel;
v61 = m_leftLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v102, -70.0, -50.0);
cocos2d::CCPoint::operator+(&v103, &v93, &v102);
v61(m_leftLabel, &v103.origin);
v62 = cocos2d::CCLabelBMFont::create();
a1->m_rightLabel = v62;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v62, 20);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_rightLabel->setScale)(a1->m_rightLabel, 1056964608);
m_rightLabel = a1->m_rightLabel;
v64 = m_rightLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v102, 70.0, -50.0);
cocos2d::CCPoint::operator+(&v103, &v93, &v102);
v64(m_rightLabel, &v103.origin);
RewardFrame = RewardsPage::getRewardFrame((int)&dword_0 + 2, 1);
v66 = cocos2d::CCSprite::createWithSpriteFrameName(RewardFrame);
v101[1] = nullptr;
v101[0] = (char *)RewardsPage::onReward;
v67 = v66;
v68 = CCMenuItemSpriteExtra::create(
v66,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(RewardsPage::onReward, (unsigned int)a1));
a1->m_rightChest = v68;
sub_776584((int)&v103, "chestClick.ogg");
sub_775D40(&v68->m_selectSound, &v103);
sub_774008(&v103);
a1->m_rightChest->setTag(a1->m_rightChest, 2);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, a1->m_rightChest);
m_rightChest = a1->m_rightChest;
m_mainLayer = a1->m_mainLayer;
v86 = m_rightChest->setPosition;
v88 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v95, 70.0, 14.0);
cocos2d::CCPoint::operator+(&v96, &v93, &v95);
cocos2d::CCNode::convertToWorldSpace(&v102, m_mainLayer, &v96);
cocos2d::CCNode::convertToNodeSpace(&v103.origin, v88, &v102);
v86(m_rightChest, &v103.origin);
a1->m_rightChest->m_scaleMultiplier = 1.08;
v71 = RewardsPage::getRewardFrame((int)&dword_0 + 1, (int)&dword_0 + 1);
v72 = cocos2d::CCSprite::createWithSpriteFrameName(v71);
height = v67->getContentSize(v67)->height;
LODWORD(v102.x) = RewardsPage::onReward;
v102.y = 0.0;
v74 = CCMenuItemSpriteExtra::create(
v72,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(RewardsPage::onReward, (unsigned int)a1));
v75 = v74->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_leftChest = v74;
v75->setTag(v74, 1);
m_leftChest = a1->m_leftChest;
sub_776584((int)&v103, "chestClick.ogg");
sub_775D40(&m_leftChest->m_selectSound, &v103);
sub_774008(&v103);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, a1->m_leftChest);
v77 = a1->m_leftChest;
v78 = a1->m_mainLayer;
v79 = a1->m_buttonMenu;
v80 = v77->setPosition;
cocos2d::CCPoint::CCPoint(&v94, -70.0, 14.0 - (float)((float)(height * 0.2) * 0.5));
cocos2d::CCPoint::operator+(&v95, &v93, &v94);
cocos2d::CCNode::convertToWorldSpace(&v96, v78, &v95);
cocos2d::CCNode::convertToNodeSpace(&v103.origin, v79, &v96);
v80(v77, &v103.origin);
a1->m_leftChest->m_scaleMultiplier = 1.08;
GameLevelManager::sharedState()->m_GJRewardDelegate = &a1->GJRewardDelegate;
v81 = GameStatsManager::sharedState();
if ( GameStatsManager::areRewardsLoaded(v81) )
{
RewardsPage::updateTimers(a1, 0.0);
}
else
{
a1->m_leftLabel->setVisible(a1->m_leftLabel, 0);
a1->m_rightLabel->setVisible(a1->m_rightLabel, 0);
v82 = GameLevelManager::sharedState();
GameLevelManager::getGJRewards(v82, 0);
}
LODWORD(v103.origin.x) = RewardsPage::updateTimers;
v103.origin.y = 0.0;
cocos2d::CCNode::schedule(a1, (cocos2d::SEL_SCHEDULE)(unsigned int)RewardsPage::updateTimers);
return v87;
}