//
// CustomSongWidget::updateMultiAssetInfo from 0x746c74 to 0x7474c0 (2124 bytes)
//
// 5 xrefs:
// > CustomSongWidget::processNextMultiAsset @ 0x747d2c
// > CustomSongWidget::processNextMultiAsset @ 0x747e88
// > CustomSongWidget::updateWithMultiAssets @ 0x748a18
// > CustomSongWidget::downloadAssetFinished @ 0x748efc
// > ??> @ 0xc8580
//
// 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)
{
std::_rb_tree_base *m_left; // x19
int v4; // w21
void *v5; // x0
std::_rb_tree_base *j; // x19
void *v7; // x0
bool v8; // w2
__int64 v9; // x1
CCMenuItemSpriteExtra *m_infoBtn; // x0
__int64 v11; // x1
void *v12; // x0
void *v13; // x0
void *v14; // x0
void *v15; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
char *v20; // x0
unsigned int *v21; // x1
int v22; // w2
void *v23; // x0
unsigned int *v24; // x1
int v25; // w2
const char *m_nodecount; // x22
std::size_t v27; // x19
cocos2d::CCString *v28; // x0
char *CString; // x0
void *v30; // x0
cocos2d::CCString *v31; // x0
size_t v32; // x0
char *v33; // x0
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x1
int v37; // w2
unsigned int *v38; // x19
int v39; // w1
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
_BOOL4 v46; // [xsp+60h] [xbp+60h]
int i; // [xsp+64h] [xbp+64h]
const char *v49; // [xsp+78h] [xbp+78h]
__int64 v50; // [xsp+90h] [xbp+90h] BYREF
__int64 v51; // [xsp+98h] [xbp+98h] BYREF
__int64 v52; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v53; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v54; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v55; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v56; // [xsp+C0h] [xbp+C0h] BYREF
char *v57; // [xsp+C8h] [xbp+C8h] BYREF
__int64 v58; // [xsp+D0h] [xbp+D0h]
v46 = a2;
sub_D153B8((int)&v50, &byte_F288A0);
sub_D153B8((int)&v51, &byte_F288A0);
sub_D153B8((int)&v52, &byte_F288A0);
sub_D153B8((int)&v53, &byte_F288A0);
m_left = a1->m_songs.m_header.m_left;
v4 = 0;
for ( i = a1->m_sfx.m_nodecount + a1->m_songs.m_nodecount;
&a1->m_songs.m_header != m_left;
m_left = (std::_rb_tree_base *)sub_CFAB14(m_left) )
{
if ( *(&m_left[1].m_isblack + 4) )
{
if ( *(_QWORD *)(v50 - 24) )
sub_D15FD4(&v50, ", ", 2);
GameToolbox::intToString(&v54, (GameToolbox *)*(unsigned int *)&m_left[1].m_isblack);
sub_D15E14(&v50, &v54);
v5 = (void *)(v54 - 24);
if ( (__int64 *)(v54 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v54 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v54 - 8);
*(_DWORD *)(v54 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v5);
}
++v4;
}
else
{
if ( *(_QWORD *)(v51 - 24) )
sub_D15FD4(&v51, ", ", 2);
GameToolbox::intToString(&v55, (GameToolbox *)*(unsigned int *)&m_left[1].m_isblack);
sub_D15E14(&v51, &v55);
v23 = (void *)(v55 - 24);
if ( (__int64 *)(v55 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v55 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v55 - 8);
*(_DWORD *)(v55 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v23);
}
}
}
for ( j = a1->m_sfx.m_header.m_left; &a1->m_sfx.m_header != j; j = (std::_rb_tree_base *)sub_CFAB14(j) )
{
if ( *(&j[1].m_isblack + 4) )
{
if ( *(_QWORD *)(v52 - 24) )
sub_D15FD4(&v52, ", ", 2);
GameToolbox::intToString(&v56, (GameToolbox *)*(unsigned int *)&j[1].m_isblack);
sub_D15E14(&v52, &v56);
v7 = (void *)(v56 - 24);
if ( (__int64 *)(v56 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v56 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v56 - 8);
*(_DWORD *)(v56 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v7);
}
++v4;
}
else
{
if ( *(_QWORD *)(v53 - 24) )
sub_D15FD4(&v53, ", ", 2);
GameToolbox::intToString((__int64 *)&v57, (GameToolbox *)*(unsigned int *)&j[1].m_isblack);
sub_D15E14(&v53, &v57);
v20 = v57 - 24;
if ( v57 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v57 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *((_DWORD *)v57 - 2);
*((_DWORD *)v57 - 2) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v20);
}
}
}
if ( a1->m_songs.m_nodecount || a1->m_sfx.m_nodecount )
{
v8 = i > v4;
a1->m_hasSFX = 1;
v9 = 1;
}
else
{
v9 = 0;
v8 = 0;
a1->m_hasSFX = 0;
}
m_infoBtn = a1->m_infoBtn;
a1->m_unkBool2 = v8;
if ( m_infoBtn )
m_infoBtn->setVisible(m_infoBtn, v9);
if ( a1->m_hasSFX )
{
m_nodecount = (const char *)a1->m_songs.m_nodecount;
v27 = a1->m_sfx.m_nodecount;
formatBytes(a1->m_totalBytes);
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Songs: %i SFX: %i Size: %s",
m_nodecount,
v27,
v58);
CString = (char *)cocos2d::CCString::getCString(v28);
sub_D153B8((int)&v57, CString);
v30 = (void *)(v58 - 24);
if ( (__int64 *)(v58 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v58 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(v58 - 8);
*(_DWORD *)(v58 - 8) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v30);
}
if ( i > v4 && v4 > 0 )
{
v31 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s (%i/%i)",
v57,
(unsigned int)v4,
(unsigned int)i);
v49 = cocos2d::CCString::getCString(v31);
v32 = strlen(v49);
sub_D1798C(&v57, v49, v32);
}
a1->m_songIDLabel->setString(a1->m_songIDLabel, (const unsigned __int8 *)v57);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_songIDLabel, 230.0, 0.4, 0.0);
v33 = v57 - 24;
if ( v57 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)(v57 - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *((_DWORD *)v57 - 2);
*((_DWORD *)v57 - 2) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v33);
}
}
if ( v46 )
{
CustomSongWidget::updateSongInfo(a1);
v11 = v53;
v12 = (void *)(v53 - 24);
if ( (__int64 *)(v53 - 24) == &qword_124B6B0 )
goto LABEL_23;
}
else
{
v11 = v53;
v12 = (void *)(v53 - 24);
if ( (__int64 *)(v53 - 24) == &qword_124B6B0 )
goto LABEL_23;
}
if ( &pthread_create )
{
v36 = (unsigned int *)(v11 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(_DWORD *)(v11 - 8);
*(_DWORD *)(v11 - 8) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v12);
LABEL_23:
v13 = (void *)(v52 - 24);
if ( (__int64 *)(v52 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v52 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *(_DWORD *)(v52 - 8);
*(_DWORD *)(v52 - 8) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v13);
}
v14 = (void *)(v51 - 24);
if ( (__int64 *)(v51 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v51 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(_DWORD *)(v51 - 8);
*(_DWORD *)(v51 - 8) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v14);
}
v15 = (void *)(v50 - 24);
if ( (__int64 *)(v50 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)(v50 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *(_DWORD *)(v50 - 8);
*(_DWORD *)(v50 - 8) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v15);
}
}