//
// MusicBrowser::trySetupMusicBrowser from 0x140339c40 to 0x140339d71 (305 bytes)
//
// 3 xrefs:
// > MusicBrowser::init @ 0x140339431
// > MusicBrowser::musicActionFinished @ 0x140339deb
// > ??> @ 0x1406d5354
//
// 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=1
void MusicBrowser::trySetupMusicBrowser(MusicBrowser *a1)
{
MusicDownloadManager *v2; // rax
GJSongType m_songType; // esi
cocos2d::CCObject *v4; // rax
MusicSearchResult *v5; // rdi
__int64 v6; // rdx
MusicDownloadManager *v7; // rax
MusicDownloadManager *v8; // rax
MusicDownloadManager *v9; // rax
MusicSearchResult *v10; // [rsp+38h] [rbp+10h]
if ( MusicDownloadManager::sharedState()->m_musicObjects )
{
if ( !MusicDownloadManager::sharedState()->m_customContentURL.m_data.m_size )
{
v2 = MusicDownloadManager::sharedState();
MusicDownloadManager::getCustomContentURL(v2);
}
m_songType = a1->m_songType;
v10 = (MusicSearchResult *)operator new(0x90u);
v4 = MusicSearchResult::MusicSearchResult(v10);
v5 = (MusicSearchResult *)v4;
if ( v4 )
{
v4[2].m_uAutoReleaseCount = m_songType;
cocos2d::CCObject::autorelease(v4);
}
v6 = 0;
if ( a1->m_songType == 1 )
v6 = 6;
v5->updateObjects(v5, (AudioSortType)v6);
MusicBrowser::setupList(a1, v5);
if ( !MusicDownloadManager::sharedState()->m_downloadingMusicLibrary )
{
a1->m_autoUpdating = 1;
if ( !MusicDownloadManager::sharedState()->m_customContentURL.m_data.m_size )
{
a1->m_gettingURL = 1;
LABEL_11:
v7 = MusicDownloadManager::sharedState();
MusicDownloadManager::getCustomContentURL(v7);
return;
}
a1->m_gettingURL = 0;
v8 = MusicDownloadManager::sharedState();
MusicDownloadManager::tryUpdateMusicLibrary(v8);
}
}
else
{
if ( !MusicDownloadManager::sharedState()->m_customContentURL.m_data.m_size )
goto LABEL_11;
v9 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadMusicLibrary(v9);
}
}