//
// CustomSongWidget::downloadAssetFinished from 0x3e07c0 to 0x3e085e (158 bytes)
//
// 2 xrefs:
// > CustomSongWidget::downloadSongFinished @ 0x3e0870
// > CustomSongWidget::downloadSFXFinished @ 0x3e08e6
//
// 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::downloadAssetFinished(CustomSongWidget *a1, int a2, GJAssetType a3)
{
GJAssetDownloadAction *m_finish; // r3
GJAssetDownloadAction *i; // r1
GJAssetDownloadAction *v8; // r4
int m_assetType; // r2
GJAssetDownloadAction *v10; // r3
GJAssetDownloadAction *m_start; // r2
GJAssetDownloadAction *v12; // r3
int j; // r2
int *p_m_status; // r1
GJAssetType *p_m_assetType; // r0
GJAssetType v16; // t1
m_finish = a1->m_undownloadedAssets.m_finish;
for ( i = a1->m_undownloadedAssets.m_start; i != m_finish; i = (GJAssetDownloadAction *)((char *)i + 16) )
{
v8 = (GJAssetDownloadAction *)((char *)i + 16);
if ( i->m_id == a2 )
{
m_assetType = i->m_assetType;
if ( m_assetType == a3 )
{
if ( a3 == 1 )
{
*(_BYTE *)std::map::operator[](&a1->m_songs.compare.pad, i, m_assetType) = 1;
}
else if ( a3 == User )
{
*(_BYTE *)std::map::operator[](&a1->m_sfx.compare.pad, i, m_assetType) = 1;
}
v10 = a1->m_undownloadedAssets.m_finish;
if ( v8 != v10 )
{
for ( j = ((char *)v10 - (char *)v8) >> 4; ; --j )
{
v8 = (GJAssetDownloadAction *)((char *)v8 + 16);
if ( j <= 0 )
break;
p_m_status = &v8[-2].m_status;
p_m_assetType = &v8[-3].m_assetType;
do
{
v16 = *p_m_status++;
*p_m_assetType++ = v16;
}
while ( p_m_status != &v8[-1].m_status );
*(_BYTE *)p_m_assetType = *(_BYTE *)p_m_status;
}
}
m_start = a1->m_undownloadedAssets.m_start;
v12 = (GJAssetDownloadAction *)((char *)v10 - 16);
a1->m_undownloadedAssets.m_finish = v12;
if ( m_start != v12 )
CustomSongWidget::updateMultiAssetInfo(a1, 0);
CustomSongWidget::processNextMultiAsset(a1);
return;
}
}
}
}