//
// ScrollViewPopup::initPopup from 0x140621980 to 0x140621f07 (1415 bytes)
//
// 5 xrefs:
// > MusicBrowser::onChangelog @ 0x14047dda4
// > SFXBrowser::onChangelog @ 0x14061eff4
// > ??> @ 0x1408e676c
// > ??> @ 0x1408e67c8
// > ??> @ 0x14093047c
//
// 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:35:22 +0000
//
bool ScrollViewPopup::initPopup(__int64 a1, cocos2d::CCObject *a2, const char *a3, ...)
{
bool result; // al
__int64 v7; // rdx
__int64 v8; // rcx
__int64 v9; // rax
__int64 v10; // rax
_QWORD *v11; // rax
float v12; // xmm9_4
float v13; // xmm11_4
_QWORD *v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rdx
struct cocos2d::CCLabelBMFont *v18; // rdi
__int64 v19; // rbx
float v20; // xmm8_4
__int64 v21; // rax
__int64 v22; // rcx
__int64 v23; // rax
struct cocos2d::CCSprite *v24; // rax
cocos2d::CCObject *v25; // rdi
__int64 v26; // rbx
__int64 v27; // rax
float v28; // xmm11_4
float v29; // xmm9_4
__int64 v30; // rax
_QWORD *v31; // rbx
__int64 v32; // rdx
void (__fastcall *v33)(_QWORD *, __int64); // r8
const struct cocos2d::CCSize *v34; // rax
cocos2d::CCObject *v35; // rax
float v36; // xmm1_4
float v37; // xmm2_4
__int64 v38; // rbx
cocos2d::CCObject *v39; // rdi
__int64 v40; // rax
cocos2d::CCArray *v41; // rcx
__int64 v42; // r15
struct cocos2d::CCLabelBMFont *v43; // rdi
void (__fastcall **v44)(char *, __int64 *); // rdx
__int64 v45; // rbx
__int64 v46; // rax
__int64 v47; // rbx
__int64 v48; // rax
__int64 v49; // rbx
__int64 v50; // rcx
float v51; // [rsp+30h] [rbp-59h] BYREF
float v52; // [rsp+34h] [rbp-55h]
_DWORD v53[2]; // [rsp+38h] [rbp-51h] BYREF
float v54[2]; // [rsp+40h] [rbp-49h] BYREF
char v55[8]; // [rsp+48h] [rbp-41h] BYREF
_BYTE v56[16]; // [rsp+50h] [rbp-39h] BYREF
__int64 v57; // [rsp+F8h] [rbp+6Fh] BYREF
va_list va; // [rsp+F8h] [rbp+6Fh]
__int64 v59; // [rsp+100h] [rbp+77h]
__int64 v60; // [rsp+108h] [rbp+7Fh]
va_list va1; // [rsp+110h] [rbp+87h] BYREF
va_start(va1, a3);
va_start(va, a3);
v57 = va_arg(va1, _QWORD);
v59 = va_arg(va1, _QWORD);
v60 = va_arg(va1, _QWORD);
result = FLAlertLayer::init_1(a1, 150);
if ( result )
{
LOBYTE(v7) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v7);
*(_BYTE *)(a1 + 596) = 1;
if ( a2 )
{
*(_QWORD *)(a1 + 664) = a2;
cocos2d::CCObject::retain(a2);
}
v9 = cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize(v9, v54);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v51, v54[0] * 0.5, v54[1] * 0.5);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v56, 0.0, 0.0, 80.0, 80.0);
v11 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v10);
v12 = *(float *)&v60;
v13 = *(float *)&v59;
v14 = v11;
v15 = *v11;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)va, *(float *)&v59, *(float *)&v60);
(*(void (__fastcall **)(_QWORD *, __int64))(v15 + 312))(v14, v16);
(*(void (__fastcall **)(_QWORD *, float *))(*v14 + 184LL))(v14, &v51);
LOBYTE(v17) = -1;
(*(void (__fastcall **)(_QWORD *, __int64))(v14[40] + 40LL))(v14 + 40, v17);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v14,
0xFFFFFFFFLL);
v18 = cocos2d::CCLabelBMFont::create(a3, &qword_140704F78);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v18 + 160LL))(v18);
v19 = *(_QWORD *)v18;
v20 = v12 * 0.5;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)va, v51, (float)((float)(v12 * 0.5) + v52) - 16.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v19 + 184))(v18, v21);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v18);
*(_DWORD *)(a1 + 640) = -1;
v23 = cocos2d::CCMenu::create(v22);
*(_QWORD *)(a1 + 552) = v23;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v23 + 184LL))(v23, &unk_14090BCC8);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 552),
10);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
LODWORD(v19) = (_DWORD)v24;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v24 + 160LL))(v24);
v25 = CCMenuItemSpriteExtra::create(v19, 0, a1, (__int64)ScrollViewPopup::onClose);
v26 = *(_QWORD *)v25;
*((_DWORD *)v25 + 93) = 1067030938;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)va,
(float)(v51 - (float)(v13 * 0.5)) + 6.0,
(float)((float)(v12 * 0.5) + v52) - 6.0);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v26 + 184))(v25, v27);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v25);
v28 = v13 - 20.0;
v29 = (float)(v12 - 36.0) - 14.0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v55, v28, v29);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, v51, (float)((float)(v52 - v20) + 14.0) + (float)(v29 * 0.5));
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v56, 0.0, 0.0, 40.0, 40.0);
v31 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02_small.png", v30);
(*(void (__fastcall **)(_QWORD *, char *))(*v31 + 312LL))(v31, v55);
(*(void (__fastcall **)(_QWORD *, _DWORD *))(*v31 + 184LL))(v31, v53);
v32 = v31[40];
v33 = *(void (__fastcall **)(_QWORD *, __int64))(v32 + 40);
LOBYTE(v32) = 60;
v33(v31 + 40, v32);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v31, 4);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)va, (const struct cocos2d::CCSize *)v55);
v35 = ScrollableContentLayer::create(v34);
v36 = *(float *)v53;
v37 = *(float *)&v53[1] - (float)(v29 * 0.5);
*(_QWORD *)(a1 + 672) = v35;
v38 = *(_QWORD *)v35;
v39 = v35;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)va, v36 - (float)(v28 * 0.5), v37);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v38 + 184))(v39, v40);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 672),
5);
v41 = *(cocos2d::CCArray **)(a1 + 664);
v42 = *(_QWORD *)(*(_QWORD *)(a1 + 672) + 416LL);
if ( v41 && cocos2d::CCArray::count(v41) )
{
v29 = fmaxf(v29, (*(float (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1080LL))(a1, v42));
}
else
{
v43 = cocos2d::CCLabelBMFont::create((const char *)&xmmword_1407B6BE8, "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v43 + 160LL))(v43);
LOWORD(v57) = -19276;
v44 = *((void (__fastcall ***)(char *, __int64 *))v43 + 46);
BYTE2(v57) = -76;
(*v44)((char *)v43 + 368, (__int64 *)va);
v45 = *(_QWORD *)v43;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)va, 0.5, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v45 + 288))(v43, v46);
v47 = *(_QWORD *)v43;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)va, v28 * 0.5, (float)-v29 * 0.5);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v47 + 184))(v43, v48);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v42 + 464LL))(v42, v43);
}
v49 = *(_QWORD *)(a1 + 672);
*(float *)(v49 + 432) = v29;
ScrollableContentLayer::clampOffset(v49);
ScrollableContentLayer::ensureScrollThumb(v50);
ScrollableContentLayer::applyContentPosition(v49);
return 1;
}
return result;
}