//
// SFXBrowser::setupList from 0x14047fa20 to 0x1404801f8 (2008 bytes)
//
// 9 xrefs:
// > SFXBrowser::setupSFXBrowser @ 0x14047f7c5
// > SFXBrowser::sortSelectClosed @ 0x140480447
// > SFXBrowser::onToggleCompactMode @ 0x1404804e9
// > SFXBrowser::onClearSearch @ 0x140480558
// > SFXBrowser::setTextPopupClosed @ 0x140480752
// > SFXBrowser::cellPerformedAction @ 0x140480831
// > SFXBrowser::onPage @ 0x140480942
// > SFXBrowser::onExitFolder @ 0x140480c67
// > ??> @ 0x1406db9b4
//
// 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
//
// Hidden C++ exception states: #wind=6
void SFXBrowser::setupList(SFXBrowser *a1, SFXSearchResult *a2)
{
SFXSearchResult *v2; // r13
int v4; // r14d
size_t v5; // rsi
unsigned __int64 v6; // r15
MusicDownloadManager *v7; // rax
cocos2d::CCString *v8; // rax
const char *CString; // rax
size_t v10; // r8
__int64 v11; // rdx
__int64 v12; // rcx
__int64 v13; // r8
__int64 v14; // r9
void **v15; // r12
__int64 v16; // rbx
unsigned __int64 v17; // r13
SFXBrowser_vtbl *v18; // rbx
cocos2d::CCNode *v19; // rax
MusicDownloadManager *v20; // rbx
MusicDownloadManager *v21; // rax
cocos2d::CCString *v22; // rax
const char *v23; // rax
const char *v24; // rdx
LoadingCircleSprite *m_circleSprite; // rbx
_BOOL8 v26; // rdx
cocos2d::CCArray *m_sfxObjects; // rcx
__int64 v28; // rax
cocos2d::CCTouchDispatcher *v29; // rax
SFXSearchResult *m_searchResult; // rcx
_BOOL8 v31; // rdx
SFXSearchResult *v32; // rcx
SFXFolderObject *m_folderObject; // rax
unsigned __int64 v34; // rax
SFXSearchResult *v35; // r8
std::string *p_m_searchQuery; // rdx
const char *v37; // rdx
SFXFolderObject *v38; // r8
std::string *p_m_name; // r8
std::string *m_bigStorage; // rdx
__int64 v41; // rcx
__int64 SFXFolderPathForID; // rbx
void *v43; // rcx
const char *v44; // rdx
void **v45; // rdx
float v46; // xmm6_4
double v47; // xmm0_8
const cocos2d::CCPoint *v48; // rax
__int64 v49; // rcx
SetupTriggerPopup *v50; // rsi
int v51; // r12d
cocos2d::CCArray *m_filterObjects; // r13
signed int v53; // r15d
signed int i; // ebx
struct cocos2d::CCObject *v55; // rax
ButtonSprite *v56; // r8
cocos2d::CCPoint v57; // r9
__int64 v58; // rcx
cocos2d::CCDirector *v59; // rax
CustomListView *v60; // rax
const char *v61; // rdx
GJCommentListLayer *v62; // rax
float v63; // xmm0_4
GJCommentListLayer_vtbl *v64; // rbx
const cocos2d::CCPoint *v65; // rax
_BOOL8 v66; // rdx
int v67; // [rsp+20h] [rbp-E0h]
SFXSearchResult *v68; // [rsp+40h] [rbp-C0h] BYREF
float v69; // [rsp+48h] [rbp-B8h]
__int128 v70; // [rsp+58h] [rbp-A8h] BYREF
unsigned __int64 v71; // [rsp+68h] [rbp-98h]
__int64 v72; // [rsp+70h] [rbp-90h]
__int128 *v73; // [rsp+78h] [rbp-88h]
void *Block[2]; // [rsp+80h] [rbp-80h] BYREF
__int128 v75; // [rsp+90h] [rbp-70h]
__int128 v76; // [rsp+A0h] [rbp-60h] BYREF
__int64 v77; // [rsp+B0h] [rbp-50h]
__int64 v78; // [rsp+B8h] [rbp-48h]
__int128 v79; // [rsp+C0h] [rbp-40h] BYREF
__int64 v80; // [rsp+D0h] [rbp-30h]
__int64 v81; // [rsp+D8h] [rbp-28h]
void *Src[2]; // [rsp+E0h] [rbp-20h] BYREF
unsigned __int64 v83; // [rsp+F0h] [rbp-10h]
unsigned __int64 v84; // [rsp+F8h] [rbp-8h]
__int128 v85; // [rsp+100h] [rbp+0h] BYREF
__int64 v86; // [rsp+110h] [rbp+10h]
__int64 v87; // [rsp+118h] [rbp+18h]
__int128 v88; // [rsp+120h] [rbp+20h] BYREF
__int128 v89; // [rsp+130h] [rbp+30h]
if ( a2 )
{
v2 = a2;
v68 = a2;
v4 = 0;
v5 = -1;
v6 = 15;
if ( a1->m_libraryVersion > 0 && a1->m_libraryVersion != MusicDownloadManager::sharedState()->m_sfxLibraryVersion )
{
v7 = MusicDownloadManager::sharedState();
v8 = cocos2d::CCString::createWithFormat("SFX Library Updated to version %i", v7->m_sfxLibraryVersion);
CString = cocos2d::CCString::getCString(v8);
*(_OWORD *)Src = 0;
v83 = 0;
v84 = 0;
v10 = -1;
do
++v10;
while ( CString[v10] );
sub_14003A930(Src, CString, v10);
v73 = &v85;
v85 = 0;
v86 = 0;
v87 = 15;
LOBYTE(v85) = 0;
v70 = 0;
v71 = 0;
v72 = 0;
v15 = Src;
if ( v84 > 0xF )
v15 = (void **)Src[0];
v16 = 0x7FFFFFFFFFFFFFFFLL;
v17 = v83;
if ( v83 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v12, v11, v13, v14);
v72 = 15;
if ( v83 > 0xF )
{
if ( (v83 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v16 = v83 | 0xF;
if ( (v83 | 0xF) < 0x16 )
v16 = 22;
}
*(_QWORD *)&v70 = sub_14003AA10(v16 + 1);
v71 = v17;
v72 = v16;
memcpy((void *)v70, v15, v17 + 1);
}
else
{
v71 = v83;
v70 = *(_OWORD *)v15;
}
v18 = a1->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v19 = TextAlertPopup::create((__int64)&v70, v11, v13, 150, (__int64)&v85);
v18->addChild_0(a1, v19, 100);
sub_14003A830((__int64)Src);
v2 = v68;
}
a1->m_libraryVersion = MusicDownloadManager::sharedState()->m_sfxLibraryVersion;
v20 = MusicDownloadManager::sharedState();
v21 = MusicDownloadManager::sharedState();
v22 = cocos2d::CCString::createWithFormat(
"SFX Library Version %i. SFX Count: %i",
v21->m_sfxLibraryVersion,
v20->m_sfxObjectCount);
v23 = cocos2d::CCString::getCString(v22);
v88 = 0;
v89 = 0;
do
++v5;
while ( v23[v5] );
sub_14003A930(&v88, v23, v5);
v24 = (const char *)&v88;
if ( *((_QWORD *)&v89 + 1) > 0xFu )
v24 = (const char *)v88;
a1->m_infoLabel->setString(&a1->m_infoLabel->cocos2d::CCLabelProtocol, v24);
m_circleSprite = a1->m_circleSprite;
cocos2d::CCNode::stopActionByTag(m_circleSprite, 0);
m_circleSprite->setOpacity(&m_circleSprite->cocos2d::CCRGBAProtocol, 0);
m_circleSprite->setVisible(m_circleSprite, 0);
m_sfxObjects = a1->m_sfxObjects;
if ( m_sfxObjects )
cocos2d::CCObject::release(m_sfxObjects);
if ( a1->m_listLayer )
{
v28 = cocos2d::CCDirector::sharedDirector(m_sfxObjects);
v29 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 144LL))(v28);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v29, a1->m_listLayer);
a1->m_listLayer->removeMeAndCleanup(a1->m_listLayer);
a1->m_listLayer = nullptr;
}
m_searchResult = a1->m_searchResult;
if ( v2 != m_searchResult )
{
if ( m_searchResult )
cocos2d::CCObject::release(m_searchResult);
a1->m_searchResult = v2;
cocos2d::CCObject::retain(v2);
}
LOBYTE(v26) = a1->m_searchResult->m_searchQuery.m_data.m_size != 0;
a1->m_clearSearchButton->setVisible(a1->m_clearSearchButton, v26);
v32 = a1->m_searchResult;
m_folderObject = v32->m_folderObject;
if ( !m_folderObject || m_folderObject->m_folderID <= 0 || v32->m_searchQuery.m_data.m_size )
v31 = 0;
else
LOBYTE(v31) = 1;
a1->m_backButton->setVisible(a1->m_backButton, v31);
v76 = 0;
v77 = 1;
v34 = 15;
v78 = 15;
LOWORD(v76) = 32;
v35 = a1->m_searchResult;
if ( v35->m_searchQuery.m_data.m_size )
{
v77 = 1;
LOWORD(v76) = 34;
p_m_searchQuery = &v35->m_searchQuery;
if ( v35->m_searchQuery.m_data.m_capacity > 0xF )
p_m_searchQuery = (std::string *)v35->m_searchQuery.m_data.m_bigStorage;
sub_140041270(&v76, p_m_searchQuery, v35->m_searchQuery.m_data.m_size);
sub_140041270(&v76, "\"", 1u);
v34 = v78;
}
v37 = (const char *)&v76;
if ( v34 > 0xF )
v37 = (const char *)v76;
a1->m_searchLabel->setString(&a1->m_searchLabel->cocos2d::CCLabelProtocol, v37);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_searchLabel, 100.0, 0.80000001, 0.0);
v79 = 0;
v80 = 0;
v81 = 15;
LOBYTE(v79) = 0;
*(_OWORD *)Block = 0;
*(_QWORD *)&v75 = 0;
*((_QWORD *)&v75 + 1) = 15;
LOBYTE(Block[0]) = 0;
v38 = a1->m_searchResult->m_folderObject;
if ( v38 )
{
p_m_name = &v38->m_name;
if ( &v79 != (__int128 *)p_m_name )
{
m_bigStorage = p_m_name;
if ( p_m_name->m_data.m_capacity > 0xF )
m_bigStorage = (std::string *)p_m_name->m_data.m_bigStorage;
sub_14003CCE0((void **)&v79, m_bigStorage, p_m_name->m_data.m_size);
}
MusicDownloadManager::sharedState();
SFXFolderPathForID = MusicDownloadManager::getSFXFolderPathForID(
v41,
(__int64)&v85,
a1->m_searchResult->m_folderObject->m_sfxID);
if ( Block != (void **)SFXFolderPathForID )
{
if ( *((_QWORD *)&v75 + 1) > 0xFu )
{
v43 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v75 + 1) + 1LL) >= 0x1000 )
{
v43 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v43 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v43);
}
*(_QWORD *)&v75 = 0;
*((_QWORD *)&v75 + 1) = 15;
LOBYTE(Block[0]) = 0;
*(_OWORD *)Block = *(_OWORD *)SFXFolderPathForID;
v75 = *(_OWORD *)(SFXFolderPathForID + 16);
*(_QWORD *)(SFXFolderPathForID + 16) = 0;
*(_QWORD *)(SFXFolderPathForID + 24) = 15;
*(_BYTE *)SFXFolderPathForID = 0;
}
sub_14003A830((__int64)&v85);
v6 = v81;
}
v44 = (const char *)&v79;
if ( v6 > 0xF )
v44 = (const char *)v79;
a1->m_nameLabel->setString(&a1->m_nameLabel->cocos2d::CCLabelProtocol, v44);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_nameLabel, 150.0, 0.5, 0.0);
v45 = Block;
if ( *((_QWORD *)&v75 + 1) > 0xFu )
v45 = (void **)Block[0];
a1->m_pathLabel->setString(&a1->m_pathLabel->cocos2d::CCLabelProtocol, (const char *)v45);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_pathLabel, 150.0, 0.60000002, 0.0);
v46 = -a1->m_nameLabel->getContentSize(a1->m_nameLabel)->width;
v47 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_nameLabel->getScale)(a1->m_nameLabel);
cocos2d::CCPoint::CCPoint((float)(*(float *)&v47 * v46) - 2.0, (float)(*(float *)&v47 * v46) - 2.0);
v48 = a1->m_nameLabel->getPosition_0(a1->m_nameLabel);
cocos2d::CCPoint::operator+(v48, &v68);
a1->m_pathLabel->setPosition_0(a1->m_pathLabel, (const cocos2d::CCPoint *)&v68);
v50 = (SetupTriggerPopup *)cocos2d::CCArray::create(v49);
v51 = a1->m_cellAmount * v2->m_startIndex;
m_filterObjects = v2->m_filterObjects;
v53 = cocos2d::CCArray::count(m_filterObjects);
for ( i = v51; i < v51 + a1->m_cellAmount; ++i )
{
if ( i >= v53 )
break;
v55 = cocos2d::CCArray::objectAtIndex(m_filterObjects, i);
cocos2d::CCArray::addObject(v50, v55, v56, v57);
}
a1->m_sfxObjects = (cocos2d::CCArray *)v50;
cocos2d::CCObject::retain(v50);
v59 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v58);
cocos2d::CCDirector::getWinSize(v59);
LOBYTE(v4) = a1->m_compactMode;
v60 = CustomListView::create(
a1->m_sfxObjects,
&a1->TableViewCellDelegate,
220.0,
340.0,
v67,
(BoomListType)(v4 + 23),
0.0);
v62 = GJCommentListLayer::create(v60, v61, (cocos2d::ccColor4B)-13487566, 340.0, 220.0, 1);
a1->m_listLayer = v62;
v63 = ((float (__fastcall *)(cocos2d::CCLayer *, GJCommentListLayer *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v62,
10);
v64 = a1->m_listLayer->__vftable;
cocos2d::CCPoint::CCPoint(v63, (float)(v69 - 340.0) * 0.5);
v64->setPosition_0(a1->m_listLayer, v65);
LOBYTE(v66) = 1;
a1->m_refreshButton->setVisible(a1->m_refreshButton, v66);
SFXBrowser::updatePageLabel(a1);
sub_14003A830((__int64)Block);
sub_14003A830((__int64)&v79);
sub_14003A830((__int64)&v76);
sub_14003A830((__int64)&v88);
}
}