//
// SFXBrowser::setupList from 0x140619900 to 0x14061a4a7 (2983 bytes)
//
// 11 xrefs:
// > SFXBrowser::setupSFXBrowser @ 0x140618eda
// > SFXBrowser::setupSFXBrowser @ 0x140619676
// > SFXBrowser::switchToView @ 0x14061b791
// > SFXBrowser::refreshCustomList @ 0x14061bd36
// > SFXBrowser::onToggleCompactMode @ 0x14061f32c
// > SFXBrowser::onToggleSearch @ 0x14061f54b
// > SFXBrowser::textChanged @ 0x14061f8dc
// > SFXBrowser::cellPerformedAction @ 0x14061fc86
// > SFXBrowser::onPage @ 0x140620386
// > SFXBrowser::onExitFolder @ 0x1406207e0
// > ??> @ 0x1409301b8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:35:20 +0000
//
// Hidden C++ exception states: #wind=16
void __fastcall SFXBrowser::setupList(__int64 *a1, __int64 a2)
{
size_t v4; // rsi
__int64 v5; // rdx
int v6; // eax
cocos2d::CCString *v7; // rax
const char *CString; // rax
size_t v9; // r8
__int64 v10; // rdx
__int64 v11; // rcx
__int64 v12; // r8
void **v13; // r15
__int64 v14; // rbx
unsigned __int64 v15; // rdi
__int64 v16; // rbx
cocos2d::CCNode *v17; // rax
cocos2d::CCString *v18; // rax
const char *v19; // rax
size_t v20; // r8
__int128 *v21; // rdx
cocos2d::CCNode *v22; // rbx
__int64 v23; // rdx
cocos2d::CCObject *v24; // rcx
__int64 v25; // rax
int v26; // ecx
bool v27; // cl
__int64 v28; // rcx
size_t v29; // rbx
unsigned __int64 v30; // rdi
__int64 v31; // rcx
int v32; // eax
__int64 v33; // r8
size_t *v34; // r8
void *v35; // rdx
__int64 v36; // rcx
void **v37; // rax
__m128i v38; // xmm1
__int64 v39; // r8
size_t *v40; // r8
void *v41; // rdx
__int64 v42; // rcx
int v43; // ebx
struct cocos2d::CCObject *SFXFolderObjectForID; // rax
__int64 v45; // rcx
struct cocos2d::CCObject *v46; // rbx
int i; // edi
char *v48; // r8
__int64 v49; // rcx
__m128i v50; // xmm6
__int128 *v51; // rdx
__int64 v52; // rdx
void **v53; // rdx
cocos2d::CCObject *v54; // rcx
__int64 v55; // rax
struct cocos2d::CCObject *v56; // rbx
cocos2d::CCTouchDispatcher *v57; // rax
cocos2d::CCArray *v58; // r13
int v59; // edi
cocos2d::CCArray *v60; // r15
signed int v61; // r12d
signed int j; // ebx
struct cocos2d::CCObject *v63; // rax
__int64 v64; // rcx
__int64 v65; // rax
int v66; // eax
int v67; // edx
cocos2d::CCLayerColor *v68; // rax
__int64 v69; // rdi
__int64 v70; // rbx
__int64 v71; // rax
__int64 v72; // rdx
__int64 v73; // rdx
int v74; // r15d
__int64 v75; // rdi
__int64 v76; // rdi
__int64 v77; // rdi
int v78; // eax
const char *v79; // rdx
__int64 v80; // rbx
__int64 v81; // rdx
__int64 v82; // r8
cocos2d::CCNode *v83; // rax
char v84; // bl
char v85; // al
__int64 v86; // rcx
__int64 v87; // rcx
__int64 v88; // rax
const char *v89; // rbx
const char *v90; // rdx
__int64 v91; // rax
const char *v92; // rdx
__int64 v93; // rcx
__int64 v94; // rax
__int64 v95; // rdx
__int64 v96; // rcx
__int64 *v97; // rsi
__int64 v98; // rdi
const char *v99; // rbx
cocos2d::CCSpriteFrameCache *v100; // rax
struct cocos2d::CCSpriteFrame *v101; // rax
__int64 v102; // [rsp+20h] [rbp-E0h]
void *v103; // [rsp+40h] [rbp-C0h]
__int128 *v104; // [rsp+50h] [rbp-B0h] BYREF
float v105[2]; // [rsp+58h] [rbp-A8h] BYREF
__int128 v106; // [rsp+60h] [rbp-A0h] BYREF
__int64 v107; // [rsp+70h] [rbp-90h]
unsigned __int64 v108; // [rsp+78h] [rbp-88h]
__int128 v109; // [rsp+80h] [rbp-80h] BYREF
__m128i v110; // [rsp+90h] [rbp-70h]
void *Src[2]; // [rsp+A0h] [rbp-60h] BYREF
unsigned __int64 v112; // [rsp+B0h] [rbp-50h]
unsigned __int64 v113; // [rsp+B8h] [rbp-48h]
__int128 v114; // [rsp+C0h] [rbp-40h] BYREF
__int64 v115; // [rsp+D0h] [rbp-30h]
__int64 v116; // [rsp+D8h] [rbp-28h]
void *v117[2]; // [rsp+E0h] [rbp-20h] BYREF
__m128i v118; // [rsp+F0h] [rbp-10h]
__int128 v119; // [rsp+100h] [rbp+0h] BYREF
__int64 v120; // [rsp+110h] [rbp+10h]
unsigned __int64 v121; // [rsp+118h] [rbp+18h]
if ( !a2 )
return;
v4 = -1;
v5 = qword_14090C070;
if ( *((int *)a1 + 273) > 0 )
{
if ( !qword_14090C070 )
{
v103 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v103);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v5 = qword_14090C070;
}
v6 = *(_DWORD *)(v5 + 432);
if ( *((_DWORD *)a1 + 273) != v6 )
{
v7 = cocos2d::CCString::createWithFormat("SFX Library Updated to version %i", v6);
CString = cocos2d::CCString::getCString(v7);
*(_OWORD *)Src = 0;
v112 = 0;
v113 = 0;
v9 = -1;
do
++v9;
while ( CString[v9] );
sub_14003D230(Src, CString, v9);
v114 = 0;
v115 = 0;
v116 = 15;
LOBYTE(v114) = 0;
v109 = 0;
v110 = 0u;
v13 = Src;
if ( v113 > 0xF )
v13 = (void **)Src[0];
v14 = 0x7FFFFFFFFFFFFFFFLL;
v15 = v112;
if ( v112 > 0x7FFFFFFFFFFFFFFFLL )
sub_140009D90(v11);
if ( v112 > 0xF )
{
if ( (v112 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v14 = v112 | 0xF;
if ( (v112 | 0xF) < 0x16 )
v14 = 22;
}
*(_QWORD *)&v109 = sub_14003D460(v14 + 1);
v110.m128i_i64[0] = v15;
v110.m128i_i64[1] = v14;
memcpy((void *)v109, v13, v15 + 1);
}
else
{
v110.m128i_i64[0] = v112;
v110.m128i_i64[1] = 15;
v109 = *(_OWORD *)v13;
}
v16 = *a1;
v17 = TextAlertPopup::create((__int64)&v109, v10, v12, 150, (__int64)&v114);
(*(void (__fastcall **)(__int64 *, cocos2d::CCNode *, __int64))(v16 + 456))(a1, v17, 100);
sub_14003D310((__int64)Src);
v5 = qword_14090C070;
}
}
if ( !v5 )
{
v104 = (__int128 *)operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v104);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v5 = qword_14090C070;
}
*((_DWORD *)a1 + 273) = *(_DWORD *)(v5 + 432);
v18 = cocos2d::CCString::createWithFormat(
"SFX Library Version %i. SFX Count: %i",
*(_DWORD *)(v5 + 432),
*(_DWORD *)(v5 + 436));
v19 = cocos2d::CCString::getCString(v18);
v119 = 0;
v120 = 0;
v121 = 0;
v20 = -1;
do
++v20;
while ( v19[v20] );
sub_14003D230(&v119, v19, v20);
v21 = &v119;
if ( v121 > 0xF )
v21 = (__int128 *)v119;
(**(void (__fastcall ***)(__int64, __int128 *))(a1[99] + 360))(a1[99] + 360, v21);
v22 = (cocos2d::CCNode *)a1[135];
cocos2d::CCNode::stopActionByTag(v22, 0);
(*(void (__fastcall **)(_QWORD *, _QWORD))(*((_QWORD *)v22 + 40) + 40LL))((_QWORD *)v22 + 40, 0);
(*(void (__fastcall **)(cocos2d::CCNode *, _QWORD))(*(_QWORD *)v22 + 336LL))(v22, 0);
v24 = (cocos2d::CCObject *)a1[89];
if ( (cocos2d::CCObject *)a2 != v24 )
{
if ( v24 )
cocos2d::CCObject::release(v24);
a1[89] = a2;
cocos2d::CCObject::retain((cocos2d::CCObject *)a2);
}
v25 = a1[89];
v26 = *(_DWORD *)(v25 + 148);
v27 = !v26 || v26 == 4;
if ( *((_BYTE *)a1 + 880)
|| !v27
|| (v28 = *(_QWORD *)(v25 + 184)) == 0
|| *(int *)(v28 + 60) <= 0
|| *(_QWORD *)(v25 + 120) )
{
v23 = 0;
}
else
{
LOBYTE(v23) = 1;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1[103] + 336LL))(a1[103], v23);
v106 = 0;
v107 = 0;
v108 = 15;
LOBYTE(v106) = 0;
*(_OWORD *)v117 = 0;
v29 = 0;
v118.m128i_i64[0] = 0;
v30 = 15;
v118.m128i_i64[1] = 15;
LOBYTE(v117[0]) = 0;
v31 = a1[89];
v32 = *(_DWORD *)(v31 + 148);
switch ( v32 )
{
case 1:
v107 = 9;
strcpy((char *)&v106, "Favorites");
break;
case 2:
v107 = 6;
strcpy((char *)&v106, "Recent");
break;
case 3:
v107 = 10;
strcpy((char *)&v106, "This Level");
break;
default:
if ( v32 == 4 && (v33 = *(_QWORD *)(v31 + 184)) != 0 )
{
v34 = (size_t *)(v33 + 80);
if ( &v106 != (__int128 *)v34 )
{
v35 = v34;
if ( v34[3] > 0xF )
v35 = (void *)*v34;
sub_1400405A0((void **)&v106, v35, v34[2]);
}
v36 = qword_14090C070;
if ( !qword_14090C070 )
{
v104 = (__int128 *)operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v104);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v36 = qword_14090C070;
}
v37 = (void **)sub_140485FC0(v36, &v114, *(_DWORD *)(*(_QWORD *)(a1[89] + 184) + 76LL));
if ( v117 != v37 )
{
*(_OWORD *)v117 = *(_OWORD *)v37;
v118 = *((__m128i *)v37 + 1);
v38 = v118;
v37[2] = nullptr;
v37[3] = (void *)15;
*(_BYTE *)v37 = 0;
v30 = _mm_srli_si128(v38, 8).m128i_u64[0];
v29 = v38.m128i_i64[0];
}
sub_14003D310((__int64)&v114);
}
else
{
v39 = *(_QWORD *)(v31 + 184);
if ( v39 )
{
v40 = (size_t *)(v39 + 80);
if ( &v106 != (__int128 *)v40 )
{
v41 = v40;
if ( v40[3] > 0xF )
v41 = (void *)*v40;
sub_1400405A0((void **)&v106, v41, v40[2]);
}
v42 = *(_QWORD *)(a1[89] + 184);
v43 = *(_DWORD *)(v42 + 56);
if ( !qword_14090C070 )
{
v104 = (__int128 *)operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v104);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
}
v109 = 0;
v110.m128i_i64[0] = 0;
v110.m128i_i64[1] = 15;
LOBYTE(v109) = 0;
SFXFolderObjectForID = MusicDownloadManager::getSFXFolderObjectForID(v42, v43);
v46 = MusicDownloadManager::getSFXFolderObjectForID(v45, *((_DWORD *)SFXFolderObjectForID + 15));
for ( i = 0; v46; v46 = MusicDownloadManager::getSFXFolderObjectForID(v49, *((_DWORD *)v46 + 15)) )
{
if ( i >= 10 )
break;
++i;
sub_140059D70(&v109, 0, " \\ ", 3u);
v48 = (char *)v46 + 80;
if ( *((_QWORD *)v46 + 13) > 0xFu )
v48 = *((char **)v46 + 10);
sub_140059D70(&v109, 0, v48, *((_QWORD *)v46 + 12));
}
*(_OWORD *)v117 = v109;
v50 = v110;
v118 = v110;
v110.m128i_i64[0] = 0;
v110.m128i_i64[1] = 15;
LOBYTE(v109) = 0;
sub_14003D310((__int64)&v109);
v30 = _mm_srli_si128(v50, 8).m128i_u64[0];
v29 = v50.m128i_i64[0];
}
}
break;
}
v51 = &v106;
if ( v108 > 0xF )
v51 = (__int128 *)v106;
(**(void (__fastcall ***)(__int64, __int128 *))(a1[92] + 360))(a1[92] + 360, v51);
cocos2d::CCLabelBMFont::limitLabelWidth((cocos2d::CCLabelBMFont *)a1[92], 150.0, 0.5, 0.0);
LOBYTE(v52) = *((_BYTE *)a1 + 880) == 0;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1[92] + 336LL))(a1[92], v52);
if ( a1 + 95 != (__int64 *)v117 )
{
v53 = v117;
if ( v30 > 0xF )
v53 = (void **)v117[0];
sub_1400405A0((void **)a1 + 95, v53, v29);
}
SFXBrowser::fitFolderPath(a1);
v54 = (cocos2d::CCObject *)a1[90];
if ( v54 )
cocos2d::CCObject::release(v54);
if ( a1[91] )
{
v55 = cocos2d::CCDirector::sharedDirector(v54);
v56 = (struct cocos2d::CCObject *)a1[91];
v57 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v55 + 144LL))(v55);
cocos2d::CCTouchDispatcher::unregisterForcePrio(v57, v56);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1[91] + 528LL))(a1[91]);
a1[91] = 0;
}
v58 = (cocos2d::CCArray *)cocos2d::CCArray::create(v54);
v59 = *((_DWORD *)a1 + 274) * *(_DWORD *)(a2 + 96);
v60 = *(cocos2d::CCArray **)(a2 + 64);
v61 = cocos2d::CCArray::count(v60);
for ( j = v59; j < v59 + *((_DWORD *)a1 + 274); ++j )
{
if ( j >= v61 )
break;
v63 = cocos2d::CCArray::objectAtIndex(v60, j);
cocos2d::CCArray::addObject(v58, v63);
}
a1[90] = (__int64)v58;
cocos2d::CCObject::retain(v58);
v65 = cocos2d::CCDirector::sharedDirector(v64);
cocos2d::CCDirector::getWinSize(v65, v105);
v66 = (unsigned int)CustomListView::create(
(cocos2d::CCObject *)a1[90],
(__int64)(a1 + 84),
220.0,
340.0,
v102,
(unsigned int)(*((_BYTE *)a1 + 1103) != 0) + 21);
v68 = GJCommentListLayer::create(v66, v67, -13487566, 340.0, 1130102784, 1, 0);
a1[91] = (__int64)v68;
(*(void (__fastcall **)(__int64, cocos2d::CCLayerColor *, __int64))(*(_QWORD *)a1[73] + 456LL))(a1[73], v68, 9);
v69 = *(_QWORD *)a1[91];
v70 = a1[91];
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v104,
(float)(v105[0] - 340.0) * 0.5,
(float)((float)(v105[1] - 220.0) * 0.5) - 10.0);
(*(void (__fastcall **)(__int64, __int64))(v69 + 184))(v70, v71);
LOBYTE(v72) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1[104] + 336LL))(a1[104], v72);
SFXBrowser::updateSelectionUI(a1);
v74 = *(_DWORD *)(a1[89] + 148);
v75 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v104 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v104);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v75 = qword_14090BFD0;
}
v76 = *(_QWORD *)(v75 + 568);
if ( v76 )
{
v77 = *(_QWORD *)(v76 + 3528);
if ( v77 )
{
v78 = *(_DWORD *)(v77 + 720);
if ( v78 )
{
v79 = "Shared folders removed, level share off";
if ( v78 == 1 )
v79 = "Setup too large to share";
v104 = &v114;
v114 = 0;
v115 = 0;
v116 = 15;
LOBYTE(v114) = 0;
*(_OWORD *)Src = 0;
v112 = 0;
v113 = 0;
do
++v4;
while ( v79[v4] );
sub_14003D230(Src, v79, v4);
v80 = *a1;
v83 = TextAlertPopup::create((__int64)Src, v81, v82, 150, (__int64)&v114);
(*(void (__fastcall **)(__int64 *, cocos2d::CCNode *, __int64))(v80 + 456))(a1, v83, 100);
*(_DWORD *)(v77 + 720) = 0;
}
if ( *(_QWORD *)(v77 + 680) )
{
v84 = 1;
goto LABEL_96;
}
}
}
else
{
v77 = 0;
}
v84 = 0;
if ( !v77 )
{
LABEL_98:
v85 = 0;
goto LABEL_99;
}
LABEL_96:
if ( !*(_QWORD *)(v77 + 656) )
goto LABEL_98;
v85 = 1;
LABEL_99:
v86 = a1[116];
if ( v86 )
{
if ( v74 == 3 && !*((_BYTE *)a1 + 880) && (v84 || v85) )
LOBYTE(v73) = 1;
else
v73 = 0;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v86 + 336LL))(v86, v73);
}
v87 = a1[117];
if ( v87 )
{
if ( v74 == 3 && !*((_BYTE *)a1 + 880) && v84 )
LOBYTE(v73) = 1;
else
v73 = 0;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v87 + 336LL))(v87, v73);
}
if ( a1[89] )
{
v88 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[111] + 952LL))(a1[111]);
v89 = "GJ_button_01.png";
v90 = "GJ_button_01.png";
if ( *(_DWORD *)(a1[89] + 148) == 1 )
v90 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v88, v90);
v91 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[112] + 952LL))(a1[112]);
v92 = "GJ_button_01.png";
if ( *(_DWORD *)(a1[89] + 148) == 2 )
v92 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v91, v92);
v93 = a1[113];
if ( v93 )
{
v94 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v93 + 952LL))(v93);
if ( *(_DWORD *)(a1[89] + 148) == 3 )
v89 = "GJ_button_02.png";
ButtonSprite::updateBGImage(v94, v89);
}
v97 = (__int64 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[114] + 952LL))(a1[114]);
v98 = *v97;
v99 = "GJ_customSFXButton_001.png";
if ( *((_DWORD *)a1 + 277) == 4 )
v99 = "GJ_mainSFXButton_001.png";
v100 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v96, v95);
v101 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v100, v99);
(*(void (__fastcall **)(__int64 *, struct cocos2d::CCSpriteFrame *))(v98 + 1008))(v97, v101);
}
SFXBrowser::updatePageLabel(a1);
sub_14003D310((__int64)v117);
sub_14003D310((__int64)&v106);
sub_14003D310((__int64)&v119);
}