//
// NewsPopup::init from 0x14049dbe0 to 0x14049e4bb (2267 bytes)
//
// 4 xrefs:
// > MenuLayer::onNews @ 0x14047463f
// > MenuLayer::onNews @ 0x140474630
// > ??> @ 0x1407b9668
// > ??> @ 0x1409293a8
//
// 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:32:55 +0000
//
// Hidden C++ exception states: #wind=8
bool __fastcall NewsPopup::init(__int64 a1)
{
bool result; // al
__int64 v3; // rdx
__int64 v4; // rcx
__int64 v5; // rcx
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rdi
__int64 v9; // rbx
__int64 v10; // rax
int i; // r14d
cocos2d::CCSprite *v12; // rdi
float v13; // xmm6_4
float v14; // xmm7_4
__int64 v15; // rbx
__int64 v16; // rax
struct cocos2d::CCLabelBMFont *v17; // rdi
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rcx
__int64 v21; // rax
__int64 *v22; // rbx
cocos2d::CCObject *v23; // rdi
__int64 v24; // rbx
__int64 v25; // rax
float v26; // xmm7_4
float v27; // xmm8_4
__int64 *v28; // rdi
cocos2d::CCObject *v29; // rbx
__int64 v30; // rdi
__int64 v31; // rbx
__int64 v32; // rax
cocos2d::CCSprite *v33; // rdi
cocos2d::CCObject *v34; // rbx
__int64 v35; // rdi
__int64 v36; // rbx
__int64 v37; // rax
int v38; // edx
cocos2d::CCLayerColor *v39; // rbx
const struct cocos2d::CCSize *v40; // rax
cocos2d::CCObject *v41; // rax
__int64 v42; // rdx
__int64 v43; // rcx
struct cocos2d::CCLabelBMFont *v44; // rax
__int64 v45; // rdi
__int64 v46; // rbx
__int64 v47; // rax
__int64 v48; // rdi
__int64 v49; // rbx
__int64 v50; // rax
__int64 v51; // rax
float v52[2]; // [rsp+38h] [rbp-49h] BYREF
_BYTE v53[8]; // [rsp+40h] [rbp-41h] BYREF
_BYTE v54[8]; // [rsp+48h] [rbp-39h] BYREF
void *v55; // [rsp+F0h] [rbp+6Fh] BYREF
float v56; // [rsp+F8h] [rbp+77h] BYREF
float v57; // [rsp+FCh] [rbp+7Bh]
float v58; // [rsp+100h] [rbp+7Fh] BYREF
float v59; // [rsp+104h] [rbp+83h]
result = FLAlertLayer::init_1(a1, 150);
if ( !result )
return result;
LOBYTE(v3) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v3);
*(_BYTE *)(a1 + 596) = 1;
v4 = qword_14090C070;
if ( !qword_14090C070 )
{
v55 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v4 = qword_14090C070;
}
if ( !*(_BYTE *)(v4 + 969) )
{
*(_BYTE *)(v4 + 969) = 1;
if ( *(_QWORD *)(v4 + 936) == *(_QWORD *)(v4 + 944) )
{
MusicDownloadManager::parseNewsFeed(v4);
v4 = qword_14090C070;
}
}
if ( !v4 )
{
v55 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v4 = qword_14090C070;
}
MusicDownloadManager::addMusicDownloadDelegate(v4, a1 + 672);
v5 = qword_14090C070;
if ( !qword_14090C070 )
{
v55 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v5 = qword_14090C070;
}
if ( *(_QWORD *)(v5 + 936) == *(_QWORD *)(v5 + 944) )
{
if ( !v5 )
{
v55 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v5 = qword_14090C070;
}
*(_BYTE *)(v5 + 968) = 0;
}
v6 = cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6, &v58);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, v58 * 0.5, v59 * 0.5);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v54, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v7);
v9 = *(_QWORD *)v8;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v55, 420.0, 280.0);
(*(void (__fastcall **)(__int64, __int64))(v9 + 312))(v8, v10);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v8 + 184LL))(v8, &v56);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v8,
0xFFFFFFFFLL);
for ( i = 0; i < 4; ++i )
{
v12 = cocos2d::CCSprite::createWithSpriteFrameName("dailyLevelCorner_001.png");
(*(void (__fastcall **)(_QWORD, cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v12,
8);
v13 = 185.0;
v14 = 115.0;
if ( i )
{
if ( i == 1 )
{
v13 = -185.0;
cocos2d::CCSprite::setFlipY(v12, 1);
goto LABEL_25;
}
if ( i == 2 )
{
cocos2d::CCSprite::setFlipX(v12, 1);
cocos2d::CCSprite::setFlipY(v12, 1);
goto LABEL_25;
}
if ( i != 3 )
goto LABEL_25;
cocos2d::CCSprite::setFlipX(v12, 1);
}
else
{
v13 = -185.0;
}
v14 = -116.0;
LABEL_25:
v15 = *(_QWORD *)v12;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v55, v56 + v13, v57 + v14);
(*(void (__fastcall **)(cocos2d::CCSprite *, __int64))(v15 + 184))(v12, v16);
}
v17 = cocos2d::CCLabelBMFont::create("News", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v17 + 160LL))(v17);
v18 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v55, v56, (float)(v57 + 140.0) - 17.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v18 + 184))(v17, v19);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v17,
3);
*(_DWORD *)(a1 + 640) = -1;
v21 = cocos2d::CCMenu::create(v20);
*(_QWORD *)(a1 + 552) = v21;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v21 + 184LL))(v21, &unk_14090B368);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 552),
10);
v22 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
(*(void (__fastcall **)(__int64 *))(*v22 + 160))(v22);
v55 = operator new(0x208u);
v23 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v55);
if ( v23 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v23, v22, 0, a1, (__int64)ScrollViewPopup::onClose) )
{
cocos2d::CCObject::autorelease(v23);
goto LABEL_31;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v23 + 8LL))(v23, 1);
}
v23 = nullptr;
LABEL_31:
*((_DWORD *)v23 + 93) = 1067030938;
v24 = *(_QWORD *)v23;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v55, (float)(v56 - 210.0) + 6.0, (float)(v57 + 140.0) - 6.0);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v24 + 184))(v23, v25);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v23);
v26 = fmaxf(20.0, (float)(v56 - 210.0) - 28.0);
v27 = fminf(v58 - 20.0, (float)(v56 + 210.0) + 28.0);
v28 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v55 = operator new(0x208u);
v29 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v55);
if ( v29 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v29, v28, 0, a1, (__int64)NewsPopup::onPrevPage) )
{
cocos2d::CCObject::autorelease(v29);
goto LABEL_36;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v29 + 8LL))(v29, 1);
}
v29 = nullptr;
LABEL_36:
*(_QWORD *)(a1 + 752) = v29;
*((_DWORD *)v29 + 93) = 1069547520;
v30 = **(_QWORD **)(a1 + 752);
v31 = *(_QWORD *)(a1 + 752);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v55, v26, v57);
(*(void (__fastcall **)(__int64, __int64))(v30 + 184))(v31, v32);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
*(_QWORD *)(a1 + 752));
v33 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v33, 1);
v55 = operator new(0x208u);
v34 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v55);
if ( v34 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v34, (__int64 *)v33, 0, a1, (__int64)NewsPopup::onNextPage) )
{
cocos2d::CCObject::autorelease(v34);
goto LABEL_41;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v34 + 8LL))(v34, 1);
}
v34 = nullptr;
LABEL_41:
*(_QWORD *)(a1 + 760) = v34;
*((_DWORD *)v34 + 93) = 1069547520;
v35 = **(_QWORD **)(a1 + 760);
v36 = *(_QWORD *)(a1 + 760);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v55, v27, v57);
(*(void (__fastcall **)(__int64, __int64))(v35 + 184))(v36, v37);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
*(_QWORD *)(a1 + 760));
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v53, 340.0, 232.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, v56 - 170.0, (float)(v57 - 140.0) + 12.0);
LODWORD(v55) = 838860800;
v39 = GJCommentListLayer::create(0, v38, 838860800, 340.0, 1130889216, 0);
(*(void (__fastcall **)(cocos2d::CCLayerColor *, float *))(*(_QWORD *)v39 + 184LL))(v39, v52);
(*(void (__fastcall **)(_QWORD, cocos2d::CCLayerColor *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v39,
4);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v55, (const struct cocos2d::CCSize *)v53);
v41 = ScrollableContentLayer::create(v40);
*(_QWORD *)(a1 + 712) = v41;
*((_BYTE *)v41 + 499) = 50;
v43 = *((_QWORD *)v41 + 61);
if ( v43 )
{
LOBYTE(v42) = 50;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(v43 + 408) + 40LL))(v43 + 408, v42);
}
(*(void (__fastcall **)(cocos2d::CCLayerColor *, _QWORD, __int64))(*(_QWORD *)v39 + 456LL))(
v39,
*(_QWORD *)(a1 + 712),
6);
v44 = cocos2d::CCLabelBMFont::create(&byte_1406ED6E0, "goldFont.fnt");
*(_QWORD *)(a1 + 736) = v44;
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v44 + 160LL))(v44);
v45 = **(_QWORD **)(a1 + 736);
v46 = *(_QWORD *)(a1 + 736);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v55, 1.0, 0.0);
(*(void (__fastcall **)(__int64, __int64))(v45 + 288))(v46, v47);
v48 = **(_QWORD **)(a1 + 736);
v49 = *(_QWORD *)(a1 + 736);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v55, v52[0] + 340.0, (float)(v52[1] + 232.0) + 5.0);
(*(void (__fastcall **)(__int64, __int64))(v48 + 184))(v49, v50);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 736),
9);
v51 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v55 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v55);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v51 = qword_14090BFD0;
}
*(_DWORD *)(a1 + 708) = *(_DWORD *)(v51 + 1176);
NewsPopup::refreshFromManager(a1);
return 1;
}