//
// CustomSongWidget::processNextMultiAsset from 0x1000fe438 to 0x1000fe664 (556 bytes)
//
// 4 xrefs:
// > CustomSongWidget::startMultiAssetDownload @ 0x1000fd408
// > CustomSongWidget::downloadAssetFinished @ 0x1000fe2fc
// > CustomSongWidget::downloadAssetFailed @ 0x1000fe404
// > CustomSongWidget::processNextMultiAsset @ 0x1000fe64c
//
// 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 __fastcall CustomSongWidget::processNextMultiAsset(CustomSongWidget *a1)
{
cocos2d::extension::CCHttpClient *Instance; // x0
size_t v3; // x0
std::__vector_base::pointer begin; // x21
std::__vector_base::pointer end; // x8
size_t v6; // x20
float v7; // s0
float v8; // s1
cocos2d::CCLabelBMFont *m_errorLabel; // x0
GJAssetType m_assetType; // w8
int m_id; // w21
MusicDownloadManager *v12; // x0
MusicDownloadManager *v13; // x0
MusicDownloadManager *v14; // x0
cocos2d::extension::CCHttpClient *v15; // x0
size_t v16; // x0
int v17; // [xsp+8h] [xbp-28h] BYREF
__int16 v18; // [xsp+Ch] [xbp-24h] BYREF
char v19; // [xsp+Eh] [xbp-22h]
if ( a1->m_undownloadedAssets.__begin_ == a1->m_undownloadedAssets.__end_ )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_errorLabel->setColor)(
a1->m_errorLabel,
&unk_100636BC9);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_errorLabel->setString)(
a1->m_errorLabel,
"Download complete.");
if ( a1->m_isMusicLibrary )
{
v7 = 140.0;
v8 = 0.35;
}
else
{
v7 = 230.0;
v8 = 0.4;
}
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_errorLabel, v7, v8, 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);
begin = a1->m_undownloadedAssets.__begin_;
end = a1->m_undownloadedAssets.__end_;
if ( begin != end )
{
v6 = v3;
while ( LOBYTE(begin[1].m_id) == 1 )
{
begin = (std::__vector_base::pointer)((char *)begin + 16);
if ( begin == end )
return;
}
if ( begin->m_status < 2 )
{
LOBYTE(begin[1].m_id) = 1;
m_assetType = begin->m_assetType;
if ( m_assetType == User )
{
v13 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadSFX(v13, begin->m_id);
}
else if ( m_assetType == 1 )
{
m_id = begin->m_id;
v17 = m_id;
if ( m_id > 9999999 )
{
v14 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadSong(v14, m_id);
}
else
{
sub_1000B4D20((__int64)&a1->m_nextSongIDs, &v17, &v17);
v12 = MusicDownloadManager::sharedState();
MusicDownloadManager::getSongInfo(v12, v17, 0);
}
}
}
else
{
CustomSongWidget::updateMultiAssetInfo(a1, 1);
m_errorLabel = a1->m_errorLabel;
v19 = 25;
v18 = 13055;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))m_errorLabel->setColor)(m_errorLabel, &v18);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))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);
}
v15 = cocos2d::extension::CCHttpClient::getInstance();
v16 = cocos2d::extension::CCHttpClient::availableThreadCount(v15);
if ( a1->m_undownloadedAssets.__begin_ != a1->m_undownloadedAssets.__end_ && v16 && v16 < v6 )
CustomSongWidget::processNextMultiAsset(a1);
}
}
}