//
// CustomSongWidget::processNextMultiAsset from 0x747cb0 to 0x747ef4 (580 bytes)
//
// 5 xrefs:
// > CustomSongWidget::processNextMultiAsset @ 0x747dc4
// > CustomSongWidget::startMultiAssetDownload @ 0x748054
// > CustomSongWidget::downloadAssetFailed @ 0x748538
// > CustomSongWidget::downloadAssetFinished @ 0x748f1c
// > ??> @ 0xb3cd0
//
// 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
//
void CustomSongWidget::processNextMultiAsset(CustomSongWidget *a1)
{
cocos2d::extension::CCHttpClient *Instance; // x0
size_t v3; // x0
GJAssetDownloadAction *m_start; // x19
GJAssetDownloadAction *m_finish; // x1
size_t v6; // x22
cocos2d::CCLabelBMFont *m_errorLabel; // x0
void (__fastcall *setColor)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::extension::CCHttpClient *v9; // x0
size_t v10; // x0
GJAssetType m_assetType; // w0
MusicDownloadManager *v12; // x0
MusicDownloadManager *v13; // x0
MusicDownloadManager *v14; // x0
int m_id; // [xsp+30h] [xbp+30h] BYREF
if ( a1->m_undownloadedAssets.m_start == a1->m_undownloadedAssets.m_finish )
{
a1->m_errorLabel->setColor(a1->m_errorLabel, (const cocos2d::ccColor3B *)&unk_ECD700);
a1->m_errorLabel->setString(a1->m_errorLabel, "Download complete.");
if ( a1->m_isMusicLibrary )
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_errorLabel, 140.0, 0.35, 0.0);
else
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_errorLabel, 230.0, 0.4, 0.0);
CustomSongWidget::showError(a1, 1);
a1->m_unkBool2 = 0;
CustomSongWidget::updateMultiAssetInfo(a1, 1);
}
else
{
Instance = cocos2d::extension::CCHttpClient::getInstance();
v3 = cocos2d::extension::CCHttpClient::availableThreadCount(Instance);
m_start = a1->m_undownloadedAssets.m_start;
m_finish = a1->m_undownloadedAssets.m_finish;
v6 = v3;
if ( m_finish != m_start )
{
while ( LOBYTE(m_start[1].m_id) )
{
m_start = (GJAssetDownloadAction *)((char *)m_start + 16);
if ( m_finish == m_start )
return;
}
if ( m_start->m_status <= 1 )
{
m_assetType = m_start->m_assetType;
LOBYTE(m_start[1].m_id) = 1;
if ( m_assetType == 1 )
{
m_id = m_start->m_id;
if ( m_id > (int)&loc_98967C + 3 )
{
v14 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadSong(v14, m_id);
}
else
{
std::_Rb_tree,std::less,std::allocator>::_M_insert_unique(
&a1->m_nextSongIDs._M_t._M_impl._M_key_compare.pad,
&m_id);
v13 = MusicDownloadManager::sharedState();
MusicDownloadManager::getSongInfo(v13, m_id, 0);
}
}
else if ( m_assetType == User )
{
v12 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadSFX(v12, m_start->m_id);
}
}
else
{
CustomSongWidget::updateMultiAssetInfo(a1, 1);
m_errorLabel = a1->m_errorLabel;
setColor = m_errorLabel->setColor;
LOWORD(m_id) = 13055;
BYTE2(m_id) = 25;
setColor(m_errorLabel, (const cocos2d::ccColor3B *)&m_id);
a1->m_errorLabel->setString(a1->m_errorLabel, "Some assets failed to download.");
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_errorLabel, 230.0, 0.4, 0.0);
CustomSongWidget::showError(a1, 0);
}
v9 = cocos2d::extension::CCHttpClient::getInstance();
v10 = cocos2d::extension::CCHttpClient::availableThreadCount(v9);
if ( a1->m_undownloadedAssets.m_start != a1->m_undownloadedAssets.m_finish && v10 && v6 > v10 )
CustomSongWidget::processNextMultiAsset(a1);
}
}
}