//
// CustomSongWidget::downloadAssetFinished from 0x1000fe204 to 0x1000fe314 (272 bytes)
//
// 3 xrefs:
// > CustomSongWidget::downloadSongFinished @ 0x1000fe164
// > CustomSongWidget::downloadSFXFinished @ 0x1000fe414
// > sub_1000FE418 @ 0x1000fe420
//
// 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::downloadAssetFinished(CustomSongWidget *a1, int a2, GJAssetType a3)
{
std::__vector_base::pointer begin; // x21
std::__vector_base::pointer end; // x9
__int64 v6; // x22
std::map *p_m_sfx; // x0
char *v8; // x20
std::__vector_base::pointer v9; // x1
std::__vector_base::pointer v10; // x9
__int64 v11; // x8
__int64 v12; // x21
std::__vector_base::pointer v13; // x8
char v14; // [xsp+7h] [xbp-29h] BYREF
char *v15; // [xsp+8h] [xbp-28h] BYREF
begin = a1->m_undownloadedAssets.__begin_;
end = a1->m_undownloadedAssets.__end_;
if ( begin == end )
return;
v6 = 0;
while ( *(int *)((char *)&begin->m_id + v6) != a2 || *(GJAssetType *)((char *)&begin->m_assetType + v6) != a3 )
{
v6 += 16;
if ( (std::__vector_base::pointer)((char *)begin + v6) == end )
return;
}
if ( a3 == User )
{
v15 = (char *)begin + v6;
p_m_sfx = &a1->m_sfx;
goto LABEL_11;
}
if ( a3 == 1 )
{
v15 = (char *)begin + v6;
p_m_sfx = &a1->m_songs;
LABEL_11:
*(_BYTE *)(sub_1000FE7D8(p_m_sfx, (char *)begin + v6, &unk_100636BF7, &v15, &v14) + 32) = 1;
}
v8 = (char *)begin + v6;
v9 = (std::__vector_base::pointer)((char *)begin + v6 + 16);
v10 = a1->m_undownloadedAssets.__end_;
v11 = (char *)v10 - (char *)begin - v6;
v12 = v11 - 16;
if ( v9 != v10 )
memmove(v8, v9, v11 - 19);
v13 = a1->m_undownloadedAssets.__begin_;
a1->m_undownloadedAssets.__end_ = (std::__vector_base::pointer)&v8[v12];
if ( v13 != (std::__vector_base::pointer)&v8[v12] )
CustomSongWidget::updateMultiAssetInfo(a1, 0);
CustomSongWidget::processNextMultiAsset(a1);
}