//
// SFXBrowser::setupList from 0x100169bb0 to 0x10016a1f4 (1604 bytes)
//
// 8 xrefs:
// > SFXBrowser::onExitFolder @ 0x1001696e0
// > SFXBrowser::onPage @ 0x100169780
// > SFXBrowser::onToggleCompactMode @ 0x1001698ac
// > SFXBrowser::onClearSearch @ 0x100169a74
// > SFXBrowser::setupSFXBrowser @ 0x100169b68
// > SFXBrowser::sortSelectClosed @ 0x10016a628
// > SFXBrowser::setTextPopupClosed @ 0x10016a7a8
// > SFXBrowser::cellPerformedAction @ 0x10016a820
//
// 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 SFXBrowser::setupList(SFXBrowser *a1, SFXSearchResult *a2)
{
int m_libraryVersion; // w21
MusicDownloadManager *v5; // x0
cocos2d::CCString *v6; // x0
char *CString; // x0
__int64 v8; // x0
int m_sfxLibraryVersion; // w21
MusicDownloadManager *v10; // x0
cocos2d::CCString *v11; // x0
char *v12; // x0
__int128 *v13; // x1
cocos2d::CCArray *m_sfxObjects; // x0
cocos2d::CCDirector *v15; // x0
cocos2d::CCTouchDispatcher *v16; // x0
SFXSearchResult *m_searchResult; // x0
std::size_t size; // x9
CCMenuItemSpriteExtra *m_backButton; // x21
SFXSearchResult *v20; // x9
std::size_t v21; // x8
_BOOL8 v22; // x1
SFXSearchResult *v23; // x9
SFXSearchResult *v24; // x8
std::string *p_m_searchQuery; // x8
const std::string::value_type *v26; // x9
std::size_t capacitym1; // t1
int v28; // w11
const std::string::value_type *v29; // x1
std::string::size_type v30; // x2
std::string *v31; // x1
SFXFolderObject *ActiveFolder; // x0
SFXFolderObject *v33; // x0
std::string *v34; // x1
std::string *v35; // x1
cocos2d::CCLabelBMFont *m_pathLabel; // x21
float32x2_t *v37; // x22
float v38; // s8
__n128 v39; // q0
__n128 v40; // q1
double v41; // d0
__int64 v42; // x0
cocos2d::CCArray *v43; // x21
int m_startIndex; // w23
int m_cellAmount; // w24
cocos2d::CCArray *m_filterObjects; // x20
int v47; // w0
int v48; // w22
__int64 v49; // x24
__int64 v50; // x23
__int64 v51; // x0
cocos2d::CCDirector *v53; // x0
BoomListType v54; // w3
CustomListView *v55; // x0
__n128 v56; // q0
GJCommentListLayer *m_listLayer; // x20
__n128 v58; // q1
float32x2_t v59; // [xsp+10h] [xbp-100h] BYREF
std::string v60; // [xsp+18h] [xbp-F8h] BYREF
std::string v61; // [xsp+30h] [xbp-E0h] BYREF
std::string v62; // [xsp+48h] [xbp-C8h] BYREF
std::string v63; // [xsp+60h] [xbp-B0h] BYREF
void *__p[2]; // [xsp+78h] [xbp-98h] BYREF
char v65; // [xsp+8Fh] [xbp-81h]
__int128 __dst; // [xsp+90h] [xbp-80h] BYREF
__int64 v67; // [xsp+A0h] [xbp-70h]
__int128 v68; // [xsp+A8h] [xbp-68h] BYREF
__int64 v69; // [xsp+B8h] [xbp-58h]
if ( !a2 )
return;
m_libraryVersion = a1->m_libraryVersion;
if ( m_libraryVersion >= 1 && m_libraryVersion != MusicDownloadManager::sharedState()->m_sfxLibraryVersion )
{
v5 = MusicDownloadManager::sharedState();
v6 = (cocos2d::CCString *)sub_100268F4C("SFX Library Updated to version %i", v5->m_sfxLibraryVersion);
CString = (char *)cocos2d::CCString::getCString(v6);
sub_100009900(&v68, CString);
if ( SHIBYTE(v69) < 0 )
{
sub_1000097D0(&__dst, (void *)v68, *((unsigned __int64 *)&v68 + 1));
}
else
{
__dst = v68;
v67 = v69;
}
sub_100009900(__p, "");
v8 = TextAlertPopup::create(&__dst, 150, __p, 1.0, 0.5);
((void (__fastcall *)(SFXBrowser *, __int64, __int64))a1->addChild_0)(a1, v8, 100);
if ( v65 < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v67) < 0 )
operator delete((void *)__dst);
if ( SHIBYTE(v69) < 0 )
operator delete((void *)v68);
}
a1->m_libraryVersion = MusicDownloadManager::sharedState()->m_sfxLibraryVersion;
m_sfxLibraryVersion = MusicDownloadManager::sharedState()->m_sfxLibraryVersion;
v10 = MusicDownloadManager::sharedState();
v11 = (cocos2d::CCString *)sub_100268F4C(
"SFX Library Version %i. SFX Count: %i",
m_sfxLibraryVersion,
v10->m_sfxObjectCount);
v12 = (char *)cocos2d::CCString::getCString(v11);
sub_100009900(&v68, v12);
if ( v69 >= 0 )
v13 = &v68;
else
v13 = (__int128 *)v68;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int128 *))a1->m_infoLabel->setString)(a1->m_infoLabel, v13);
LoadingCircleSprite::hideCircle(a1->m_circleSprite);
m_sfxObjects = a1->m_sfxObjects;
if ( m_sfxObjects )
cocos2d::CCObject::release(m_sfxObjects);
if ( a1->m_listLayer )
{
v15 = cocos2d::CCDirector::sharedDirector();
v16 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v15->getTouchDispatcher)(v15);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v16, a1->m_listLayer);
((void (__fastcall *)(GJCommentListLayer *))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;
}
size = m_searchResult->m_searchQuery.m_data.m_short.shortStorage.__elems_[22];
if ( (size & 0x8000000000000000LL) != 0 )
size = m_searchResult->m_searchQuery.m_data.m_long.size;
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_clearSearchButton->setVisible)(
a1->m_clearSearchButton,
size != 0);
m_backButton = a1->m_backButton;
if ( SFXSearchResult::getActiveFolder(a1->m_searchResult)
&& SFXSearchResult::getActiveFolder(a1->m_searchResult)->m_folderID >= 1 )
{
v20 = a1->m_searchResult;
v21 = v20->m_searchQuery.m_data.m_short.shortStorage.__elems_[22];
if ( (v21 & 0x8000000000000000LL) != 0 )
v21 = v20->m_searchQuery.m_data.m_long.size;
v22 = v21 == 0;
}
else
{
v22 = 0;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BOOL8))m_backButton->setVisible)(m_backButton, v22);
sub_100009900(&v63, " ");
v23 = a1->m_searchResult;
if ( (v23->m_searchQuery.m_data.m_short.shortStorage.__elems_[22] & 0x8000000000000000LL) == 0 )
{
if ( !v23->m_searchQuery.m_data.m_short.shortStorage.__elems_[22] )
goto LABEL_43;
LABEL_36:
std::string::assign(&v63, "\"");
v24 = a1->m_searchResult;
capacitym1 = v24->m_searchQuery.m_data.m_long.capacitym1;
p_m_searchQuery = &v24->m_searchQuery;
v26 = (const std::string::value_type *)capacitym1;
v28 = p_m_searchQuery->m_data.m_short.shortStorage.__elems_[22];
if ( v28 >= 0 )
v29 = (const std::string::value_type *)p_m_searchQuery;
else
v29 = v26;
if ( v28 >= 0 )
v30 = (unsigned __int8)p_m_searchQuery->m_data.m_short.shortStorage.__elems_[22];
else
v30 = p_m_searchQuery->m_data.m_long.size;
std::string::append(&v63, v29, v30);
std::string::append(&v63, "\"");
goto LABEL_43;
}
if ( v23->m_searchQuery.m_data.m_long.size )
goto LABEL_36;
LABEL_43:
if ( (v63.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v31 = &v63;
else
v31 = (std::string *)v63.__r_.__value_.__r.__words[0];
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))a1->m_searchLabel->setString)(a1->m_searchLabel, v31);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_searchLabel, 100.0, 0.8, 0.0);
sub_100009900(&v62, "");
sub_100009900(&v61, "");
if ( SFXSearchResult::getActiveFolder(a1->m_searchResult) )
{
ActiveFolder = SFXSearchResult::getActiveFolder(a1->m_searchResult);
std::string::operator=(&v62, (const std::string *)&ActiveFolder->m_name);
MusicDownloadManager::sharedState();
v33 = SFXSearchResult::getActiveFolder(a1->m_searchResult);
MusicDownloadManager::getSFXFolderPathForID(v33->m_sfxID, 1, &v60);
if ( SHIBYTE(v61.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v61.__r_.__value_.__l.__data_);
v61 = v60;
}
if ( (v62.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v34 = &v62;
else
v34 = (std::string *)v62.__r_.__value_.__r.__words[0];
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))a1->m_nameLabel->setString)(a1->m_nameLabel, v34);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_nameLabel, 150.0, 0.5, 0.0);
if ( (v61.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v35 = &v61;
else
v35 = (std::string *)v61.__r_.__value_.__r.__words[0];
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))a1->m_pathLabel->setString)(a1->m_pathLabel, v35);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_pathLabel, 150.0, 0.6, 0.0);
m_pathLabel = a1->m_pathLabel;
v37 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_nameLabel->getPosition)(a1->m_nameLabel);
v38 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_nameLabel->getContentSize)(a1->m_nameLabel);
v39.n128_f64[0] = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_nameLabel->getScale)(a1->m_nameLabel);
v39.n128_f32[0] = -2.0 - (float)(v38 * v39.n128_f32[0]);
v40.n128_u32[0] = 0;
sub_100022980(v39, v40, &v59);
*(float32x2_t *)&v41 = sub_1000229DC(v37, &v59, (float32x2_t *)&v60);
v42 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *, double))m_pathLabel->setPosition)(
m_pathLabel,
&v60,
v41);
v43 = (cocos2d::CCArray *)sub_10024A15C(v42);
m_startIndex = a2->m_startIndex;
m_cellAmount = a1->m_cellAmount;
m_filterObjects = a2->m_filterObjects;
v47 = sub_10024A36C(m_filterObjects);
if ( a1->m_cellAmount >= 1 )
{
v48 = v47;
v49 = (unsigned int)(m_cellAmount * m_startIndex);
if ( (int)v49 < v47 )
{
v50 = v49;
do
{
v51 = sub_10024A388(m_filterObjects, v50);
sub_10024A2D0(v43, v51);
v50 = (unsigned int)(v50 + 1);
}
while ( (int)v50 < a1->m_cellAmount + (int)v49 && (int)v50 < v48 );
}
}
a1->m_sfxObjects = v43;
cocos2d::CCObject::retain(v43);
v53 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v53);
if ( a1->m_compactMode )
v54 = SFX2;
else
v54 = SFX;
v55 = CustomListView::create(a1->m_sfxObjects, &a1->TableViewCellDelegate, 220.0, 340.0, 0, v54, 0.0);
a1->m_listLayer = GJCommentListLayer::create(v55, "", (cocos2d::ccColor4B)-13487566, 340.0, 220.0, 1);
v56 = ((__n128 (__fastcall *)(cocos2d::CCLayer *))a1->m_mainLayer->addChild_0)(a1->m_mainLayer);
v56.n128_f32[0] = (float)(*(float *)&v60.__r_.__value_.__l.__data_ + -340.0) * 0.5;
m_listLayer = a1->m_listLayer;
v58.n128_f32[0] = (float)((float)(*((float *)v60.__r_.__value_.__r.__words + 1) + -220.0) * 0.5) + -10.0;
sub_100022980(v56, v58, &v59);
((void (__fastcall *)(GJCommentListLayer *, float32x2_t *))m_listLayer->setPosition)(m_listLayer, &v59);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_refreshButton->setVisible)(a1->m_refreshButton, 1);
SFXBrowser::updatePageLabel(a1);
if ( SHIBYTE(v61.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v61.__r_.__value_.__l.__data_);
if ( SHIBYTE(v62.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v62.__r_.__value_.__l.__data_);
if ( SHIBYTE(v63.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v63.__r_.__value_.__l.__data_);
if ( SHIBYTE(v69) < 0 )
operator delete((void *)v68);
}