//
// SFXBrowser::setupList from 0x10043fb40 to 0x10044036f (2095 bytes)
//
// 11 xrefs:
// > SFXBrowser::onExitFolder @ 0x10043f608
// > SFXBrowser::onPage @ 0x10043f69b
// > SFXBrowser::onToggleCompactMode @ 0x10043f7d9
// > SFXBrowser::onClearSearch @ 0x10043f98f
// > SFXBrowser::setupSFXBrowser @ 0x10043fac4
// > SFXBrowser::sortSelectClosed @ 0x10044096a
// > sub_100440970 @ 0x1004409ba
// > SFXBrowser::setTextPopupClosed @ 0x100440bcb
// > sub_100440BE0 @ 0x100440c2c
// > SFXBrowser::cellPerformedAction @ 0x100440cac
// > sub_100440CF0 @ 0x100440d66
//
// 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)
{
__int64 v2; // xmm0_8
SFXSearchResult *v3; // r14
SFXBrowser *v4; // r15
int m_libraryVersion; // ebx
cocos2d::CCString *v6; // rax
const char *CString; // r12
size_t v8; // rax
size_t v9; // r15
char *v10; // r13
char v11; // r14
size_t v12; // r14
cocos2d::CCObject *v13; // rax
SFXSearchResult *v14; // rbx
cocos2d::CCString *v15; // rax
const char *v16; // r12
size_t v17; // rax
size_t v18; // r15
char *v19; // r13
size_t v20; // r14
SFXBrowser *v21; // r13
char *v22; // rsi
cocos2d::CCObject *m_sfxObjects; // rdi
cocos2d::CCDirector *v24; // rax
cocos2d::CCTouchDispatcher *v25; // rax
SFXSearchResult *m_searchResult; // rax
unsigned int sizex2; // ecx
std::size_t size; // rcx
CCMenuItemSpriteExtra *m_backButton; // r15
SFXSearchResult *v30; // rcx
unsigned int v31; // eax
std::size_t v32; // rax
bool v33; // al
SFXSearchResult *v34; // rcx
unsigned int v35; // eax
SFXSearchResult *v36; // rsi
unsigned int v37; // edx
std::string::size_type v38; // rdx
const std::string::value_type *longStorage; // rsi
cocos2d::CCLabelBMFont **p_m_searchLabel; // rbx
cocos2d::CCLabelBMFont *m_searchLabel; // rdi
std::string::pointer data; // rsi
SFXFolderObject *ActiveFolder; // rax
std::string::pointer v44; // rsi
char *v45; // rsi
cocos2d::CCLabelBMFont *m_pathLabel; // r15
unsigned __int64 *v47; // r12
float v48; // xmm0_4
cocos2d::CCObject *v49; // r15
int v50; // ebx
cocos2d::CCArray *m_filterObjects; // r14
int v52; // eax
int v53; // r12d
int v54; // r13d
__int64 v55; // rax
SFXBrowser *v56; // rbx
CustomListView *v57; // rax
GJCommentListLayer *v58; // rax
GJCommentListLayer *m_listLayer; // r14
__int128 v60; // [rsp+0h] [rbp-F0h] BYREF
void *v61; // [rsp+10h] [rbp-E0h]
std::string v62; // [rsp+18h] [rbp-D8h] BYREF
__int128 v63; // [rsp+30h] [rbp-C0h] BYREF
void *v64; // [rsp+40h] [rbp-B0h]
std::string v65; // [rsp+50h] [rbp-A0h] BYREF
unsigned __int64 v66; // [rsp+6Ch] [rbp-84h] BYREF
float v67; // [rsp+74h] [rbp-7Ch]
std::string v68; // [rsp+78h] [rbp-78h] BYREF
__int128 v69; // [rsp+90h] [rbp-60h] BYREF
void *v70; // [rsp+A0h] [rbp-50h]
SFXBrowser *v71; // [rsp+A8h] [rbp-48h]
__int128 __dst; // [rsp+B0h] [rbp-40h] BYREF
void *__p; // [rsp+C0h] [rbp-30h]
if ( !a2 )
return;
v3 = a2;
v4 = a1;
m_libraryVersion = a1->m_libraryVersion;
v71 = a1;
if ( m_libraryVersion > 0 && m_libraryVersion != MusicDownloadManager::sharedState()->m_sfxLibraryVersion )
{
MusicDownloadManager::sharedState();
v6 = (cocos2d::CCString *)sub_1007AB580("SFX Library Updated to version %i", v60);
CString = cocos2d::CCString::getCString(v6);
v8 = strlen(CString);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_86;
v9 = v8;
if ( v8 >= 0x17 )
{
v12 = 26;
if ( (v8 | 7) != 0x17 )
v12 = (v8 | 7) + 1;
v10 = (char *)operator new(v12);
__p = v10;
*(_QWORD *)&__dst = v12 + 1;
*((_QWORD *)&__dst + 1) = v9;
}
else
{
LOBYTE(__dst) = 2 * v8;
v10 = (char *)&__dst + 1;
if ( !v8 )
{
BYTE1(__dst) = 0;
v11 = __dst;
if ( (__dst & 1) == 0 )
{
LABEL_8:
v64 = __p;
v63 = __dst;
v4 = v71;
goto LABEL_14;
}
LABEL_13:
sub_100006B70(&v63, __p, *((unsigned __int64 *)&__dst + 1), *(double *)&v2);
v4 = v71;
LABEL_14:
LOWORD(v60) = 0;
v2 = 1065353216;
v13 = TextAlertPopup::create((__int64)&v63, 0x96u, &v60, (__m128)0x3F800000u, 0.5);
((void (__fastcall *)(SFXBrowser *, cocos2d::CCObject *, __int64))v4->addChild_0)(v4, v13, 100);
if ( (v60 & 1) != 0 )
{
operator delete(v61);
if ( (v63 & 1) == 0 )
{
LABEL_16:
if ( (v11 & 1) == 0 )
{
LABEL_18:
v3 = a2;
goto LABEL_19;
}
LABEL_17:
operator delete(__p);
goto LABEL_18;
}
}
else if ( (v63 & 1) == 0 )
{
goto LABEL_16;
}
operator delete(v64);
if ( (v11 & 1) == 0 )
goto LABEL_18;
goto LABEL_17;
}
}
memmove(v10, CString, v9);
v10[v9] = 0;
v11 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_8;
goto LABEL_13;
}
LABEL_19:
v14 = v3;
v4->m_libraryVersion = MusicDownloadManager::sharedState()->m_sfxLibraryVersion;
MusicDownloadManager::sharedState();
MusicDownloadManager::sharedState();
v15 = (cocos2d::CCString *)sub_1007AB580("SFX Library Version %i. SFX Count: %i", v60);
v16 = cocos2d::CCString::getCString(v15);
v17 = strlen(v16);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_86:
sub_100006BF0(*(double *)&v2);
v18 = v17;
if ( v17 >= 0x17 )
{
v20 = 26;
if ( (v17 | 7) != 0x17 )
v20 = (v17 | 7) + 1;
v19 = (char *)operator new(v20);
__p = v19;
*(_QWORD *)&__dst = v20 + 1;
*((_QWORD *)&__dst + 1) = v18;
v3 = v14;
goto LABEL_26;
}
LOBYTE(__dst) = 2 * v17;
v19 = (char *)&__dst + 1;
if ( v17 )
LABEL_26:
memmove(v19, v16, v18);
v19[v18] = 0;
v21 = v71;
if ( (__dst & 1) != 0 )
v22 = (char *)__p;
else
v22 = (char *)&__dst + 1;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v71->m_infoLabel->setString)(v71->m_infoLabel, v22);
LoadingCircleSprite::hideCircle(v21->m_circleSprite);
m_sfxObjects = v21->m_sfxObjects;
if ( m_sfxObjects )
cocos2d::CCObject::release(m_sfxObjects);
if ( v21->m_listLayer )
{
v24 = cocos2d::CCDirector::sharedDirector();
v25 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v24->getTouchDispatcher)(v24);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v25, v21->m_listLayer);
((void (__fastcall *)(GJCommentListLayer *))v21->m_listLayer->removeMeAndCleanup)(v21->m_listLayer);
v21->m_listLayer = nullptr;
}
m_searchResult = v21->m_searchResult;
if ( m_searchResult != v3 )
{
if ( m_searchResult )
cocos2d::CCObject::release(v21->m_searchResult);
v21->m_searchResult = v3;
cocos2d::CCObject::retain(v3);
m_searchResult = v21->m_searchResult;
}
sizex2 = m_searchResult->m_searchQuery.m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
size = m_searchResult->m_searchQuery.m_data.m_long.size;
else
size = sizex2 >> 1;
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))v21->m_clearSearchButton->setVisible)(
v21->m_clearSearchButton,
size != 0);
m_backButton = v21->m_backButton;
if ( SFXSearchResult::getActiveFolder(v21->m_searchResult)
&& SFXSearchResult::getActiveFolder(v21->m_searchResult)->m_folderID > 0 )
{
v30 = v21->m_searchResult;
v31 = v30->m_searchQuery.m_data.m_short.sizex2;
if ( (v31 & 1) != 0 )
v32 = v30->m_searchQuery.m_data.m_long.size;
else
v32 = v31 >> 1;
v33 = v32 == 0;
}
else
{
v33 = 0;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))m_backButton->setVisible)(m_backButton, v33);
*(_WORD *)&v68.__r_.__value_.__l.0 = 8194;
v68.__r_.__value_.__s.__data_[1] = 0;
v34 = v21->m_searchResult;
v35 = v34->m_searchQuery.m_data.m_short.sizex2;
if ( (v35 & 1) == 0 )
{
if ( v35 >> 1 )
goto LABEL_50;
LABEL_53:
p_m_searchLabel = &v21->m_searchLabel;
m_searchLabel = v21->m_searchLabel;
LABEL_56:
data = v68.__r_.__value_.__s.__data_;
goto LABEL_58;
}
if ( !v34->m_searchQuery.m_data.m_long.size )
goto LABEL_53;
LABEL_50:
std::string::assign(&v68, "\"");
v36 = v21->m_searchResult;
v37 = v36->m_searchQuery.m_data.m_short.sizex2;
if ( (v37 & 1) != 0 )
{
v38 = v36->m_searchQuery.m_data.m_long.size;
longStorage = v36->m_searchQuery.m_data.m_long.longStorage;
}
else
{
longStorage = v36->m_searchQuery.m_data.m_short.shortStorage.__elems_;
v38 = v37 >> 1;
}
std::string::append(&v68, longStorage, v38);
std::string::append(&v68, "\"");
p_m_searchLabel = &v21->m_searchLabel;
m_searchLabel = v21->m_searchLabel;
if ( (*(_BYTE *)&v68.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_56;
data = v68.__r_.__value_.__l.__data_;
LABEL_58:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string::pointer))m_searchLabel->setString)(m_searchLabel, data);
cocos2d::CCLabelBMFont::limitLabelWidth(*p_m_searchLabel, 100.0, 0.80000001, 0.0);
*(_WORD *)&v65.__r_.__value_.__l.0 = 0;
LOWORD(v69) = 0;
if ( SFXSearchResult::getActiveFolder(v21->m_searchResult) )
{
ActiveFolder = SFXSearchResult::getActiveFolder(v21->m_searchResult);
std::string::operator=(&v65, (const std::string *)&ActiveFolder->m_name);
MusicDownloadManager::sharedState();
SFXSearchResult::getActiveFolder(v21->m_searchResult);
MusicDownloadManager::getSFXFolderPathForID(&v62);
if ( (v69 & 1) != 0 )
operator delete(v70);
v70 = v62.__r_.__value_.__l.__data_;
v69 = *(_OWORD *)&v62.__r_.__value_.__l.0;
}
if ( (*(_BYTE *)&v65.__r_.__value_.__s.0 & 1) != 0 )
v44 = v65.__r_.__value_.__l.__data_;
else
v44 = v65.__r_.__value_.__s.__data_;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string::pointer))v21->m_nameLabel->setString)(
v21->m_nameLabel,
v44);
cocos2d::CCLabelBMFont::limitLabelWidth(v21->m_nameLabel, 150.0, 0.5, 0.0);
if ( (v69 & 1) != 0 )
v45 = (char *)v70;
else
v45 = (char *)&v69 + 1;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v21->m_pathLabel->setString)(v21->m_pathLabel, v45);
cocos2d::CCLabelBMFont::limitLabelWidth(v21->m_pathLabel, 150.0, 0.60000002, 0.0);
m_pathLabel = v21->m_pathLabel;
v47 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v21->m_nameLabel->getPosition)(v21->m_nameLabel);
v67 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v21->m_nameLabel->getContentSize)(v21->m_nameLabel);
v48 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v21->m_nameLabel->getScale)(v21->m_nameLabel);
sub_10028CBE0((float *)&v66, -2.0 - (float)(v67 * v48), 0.0);
sub_10028CCE0((double *)&v62, v47, &v66);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))m_pathLabel->setPosition)(m_pathLabel, &v62);
v49 = (cocos2d::CCObject *)sub_10071F9E0(m_pathLabel, &v62);
v50 = v3->m_startIndex * v21->m_cellAmount;
m_filterObjects = v3->m_filterObjects;
v52 = sub_100720070(m_filterObjects);
if ( v21->m_cellAmount > 0 )
{
v53 = v52;
if ( v50 < v52 )
{
v54 = v50;
do
{
v55 = sub_1007200C0(m_filterObjects, (unsigned int)v54);
sub_10071FCD0(v49, v55);
++v54;
}
while ( v54 < v50 + v71->m_cellAmount && v54 < v53 );
}
}
v56 = v71;
v71->m_sfxObjects = (cocos2d::CCArray *)v49;
cocos2d::CCObject::retain(v49);
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v62);
v57 = CustomListView::create(
v56->m_sfxObjects,
&v56->TableViewCellDelegate,
220.0,
340.0,
0,
(BoomListType)(v56->m_compactMode + 23),
0.0);
v58 = GJCommentListLayer::create(v57, "", (cocos2d::ccColor4B)-13487566, 340.0, 220.0, 1);
v56->m_listLayer = v58;
((void (__fastcall *)(cocos2d::CCLayer *, GJCommentListLayer *, __int64))v56->m_mainLayer->addChild_0)(
v56->m_mainLayer,
v58,
10);
m_listLayer = v56->m_listLayer;
sub_10028CBE0(
(float *)&v66,
(float)(*(float *)&v62.__r_.__value_.__l.0 + -340.0) * 0.5,
(float)((float)(*((float *)v62.__r_.__value_.__r.__words + 1) + -220.0) * 0.5) + -10.0);
((void (__fastcall *)(GJCommentListLayer *, unsigned __int64 *))m_listLayer->setPosition)(m_listLayer, &v66);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v56->m_refreshButton->setVisible)(v56->m_refreshButton, 1);
SFXBrowser::updatePageLabel(v56);
if ( (v69 & 1) == 0 )
{
if ( (*(_BYTE *)&v65.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_75;
LABEL_80:
operator delete(v65.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v68.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_76:
if ( (__dst & 1) == 0 )
return;
goto LABEL_77;
}
goto LABEL_81;
}
operator delete(v70);
if ( (*(_BYTE *)&v65.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_80;
LABEL_75:
if ( (*(_BYTE *)&v68.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_76;
LABEL_81:
operator delete(v68.__r_.__value_.__l.__data_);
if ( (__dst & 1) != 0 )
LABEL_77:
operator delete(__p);
}