//
// CustomSongWidget::processNextMultiAsset from 0x1400cd260 to 0x1400cd493 (563 bytes)
//
// 7 xrefs:
// > CustomSongWidget::startMultiAssetDownload @ 0x1400cd258
// > CustomSongWidget::downloadAssetFinished @ 0x1400cd544
// > CustomSongWidget::downloadAssetFailed @ 0x1400cd629
// > ??> @ 0x14066cef0
// > ??> @ 0x14066cf10
// > ??> @ 0x14066cf20
// > ??> @ 0x1406c83b8
//
// 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; // rax
unsigned __int64 v3; // rax
std::_Vector_val>::pointer Mylast; // rcx
unsigned __int64 v5; // rsi
std::_Vector_val>::pointer Myfirst; // rbx
cocos2d::CCRGBAProtocol *v7; // rcx
GJAssetType m_assetType; // eax
int m_id; // ebx
MusicDownloadManager *v10; // rax
MusicDownloadManager *v11; // rax
MusicDownloadManager *v12; // rax
cocos2d::extension::CCHttpClient *v13; // rax
unsigned __int64 v14; // rax
float v15; // xmm2_4
float v16; // xmm1_4
_BYTE v17[16]; // [rsp+20h] [rbp-38h] BYREF
__int16 v18; // [rsp+60h] [rbp+8h] BYREF
char v19; // [rsp+62h] [rbp+Ah]
int v20; // [rsp+68h] [rbp+10h] BYREF
if ( a1->m_undownloadedAssets._Mypair._Myval2._Myfirst == a1->m_undownloadedAssets._Mypair._Myval2._Mylast )
{
a1->m_errorLabel->setColor(&a1->m_errorLabel->cocos2d::CCRGBAProtocol, &stru_140529A30);
a1->m_errorLabel->setString(&a1->m_errorLabel->cocos2d::CCLabelProtocol, "Download complete.");
if ( a1->m_isMusicLibrary )
{
v15 = 0.34999999;
v16 = 140.0;
}
else
{
v15 = 0.40000001;
v16 = 230.0;
}
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_errorLabel, v16, v15, 0.0);
CustomSongWidget::showError(a1, 1);
a1->m_unkBool2 = 0;
CustomSongWidget::updateMultiAssetInfo(a1, 1);
}
else
{
do
{
Instance = (cocos2d::extension::CCHttpClient *)cocos2d::extension::CCHttpClient::getInstance();
v3 = cocos2d::extension::CCHttpClient::availableThreadCount(Instance);
Mylast = a1->m_undownloadedAssets._Mypair._Myval2._Mylast;
v5 = v3;
Myfirst = a1->m_undownloadedAssets._Mypair._Myval2._Myfirst;
if ( Myfirst == Mylast )
break;
while ( LOBYTE(Myfirst[1].m_id) )
{
Myfirst = (std::_Vector_val>::pointer)((char *)Myfirst + 16);
if ( Myfirst == Mylast )
return;
}
if ( Myfirst->m_status <= 1 )
{
LOBYTE(Myfirst[1].m_id) = 1;
m_assetType = Myfirst->m_assetType;
if ( m_assetType == 1 )
{
m_id = Myfirst->m_id;
v20 = m_id;
if ( m_id >= 10000000 )
{
v11 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadSong(v11, m_id);
}
else
{
sub_1400CDF10(&a1->m_nextSongIDs, v17, &v20);
v10 = MusicDownloadManager::sharedState();
MusicDownloadManager::getSongInfo(v10, v20, 0);
}
}
else if ( m_assetType == User )
{
v12 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadSFX(v12, Myfirst->m_id);
}
}
else
{
CustomSongWidget::updateMultiAssetInfo(a1, 1);
v7 = &a1->m_errorLabel->cocos2d::CCRGBAProtocol;
v18 = 13055;
v19 = 25;
v7->setColor(v7, (const cocos2d::ccColor3B *)&v18);
a1->m_errorLabel->setString(&a1->m_errorLabel->cocos2d::CCLabelProtocol, "Some assets failed to download.");
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_errorLabel, 230.0, 0.40000001, 0.0);
CustomSongWidget::showError(a1, 0);
}
v13 = (cocos2d::extension::CCHttpClient *)cocos2d::extension::CCHttpClient::getInstance();
v14 = cocos2d::extension::CCHttpClient::availableThreadCount(v13);
if ( a1->m_undownloadedAssets._Mypair._Myval2._Myfirst == a1->m_undownloadedAssets._Mypair._Myval2._Mylast )
break;
}
while ( v14 && v14 < v5 );
}
}