//
// ChallengesPage::init from 0xa63918 to 0xa64114 (2044 bytes)
//
// 3 xrefs:
// > ChallengesPage::create @ 0xa642b0
// > ??> @ 0xe63c8
// > ??> @ 0x148f080
//
// This function is hookable on this platform (idp: arm, 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 13:00:16 +0000
//
__int64 __fastcall ChallengesPage::init(ChallengesPage *this)
{
cocos2d::CCDirector *v2; // x0
unsigned int v3; // w25
cocos2d::CCDirector *v5; // x0
cocos2d::CCArray *WinSize; // x0
int v7; // w22
cocos2d::CCObject *v8; // x0
cocos2d::CCDictionary *v9; // x0
cocos2d::CCObject *v10; // x0
__int64 v11; // x21
void (__fastcall *v12)(__int64, GameStatsManager **); // x23
void (__fastcall *v13)(__int64, GameStatsManager **); // x23
const char *v14; // x1
cocos2d::CCSprite *v15; // x21
void (__fastcall *v16)(cocos2d::CCSprite *, GameStatsManager **); // x23
void (__fastcall *v17)(cocos2d::CCSprite *, GameStatsManager **); // x22
const char *v18; // x1
int v19; // w21
__int64 v20; // x0
cocos2d::CCMenu *v21; // x22
__int64 v22; // x22
float v23; // s1
void (__fastcall *v24)(__int64, GameStatsManager **); // x23
const char *v25; // x2
__int64 v26; // x0
__int64 v27; // x22
void (__fastcall *v28)(__int64, GameStatsManager **); // x23
float v29; // s12
__int64 v30; // x0
void (__fastcall *v31)(__int64, GameStatsManager **); // x23
float *v32; // x0
__int64 v33; // x22
float v34; // s11
float v35; // s0
GameLevelManager *v36; // x0
int v37; // w1
cocos2d::CCObject *ChallengeNode; // x0
__int64 v39; // x0
int v40; // w22
__int64 v41; // x21
void (__fastcall *v42)(__int64, GameStatsManager **); // x26
const char *v43; // x2
cocos2d::CCObject *v44; // x21
float v45; // s1
void (__fastcall *v46)(cocos2d::CCObject *, GameStatsManager **); // x26
double v47; // d8
double *v48; // x0
GameStatsManager *v49; // x0
GameLevelManager *v50; // x0
GameLevelManager *v51; // x0
__int64 v52; // x22
cocos2d::CCNode *v53; // x23
void (__fastcall *v54)(__int64, GameStatsManager **); // x19
float v55; // s0
void (__fastcall *v56)(cocos2d::CCSprite *, GameStatsManager **); // x23
GameStatsManager *v57; // x0
__int64 v58; // [xsp+B0h] [xbp+B0h] BYREF
float v59[2]; // [xsp+B8h] [xbp+B8h] BYREF
_BYTE v60[8]; // [xsp+C0h] [xbp+C0h] BYREF
GameStatsManager *v61[2]; // [xsp+C8h] [xbp+C8h] BYREF
__int64 v62[2]; // [xsp+D8h] [xbp+D8h] BYREF
void *v63; // [xsp+E8h] [xbp+E8h]
__int64 v64[2]; // [xsp+F0h] [xbp+F0h] BYREF
void *v65; // [xsp+100h] [xbp+100h]
v2 = (cocos2d::CCDirector *)(unsigned __int8)FLAlertLayer::init(this, 150);
v3 = (unsigned __int8)v2;
if ( !(_BYTE)v2 )
return v3;
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v2);
WinSize = (cocos2d::CCArray *)cocos2d::CCDirector::getWinSize(&v58, v5);
v7 = 1;
v8 = (cocos2d::CCObject *)cocos2d::CCArray::create(WinSize);
*((_QWORD *)this + 86) = v8;
v9 = (cocos2d::CCDictionary *)cocos2d::CCObject::retain(v8);
v10 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v9);
*((_QWORD *)this + 91) = v10;
cocos2d::CCObject::retain(v10);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v61, 0.0, 0.0, 80.0, 80.0);
v11 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v61);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 912LL))(v11, 0xFFFFFFFFLL);
v12 = *(void (__fastcall **)(__int64, GameStatsManager **))(*(_QWORD *)v11 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v61, 420.0, 280.0);
v12(v11, v61);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v11,
0xFFFFFFFFLL);
v13 = *(void (__fastcall **)(__int64, GameStatsManager **))(*(_QWORD *)v11 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, *(float *)&v58 * 0.5, *((float *)&v58 + 1) * 0.5);
v13(v11, v61);
while ( 1 )
{
while ( 1 )
{
v15 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"dailyLevelCorner_001.png",
v14);
(*(void (__fastcall **)(_QWORD, cocos2d::CCSprite *, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v15,
8);
if ( v7 != 3 )
break;
cocos2d::CCSprite::setFlipX(v15, 1);
cocos2d::CCSprite::setFlipY(v15, 1);
v55 = 185.0;
LABEL_24:
++v7;
v56 = *(void (__fastcall **)(cocos2d::CCSprite *, GameStatsManager **))(*(_QWORD *)v15 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
v55 + (float)(*(float *)&v58 * 0.5),
(float)(*((float *)&v58 + 1) * 0.5) + 115.0);
v56(v15, v61);
}
if ( v7 == 4 )
break;
if ( v7 == 2 )
{
cocos2d::CCSprite::setFlipY(v15, 1);
v55 = -185.0;
goto LABEL_24;
}
v16 = *(void (__fastcall **)(cocos2d::CCSprite *, GameStatsManager **))(*(_QWORD *)v15 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
(float)(*(float *)&v58 * 0.5) + -185.0,
(float)(*((float *)&v58 + 1) * 0.5) + -115.0);
v16(v15, v61);
++v7;
}
cocos2d::CCSprite::setFlipX(v15, 1);
v17 = *(void (__fastcall **)(cocos2d::CCSprite *, GameStatsManager **))(*(_QWORD *)v15 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
(float)(*(float *)&v58 * 0.5) + 185.0,
(float)(*((float *)&v58 + 1) * 0.5) + -115.0);
v17(v15, v61);
v19 = 1;
v20 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v18);
v21 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v20, 0, (__int64)this, (__int64)ChallengesPage::onClose, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v21, 1.6);
v22 = cocos2d::CCMenu::create(v21, nullptr);
v23 = *(float *)&v58;
*((_QWORD *)this + 69) = v22;
v24 = *(void (__fastcall **)(__int64, GameStatsManager **))(*(_QWORD *)v22 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
(float)((float)(v23 * 0.5) + -210.0) + 10.0,
(float)((float)(*((float *)&v58 + 1) * 0.5) + 140.0) - 10.0);
v24(v22, v61);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
*((_QWORD *)this + 69),
10);
v26 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"New quests in: 00:00:00", "goldFont.fnt", v25);
*((_QWORD *)this + 87) = v26;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(*((_QWORD *)this + 73), v26, 20);
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 87) + 160LL))(*((_QWORD *)this + 87), 0.5);
v27 = *((_QWORD *)this + 87);
v28 = *(void (__fastcall **)(__int64, GameStatsManager **))(*(_QWORD *)v27 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, 0.0, 0.5);
v28(v27, v61);
v29 = *(float *)&v58;
v30 = *((_QWORD *)this + 87);
v31 = *(void (__fastcall **)(__int64, GameStatsManager **))(*(_QWORD *)v30 + 184LL);
v32 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v30 + 328LL))(v30);
v33 = *((_QWORD *)this + 87);
v34 = *v32;
v35 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v33 + 168LL))(v33);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
-(float)((float)((float)(v34 * v35) * 0.5) - (float)(v29 * 0.5)),
(float)((float)(*((float *)&v58 + 1) * 0.5) + -140.0) + 15.0);
v31(v33, v61);
v36 = (GameLevelManager *)cocos2d::CCNode::schedule(this, ChallengesPage::updateTimers, 0, 1.0);
*(_QWORD *)(GameLevelManager::sharedState(v36) + 1424) = (char *)this + 672;
do
{
v37 = v19++;
ChallengeNode = ChallengesPage::createChallengeNode((cocos2d::CCDictionary **)this, v37, 1u, 0.0, 0);
}
while ( v19 != 4 );
v39 = LoadingCircle::create(ChallengeNode);
*((_QWORD *)this + 88) = v39;
*(_QWORD *)(v39 + 552) = *((_QWORD *)this + 73);
v40 = 0;
*(_BYTE *)(*((_QWORD *)this + 88) + 560LL) = 0;
LoadingCircle::show(*((cocos2d::CCNode ***)this + 88));
v41 = *(_QWORD *)(*((_QWORD *)this + 88) + 544LL);
v42 = *(void (__fastcall **)(__int64, GameStatsManager **))(*(_QWORD *)v41 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
*(float *)&v58 * 0.5,
(float)((float)(*((float *)&v58 + 1) * 0.5) + -140.0) + 17.0);
v42(v41, v61);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(*((_QWORD *)this + 88) + 544LL) + 160LL))(
*(_QWORD *)(*((_QWORD *)this + 88) + 544LL),
0.28);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 88) + 344LL))(*((_QWORD *)this + 88), 0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v59,
(float)((float)(*(float *)&v58 * 0.5) + 210.0) - 30.0,
(float)((float)(*((float *)&v58 + 1) * 0.5) + 80.0) + 5.0);
do
{
v44 = (cocos2d::CCObject *)cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"...", "chatFont.fnt", v43);
(*(void (__fastcall **)(cocos2d::CCObject *, float))(*(_QWORD *)v44 + 160LL))(v44, 1.4);
(*(void (__fastcall **)(cocos2d::CCObject *, void *))(*(_QWORD *)v44 + 1072LL))(v44, &unk_11739D0);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v44 + 1024LL))(v44, 100);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v44,
1);
v45 = (float)v40++;
v46 = *(void (__fastcall **)(cocos2d::CCObject *, GameStatsManager **))(*(_QWORD *)v44 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, v59[0], v59[1] - (float)(v45 * 80.0));
v46(v44, v61);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v44 + 344LL))(v44, 0);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 86), v44);
}
while ( v40 != 3 );
clock_gettime(0, (struct timespec *)v61);
v47 = (double)(__int64)v61[0] + (double)(__int64)v61[1] / 1000000000.0;
v48 = (double *)GameStatsManager::sharedState(v61[0]);
if ( v48[64] < v47 )
{
v57 = (GameStatsManager *)GameStatsManager::sharedState((GameStatsManager *)v48);
GameStatsManager::resetChallengeTimer(v57);
}
v49 = (GameStatsManager *)GameStatsManager::sharedState((GameStatsManager *)v48);
if ( GameStatsManager::areChallengesLoaded(v49) )
{
(*(void (__fastcall **)(ChallengesPage *))(*(_QWORD *)this + 1352LL))(this);
}
else
{
v50 = (GameLevelManager *)(*(__int64 (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 87) + 344LL))(
*((_QWORD *)this + 87),
0);
v51 = (GameLevelManager *)GameLevelManager::sharedState(v50);
GameLevelManager::getGJChallenges(v51);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 88) + 344LL))(*((_QWORD *)this + 88), 1);
}
v62[0] = 0;
v62[1] = 0;
v63 = nullptr;
std::string::__init(v62, "Quests", 6u);
v64[0] = 0;
v64[1] = 0;
v65 = nullptr;
std::string::__init(
v64,
"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);
v52 = InfoAlertButton::create((char *)v62, (char *)v64, 1.0);
if ( (v64[0] & 1) != 0 )
operator delete(v65);
if ( (v62[0] & 1) != 0 )
operator delete(v63);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v52);
v53 = *((cocos2d::CCNode **)this + 69);
v54 = *(void (__fastcall **)(__int64, GameStatsManager **))(*(_QWORD *)v52 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v60,
(float)((float)(*(float *)&v58 * 0.5) + 210.0) - 5.0,
(float)((float)(*((float *)&v58 + 1) * 0.5) + 140.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace((__int64 *)v61, v53, (const cocos2d::CCPoint *)v60);
v54(v52, v61);
return v3;
}