//
// MusicBrowser::setupList from 0xa5adbc to 0xa5b444 (1672 bytes)
//
// 6 xrefs:
// > MusicBrowser::setupMusicBrowser @ 0xa5b49c
// > MusicBrowser::onPage @ 0xa5c2c4
// > MusicBrowser::onClearSearch @ 0xa5c324
// > MusicBrowser::setTextPopupClosed @ 0xa5c378
// > MusicBrowser::FLAlert_Clicked @ 0xa5c3d4
// > ??> @ 0x51e28
//
// 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 MusicBrowser::setupList(MusicBrowser *a1, MusicSearchResult *a2)
{
int m_libraryVersion; // w21
MusicDownloadManager *v5; // x0
cocos2d::CCString *v6; // x0
char *CString; // x0
void (__fastcall *addChild_0)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int); // x24
__int64 v9; // x0
void *v10; // x0
void *v11; // x0
unsigned __int8 *v12; // x0
unsigned int *v13; // x1
int v14; // w2
MusicDownloadManager *v15; // x0
GJSongType m_songType; // w1
const char *v17; // x21
MusicDownloadManager *v18; // x0
GJSongType v19; // w1
__int64 m_ncsSongCount; // x3
cocos2d::CCString *v21; // x0
char *v22; // x0
cocos2d::CCDirector *v23; // x0
cocos2d::CCTouchDispatcher *v24; // x0
MusicSearchResult *m_searchResult; // x0
cocos2d::CCDirector *v26; // x0
cocos2d::CCArray *v27; // x0
cocos2d::CCArray *v28; // x21
MusicSearchResult *v29; // x0
signed int v30; // w19
signed int v31; // w22
signed int v32; // w26
cocos2d::CCObject *v33; // x0
CustomListView *v34; // x0
GJCommentListLayer *v35; // x0
cocos2d::CCLayer *m_mainLayer; // x3
GJCommentListLayer *m_listLayer; // x19
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
int v39; // w19
ButtonSprite *v40; // x0
ButtonSprite *v41; // x0
unsigned __int8 *v42; // x0
unsigned int *v43; // x1
int v44; // w2
unsigned int *v45; // x1
int v46; // w2
unsigned int *v47; // x1
int v48; // w2
__int64 v49; // [xsp+0h] [xbp+0h] BYREF
__int64 m_musicLibraryVersion; // [xsp+68h] [xbp+68h]
const unsigned __int8 *v51; // [xsp+80h] [xbp+80h] BYREF
__int64 v52; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v53; // [xsp+90h] [xbp+90h] BYREF
if ( a2 )
{
m_libraryVersion = a1->m_libraryVersion;
if ( m_libraryVersion > 0 && m_libraryVersion != MusicDownloadManager::sharedState()->m_musicLibraryVersion )
{
v5 = MusicDownloadManager::sharedState();
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Music Library Updated to version %i",
(const char *)(unsigned int)v5->m_musicLibraryVersion);
CString = (char *)cocos2d::CCString::getCString(v6);
sub_D153B8((unsigned int)&v49 + 128, CString);
addChild_0 = a1->addChild_0;
sub_D18D28(&v52);
sub_D153B8((int)&v53, &byte_F288A0);
v9 = TextAlertPopup::create(1.0, 0.5, (__int64)&v52, 150);
addChild_0(a1, (cocos2d::CCNode *)v9, 100);
v10 = (void *)(*(_QWORD *)&v53 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v53 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(*(_QWORD *)&v53 - 8LL);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(_DWORD *)(*(_QWORD *)&v53 - 8LL);
*(_DWORD *)(*(_QWORD *)&v53 - 8LL) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v10);
}
v11 = (void *)(v52 - 24);
if ( (__int64 *)(v52 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(v52 - 8);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(_DWORD *)(v52 - 8);
*(_DWORD *)(v52 - 8) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v11);
}
v12 = (unsigned __int8 *)(v51 - 24);
if ( v51 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v51 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v51 - 2);
*((_DWORD *)v51 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v12);
}
}
v15 = MusicDownloadManager::sharedState();
m_songType = a1->m_songType;
a1->m_libraryVersion = v15->m_musicLibraryVersion;
if ( m_songType == 1 )
v17 = "NCS";
else
v17 = "Music";
v18 = MusicDownloadManager::sharedState();
v19 = a1->m_songType;
m_musicLibraryVersion = (unsigned int)v18->m_musicLibraryVersion;
if ( v19 == 1 )
m_ncsSongCount = (unsigned int)MusicDownloadManager::sharedState()->m_ncsSongCount;
else
m_ncsSongCount = (unsigned int)MusicDownloadManager::sharedState()->m_musicObjectCount;
v21 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s Library Version %i. Song Count: %i",
v17,
m_musicLibraryVersion,
m_ncsSongCount);
v22 = (char *)cocos2d::CCString::getCString(v21);
sub_D153B8((int)&v51, v22);
a1->m_infoLabel->setString(a1->m_infoLabel, v51);
LoadingCircleSprite::hideCircle(a1->m_circleSprite);
if ( a1->m_listLayer )
{
v23 = cocos2d::CCDirector::sharedDirector();
v24 = v23->getTouchDispatcher(v23);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v24, a1->m_listLayer);
a1->m_listLayer->removeMeAndCleanup(a1->m_listLayer);
a1->m_listLayer = nullptr;
}
cocos2d::CCObject::retain(a2);
m_searchResult = a1->m_searchResult;
if ( m_searchResult )
cocos2d::CCObject::release(m_searchResult);
a1->m_searchResult = a2;
v26 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v26);
v28 = (cocos2d::CCArray *)cocos2d::CCArray::create(v27);
v29 = a1->m_searchResult;
v30 = 10 * v29->m_startIndex;
v31 = cocos2d::CCArray::count(v29->m_filterObjects);
v32 = v30 + 9;
if ( v30 < v31 )
{
do
{
v33 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(a1->m_searchResult->m_filterObjects, v30);
cocos2d::CCArray::addObject(v28, v33);
++v30;
}
while ( v30 <= v32 && v31 > v30 );
}
v34 = CustomListView::create(v28, (BoomListType)((_DWORD)a1 + 640), 220.0, 340.0);
v35 = GJCommentListLayer::create(v34, &byte_F288A0, (cocos2d::ccColor4B)-13487566, 340.0, 220.0, 1);
m_mainLayer = a1->m_mainLayer;
a1->m_listLayer = v35;
m_mainLayer->addChild_0(m_mainLayer, v35, 10);
m_listLayer = a1->m_listLayer;
setPosition = m_listLayer->setPosition;
cocos2d::CCPoint::CCPoint(
&v53,
(float)(*(float *)&v52 - 340.0) * 0.5,
(float)((float)(*((float *)&v52 + 1) - 220.0) * 0.5) + -10.0);
setPosition(m_listLayer, &v53);
a1->m_refreshButton->setVisible(a1->m_refreshButton, 1);
if ( (int)cocos2d::CCArray::count(a1->m_searchResult->m_filterObjects) <= 0 )
v39 = 0;
else
v39 = vcvtps_s32_f32((float)(((unsigned int)cocos2d::CCArray::count(a1->m_searchResult->m_filterObjects) - 1) / 0xA));
a1->m_prevButton->setVisible(a1->m_prevButton, a1->m_searchResult->m_startIndex > 0);
a1->m_nextButton->setVisible(a1->m_nextButton, a1->m_searchResult->m_startIndex < v39);
a1->m_clearSearchButton->setVisible(
a1->m_clearSearchButton,
*((_QWORD *)a1->m_searchResult->m_searchQuery.m_data.m_data - 3) != 0);
v40 = (ButtonSprite *)a1->m_tagFilterButton->getNormalImage(a1->m_tagFilterButton);
if ( a1->m_searchResult->m_tagFilter )
ButtonSprite::updateBGImage(v40, "GJ_button_02.png");
else
ButtonSprite::updateBGImage(v40, "GJ_button_01.png");
v41 = (ButtonSprite *)a1->m_artistFilterButton->getNormalImage(a1->m_artistFilterButton);
if ( a1->m_searchResult->m_artistFilter )
ButtonSprite::updateBGImage(v41, "GJ_button_02.png");
else
ButtonSprite::updateBGImage(v41, "GJ_button_01.png");
MusicBrowser::updatePageLabel(a1);
v42 = (unsigned __int8 *)(v51 - 24);
if ( v51 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v43 = (unsigned int *)(v51 - 8);
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *((_DWORD *)v51 - 2);
*((_DWORD *)v51 - 2) = v44 - 1;
}
if ( v44 <= 0 )
operator delete(v42);
}
}
}