//
// CustomSongWidget::startMultiAssetDownload from 0x747f04 to 0x7480b0 (428 bytes)
//
// 2 xrefs:
// > CustomSongWidget::onDownload @ 0x748240
// > ??> @ 0x72648
//
// 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::startMultiAssetDownload(CustomSongWidget *a1)
{
std::_rb_tree_base *m_left; // x19
std::_rb_tree_base *p_m_header; // x20
int v4; // w1
int v5; // w0
GJAssetDownloadAction *m_finish; // x0
GJAssetDownloadAction *m_reserveEnd; // x2
std::_rb_tree_base *v8; // x19
std::_rb_tree_base *i; // x20
int v10; // w1
int v11; // w0
GJAssetDownloadAction *v12; // x0
GJAssetDownloadAction *v13; // x2
int v14; // [xsp+50h] [xbp+50h] BYREF
int v15; // [xsp+54h] [xbp+54h] BYREF
m_left = a1->m_songs.m_header.m_left;
p_m_header = &a1->m_songs.m_header;
for ( a1->m_undownloadedAssets.m_finish = a1->m_undownloadedAssets.m_start;
p_m_header != m_left;
m_left = (std::_rb_tree_base *)sub_CFAB14(m_left) )
{
while ( 1 )
{
v4 = *(_DWORD *)&m_left[1].m_isblack;
v5 = *((unsigned __int8 *)&m_left[1].m_isblack + 4);
v14 = v4;
if ( !v5 )
break;
LABEL_3:
m_left = (std::_rb_tree_base *)sub_CFAB14(m_left);
if ( p_m_header == m_left )
goto LABEL_9;
}
m_finish = a1->m_undownloadedAssets.m_finish;
m_reserveEnd = a1->m_undownloadedAssets.m_reserveEnd;
v15 = 1;
if ( m_finish == m_reserveEnd )
{
std::vector::_M_emplace_back_aux(
(__int64)&a1->m_undownloadedAssets,
&v14,
&v15);
goto LABEL_3;
}
if ( m_finish )
{
m_finish->m_id = v4;
*(_QWORD *)&m_finish->m_assetType = 1;
LOBYTE(m_finish[1].m_id) = 0;
}
a1->m_undownloadedAssets.m_finish = (GJAssetDownloadAction *)((char *)m_finish + 16);
}
LABEL_9:
v8 = a1->m_sfx.m_header.m_left;
for ( i = &a1->m_sfx.m_header; i != v8; v8 = (std::_rb_tree_base *)sub_CFAB14(v8) )
{
while ( 1 )
{
v10 = *(_DWORD *)&v8[1].m_isblack;
v11 = *((unsigned __int8 *)&v8[1].m_isblack + 4);
v14 = v10;
if ( !v11 )
break;
LABEL_11:
v8 = (std::_rb_tree_base *)sub_CFAB14(v8);
if ( i == v8 )
goto LABEL_17;
}
v12 = a1->m_undownloadedAssets.m_finish;
v13 = a1->m_undownloadedAssets.m_reserveEnd;
v15 = 2;
if ( v12 == v13 )
{
std::vector::_M_emplace_back_aux(
(__int64)&a1->m_undownloadedAssets,
&v14,
&v15);
goto LABEL_11;
}
if ( v12 )
{
v12->m_id = v10;
*(_QWORD *)&v12->m_assetType = 2;
LOBYTE(v12[1].m_id) = 0;
}
a1->m_undownloadedAssets.m_finish = (GJAssetDownloadAction *)((char *)v12 + 16);
}
LABEL_17:
CustomSongWidget::processNextMultiAsset(a1);
}