//
// CustomSongWidget::updateMultiAssetInfo from 0x3dfb60 to 0x3dfe26 (710 bytes)
//
// 4 xrefs:
// > CustomSongWidget::processNextMultiAsset @ 0x3dfec2
// > CustomSongWidget::processNextMultiAsset @ 0x3dfef4
// > CustomSongWidget::downloadAssetFinished @ 0x3e081e
// > CustomSongWidget::updateWithMultiAssets @ 0x3e0a24
//
// 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::updateMultiAssetInfo(CustomSongWidget *a1, bool a2)
{
signed int v3; // r6
std::_rb_tree_base *v4; // r11
std::_rb_tree_base *v5; // r10
int v6; // r1
bool v7; // r3
CCMenuItemSpriteExtra *m_infoBtn; // r0
const char *m_nodecount; // r10
std::size_t v10; // r9
cocos2d::CCString *v11; // r0
char *CString; // r0
cocos2d::CCString *v13; // r0
char *v14; // r0
signed int v15; // [sp+4h] [bp-20h]
_BOOL4 v16; // [sp+10h] [bp-14h]
int v17; // [sp+20h] [bp-4h] BYREF
int v18; // [sp+24h] [bp+0h] BYREF
int v19; // [sp+28h] [bp+4h] BYREF
int v20; // [sp+2Ch] [bp+8h] BYREF
GameToolbox v21; // [sp+30h] [bp+Ch] BYREF
GameToolbox v22; // [sp+34h] [bp+10h] BYREF
GameToolbox v23; // [sp+38h] [bp+14h] BYREF
char *v24; // [sp+3Ch] [bp+18h] BYREF
std::_rb_tree_base *i; // [sp+40h] [bp+1Ch] BYREF
v16 = a2;
sub_776584((int)&v17, (char *)&unk_939830);
sub_776584((int)&v18, (char *)&unk_939830);
sub_776584((int)&v19, (char *)&unk_939830);
sub_776584((int)&v20, (char *)&unk_939830);
v3 = 0;
v15 = a1->m_sfx.m_nodecount + a1->m_songs.m_nodecount;
for ( i = a1->m_songs.m_header.m_left; ; std::_Rb_tree_iterator>::operator++(&i) )
{
v4 = i;
if ( i == &a1->m_songs.m_header )
break;
if ( LOBYTE(i[1].m_parent) )
{
if ( *(_DWORD *)(v17 - 12) )
sub_774544((int)&v17, ", ");
GameToolbox::intToString(&v21, *(_DWORD *)&v4[1].m_isblack);
sub_77441C(&v17, &v21);
++v3;
sub_774008(&v21);
}
else
{
if ( *(_DWORD *)(v18 - 12) )
sub_774544((int)&v18, ", ");
GameToolbox::intToString(&v22, *(_DWORD *)&v4[1].m_isblack);
sub_77441C(&v18, &v22);
sub_774008(&v22);
}
}
for ( i = a1->m_sfx.m_header.m_left; ; std::_Rb_tree_iterator>::operator++(&i) )
{
v5 = i;
if ( i == &a1->m_sfx.m_header )
break;
if ( LOBYTE(i[1].m_parent) )
{
if ( *(_DWORD *)(v19 - 12) )
sub_774544((int)&v19, ", ");
GameToolbox::intToString(&v23, *(_DWORD *)&v5[1].m_isblack);
sub_77441C(&v19, &v23);
++v3;
sub_774008(&v23);
}
else
{
if ( *(_DWORD *)(v20 - 12) )
sub_774544((int)&v20, ", ");
GameToolbox::intToString((GameToolbox *)&v24, *(_DWORD *)&v5[1].m_isblack);
sub_77441C(&v20, &v24);
sub_774008(&v24);
}
}
if ( a1->m_songs.m_nodecount )
v6 = 1;
else
v6 = a1->m_sfx.m_nodecount != 0;
a1->m_hasSFX = v6;
if ( v6 )
v7 = v3 < v15;
else
v7 = 0;
m_infoBtn = a1->m_infoBtn;
a1->m_unkBool2 = v7;
if ( m_infoBtn )
((void (__fastcall *)(CCMenuItemSpriteExtra *))m_infoBtn->setVisible)(m_infoBtn);
if ( a1->m_hasSFX )
{
m_nodecount = (const char *)a1->m_songs.m_nodecount;
v10 = a1->m_sfx.m_nodecount;
formatBytes((int)&i);
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Songs: %i SFX: %i Size: %s",
m_nodecount,
v10,
i);
CString = (char *)cocos2d::CCString::getCString(v11);
sub_776584((int)&v24, CString);
sub_774008(&i);
if ( v3 && v15 > v3 )
{
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s (%i/%i)", v24, v3);
v14 = (char *)cocos2d::CCString::getCString(v13);
sub_7753D4((int)&v24, v14);
}
a1->m_songIDLabel->setString(a1->m_songIDLabel, (const unsigned __int8 *)v24);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_songIDLabel, 230.0, 0.4, 0.0);
sub_774008(&v24);
}
if ( v16 )
CustomSongWidget::updateSongInfo(a1);
sub_774008(&v20);
sub_774008(&v19);
sub_774008(&v18);
sub_774008(&v17);
}