//
// MusicBrowser::setupList from 0x10060f2e0 to 0x10060f8b2 (1490 bytes)
//
// 7 xrefs:
// > MusicBrowser::onPage @ 0x10060ea12
// > MusicBrowser::onClearSearch @ 0x10060ec08
// > MusicBrowser::setupMusicBrowser @ 0x10060f26b
// > MusicBrowser::setTextPopupClosed @ 0x10060fd24
// > sub_10060FD30 @ 0x10060fd74
// > MusicBrowser::FLAlert_Clicked @ 0x10060ff2d
// > sub_10060FF40 @ 0x10060ff81
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall MusicBrowser::setupList(MusicBrowser *a1, MusicSearchResult *a2)
{
__int64 v2; // xmm0_8
int m_libraryVersion; // r14d
cocos2d::CCString *v5; // rax
const char *CString; // r14
size_t v7; // rax
size_t v8; // r15
char *v9; // r13
char v10; // r14
size_t v11; // r12
cocos2d::CCObject *v12; // rax
cocos2d::CCString *v13; // rax
const char *v14; // r12
size_t v15; // rax
size_t v16; // r15
char *v17; // r13
MusicSearchResult *v18; // r14
cocos2d::CCLabelBMFont *m_infoLabel; // rdi
char *v20; // rsi
size_t v21; // r14
cocos2d::CCDirector *v22; // rax
cocos2d::CCTouchDispatcher *v23; // rax
MusicSearchResult *m_searchResult; // rdi
cocos2d::CCDirector *v25; // rsi
cocos2d::CCArray *v26; // r14
MusicSearchResult *v27; // rax
int m_startIndex; // r12d
int v29; // eax
int v30; // r15d
int v31; // r12d
__int64 v32; // rax
CustomListView *v33; // rax
GJCommentListLayer *v34; // rax
GJCommentListLayer *m_listLayer; // r14
int v36; // r14d
MusicSearchResult *v37; // rcx
unsigned int sizex2; // eax
std::size_t size; // rax
ButtonSprite *v40; // rax
const char *v41; // r14
const char *v42; // rsi
ButtonSprite *v43; // rax
float v44; // [rsp+0h] [rbp-90h] BYREF
__int128 v45; // [rsp+8h] [rbp-88h] BYREF
void *v46; // [rsp+18h] [rbp-78h]
__int128 v47; // [rsp+20h] [rbp-70h] BYREF
void *v48; // [rsp+30h] [rbp-60h]
float v49[2]; // [rsp+40h] [rbp-50h] BYREF
MusicSearchResult *v50; // [rsp+48h] [rbp-48h]
__int128 __dst; // [rsp+50h] [rbp-40h] BYREF
void *__p; // [rsp+60h] [rbp-30h]
if ( !a2 )
return;
v50 = a2;
m_libraryVersion = a1->m_libraryVersion;
if ( m_libraryVersion <= 0 || m_libraryVersion == MusicDownloadManager::sharedState()->m_musicLibraryVersion )
goto LABEL_18;
MusicDownloadManager::sharedState();
v5 = (cocos2d::CCString *)sub_1007AB580("Music Library Updated to version %i", SLOBYTE(v44));
CString = cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_52;
v8 = v7;
if ( v7 >= 0x17 )
{
v11 = 26;
if ( (v7 | 7) != 0x17 )
v11 = (v7 | 7) + 1;
v9 = (char *)operator new(v11);
__p = v9;
*(_QWORD *)&__dst = v11 + 1;
*((_QWORD *)&__dst + 1) = v8;
LABEL_12:
memmove(v9, CString, v8);
v9[v8] = 0;
v10 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_8;
LABEL_13:
sub_100006B70(&v47, __p, *((unsigned __int64 *)&__dst + 1), *(double *)&v2);
goto LABEL_14;
}
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( v7 )
goto LABEL_12;
BYTE1(__dst) = 0;
v10 = __dst;
if ( (__dst & 1) != 0 )
goto LABEL_13;
LABEL_8:
v48 = __p;
v47 = __dst;
LABEL_14:
LOWORD(v45) = 0;
v2 = 1065353216;
v12 = TextAlertPopup::create((__int64)&v47, 0x96u, &v45, (__m128)0x3F800000u, 0.5);
((void (__fastcall *)(MusicBrowser *, cocos2d::CCObject *, __int64))a1->addChild_0)(a1, v12, 100);
if ( (v45 & 1) != 0 )
{
operator delete(v46);
if ( (v47 & 1) == 0 )
{
LABEL_16:
if ( (v10 & 1) == 0 )
goto LABEL_18;
goto LABEL_17;
}
}
else if ( (v47 & 1) == 0 )
{
goto LABEL_16;
}
operator delete(v48);
if ( (v10 & 1) != 0 )
LABEL_17:
operator delete(__p);
LABEL_18:
a1->m_libraryVersion = MusicDownloadManager::sharedState()->m_musicLibraryVersion;
MusicDownloadManager::sharedState();
MusicDownloadManager::sharedState();
v13 = (cocos2d::CCString *)sub_1007AB580("%s Library Version %i. Song Count: %i", SLOBYTE(v44));
v14 = cocos2d::CCString::getCString(v13);
v15 = strlen(v14);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_52:
sub_100006BF0(*(double *)&v2);
v16 = v15;
if ( v15 >= 0x17 )
{
v21 = 26;
if ( (v15 | 7) != 0x17 )
v21 = (v15 | 7) + 1;
v17 = (char *)operator new(v21);
__p = v17;
*(_QWORD *)&__dst = v21 + 1;
*((_QWORD *)&__dst + 1) = v16;
v18 = v50;
LABEL_26:
memmove(v17, v14, v16);
v17[v16] = 0;
m_infoLabel = a1->m_infoLabel;
if ( (__dst & 1) != 0 )
goto LABEL_22;
LABEL_27:
v20 = (char *)&__dst + 1;
goto LABEL_28;
}
LOBYTE(__dst) = 2 * v15;
v17 = (char *)&__dst + 1;
v18 = v50;
if ( v15 )
goto LABEL_26;
BYTE1(__dst) = 0;
m_infoLabel = a1->m_infoLabel;
if ( (__dst & 1) == 0 )
goto LABEL_27;
LABEL_22:
v20 = (char *)__p;
LABEL_28:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))m_infoLabel->setString)(m_infoLabel, v20);
LoadingCircleSprite::hideCircle(a1->m_circleSprite);
if ( a1->m_listLayer )
{
v22 = cocos2d::CCDirector::sharedDirector();
v23 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v22->getTouchDispatcher)(v22);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v23, a1->m_listLayer);
((void (__fastcall *)(GJCommentListLayer *))a1->m_listLayer->removeMeAndCleanup)(a1->m_listLayer);
a1->m_listLayer = nullptr;
}
cocos2d::CCObject::retain(v18);
m_searchResult = a1->m_searchResult;
if ( m_searchResult )
cocos2d::CCObject::release(m_searchResult);
a1->m_searchResult = v18;
v25 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v49);
v26 = (cocos2d::CCArray *)sub_10071F9E0(v49, v25);
v27 = a1->m_searchResult;
m_startIndex = v27->m_startIndex;
v29 = sub_100720070(v27->m_filterObjects);
v30 = 10 * m_startIndex;
v31 = 10 * m_startIndex + 10;
if ( v31 >= v29 )
v31 = v29;
if ( v29 > v30 )
{
do
{
v32 = sub_1007200C0(a1->m_searchResult->m_filterObjects, (unsigned int)v30);
sub_10071FCD0(v26, v32);
++v30;
}
while ( v30 < v31 );
}
v33 = CustomListView::create(v26, &a1->TableViewCellDelegate, 220.0, 340.0, 0, CustomMusic, 0.0);
v34 = GJCommentListLayer::create(v33, "", (cocos2d::ccColor4B)-13487566, 340.0, 220.0, 1);
a1->m_listLayer = v34;
((void (__fastcall *)(cocos2d::CCLayer *, GJCommentListLayer *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v34,
10);
m_listLayer = a1->m_listLayer;
sub_10028CBE0(&v44, (float)(v49[0] + -340.0) * 0.5, (float)((float)(v49[1] + -220.0) * 0.5) + -10.0);
((void (__fastcall *)(GJCommentListLayer *, float *))m_listLayer->setPosition)(m_listLayer, &v44);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_refreshButton->setVisible)(a1->m_refreshButton, 1);
if ( (int)sub_100720070(a1->m_searchResult->m_filterObjects) <= 0 )
v36 = 0;
else
v36 = (int)(float)(((unsigned int)sub_100720070(a1->m_searchResult->m_filterObjects) - 1) / 0xA);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_prevButton->setVisible)(
a1->m_prevButton,
a1->m_searchResult->m_startIndex > 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_nextButton->setVisible)(
a1->m_nextButton,
a1->m_searchResult->m_startIndex < v36);
v37 = a1->m_searchResult;
sizex2 = v37->m_searchQuery.m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
size = v37->m_searchQuery.m_data.m_long.size;
else
size = sizex2 >> 1;
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_clearSearchButton->setVisible)(
a1->m_clearSearchButton,
size != 0);
v40 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_tagFilterButton->getNormalImage)(a1->m_tagFilterButton);
v41 = "GJ_button_01.png";
v42 = "GJ_button_01.png";
if ( a1->m_searchResult->m_tagFilter )
v42 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v40, v42);
v43 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_artistFilterButton->getNormalImage)(a1->m_artistFilterButton);
if ( a1->m_searchResult->m_artistFilter )
v41 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v43, v41);
MusicBrowser::updatePageLabel(a1);
if ( (__dst & 1) != 0 )
operator delete(__p);
}