//
// ChallengesPage::init from 0x600278 to 0x600856 (1502 bytes)
//
// 1 xrefs:
// > ChallengesPage::create @ 0x5ff67a
//
// 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:54:40 +0000
//
GameManager *__fastcall ChallengesPage::init(ChallengesPage *this)
{
GameManager *v2; // r0
GameManager *v3; // r9
cocos2d::CCArray *WinSize; // r0
cocos2d::CCObject *v5; // r0
cocos2d::CCDictionary *v6; // r0
cocos2d::CCObject *v7; // r0
int v8; // r6
void (__fastcall *v9)(int, float *); // r10
void (__fastcall *v10)(int, float *); // r10
int v11; // r0
int v12; // r6
const char *v13; // r1
cocos2d::CCSprite *v14; // r7
float v15; // s15
float v16; // s14
void (__fastcall *v17)(cocos2d::CCSprite *, float *); // r11
int v18; // r0
cocos2d::CCMenu *v19; // r7
int v20; // r0
float v21; // s14
float v22; // s13
int v23; // r7
void (__fastcall *v24)(int, float *); // r10
const char *v25; // r2
int v26; // r0
int v27; // r7
void (__fastcall *v28)(int, float *); // r10
int v29; // r0
float v30; // s21
void (__fastcall *v31)(int, float *); // r10
float *v32; // r0
int v33; // r7
float v34; // s20
float v35; // r0
int v36; // r7
GameLevelManager *v37; // r0
const char *v38; // r1
int *ChallengeNode; // r0
int v40; // r10
cocos2d::CCLayerColor *v41; // r0
int v42; // r3
int v43; // r6
void (__fastcall *v44)(int, float *); // r7
const char *v45; // r2
cocos2d::CCLabelBMFont *v46; // r12
cocos2d::CCObject *v47; // r6
int v48; // s15
GameStatsManager *v49; // r0
double v50; // d9
double *v51; // r0
int v52; // r0
GameStatsManager *v53; // r0
_BOOL4 v54; // r1
GameLevelManager *v55; // r0
GameLevelManager *v56; // r0
int v57; // r10
const cocos2d::CCPoint *v58; // r7
void (__fastcall *v59)(int, float *); // r6
void (__fastcall *v61)(cocos2d::CCObject *, float *); // [sp+8h] [bp-64h]
cocos2d::CCLabelBMFont *v62; // [sp+Ch] [bp-60h]
float v63; // [sp+14h] [bp-58h] BYREF
float v64; // [sp+18h] [bp-54h]
float v65[2]; // [sp+1Ch] [bp-50h] BYREF
char v66[8]; // [sp+24h] [bp-48h] BYREF
int (__fastcall *v67)(ChallengesPage *, cocos2d::CCObject *); // [sp+2Ch] [bp-40h]
int v68; // [sp+30h] [bp-3Ch]
_DWORD (*v69)(ChallengesPage *__hidden, float); // [sp+34h] [bp-38h]
int v70; // [sp+38h] [bp-34h]
int v71[3]; // [sp+3Ch] [bp-30h] BYREF
int v72[3]; // [sp+48h] [bp-24h] BYREF
float v73[4]; // [sp+54h] [bp-18h] BYREF
v2 = FLAlertLayer::init(this, 150);
v3 = v2;
if ( !v2 )
return v3;
cocos2d::CCDirector::sharedDirector(v2);
WinSize = (cocos2d::CCArray *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v63);
v5 = (cocos2d::CCObject *)cocos2d::CCArray::create(WinSize);
*((_DWORD *)this + 133) = v5;
v6 = (cocos2d::CCDictionary *)cocos2d::CCObject::retain(v5);
v7 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v6);
*((_DWORD *)this + 138) = v7;
cocos2d::CCObject::retain(v7);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v73, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v73);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v8 + 456))(v8, 255);
v9 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v8 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v73, 420.0, 280.0);
v9(v8, v73);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v8, -1);
v10 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v8 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v63 * 0.5, v64 * 0.5);
v11 = v8;
v12 = 0;
v10(v11, v73);
do
{
v14 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"dailyLevelCorner_001.png",
v13);
(*(void (__fastcall **)(_DWORD, cocos2d::CCSprite *, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
v14,
8);
switch ( v12 )
{
case 2:
cocos2d::CCSprite::setFlipX(v14, 1);
cocos2d::CCSprite::setFlipY(v14, 1);
v15 = 115.0;
LABEL_9:
v16 = 185.0;
goto LABEL_12;
case 3:
cocos2d::CCSprite::setFlipX(v14, 1);
v15 = -115.0;
goto LABEL_9;
case 1:
cocos2d::CCSprite::setFlipY(v14, 1);
v15 = 115.0;
break;
default:
v15 = -115.0;
break;
}
v16 = -185.0;
LABEL_12:
++v12;
v17 = *(void (__fastcall **)(cocos2d::CCSprite *, float *))(*(_DWORD *)v14 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v16 + (float)(v63 * 0.5), v15 + (float)(v64 * 0.5));
v17(v14, v73);
}
while ( v12 != 4 );
v18 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v13);
v67 = ChallengesPage::onClose;
v68 = 0;
v19 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v18, 0, (int)this, (int)ChallengesPage::onClose, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v19, 1.6);
v20 = cocos2d::CCMenu::create(v19, nullptr);
v21 = v64;
v22 = (float)(v63 * 0.5) - 210.0;
*((_DWORD *)this + 111) = v20;
v23 = v20;
v24 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v20 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v22 + 10.0, (float)((float)(v21 * 0.5) + 140.0) - 10.0);
v24(v23, v73);
(*(void (__fastcall **)(_DWORD, _DWORD, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
*((_DWORD *)this + 111),
10);
v26 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"New quests in: 00:00:00", "goldFont.fnt", v25);
*((_DWORD *)this + 134) = v26;
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v26, 20);
(*(void (__fastcall **)(_DWORD, float))(**((_DWORD **)this + 134) + 80))(*((_DWORD *)this + 134), 0.5);
v27 = *((_DWORD *)this + 134);
v28 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v27 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, 0.0, 0.5);
v28(v27, v73);
v29 = *((_DWORD *)this + 134);
v30 = v63 * 0.5;
v31 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v29 + 92);
v32 = (float *)(*(int (__fastcall **)(int))(*(_DWORD *)v29 + 164))(v29);
v33 = *((_DWORD *)this + 134);
v34 = *v32;
v35 = (*(float (__fastcall **)(int))(*(_DWORD *)v33 + 84))(v33);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v73,
v30 - (float)((float)(v34 * v35) * 0.5),
(float)((float)(v64 * 0.5) - 140.0) + 15.0);
v31(v33, v73);
v70 = 0;
v69 = ChallengesPage::updateTimers;
v36 = 1;
v37 = (GameLevelManager *)cocos2d::CCNode::schedule(this, ChallengesPage::updateTimers, 0, 1065353216);
*(_DWORD *)(GameLevelManager::sharedState(v37) + 920) = (char *)this + 524;
do
{
v38 = (const char *)v36++;
ChallengeNode = ChallengesPage::createChallengeNode((cocos2d::CCDictionary **)this, v38, 1, nullptr, 0);
v40 = 0;
}
while ( v36 != 4 );
v41 = LoadingCircle::create((LoadingCircle *)ChallengeNode);
v42 = *((_DWORD *)this + 115);
*((_DWORD *)this + 135) = v41;
*((_DWORD *)v41 + 111) = v42;
*(_BYTE *)(*((_DWORD *)this + 135) + 448) = 0;
LoadingCircle::show(*((cocos2d::CCNode ***)this + 135));
v43 = *(_DWORD *)(*((_DWORD *)this + 135) + 440);
v44 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v43 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v63 * 0.5, (float)((float)(v64 * 0.5) - 140.0) + 17.0);
v44(v43, v73);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(*((_DWORD *)this + 135) + 440) + 80))(
*(_DWORD *)(*((_DWORD *)this + 135) + 440),
1049582633);
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 135) + 172))(*((_DWORD *)this + 135), 0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v65,
(float)((float)(v63 * 0.5) + 210.0) - 30.0,
(float)((float)(v64 * 0.5) + 80.0) + 5.0);
v46 = (cocos2d::CCLabelBMFont *)"...";
do
{
v62 = v46;
v47 = (cocos2d::CCObject *)cocos2d::CCLabelBMFont::create(v46, "chatFont.fnt", v45);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v47 + 80))(v47, 1068708659);
(*(void (__fastcall **)(cocos2d::CCObject *, void *))(*(_DWORD *)v47 + 536))(v47, &unk_BEE6DC);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v47 + 512))(v47, 100);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
v47,
1);
v48 = v40++;
v61 = *(void (__fastcall **)(cocos2d::CCObject *, float *))(*(_DWORD *)v47 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v65[0], v65[1] - (float)((float)v48 * 80.0));
v61(v47, v73);
(*(void (__fastcall **)(cocos2d::CCObject *, _DWORD))(*(_DWORD *)v47 + 172))(v47, 0);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 133), v47);
v46 = v62;
}
while ( v40 != 3 );
v49 = (GameStatsManager *)clock_gettime(0, (struct timespec *)v73);
v50 = (double)SLODWORD(v73[0]) + (double)SLODWORD(v73[1]) / 1000000000.0;
v51 = (double *)GameStatsManager::sharedState(v49);
if ( v50 > v51[45] )
{
v52 = GameStatsManager::sharedState((GameStatsManager *)v51);
v51 = (double *)GameStatsManager::resetChallengeTimer(v52);
}
v53 = (GameStatsManager *)GameStatsManager::sharedState((GameStatsManager *)v51);
v54 = GameStatsManager::areChallengesLoaded(v53);
if ( v54 )
{
(*(void (__fastcall **)(ChallengesPage *, _BOOL4))(*(_DWORD *)this + 676))(this, v54);
}
else
{
v55 = (GameLevelManager *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 134) + 172))(*((_DWORD *)this + 134));
v56 = (GameLevelManager *)GameLevelManager::sharedState(v55);
GameLevelManager::getGJChallenges(v56);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 135) + 172))(*((_DWORD *)this + 135), 1);
}
memset(v71, 0, sizeof(v71));
std::string::__init(v71, "Quests", 6u);
memset(v72, 0, sizeof(v72));
std::string::__init(
v72,
"Quests are small daily challenges that give rewards. The type of quest is decided randomly. You can "
"have maximum 3 active and 3 queued at a time. Queued quests are indicated by dots to the right of a quest.",
0xE6u);
v57 = InfoAlertButton::create((char *)v71, (int)v72, 1065353216);
std::string::~string((int)v72);
std::string::~string((int)v71);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v57);
v58 = *((const cocos2d::CCPoint **)this + 111);
v59 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v57 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v66,
(float)((float)(v63 * 0.5) + 210.0) - 5.0,
(float)((float)(v64 * 0.5) + 140.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v73, v58);
v59(v57, v73);
return v3;
}