//
// MusicDownloadManager::createSongsInfo from 0x1001552c0 to 0x100155518 (600 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetOnlineLevelsCompleted @ 0x10008a75c
// > GameLevelManager::processOnDownloadLevelCompleted @ 0x1000a008c
//
// 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
//
__int64 __fastcall MusicDownloadManager::createSongsInfo(__int64 result, __int64 a2, __int64 a3)
{
char *v3; // x21
_QWORD *v4; // x19
cocos2d::CCDictionary *v5; // x20
cocos2d::CCArray *v6; // x21
unsigned int i; // w22
cocos2d::CCString *v8; // x0
char *CString; // x0
SongInfoObject *v10; // x0
SongInfoObject *v11; // x25
std::__hash_node_base *>::__next_pointer j; // x27
int next; // w28
cocos2d::CCObject *v14; // x26
std::string::size_type size; // x8
const char *p_m_uID; // x8
cocos2d::CCString *v17; // x0
const char *v18; // x0
void *__dst[2]; // [xsp+10h] [xbp-C0h] BYREF
__int64 v20; // [xsp+20h] [xbp-B0h]
std::string __str; // [xsp+30h] [xbp-A0h] BYREF
void *v22[2]; // [xsp+48h] [xbp-88h] BYREF
__int64 v23; // [xsp+58h] [xbp-78h]
void *__p[2]; // [xsp+60h] [xbp-70h] BYREF
__int64 v25; // [xsp+70h] [xbp-60h]
v3 = (char *)a2;
v4 = (_QWORD *)result;
if ( (*(char *)(a2 + 23) & 0x8000000000000000LL) != 0 )
{
if ( !*(_QWORD *)(a2 + 8) )
return result;
}
else if ( !*(_BYTE *)(a2 + 23) )
{
return result;
}
if ( *(char *)(a3 + 23) < 0 )
{
LODWORD(result) = (unsigned int)sub_1000097D0(__p, *(void **)a3, *(_QWORD *)(a3 + 8));
}
else
{
*(_OWORD *)__p = *(_OWORD *)a3;
v25 = *(_QWORD *)(a3 + 16);
}
v5 = (cocos2d::CCDictionary *)sub_100155580(result, (int)__p);
if ( SHIBYTE(v25) < 0 )
operator delete(__p[0]);
if ( v3[23] < 0 )
v3 = *(char **)v3;
sub_100009900(v22, v3);
sub_100009900(&__str, "~:~");
v6 = (cocos2d::CCArray *)MusicDownloadManager::createArtistsInfo(v22, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( SHIBYTE(v23) < 0 )
operator delete(v22[0]);
result = sub_10024A36C(v6);
if ( (_DWORD)result )
{
for ( i = 0; i < (unsigned int)result; ++i )
{
v8 = cocos2d::CCArray::stringAtIndex(v6, i);
CString = (char *)cocos2d::CCString::getCString(v8);
sub_100009900(v22, CString);
if ( SHIBYTE(v23) < 0 )
{
sub_1000097D0(__dst, v22[0], (unsigned __int64)v22[1]);
}
else
{
*(_OWORD *)__dst = *(_OWORD *)v22;
v20 = v23;
}
v10 = MusicDownloadManager::addSongObjectFromString(v4, (__int64)__dst);
v11 = v10;
if ( SHIBYTE(v20) < 0 )
{
operator delete(__dst[0]);
if ( v11 )
{
LABEL_25:
if ( v5 && v11->m_artistIDs.__table_.__p2_.__value_ )
{
memset(&__str, 0, sizeof(__str));
for ( j = v11->m_artistIDs.__table_.__p1_.__value_.__next_; j; j = j->__next_ )
{
next = (int)j[2].__next_;
v14 = cocos2d::CCDictionary::objectForKey(v5, next);
if ( v14 )
{
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __str.__r_.__value_.__l.__size_;
if ( size )
std::string::append(&__str, ",");
p_m_uID = (const char *)&v14[1].m_uID;
if ( SHIBYTE(v14[1].m_eObjType) < 0 )
p_m_uID = *(const char **)p_m_uID;
v17 = (cocos2d::CCString *)sub_100268F4C("%i,%s", next, p_m_uID);
v18 = cocos2d::CCString::getCString(v17);
std::string::append(&__str, v18);
}
}
std::string::operator=((std::string *)&v11->m_extraArtistNames, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}
}
}
else if ( v10 )
{
goto LABEL_25;
}
if ( SHIBYTE(v23) < 0 )
operator delete(v22[0]);
result = sub_10024A36C(v6);
}
}
return result;
}