//
// MusicBrowser::setupList from 0x14047ca30 to 0x14047d18a (1882 bytes)
//
// 9 xrefs:
// > MusicBrowser::setupMusicBrowser @ 0x14047c7b3
// > MusicBrowser::onToggleView @ 0x14047d2a9
// > MusicBrowser::onPage @ 0x14047d51b
// > MusicBrowser::onToggleSearch @ 0x14047d721
// > MusicBrowser::textChanged @ 0x14047d8bc
// > MusicBrowser::sortSelectClosed @ 0x14047df80
// > MusicBrowser::FLAlert_Clicked @ 0x14047dfd1
// > ??> @ 0x14092864c
// > ??> @ 0x140928658
//
// 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:43 +0000
//
// Hidden C++ exception states: #wind=10
void __fastcall MusicBrowser::setupList(__int64 *a1, cocos2d::CCObject *a2)
{
size_t v4; // r14
unsigned __int64 v5; // r13
_DWORD *v6; // r8
int v7; // edx
cocos2d::CCString *v8; // rax
const char *CString; // rax
size_t v10; // r8
__int64 v11; // rax
__int64 v12; // rbx
__int64 v13; // rdx
__int64 v14; // r8
cocos2d::CCNode *v15; // rax
void *v16; // rcx
int v17; // r9d
const char *v18; // rdx
cocos2d::CCString *v19; // rax
const char *v20; // rax
size_t v21; // r8
__int128 *v22; // rdx
cocos2d::CCNode *v23; // rbx
__int64 v24; // rcx
__int64 v25; // rax
struct cocos2d::CCObject *v26; // rbx
cocos2d::CCTouchDispatcher *v27; // rax
cocos2d::CCObject *v28; // rcx
__int64 v29; // rax
__int64 v30; // rcx
cocos2d::CCArray *v31; // r12
__int64 v32; // rcx
signed int v33; // ebx
signed int v34; // r15d
signed int v35; // edi
struct cocos2d::CCObject *v36; // rax
int v37; // eax
int v38; // edx
cocos2d::CCLayerColor *v39; // rax
__int64 v40; // rdi
__int64 v41; // rbx
__int64 v42; // rax
__int64 v43; // rdx
__int64 v44; // rdx
int v45; // ebx
unsigned int v46; // eax
__int64 v47; // rdx
__int64 v48; // rcx
const char *v49; // rbx
const char *v50; // rdx
__int64 v51; // rcx
const char *v52; // rdx
__int64 v53; // rax
const char *v54; // rdx
__int64 v55; // rax
const char *v56; // rdx
__int64 v57; // rcx
__int64 v58; // rax
int v59; // ebx
int v60; // edx
int v61; // r8d
cocos2d::CCString *v62; // rax
char *v63; // rax
void **v64; // rdx
void *v65; // rcx
uintptr_t Reserved; // [rsp+20h] [rbp-A9h]
void *v67; // [rsp+40h] [rbp-89h]
float v68[2]; // [rsp+48h] [rbp-81h] BYREF
void *v69; // [rsp+50h] [rbp-79h] BYREF
__int128 v70; // [rsp+58h] [rbp-71h] BYREF
__int64 v71; // [rsp+68h] [rbp-61h]
__int64 v72; // [rsp+70h] [rbp-59h]
_BYTE v73[32]; // [rsp+78h] [rbp-51h] BYREF
void *Block[2]; // [rsp+98h] [rbp-31h] BYREF
__int64 v75; // [rsp+A8h] [rbp-21h]
unsigned __int64 v76; // [rsp+B0h] [rbp-19h]
__int128 v77; // [rsp+B8h] [rbp-11h] BYREF
__int64 v78; // [rsp+C8h] [rbp-1h]
unsigned __int64 v79; // [rsp+D0h] [rbp+7h]
if ( !a2 )
return;
v4 = -1;
v5 = 15;
if ( *((int *)a1 + 217) > 0 )
{
v6 = (_DWORD *)qword_14090C070;
if ( !qword_14090C070 )
{
v67 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v67);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v6 = (_DWORD *)qword_14090C070;
}
v7 = v6[126];
if ( *((_DWORD *)a1 + 217) == v7 )
goto LABEL_14;
v8 = cocos2d::CCString::createWithFormat("Music Library Updated to version %i", v7);
CString = cocos2d::CCString::getCString(v8);
*(_OWORD *)Block = 0;
v75 = 0;
v76 = 0;
v10 = -1;
do
++v10;
while ( CString[v10] );
sub_14003D230(Block, CString, v10);
v70 = 0;
v71 = 0;
v72 = 15;
LOBYTE(v70) = 0;
v11 = sub_14003F4F0((__int64)v73, (__int64)Block);
v12 = *a1;
v15 = TextAlertPopup::create(v11, v13, v14, 150, (__int64)&v70);
(*(void (__fastcall **)(__int64 *, cocos2d::CCNode *, __int64))(v12 + 456))(a1, v15, 100);
if ( v76 > 0xF )
{
v16 = Block[0];
if ( v76 + 1 >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
}
v6 = (_DWORD *)qword_14090C070;
LABEL_14:
if ( !v6 )
{
v69 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v69);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v6 = (_DWORD *)qword_14090C070;
}
*((_DWORD *)a1 + 217) = v6[126];
if ( *((_DWORD *)a1 + 176) == 1 )
v17 = v6[128];
else
v17 = v6[127];
v18 = "Music";
if ( *((_DWORD *)a1 + 176) == 1 )
v18 = (const char *)&dword_1407B6B90;
v19 = cocos2d::CCString::createWithFormat("%s Library Version %i. Song Count: %i", v18, v6[126], v17);
v20 = cocos2d::CCString::getCString(v19);
v77 = 0;
v78 = 0;
v79 = 0;
v21 = -1;
do
++v21;
while ( v20[v21] );
sub_14003D230(&v77, v20, v21);
v22 = &v77;
if ( v79 > 0xF )
v22 = (__int128 *)v77;
(**(void (__fastcall ***)(__int64, __int128 *))(a1[91] + 360))(a1[91] + 360, v22);
v23 = (cocos2d::CCNode *)a1[107];
cocos2d::CCNode::stopActionByTag(v23, 0);
(*(void (__fastcall **)(_QWORD *, _QWORD))(*((_QWORD *)v23 + 40) + 40LL))((_QWORD *)v23 + 40, 0);
(*(void (__fastcall **)(cocos2d::CCNode *, _QWORD))(*(_QWORD *)v23 + 336LL))(v23, 0);
if ( a1[90] )
{
v25 = cocos2d::CCDirector::sharedDirector(v24);
v26 = (struct cocos2d::CCObject *)a1[90];
v27 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 144LL))(v25);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v27, v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1[90] + 528LL))(a1[90]);
a1[90] = 0;
}
cocos2d::CCObject::retain(a2);
v28 = (cocos2d::CCObject *)a1[89];
if ( v28 )
cocos2d::CCObject::release(v28);
a1[89] = (__int64)a2;
v29 = cocos2d::CCDirector::sharedDirector(v28);
cocos2d::CCDirector::getWinSize(v29, v68);
v31 = (cocos2d::CCArray *)cocos2d::CCArray::create(v30);
v32 = a1[89];
v33 = 10 * *(_DWORD *)(v32 + 96);
v34 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(v32 + 64));
v35 = v33 + 10;
if ( !__OFSUB__(v33, v33 + 10) )
{
do
{
if ( v33 >= v34 )
break;
v36 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1[89] + 64), v33);
cocos2d::CCArray::addObject(v31, v36);
++v33;
}
while ( v33 < v35 );
}
v37 = (unsigned int)CustomListView::create(v31, (__int64)(a1 + 84), 220.0, 340.0, Reserved, 23);
v39 = GJCommentListLayer::create(v37, v38, -13487566, 340.0, 1130102784, 1, 0);
a1[90] = (__int64)v39;
(*(void (__fastcall **)(__int64, cocos2d::CCLayerColor *, __int64))(*(_QWORD *)a1[73] + 456LL))(a1[73], v39, 10);
v40 = *(_QWORD *)a1[90];
v41 = a1[90];
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v69,
(float)(v68[0] - 340.0) * 0.5,
(float)((float)(v68[1] - 220.0) * 0.5) - 10.0);
(*(void (__fastcall **)(__int64, __int64))(v40 + 184))(v41, v42);
LOBYTE(v43) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1[95] + 336LL))(a1[95], v43);
v45 = 0;
if ( (int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1[89] + 64)) > 0 )
{
v46 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1[89] + 64));
v45 = (int)ceilf((float)((v46 - 1) / 0xA));
}
LOBYTE(v44) = *(_DWORD *)(a1[89] + 96) > 0;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1[93] + 336LL))(a1[93], v44);
LOBYTE(v47) = *(_DWORD *)(a1[89] + 96) < v45;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1[94] + 336LL))(a1[94], v47);
v48 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[102] + 952LL))(a1[102]);
v49 = "GJ_button_01.png";
v50 = "GJ_button_01.png";
if ( *(_BYTE *)(a1[89] + 140) )
v50 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v48, v50);
v51 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[103] + 952LL))(a1[103]);
v52 = "GJ_button_01.png";
if ( *(_BYTE *)(a1[89] + 141) )
v52 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v51, v52);
if ( a1[89] )
{
v53 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[104] + 952LL))(a1[104]);
v54 = "GJ_button_01.png";
if ( *(_DWORD *)(a1[89] + 148) == 1 )
v54 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v53, v54);
v55 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[105] + 952LL))(a1[105]);
v56 = "GJ_button_01.png";
if ( *(_DWORD *)(a1[89] + 148) == 2 )
v56 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v55, v56);
v57 = a1[106];
if ( v57 )
{
v58 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v57 + 952LL))(v57);
if ( *(_DWORD *)(a1[89] + 148) == 3 )
v49 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v58, v49);
}
}
v59 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1[89] + 64));
*(_OWORD *)Block = 0;
v75 = 0;
v76 = 15;
LOBYTE(Block[0]) = 0;
if ( v59 <= 0 )
{
v75 = 10;
strcpy((char *)Block, "No matches");
}
else
{
cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1[89] + 64));
v60 = 10 * *(_DWORD *)(a1[89] + 96);
v61 = v59;
if ( v60 + 10 < v59 )
v61 = v60 + 10;
v62 = cocos2d::CCString::createWithFormat("%i to %i of %i", v60 + 1, v61, v59);
v63 = (char *)cocos2d::CCString::getCString(v62);
do
++v4;
while ( v63[v4] );
sub_1400405A0(Block, v63, v4);
v5 = v76;
}
v64 = Block;
if ( v5 > 0xF )
v64 = (void **)Block[0];
(**(void (__fastcall ***)(__int64, void **))(a1[92] + 360))(a1[92] + 360, v64);
if ( v76 > 0xF )
{
v65 = Block[0];
if ( v76 + 1 >= 0x1000 )
{
v65 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v65 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v65);
}
sub_14003D310((__int64)&v77);
}