//
// SFXBrowser::onExitFolder from 0xb96fcc to 0xb971d0 (516 bytes)
//
// 4 xrefs:
// > SFXBrowser::onPage @ 0xb97288
// > ??> @ 0xdb2e0
// > sub_B947C8 @ 0xb94d14
// > ??> @ 0x1546918
//
// 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
//
void __fastcall SFXBrowser::onExitFolder(SFXBrowser *this, cocos2d::CCObject *a2)
{
SFXSearchResult *v3; // x0
int v4; // w1
MusicDownloadManager *v5; // x0
int v6; // w21
MusicDownloadManager *v7; // x20
__int64 v8; // x0
cocos2d::CCObject *CustomSFXFolderForID; // x1
__int64 v10; // x22
char *v11; // x1
char *v12; // x3
int v13; // w2
char *v14; // x20
int v15; // w0
int v16; // w0
int v17; // w0
int v18; // w1
_QWORD *v19; // x0
__int64 *v20; // x0
MusicDownloadManager *ActiveFolder; // x0
MusicDownloadManager *v22; // x20
__int64 v23; // x0
if ( *((_QWORD *)this + 89) )
{
if ( SFXSearchResult::getActiveFolder(*((SFXSearchResult **)this + 89)) )
{
v3 = *((SFXSearchResult **)this + 89);
v4 = *((_DWORD *)v3 + 35);
if ( (v4 & 0xFFFFFFFB) == 0 )
{
if ( v4 == 4 )
{
ActiveFolder = (MusicDownloadManager *)SFXSearchResult::getActiveFolder(v3);
v6 = *((_DWORD *)ActiveFolder + 19);
v22 = (MusicDownloadManager *)MusicDownloadManager::sharedState(ActiveFolder);
v23 = SFXSearchResult::getActiveFolder(*((SFXSearchResult **)this + 89));
CustomSFXFolderForID = (cocos2d::CCObject *)MusicDownloadManager::getCustomSFXFolderForID(
v22,
*(_DWORD *)(v23 + 60));
}
else
{
v5 = (MusicDownloadManager *)SFXSearchResult::getActiveFolder(v3);
v6 = *((_DWORD *)v5 + 14);
v7 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v5);
v8 = SFXSearchResult::getActiveFolder(*((SFXSearchResult **)this + 89));
CustomSFXFolderForID = MusicDownloadManager::getSFXFolderObjectForID(v7, *(_DWORD *)(v8 + 60));
}
if ( CustomSFXFolderForID )
{
SFXSearchResult::setActiveFolder(*((_QWORD *)this + 89), CustomSFXFolderForID);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 89) + 80LL))(
*((_QWORD *)this + 89),
*((unsigned int *)this + 278));
v10 = *((_QWORD *)this + 89);
v11 = *((char **)this + 133);
v12 = (char *)this + 1064;
v13 = *(_DWORD *)(v10 + 140);
if ( !v11 )
goto LABEL_30;
v14 = (char *)this + 1064;
do
{
while ( 1 )
{
v15 = *((_DWORD *)v11 + 7);
if ( v13 > v15 || v13 >= v15 && v6 > *((_DWORD *)v11 + 8) )
break;
v14 = v11;
v11 = *(char **)v11;
if ( !v11 )
goto LABEL_13;
}
v11 = *((char **)v11 + 1);
}
while ( v11 );
LABEL_13:
if ( v14 == v12
|| (v16 = *((_DWORD *)v14 + 7), v13 < v16)
|| v13 <= v16 && v6 < *((_DWORD *)v14 + 8)
|| v12 == v14 )
{
LABEL_30:
*(_DWORD *)(v10 + 96) = SFXSearchResult::getSelectedPage(
*((SFXSearchResult **)this + 89),
v6,
*((_DWORD *)this + 276));
SFXBrowser::setupList(this, *((cocos2d::CCArray ***)this + 89));
}
else
{
v17 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(v10 + 64));
if ( v17 <= 0 )
v18 = 0;
else
v18 = (v17 - 1) / *((_DWORD *)this + 276);
if ( v18 > *((_DWORD *)v14 + 9) )
v18 = *((_DWORD *)v14 + 9);
*(_DWORD *)(*((_QWORD *)this + 89) + 96LL) = v18;
SFXBrowser::setupList(this, *((cocos2d::CCArray ***)this + 89));
SFXBrowser::restoreListScroll(this, *((float *)v14 + 10));
v19 = std::__tree_next *>(v14);
if ( *((char **)this + 132) == v14 )
*((_QWORD *)this + 132) = v19;
v20 = *((__int64 **)this + 133);
--*((_QWORD *)this + 134);
std::__tree_remove *>(v20, (__int64 *)v14);
operator delete(v14);
}
}
}
}
}
}