//
// SFXFolderPickerPopup::rebuildList from 0xc3b984 to 0xc3c4cc (2888 bytes)
//
// 3 xrefs:
// > SFXFolderPickerPopup::refreshList @ 0xc3c4fc
// > SFXFolderPickerPopup::init @ 0xc3ce00
// > ??> @ 0x98ff8
//
// This function is hookable on this platform (idp: arm, 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 13:04:54 +0000
//
__int64 __fastcall SFXFolderPickerPopup::rebuildList(SFXFolderPickerPopup *this)
{
__int64 v2; // x0
bool v3; // w21
MusicDownloadManager *v4; // x0
MusicDownloadManager *v5; // x0
__int64 CustomSFXRoot; // x0
__int64 *v7; // x1
__int64 v8; // x3
__int64 *v9; // x0
__int64 v10; // x2
__int64 v11; // x3
char *v12; // x1
__int64 v13; // x0
unsigned int *v14; // x1
void **v15; // x19
__int64 v16; // x0
char *v17; // x21
_BYTE *v18; // x0
char *v19; // x1
int v20; // w0
__int64 v21; // x19
unsigned __int64 v22; // x21
char *v23; // x28
char v24; // w27
char v25; // w1
__int64 *v26; // x0
__int64 v27; // x3
__int64 v28; // x2
__int64 v29; // x0
bool v30; // w1
int v31; // w22
float v32; // s11
float v33; // s13
float v34; // s12
_BYTE *v35; // x1
__int64 v36; // x0
__int64 v37; // x24
int v38; // w25
__int64 v39; // x23
int v40; // w21
bool v41; // zf
int v42; // w22
__int64 v43; // x20
void (__fastcall *v44)(__int64, void **); // x27
__int64 v45; // x1
void (__fastcall *v46)(__int64, void **); // x2
void (__fastcall *v47)(__int64, void **); // x22
cocos2d::CCSprite *v48; // x0
__int64 v49; // x20
void (__fastcall *v50)(__int64, void **); // x22
float v51; // s8
float v52; // s10
const char *v53; // x1
__int64 v54; // x21
void (__fastcall *v55)(__int64, void **); // x22
void (__fastcall *v56)(__int64, void **); // x22
int v57; // w0
const char *v58; // x2
__int64 v59; // x22
void (__fastcall *v60)(__int64, void **); // x27
void (__fastcall *v61)(__int64, void **); // x27
const char *v62; // x1
char *v63; // x0
__int64 v64; // x22
void (__fastcall *v65)(__int64, void **); // x27
float v66; // s15
const char *v67; // x2
float v68; // s0
cocos2d::CCLabelBMFont *v69; // x0
float v70; // s10
cocos2d::CCLabelBMFont *v71; // x21
void (__fastcall *v72)(cocos2d::CCLabelBMFont *, void **); // x22
void (__fastcall *v73)(cocos2d::CCLabelBMFont *, void **); // x22
_BYTE *v74; // x21
void (__fastcall *v75)(_BYTE *, void **); // x22
void (__fastcall *v76)(_BYTE *, void **); // x22
float v77; // s0
int v79; // [xsp+D4h] [xbp+D4h] BYREF
bool (__fastcall *v80)(__int64, __int64); // [xsp+D8h] [xbp+D8h] BYREF
__int64 v81; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v82; // [xsp+E8h] [xbp+E8h]
__int64 v83; // [xsp+F0h] [xbp+F0h] BYREF
__int64 v84; // [xsp+F8h] [xbp+F8h]
_BYTE *v85; // [xsp+100h] [xbp+100h] BYREF
__int64 v86; // [xsp+108h] [xbp+108h]
void *v87; // [xsp+110h] [xbp+110h] BYREF
char *v88; // [xsp+118h] [xbp+118h]
char *v89; // [xsp+120h] [xbp+120h]
void *v90; // [xsp+128h] [xbp+128h] BYREF
__int64 *v91; // [xsp+130h] [xbp+130h]
__int64 *v92; // [xsp+138h] [xbp+138h]
void *v93; // [xsp+140h] [xbp+140h] BYREF
char *v94; // [xsp+148h] [xbp+148h]
unsigned __int64 v95; // [xsp+150h] [xbp+150h]
char s[16]; // [xsp+158h] [xbp+158h] BYREF
v2 = *((_QWORD *)this + 94);
if ( v2 )
{
v3 = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v2 + 416) + 584LL))(*(_QWORD *)(v2 + 416), 1);
LODWORD(v90) = -1;
v4 = (MusicDownloadManager *)std::__tree::__count_unique((__int64)this + 704, (int *)&v90);
if ( !v4 )
{
LODWORD(v93) = 1;
v4 = (MusicDownloadManager *)std::__tree::__count_unique((__int64)this + 704, (int *)&v93);
v3 = v4 != nullptr;
}
v87 = nullptr;
v88 = nullptr;
v89 = nullptr;
v90 = nullptr;
v91 = nullptr;
v92 = nullptr;
v82 = 0;
v5 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v4);
CustomSFXRoot = MusicDownloadManager::getCustomSFXRoot(v5);
v7 = v91;
v81 = CustomSFXRoot;
BYTE5(v82) = v3;
if ( v92 == v91 )
{
std::vector::__push_back_slow_path(&v90, &v81);
v9 = v91;
}
else
{
if ( v91 )
{
v8 = v82;
*v91 = v81;
v7[1] = v8;
v7 = v91;
}
v9 = v7 + 2;
v91 = v7 + 2;
}
if ( v9 != v90 )
{
while ( 1 )
{
v10 = *(v9 - 2);
v11 = *(v9 - 1);
v12 = v88;
v83 = v10;
v84 = v11;
v91 = v9 - 2;
if ( v88 == v89 )
{
std::vector::__push_back_slow_path(&v87, &v83);
}
else
{
if ( v88 )
{
*(_QWORD *)v88 = v10;
*((_QWORD *)v12 + 1) = v11;
v12 = v88;
}
v88 = v12 + 16;
}
v93 = nullptr;
v94 = nullptr;
v95 = 0;
v13 = *(_QWORD *)(v83 + 152);
if ( !v13 )
goto LABEL_71;
v14 = *(unsigned int **)(v13 + 56);
if ( *v14
&& (v15 = *((void ***)v14 + 2),
v16 = 8LL * *v14 - 8,
v17 = (char *)v15 + v16,
v15 <= (void **)((char *)v15 + v16)) )
{
v18 = *v15;
v19 = nullptr;
if ( *v15 )
{
do
{
if ( v18[72] )
{
v85 = v18;
if ( v95 <= (unsigned __int64)v19 )
{
std::vector::__push_back_slow_path((__int64)&v93, &v85);
v19 = v94;
}
else
{
if ( v19 )
{
*(_QWORD *)v19 = v18;
v19 = v94;
}
v19 += 8;
v94 = v19;
}
}
if ( v17 < (char *)++v15 )
break;
v18 = *v15;
}
while ( *v15 );
v18 = v93;
}
}
else
{
LABEL_71:
v19 = nullptr;
v18 = nullptr;
}
v80 = sub_C3A604;
std::__sort(
(__int64)v18,
v19,
(unsigned __int8 (__fastcall **)(__int64, __int64))&v80);
v20 = ((v94 - (_BYTE *)v93) >> 3) - 1;
if ( v20 >= 0 )
break;
v23 = (char *)v93;
LABEL_36:
if ( v23 )
{
if ( v94 != v23 )
v94 += 8 * ~((unsigned __int64)(v94 - 8 - v23) >> 3);
operator delete(v23);
}
v9 = v91;
if ( v90 == v91 )
goto LABEL_41;
}
v21 = 8LL * v20;
v22 = 8 * (v20 - (unsigned __int64)(unsigned int)v20) - 8;
v23 = (char *)v93;
while ( 1 )
{
while ( 1 )
{
v28 = *(_QWORD *)&v23[v21];
v79 = *(_DWORD *)(v28 + 76);
v85 = (_BYTE *)v28;
LODWORD(v86) = v84 + 1;
if ( !BYTE4(v84) )
break;
v24 = BYTE5(v84);
BYTE4(v86) = BYTE4(v84);
v25 = BYTE5(v84);
if ( !BYTE5(v84) )
goto LABEL_34;
LABEL_28:
v26 = v91;
BYTE5(v86) = v25;
BYTE6(v86) = v24;
if ( v91 != v92 )
goto LABEL_29;
LABEL_35:
std::vector::__push_back_slow_path(&v90, &v85);
v21 -= 8;
v23 = (char *)v93;
if ( v21 == v22 )
goto LABEL_36;
}
v29 = std::__tree::__count_unique((__int64)this + 680, &v79);
v24 = BYTE5(v84);
BYTE4(v86) = v29 != 0;
v25 = BYTE5(v84);
if ( BYTE5(v84) )
goto LABEL_28;
LABEL_34:
v30 = std::__tree::__count_unique((__int64)this + 704, &v79) != 0;
v26 = v91;
BYTE5(v86) = v30;
BYTE6(v86) = v24;
if ( v91 == v92 )
goto LABEL_35;
LABEL_29:
if ( v26 )
{
v27 = v86;
*v26 = (__int64)v85;
v26[1] = v27;
v26 = v91;
v23 = (char *)v93;
}
v21 -= 8;
v91 = v26 + 2;
if ( v21 == v22 )
goto LABEL_36;
}
}
LABEL_41:
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v85, (const cocos2d::CCSize *)(*((_QWORD *)this + 94) + 424LL));
v31 = *((_DWORD *)this + 168);
v32 = *(float *)&v85 - 10.0;
v33 = *(float *)&v85 * 0.5;
if ( v31 == 2 )
v34 = v32 - 30.0;
else
v34 = v32 - 8.0;
v35 = v87;
v36 = (v88 - (_BYTE *)v87) >> 4;
if ( (int)v36 > 0 )
{
v37 = 0;
v38 = 0;
while ( 1 )
{
v39 = *(_QWORD *)&v35[v37];
v40 = *(_DWORD *)&v35[v37 + 8];
if ( v35[v37 + 12] )
{
if ( *(_DWORD *)(v39 + 76) != *((_DWORD *)this + 182) )
{
v41 = v31 == 2;
v42 = 0;
if ( !v41 )
goto LABEL_48;
LABEL_69:
v42 = 0;
goto LABEL_48;
}
*((_DWORD *)this + 182) = 0;
}
if ( v31 == 2 || *(_DWORD *)(v39 + 76) != *((_DWORD *)this + 182) )
goto LABEL_69;
v42 = 1;
LABEL_48:
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v93, 0.0, 0.0, 40.0, 40.0);
v43 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", &v93);
v44 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v43 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v93, v32 + v32, 44.0);
v44(v43, &v93);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v43 + 160LL))(v43, 0.5);
v45 = 130;
if ( !v42 )
{
if ( (v38 & 1) != 0 )
v45 = 40;
else
v45 = 70;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v43 + 912LL))(v43, v45);
v46 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v43 + 960LL);
if ( v42 )
{
LOWORD(v93) = -16836;
BYTE2(v93) = 40;
}
else
{
LOWORD(v93) = 0;
BYTE2(v93) = 0;
}
v46(v43, &v93);
v47 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v43 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v33, -16.0 - (float)((float)v38 * 24.0));
v47(v43, &v93);
v48 = (cocos2d::CCSprite *)(*(__int64 (__fastcall **)(_QWORD, __int64, _QWORD))(**(_QWORD **)(*((_QWORD *)this + 94) + 416LL)
+ 464LL))(
*(_QWORD *)(*((_QWORD *)this + 94) + 416LL),
v43,
0);
v49 = cocos2d::CCSprite::create(v48);
v50 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v49 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v93, v32, 22.0);
v50(v49, &v93);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v49 + 984LL))(v49, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v49 + 936LL))(v49, 1);
v51 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v49 + 328LL))(v49) + 4) * 0.5;
v52 = (float)((float)v40 * 14.0) + 8.0;
v54 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"folderIcon_001.png", v53);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v54 + 160LL))(v54, 0.4);
v55 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v54 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, 0.0, 0.5);
v55(v54, &v93);
v56 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v54 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v52, v51);
v56(v54, &v93);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v49 + 456LL))(v49, v54);
v57 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(v39 + 152));
snprintf(s, 0x10u, "%i", v57);
v59 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)s, "chatFont.fnt", v58);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v59 + 160LL))(v59, 0.5);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v59 + 1024LL))(v59, 4294967190LL);
v60 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v59 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, 1.0, 0.5);
v60(v59, &v93);
v61 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v59 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v34, v51);
v61(v59, &v93);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v49 + 456LL))(v49, v59);
if ( *((_DWORD *)this + 168) == 2 )
{
if ( *((_BYTE *)v87 + v37 + 13) )
v63 = "GJ_checkOn_001.png";
else
v63 = "GJ_checkOff_001.png";
v64 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)v63, v62);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v64 + 160LL))(v64, 0.5);
v65 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v64 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v32 - 14.0, v51);
v65(v64, &v93);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v49 + 456LL))(v49, v64);
}
v66 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v54 + 328LL))(v54);
v68 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v54 + 168LL))(v54);
v69 = (cocos2d::CCLabelBMFont *)(v39 + 81);
v70 = (float)(v52 + (float)(v66 * v68)) + 6.0;
if ( (*(_BYTE *)(v39 + 80) & 1) != 0 )
v69 = *(cocos2d::CCLabelBMFont **)(v39 + 96);
v71 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v69, "bigFont.fnt", v67);
cocos2d::CCLabelBMFont::limitLabelWidth(v71, (float)(v34 - v70) - 28.0, 0.45, 0.15);
v72 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, void **))(*(_QWORD *)v71 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, 0.0, 0.5);
v72(v71, &v93);
v73 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, void **))(*(_QWORD *)v71 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v70, v51);
v73(v71, &v93);
(*(void (__fastcall **)(__int64, cocos2d::CCLabelBMFont *))(*(_QWORD *)v49 + 456LL))(v49, v71);
v74 = (_BYTE *)CCMenuItemSpriteExtra::create(
v49,
0,
(__int64)this,
(__int64)SFXFolderPickerPopup::onPickFolder,
0);
(*(void (__fastcall **)(_BYTE *, _QWORD))(*(_QWORD *)v74 + 72LL))(v74, *(unsigned int *)(v39 + 76));
v75 = *(void (__fastcall **)(_BYTE *, void **))(*(_QWORD *)v74 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v93, v32, 24.0);
v75(v74, &v93);
CCMenuItemSpriteExtra::setSizeMult((__int64)v74, 1.0);
v74[408] = 0;
LOWORD(v83) = -1;
BYTE2(v83) = -106;
CCMenuItemSpriteExtra::setClickColor((__int64)v74, v83);
v76 = *(void (__fastcall **)(_BYTE *, void **))(*(_QWORD *)v74 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v33, -16.0 - (float)((float)v38 * 24.0));
v76(v74, &v93);
if ( *((_BYTE *)v87 + v37 + 12) )
{
(*(void (__fastcall **)(_BYTE *, _QWORD))(*(_QWORD *)v74 + 1056LL))(v74, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v49 + 912LL))(v49, 90);
}
else if ( *((_BYTE *)v87 + v37 + 14) )
{
(*(void (__fastcall **)(_BYTE *, _QWORD))(*(_QWORD *)v74 + 1056LL))(v74, 0);
}
(*(void (__fastcall **)(_QWORD, _BYTE *, __int64))(**(_QWORD **)(*((_QWORD *)this + 94) + 416LL) + 464LL))(
*(_QWORD *)(*((_QWORD *)this + 94) + 416LL),
v74,
1);
v35 = v87;
++v38;
v37 += 16;
v36 = (v88 - (_BYTE *)v87) >> 4;
if ( v38 >= (int)v36 )
break;
v31 = *((_DWORD *)this + 168);
}
}
v77 = (float)((float)(unsigned __int64)v36 * 24.0) + 8.0;
if ( v77 < *((float *)&v85 + 1) )
v77 = *((float *)&v85 + 1);
ScrollableContentLayer::setContentHeight(*((ScrollableContentLayer **)this + 94), v77);
if ( v90 )
{
if ( v90 != v91 )
v91 += 2 * ~((unsigned __int64)((char *)(v91 - 2) - (_BYTE *)v90) >> 4);
operator delete(v90);
}
if ( v87 )
{
if ( v87 != v88 )
v88 += 16 * ~((unsigned __int64)(v88 - 16 - (_BYTE *)v87) >> 4);
operator delete(v87);
}
}
return _stack_chk_guard;
}