//
// ChallengesPage::init from 0x10003565c to 0x100035d4c (1776 bytes)
//
// 2 xrefs:
// > ChallengesPage::create @ 0x100035610
// > ??> @ 0x1008b41c0
//
// 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 10:57:32 +0000
//
__int64 __fastcall ChallengesPage::init(__int64 a1)
{
__int64 inited; // x0
__int64 v3; // x19
__int64 v4; // x0
_QWORD *WinSize; // x0
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x21
int i; // w23
__int64 v11; // x22
int v12; // w8
int v13; // w8
float v14; // s0
float v15; // w8
__int64 v16; // x0
__int64 v17; // x21
__int64 v18; // x21
__int64 v19; // x0
__int64 v20; // x21
__int64 v21; // x21
float v22; // s9
float v23; // s10
float v24; // s0
__int64 v25; // x0
__int64 v26; // x21
__int64 ChallengeNode; // x0
__int64 v28; // x0
__int64 v29; // x21
unsigned int j; // w25
__int64 v31; // x24
__int64 v32; // x0
unsigned __int64 v33; // d1
double v34; // d8
__int64 v35; // x0
__int64 v36; // x0
__int64 v37; // x0
__int64 v38; // x0
__int64 v39; // x0
__int64 v40; // x21
__int64 v41; // x20
__n128 v42; // q0
float v44; // [xsp+8h] [xbp-B8h] BYREF
void *__p[2]; // [xsp+10h] [xbp-B0h] BYREF
char v46; // [xsp+27h] [xbp-99h]
void *v47[2]; // [xsp+28h] [xbp-98h] BYREF
char v48; // [xsp+3Fh] [xbp-81h]
float v49[2]; // [xsp+40h] [xbp-80h] BYREF
__int64 v50; // [xsp+48h] [xbp-78h] BYREF
timeb v51; // [xsp+50h] [xbp-70h] BYREF
inited = FLAlertLayer::init_1(a1, 150);
v3 = inited;
if ( !(_DWORD)inited )
return v3;
v4 = cocos2d::CCDirector::sharedDirector(inited);
WinSize = cocos2d::CCDirector::getWinSize(&v50, v4);
v6 = sub_1002E736C(WinSize);
*(_QWORD *)(a1 + 688) = v6;
v7 = ((__int64 (__fastcall *)(__int64))cocos2d::CCObject::retain)(v6);
v8 = cocos2d::CCDictionary::create(v7);
*(_QWORD *)(a1 + 728) = v8;
cocos2d::CCObject::retain(v8);
sub_1000262CC((float *)&v51, 0.0, 0.0, 80.0, 80.0);
v9 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", &v51);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v9 + 912LL))(v9, 255);
sub_1000262C4((float *)&v51, 420.0, 280.0);
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v9 + 320LL))(v9, &v51);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v9,
0xFFFFFFFFLL);
sub_1000262BC((float *)&v51, *(float *)&v50 * 0.5, *((float *)&v50 + 1) * 0.5);
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v9 + 184LL))(v9, &v51);
for ( i = 0; i != 4; ++i )
{
v11 = cocos2d::CCSprite::createWithSpriteFrameName("dailyLevelCorner_001.png");
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v11, 8);
if ( i > 1 )
{
if ( i != 2 )
{
cocos2d::CCSprite::setFlipX(v11, 1);
v12 = 1127809024;
goto LABEL_11;
}
cocos2d::CCSprite::setFlipX(v11, 1);
cocos2d::CCSprite::setFlipY(v11, 1);
v13 = 1127809024;
LABEL_9:
v14 = *(float *)&v13;
v15 = 115.0;
goto LABEL_12;
}
if ( i )
{
cocos2d::CCSprite::setFlipY(v11, 1);
v13 = -1019674624;
goto LABEL_9;
}
v12 = -1019674624;
LABEL_11:
v14 = *(float *)&v12;
v15 = -115.0;
LABEL_12:
sub_1000262BC((float *)&v51, v14 + (float)(*(float *)&v50 * 0.5), v15 + (float)(*((float *)&v50 + 1) * 0.5));
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v11 + 184LL))(v11, &v51);
}
v16 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v17 = CCMenuItemSpriteExtra::create(v16, 0, a1, sub_100035D80, 0);
CCMenuItemSpriteExtra::setSizeMult(1.6);
v18 = sub_100270434(v17);
*(_QWORD *)(a1 + 552) = v18;
sub_1000262BC(
(float *)&v51,
(float)((float)(*(float *)&v50 * 0.5) + -210.0) + 10.0,
(float)((float)(*((float *)&v50 + 1) * 0.5) + 140.0) + -10.0);
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v18 + 184LL))(v18, &v51);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 552),
10);
v19 = cocos2d::CCLabelBMFont::create_1("New quests in: 00:00:00", "goldFont.fnt");
*(_QWORD *)(a1 + 696) = v19;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v19, 20);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 696) + 160LL))(*(_QWORD *)(a1 + 696), 0.5);
v20 = *(_QWORD *)(a1 + 696);
sub_1000262BC((float *)&v51, 0.0, 0.5);
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v20 + 296LL))(v20, &v51);
v21 = *(_QWORD *)(a1 + 696);
v22 = *(float *)&v50 * 0.5;
v23 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v21 + 328LL))(v21);
v24 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 696) + 168LL))(*(_QWORD *)(a1 + 696));
sub_1000262BC(
(float *)&v51,
v22 + (float)((float)-(float)(v23 * v24) * 0.5),
(float)((float)(*((float *)&v50 + 1) * 0.5) + -140.0) + 15.0);
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v21 + 184LL))(v21, &v51);
v25 = cocos2d::CCNode::schedule(a1, ChallengesPage::updateTimers, 0, 1.0);
*(_QWORD *)(GameLevelManager::sharedState(v25) + 1424) = a1 + 672;
v26 = 1;
do
{
ChallengeNode = ChallengesPage::createChallengeNode(a1, v26, 1, 0, 0.0);
v26 = (unsigned int)(v26 + 1);
}
while ( (_DWORD)v26 != 4 );
v28 = LoadingCircle::create(ChallengeNode);
*(_QWORD *)(a1 + 704) = v28;
*(_QWORD *)(v28 + 552) = *(_QWORD *)(a1 + 584);
*(_BYTE *)(v28 + 560) = 0;
LoadingCircle::show(v28);
v29 = *(_QWORD *)(*(_QWORD *)(a1 + 704) + 544LL);
sub_1000262BC((float *)&v51, *(float *)&v50 * 0.5, (float)((float)(*((float *)&v50 + 1) * 0.5) + -140.0) + 17.0);
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v29 + 184LL))(v29, &v51);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(*(_QWORD *)(a1 + 704) + 544LL) + 160LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 704) + 544LL),
0.28);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 704) + 344LL))(*(_QWORD *)(a1 + 704), 0);
sub_1000262BC(
v49,
(float)((float)(*(float *)&v50 * 0.5) + 210.0) + -30.0,
(float)((float)(*((float *)&v50 + 1) * 0.5) + 80.0) + 5.0);
for ( j = 0; j != 3; ++j )
{
v31 = cocos2d::CCLabelBMFont::create_1("...", "chatFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v31 + 160LL))(v31, 1.4);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v31 + 1072LL))(v31, &unk_10075C810);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v31 + 1024LL))(v31, 100);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v31, 1);
sub_1000262BC((float *)&v51, v49[0], v49[1] + (float)((float)j * -80.0));
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v31 + 184LL))(v31, &v51);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v31 + 344LL))(v31, 0);
sub_1002E74E0(*(_QWORD *)(a1 + 688), v31);
}
v32 = ftime(&v51);
LOWORD(v33) = v51.millitm;
v34 = (double)v33 / 1000.0 + (double)v51.time;
v35 = GameStatsManager::sharedState(v32);
if ( v34 > *(double *)(v35 + 512) )
{
v36 = GameStatsManager::sharedState(v35);
v35 = sub_1003D1A68(v36);
}
v37 = GameStatsManager::sharedState(v35);
if ( (unsigned int)sub_1003D1A70(v37) )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1352LL))(a1);
}
else
{
v38 = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 696) + 344LL))(*(_QWORD *)(a1 + 696), 0);
v39 = GameLevelManager::sharedState(v38);
sub_1000CD000(v39);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 704) + 344LL))(*(_QWORD *)(a1 + 704), 1);
}
sub_100009900(v47, "Quests");
sub_100009900(
__p,
"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.");
v40 = InfoAlertButton::create(v47, __p, 1.0);
if ( v46 < 0 )
operator delete(__p[0]);
if ( v48 < 0 )
operator delete(v47[0]);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v40);
v41 = *(_QWORD *)(a1 + 552);
sub_1000262BC(
&v44,
(float)((float)(*(float *)&v50 * 0.5) + 210.0) + -5.0,
(float)((float)(*((float *)&v50 + 1) * 0.5) + 140.0) + -5.0);
cocos2d::CCNode::convertToNodeSpace(&v51, v41, &v44, v42);
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v40 + 184LL))(v40, &v51);
return v3;
}