//
// ChallengesPage::init from 0x14009d960 to 0x14009e37e (2590 bytes)
//
// 5 xrefs:
// > ChallengesPage::create @ 0x14009d91a
// > ChallengesPage::create @ 0x14009d921
// > ChallengesPage::create @ 0x14009d90b
// > ??> @ 0x14071bf20
// > ??> @ 0x140912fa4
//
// 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 11:26:05 +0000
//
// Hidden C++ exception states: #wind=7
bool __fastcall ChallengesPage::init(__int64 a1)
{
bool result; // al
__int64 v3; // rcx
__int64 v4; // rax
__int64 v5; // rcx
cocos2d::CCObject *v6; // rax
cocos2d::CCObject *v7; // rax
__int64 v8; // rax
__int64 *v9; // rdi
__int64 v10; // rdx
void (__fastcall *v11)(__int64 *, __int64); // r8
__int64 v12; // rbx
__int64 v13; // rax
__int64 v14; // rbx
__int64 v15; // rax
int i; // esi
cocos2d::CCSprite *v17; // rdi
float v18; // xmm6_4
float v19; // xmm7_4
__int64 v20; // rbx
__int64 v21; // rax
__int64 *v22; // rdi
__int64 v23; // rbx
struct cocos2d::CCMenu *v24; // rdi
__int64 v25; // rbx
__int64 v26; // rax
struct cocos2d::CCLabelBMFont *v27; // rax
__int64 v28; // rdi
__int64 v29; // rbx
__int64 v30; // rax
__int64 *v31; // rcx
__int64 v32; // rdi
float v33; // xmm8_4
float v34; // xmm7_4
float v35; // xmm6_4
float v36; // xmm7_4
__int64 v37; // rbx
__int64 v38; // rax
int v39; // r8d
int v40; // r9d
void (__fastcall ***v41)(__int64); // r15
__int64 v42; // rax
int j; // ebx
cocos2d::CCLayerColor *v44; // rax
__int64 *v45; // rdi
__int64 v46; // rbx
__int64 v47; // rax
int k; // esi
struct cocos2d::CCObject *v49; // rdi
__int64 v50; // rdx
void (__fastcall *v51)(char *, __int64); // r8
__int64 v52; // rbx
__int64 v53; // rax
__int64 v54; // rbx
__int64 v55; // rax
__int64 v56; // rdx
__int64 *v57; // rsi
__int64 v58; // rdi
__int64 v59; // rbx
__int64 v60; // rax
__int64 v61; // rax
_QWORD *v62; // [rsp+38h] [rbp-D0h] BYREF
float v63; // [rsp+40h] [rbp-C8h] BYREF
float v64; // [rsp+44h] [rbp-C4h]
_QWORD v65[3]; // [rsp+48h] [rbp-C0h] BYREF
__int64 v66; // [rsp+60h] [rbp-A8h]
_QWORD v67[5]; // [rsp+68h] [rbp-A0h] BYREF
struct __timeb64 Time; // [rsp+90h] [rbp-78h] BYREF
result = FLAlertLayer::init_1(a1, 150);
if ( !result )
return result;
v4 = cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::getWinSize(v4, &v63);
v6 = (cocos2d::CCObject *)cocos2d::CCArray::create(v5);
*(_QWORD *)(a1 + 688) = v6;
cocos2d::CCObject::retain(v6);
v7 = (cocos2d::CCObject *)cocos2d::CCDictionary::create();
*(_QWORD *)(a1 + 728) = v7;
cocos2d::CCObject::retain(v7);
v8 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)&Time, 0.0, 0.0, 80.0, 80.0);
v9 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v8);
v10 = v9[40];
v11 = *(void (__fastcall **)(__int64 *, __int64))(v10 + 40);
LOBYTE(v10) = -1;
v11(v9 + 40, v10);
v12 = *v9;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v62, 420.0, 280.0);
(*(void (__fastcall **)(__int64 *, __int64))(v12 + 312))(v9, v13);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v9,
0xFFFFFFFFLL);
v14 = *v9;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, v63 * 0.5, v64 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v14 + 184))(v9, v15);
for ( i = 0; i < 4; ++i )
{
v17 = cocos2d::CCSprite::createWithSpriteFrameName("dailyLevelCorner_001.png");
(*(void (__fastcall **)(_QWORD, cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v17,
8);
v18 = 185.0;
v19 = 115.0;
if ( i )
{
switch ( i )
{
case 1:
v18 = -185.0;
cocos2d::CCSprite::setFlipY(v17, 1);
break;
case 2:
cocos2d::CCSprite::setFlipX(v17, 1);
cocos2d::CCSprite::setFlipY(v17, 1);
break;
case 3:
v19 = -115.0;
cocos2d::CCSprite::setFlipX(v17, 1);
break;
}
}
else
{
v18 = -185.0;
v19 = -115.0;
}
v20 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, (float)(v63 * 0.5) + v18, (float)(v64 * 0.5) + v19);
(*(void (__fastcall **)(cocos2d::CCSprite *, __int64))(v20 + 184))(v17, v21);
}
v22 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v62 = operator new(0x208u);
v23 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v62);
if ( !v23 )
goto LABEL_16;
if ( !CCMenuItemSpriteExtra::init((__int64 *)v23, v22, 0, a1, (__int64)ChallengesPage::onClose) )
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v23 + 8LL))(v23, 1);
LABEL_16:
v23 = 0;
goto LABEL_17;
}
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v23);
LABEL_17:
*(_DWORD *)(v23 + 372) = 1070386381;
v24 = cocos2d::CCMenu::create((struct cocos2d::CCMenuItem *)v23, 0);
*(_QWORD *)(a1 + 552) = v24;
v25 = *(_QWORD *)v24;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v62,
(float)((float)(v63 * 0.5) - 210.0) + 10.0,
(float)((float)(v64 * 0.5) + 140.0) - 10.0);
(*(void (__fastcall **)(struct cocos2d::CCMenu *, __int64))(v25 + 184))(v24, v26);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 552),
10);
v27 = cocos2d::CCLabelBMFont::create("New quests in: 00:00:00", "goldFont.fnt");
*(_QWORD *)(a1 + 696) = v27;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v27,
20);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 696) + 160LL))(*(_QWORD *)(a1 + 696));
v28 = **(_QWORD **)(a1 + 696);
v29 = *(_QWORD *)(a1 + 696);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, 0.0, 0.5);
(*(void (__fastcall **)(__int64, __int64))(v28 + 288))(v29, v30);
v31 = *(__int64 **)(a1 + 696);
v32 = *v31;
v33 = (float)((float)(v64 * 0.5) - 140.0) + 15.0;
v34 = v63 * 0.5;
v35 = *(float *)(*(__int64 (__fastcall **)(__int64 *))(*v31 + 320))(v31);
v36 = v34
- (float)((float)((*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 696) + 168LL))(*(_QWORD *)(a1 + 696)) * v35)
* 0.5);
v37 = *(_QWORD *)(a1 + 696);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, v36, v33);
(*(void (__fastcall **)(__int64, __int64))(v32 + 184))(v37, v38);
cocos2d::CCNode::schedule(a1, ChallengesPage::updateTimers);
v41 = (void (__fastcall ***)(__int64))(a1 + 672);
v42 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v62 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v62);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v42 = *(_QWORD *)&qword_14090BFB0;
}
*(_QWORD *)(v42 + 1552) = v41;
for ( j = 1; j <= 3; ++j )
{
LOBYTE(v39) = 1;
ChallengesPage::createChallengeNode(a1, j, v39, v40, 0);
}
v44 = LoadingCircle::create();
*(_QWORD *)(a1 + 704) = v44;
*((_QWORD *)v44 + 69) = *(_QWORD *)(a1 + 584);
*(_BYTE *)(*(_QWORD *)(a1 + 704) + 560LL) = 0;
LoadingCircle::show(*(_QWORD *)(a1 + 704));
v45 = *(__int64 **)(*(_QWORD *)(a1 + 704) + 544LL);
v46 = *v45;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, v63 * 0.5, (float)((float)(v64 * 0.5) - 140.0) + 17.0);
(*(void (__fastcall **)(__int64 *, __int64))(v46 + 184))(v45, v47);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 704) + 544LL) + 160LL))(*(_QWORD *)(*(_QWORD *)(a1 + 704) + 544LL));
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 704) + 336LL))(*(_QWORD *)(a1 + 704), 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);
for ( k = 0; k < 3; ++k )
{
v49 = cocos2d::CCLabelBMFont::create("...", "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v49 + 160LL))(v49);
(**((void (__fastcall ***)(__int64, __int16 *))v49 + 46))((__int64)v49 + 368, &word_140702D1C);
v50 = *((_QWORD *)v49 + 46);
v51 = *(void (__fastcall **)(char *, __int64))(v50 + 40);
LOBYTE(v50) = 100;
v51((char *)v49 + 368, v50);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v49,
1);
v52 = *(_QWORD *)v49;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, *(float *)v65, *((float *)v65 + 1) - (float)((float)k * 80.0));
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v52 + 184))(v49, v53);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v49 + 336LL))(v49, 0);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 688), v49);
}
v54 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v62 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v62);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v54 = qword_14090BFE0;
}
ftime64(&Time);
v55 = qword_14090BFE0;
if ( (double)Time.millitm / 1000.0 + (double)SLODWORD(Time.time) > *(double *)(v54 + 568) )
{
if ( !qword_14090BFE0 )
{
v62 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v62);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v55 = qword_14090BFE0;
}
*(_QWORD *)(v55 + 568) = 0;
}
if ( !v55 )
{
v62 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v62);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v55 = qword_14090BFE0;
}
if ( *(double *)(v55 + 568) <= 0.0 )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 696) + 336LL))(*(_QWORD *)(a1 + 696), 0);
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v62 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v62);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
}
GameLevelManager::getGJChallenges();
LOBYTE(v56) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 704) + 336LL))(*(_QWORD *)(a1 + 704), v56);
}
else
{
(**v41)(a1 + 672);
}
v62 = &v65[1];
*(_OWORD *)&v65[1] = 0;
v66 = 0;
v67[0] = 0;
v65[1] = sub_14003D460(0xF0u);
v66 = 230;
v67[0] = 239;
strcpy(
(char *)v65[1],
"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.");
*(_OWORD *)&v67[1] = 0;
v67[3] = 6;
v67[4] = 15;
strcpy((char *)&v67[1], "Quests");
v57 = (__int64 *)InfoAlertButton::create(&v67[1], &v65[1]);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v57);
v58 = *v57;
v59 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v62,
(float)((float)(v63 * 0.5) + 210.0) - 5.0,
(float)((float)(v64 * 0.5) + 140.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace(v59, &Time, v60);
(*(void (__fastcall **)(__int64 *, __int64))(v58 + 184))(v57, v61);
return 1;
}