//
// SFXBrowser::onSelectAll from 0xb9728c to 0xb97510 (644 bytes)
//
// 3 xrefs:
// > ??> @ 0xacb70
// > sub_B947C8 @ 0xb95bc8
// > ??> @ 0x1544e68
//
// 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:02:41 +0000
//
__int64 __fastcall SFXBrowser::onSelectAll(SFXBrowser *this, cocos2d::CCObject *a2)
{
__int64 v3; // x0
__int64 v5; // x0
unsigned int *v6; // x1
__int64 *v7; // x20
__int64 *v8; // x24
__int64 v9; // x19
MusicDownloadManager *v10; // x0
MusicDownloadManager *v11; // x0
char *v12; // x1
unsigned __int64 v13; // x20
int *v14; // x5
unsigned __int64 v15; // x6
int v16; // w4
__int64 *v17; // x2
int v18; // w3
int v19; // w24
__int64 v20; // x23
__int64 v21; // x19
int *v22; // x1
__int64 v23; // x0
__int64 v24; // x0
char *v25; // x0
bool v26; // cc
void *v27; // [xsp+50h] [xbp+50h] BYREF
char *v28; // [xsp+58h] [xbp+58h]
char *v29; // [xsp+60h] [xbp+60h]
v3 = *((_QWORD *)this + 89);
if ( v3 )
{
if ( *(_DWORD *)(v3 + 140) == 4 )
{
v5 = *(_QWORD *)(v3 + 64);
v27 = nullptr;
v28 = nullptr;
v29 = nullptr;
if ( v5 )
{
v6 = *(unsigned int **)(v5 + 56);
if ( *v6 )
{
v7 = *((__int64 **)v6 + 2);
v8 = &v7[*v6 - 1];
if ( v7 <= v8 )
{
v9 = *v7;
if ( *v7 )
{
do
{
v10 = (MusicDownloadManager *)*(unsigned int *)(v9 + 76);
if ( (int)v10 > 1 )
{
v11 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v10);
if ( v9 == MusicDownloadManager::getCustomSFXObject(v11, *(_DWORD *)(v9 + 76)) )
{
v25 = v28;
if ( v28 == v29 )
{
std::vector::__push_back_slow_path((__int64)&v27, (_DWORD *)(v9 + 76));
}
else
{
if ( v28 )
{
*(_DWORD *)v28 = *(_DWORD *)(v9 + 76);
v25 = v28;
}
v28 = v25 + 4;
}
}
}
if ( v8 < ++v7 )
break;
v9 = *v7;
}
while ( *v7 );
v12 = (char *)v27;
if ( v27 == v28 )
{
if ( v27 )
LABEL_42:
operator delete(v27);
}
else
{
v13 = (v28 - (_BYTE *)v27) >> 2;
if ( v13 )
{
v14 = (int *)v27;
v15 = 1;
do
{
if ( !*((_QWORD *)this + 126) )
{
LABEL_19:
v19 = 0;
goto LABEL_20;
}
v16 = *v14;
v17 = *((__int64 **)this + 126);
while ( 1 )
{
while ( 1 )
{
v18 = *((_DWORD *)v17 + 7);
if ( v16 >= v18 )
break;
v17 = (__int64 *)*v17;
if ( !v17 )
goto LABEL_19;
}
if ( v16 <= v18 )
break;
v17 = (__int64 *)v17[1];
if ( !v17 )
goto LABEL_19;
}
v26 = v13 > v15;
++v14;
++v15;
}
while ( v26 );
v19 = 1;
LABEL_20:
v20 = 0;
v21 = 0;
if ( !v19 )
goto LABEL_23;
while ( 1 )
{
v22 = (int *)&v12[v20];
++v21;
v20 += 4;
std::__tree::__erase_unique((_QWORD *)this + 125, v22);
if ( v21 == v13 )
break;
while ( 1 )
{
v12 = (char *)v27;
if ( v19 )
break;
LABEL_23:
std::__tree::__emplace_unique_key_args(
(__int64 **)this + 125,
(int *)&v12[v20],
&v12[v20]);
++v21;
v20 += 4;
if ( v21 == v13 )
goto LABEL_24;
}
}
}
LABEL_24:
SFXBrowser::updateSelectionUI(this);
v23 = *((_QWORD *)this + 91);
if ( v23 )
{
v24 = *(_QWORD *)(v23 + 544);
if ( v24 )
CustomListView::reloadAll(v24);
}
if ( v27 )
{
if ( v27 != v28 )
v28 += 4 * ~((unsigned __int64)(v28 - 4 - (_BYTE *)v27) >> 2);
goto LABEL_42;
}
}
}
}
}
}
}
}
return _stack_chk_guard;
}