//
// SFXBrowser::setupList from 0xa5d3a0 to 0xa5dd5c (2492 bytes)
//
// 9 xrefs:
// > SFXBrowser::setupSFXBrowser @ 0xa5ddf4
// > SFXBrowser::sortSelectClosed @ 0xa5ef3c
// > SFXBrowser::onToggleCompactMode @ 0xa5efac
// > SFXBrowser::onClearSearch @ 0xa5f014
// > SFXBrowser::setTextPopupClosed @ 0xa5f074
// > SFXBrowser::cellPerformedAction @ 0xa5f134
// > SFXBrowser::onExitFolder @ 0xa5f1e0
// > SFXBrowser::onPage @ 0xa5f294
// > ??> @ 0x3ed60
//
// 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 SFXBrowser::setupList(SFXBrowser *a1, SFXSearchResult *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); // x21
__int64 v9; // x0
void *v10; // x0
void *v11; // x0
unsigned __int8 *v12; // x0
unsigned int *v13; // x1
int v14; // w2
MusicDownloadManager *v15; // x0
cocos2d::CCString *v16; // x0
char *v17; // x0
cocos2d::CCArray *m_sfxObjects; // x0
cocos2d::CCDirector *v19; // x0
cocos2d::CCTouchDispatcher *v20; // x0
SFXSearchResult *m_searchResult; // x0
CCMenuItemSpriteExtra *m_backButton; // x21
void (__fastcall *setVisible)(cocos2d::CCNode *__hidden, bool); // x22
_BOOL8 v24; // x1
SFXFolderObject *ActiveFolder; // x0
MusicDownloadManager *v26; // x22
SFXFolderObject *v27; // x0
void *v28; // x0
cocos2d::CCLabelBMFont *m_pathLabel; // x21
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
const cocos2d::CCPoint *v31; // x23
float width; // s8
float v33; // s0
cocos2d::CCArray *v34; // x0
__int64 v35; // x0
cocos2d::CCArray *m_filterObjects; // x23
cocos2d::CCArray *v37; // x22
int v38; // w21
signed int v39; // w24
signed int v40; // w19
cocos2d::CCObject *v41; // x0
cocos2d::CCDirector *v42; // x0
CustomListView *v43; // x0
GJCommentListLayer *v44; // x0
cocos2d::CCLayer *m_mainLayer; // x3
GJCommentListLayer *m_listLayer; // x19
void (__fastcall *v47)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
unsigned __int8 *v48; // x0
unsigned __int8 *v49; // x0
unsigned __int8 *v50; // x0
unsigned __int8 *v51; // x20
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x1
int v57; // w2
unsigned int *v58; // x19
int v59; // w0
unsigned int *v60; // x1
int v61; // w2
unsigned int *v62; // x1
int v63; // w2
unsigned int *v64; // x1
int v65; // w2
__int64 v66; // [xsp+0h] [xbp+0h] BYREF
char *m_sfxLibraryVersion; // [xsp+78h] [xbp+78h]
const unsigned __int8 *v68; // [xsp+88h] [xbp+88h] BYREF
const unsigned __int8 *v69; // [xsp+90h] [xbp+90h] BYREF
const unsigned __int8 *v70; // [xsp+98h] [xbp+98h] BYREF
const unsigned __int8 *v71; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCPoint v72; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v73; // [xsp+B0h] [xbp+B0h] BYREF
if ( a2 )
{
m_libraryVersion = a1->m_libraryVersion;
if ( m_libraryVersion > 0 && m_libraryVersion != MusicDownloadManager::sharedState()->m_sfxLibraryVersion )
{
v5 = MusicDownloadManager::sharedState();
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"SFX Library Updated to version %i",
(const char *)(unsigned int)v5->m_sfxLibraryVersion);
CString = (char *)cocos2d::CCString::getCString(v6);
sub_D153B8((unsigned int)&v66 + 160, CString);
addChild_0 = a1->addChild_0;
sub_D18D28(&v72);
sub_D153B8((int)&v73, &byte_F288A0);
v9 = TextAlertPopup::create(1.0, 0.5, (__int64)&v72, 150);
addChild_0(a1, (cocos2d::CCNode *)v9, 100);
v10 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v62 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v63 = __ldaxr(v62);
while ( __stlxr(v63 - 1, v62) );
}
else
{
v63 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v63 - 1;
}
if ( v63 <= 0 )
operator delete(v10);
}
v11 = (void *)(*(_QWORD *)&v72 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v72 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v64 = (unsigned int *)(*(_QWORD *)&v72 - 8LL);
do
v65 = __ldaxr(v64);
while ( __stlxr(v65 - 1, v64) );
}
else
{
v65 = *(_DWORD *)(*(_QWORD *)&v72 - 8LL);
*(_DWORD *)(*(_QWORD *)&v72 - 8LL) = v65 - 1;
}
if ( v65 <= 0 )
operator delete(v11);
}
v12 = (unsigned __int8 *)(v71 - 24);
if ( v71 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v71 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v71 - 2);
*((_DWORD *)v71 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v12);
}
}
a1->m_libraryVersion = MusicDownloadManager::sharedState()->m_sfxLibraryVersion;
m_sfxLibraryVersion = (char *)(unsigned int)MusicDownloadManager::sharedState()->m_sfxLibraryVersion;
v15 = MusicDownloadManager::sharedState();
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"SFX Library Version %i. SFX Count: %i",
m_sfxLibraryVersion,
(unsigned int)v15->m_sfxObjectCount);
v17 = (char *)cocos2d::CCString::getCString(v16);
sub_D153B8((int)&v68, v17);
a1->m_infoLabel->setString(a1->m_infoLabel, v68);
LoadingCircleSprite::hideCircle(a1->m_circleSprite);
m_sfxObjects = a1->m_sfxObjects;
if ( m_sfxObjects )
cocos2d::CCObject::release(m_sfxObjects);
if ( a1->m_listLayer )
{
v19 = cocos2d::CCDirector::sharedDirector();
v20 = v19->getTouchDispatcher(v19);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v20, a1->m_listLayer);
a1->m_listLayer->removeMeAndCleanup(a1->m_listLayer);
a1->m_listLayer = nullptr;
}
m_searchResult = a1->m_searchResult;
if ( m_searchResult != a2 )
{
if ( m_searchResult )
cocos2d::CCObject::release(m_searchResult);
a1->m_searchResult = a2;
cocos2d::CCObject::retain(a2);
m_searchResult = a1->m_searchResult;
}
a1->m_clearSearchButton->setVisible(
a1->m_clearSearchButton,
*((_QWORD *)m_searchResult->m_searchQuery.m_data.m_data - 3) != 0);
m_backButton = a1->m_backButton;
setVisible = m_backButton->setVisible;
v24 = SFXSearchResult::getActiveFolder(a1->m_searchResult)
&& SFXSearchResult::getActiveFolder(a1->m_searchResult)->m_folderID > 0
&& *((_QWORD *)a1->m_searchResult->m_searchQuery.m_data.m_data - 3) == 0;
setVisible(m_backButton, v24);
sub_D153B8((int)&v69, " ");
if ( *((_QWORD *)a1->m_searchResult->m_searchQuery.m_data.m_data - 3) )
{
sub_D1798C(&v69, "\"", 1);
sub_D15E14(&v69, &a1->m_searchResult->m_searchQuery);
sub_D15FD4(&v69, "\"", 1);
}
a1->m_searchLabel->setString(a1->m_searchLabel, v69);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_searchLabel, 100.0, 0.8, 0.0);
sub_D153B8((int)&v70, &byte_F288A0);
sub_D153B8((int)&v71, &byte_F288A0);
if ( SFXSearchResult::getActiveFolder(a1->m_searchResult) )
{
ActiveFolder = SFXSearchResult::getActiveFolder(a1->m_searchResult);
sub_D18EA8(&v70, &ActiveFolder->m_name);
v26 = MusicDownloadManager::sharedState();
v27 = SFXSearchResult::getActiveFolder(a1->m_searchResult);
MusicDownloadManager::getSFXFolderPathForID(v26, v27->m_sfxID, 1u, (__int64)&v73);
sub_D163D4(&v71, &v73);
v28 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v28);
}
}
a1->m_nameLabel->setString(a1->m_nameLabel, v70);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_nameLabel, 150.0, 0.5, 0.0);
a1->m_pathLabel->setString(a1->m_pathLabel, v71);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_pathLabel, 150.0, 0.6, 0.0);
m_pathLabel = a1->m_pathLabel;
setPosition = m_pathLabel->setPosition;
v31 = a1->m_nameLabel->getPosition(a1->m_nameLabel);
width = a1->m_nameLabel->getContentSize(a1->m_nameLabel)->width;
v33 = a1->m_nameLabel->getScale(a1->m_nameLabel);
cocos2d::CCPoint::CCPoint(&v72, (float)((float)-width * v33) + -2.0, 0.0);
cocos2d::CCPoint::operator+(&v73, v31, &v72);
v34 = (cocos2d::CCArray *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCPoint *))setPosition)(
m_pathLabel,
&v73);
v35 = cocos2d::CCArray::create(v34);
m_filterObjects = a2->m_filterObjects;
v37 = (cocos2d::CCArray *)v35;
v38 = a2->m_startIndex * a1->m_cellAmount;
v39 = cocos2d::CCArray::count(m_filterObjects);
if ( v38 < v39 )
{
v40 = v38;
if ( v38 < v38 + a1->m_cellAmount )
{
do
{
v41 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(m_filterObjects, v40);
cocos2d::CCArray::addObject(v37, v41);
++v40;
}
while ( v38 + a1->m_cellAmount > v40 && v39 > v40 );
}
}
a1->m_sfxObjects = v37;
cocos2d::CCObject::retain(v37);
v42 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v42);
v43 = CustomListView::create(a1->m_sfxObjects, (BoomListType)((_DWORD)a1 + 640), 220.0, 340.0);
v44 = GJCommentListLayer::create(v43, &byte_F288A0, (cocos2d::ccColor4B)-13487566, 340.0, 220.0, 1);
m_mainLayer = a1->m_mainLayer;
a1->m_listLayer = v44;
m_mainLayer->addChild_0(m_mainLayer, v44, 10);
m_listLayer = a1->m_listLayer;
v47 = m_listLayer->setPosition;
cocos2d::CCPoint::CCPoint(&v73, (float)(v72.x - 340.0) * 0.5, (float)((float)(v72.y - 220.0) * 0.5) + -10.0);
v47(m_listLayer, &v73);
a1->m_refreshButton->setVisible(a1->m_refreshButton, 1);
SFXBrowser::updatePageLabel(a1);
v48 = (unsigned __int8 *)(v71 - 24);
if ( v71 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)(v71 - 8);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *((_DWORD *)v71 - 2);
*((_DWORD *)v71 - 2) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v48);
}
v49 = (unsigned __int8 *)(v70 - 24);
if ( v70 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(v70 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *((_DWORD *)v70 - 2);
*((_DWORD *)v70 - 2) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v49);
}
v50 = (unsigned __int8 *)(v69 - 24);
if ( v69 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(v69 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *((_DWORD *)v69 - 2);
*((_DWORD *)v69 - 2) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v50);
}
v51 = (unsigned __int8 *)(v68 - 24);
if ( v68 - 24 != (const unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(v68 - 8);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *((_DWORD *)v68 - 2);
*((_DWORD *)v68 - 2) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v51);
}
}
}