//
// MusicDownloadManager::createSongsInfo from 0x975e30 to 0x9761cc (924 bytes)
//
// 3 xrefs:
// > GameLevelManager::onGetOnlineLevelsCompleted @ 0x848764
// > GameLevelManager::processOnDownloadLevelCompleted @ 0x8595c4
// > ??> @ 0xe7ec8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:57:43 +0000
//
__int64 __fastcall MusicDownloadManager::createSongsInfo(__int64 a1, char *a2, char *a3)
{
unsigned __int8 v4; // w1
__int64 v5; // x0
char v6; // w0
__int64 v7; // x0
size_t v8; // x1
cocos2d::CCDictionary *ArtistsInfo; // x23
const char *v10; // x1
size_t v11; // x0
unsigned int i; // w28
cocos2d::CCString *v13; // x0
const char *CString; // x0
size_t v15; // x0
__int64 *v16; // x27
__int64 j; // x20
unsigned int v18; // w21
__int64 v19; // x19
size_t v20; // x1
__int64 v21; // x2
cocos2d::CCString *v22; // x0
size_t v23; // x0
char *v24; // x1
size_t v25; // x2
cocos2d::CCArray *v28; // [xsp+70h] [xbp+70h]
char *v29; // [xsp+78h] [xbp+78h]
char *v30; // [xsp+78h] [xbp+78h]
char *v31; // [xsp+78h] [xbp+78h]
__int64 v32; // [xsp+88h] [xbp+88h] BYREF
size_t v33; // [xsp+90h] [xbp+90h]
void *v34; // [xsp+98h] [xbp+98h]
__int64 v35; // [xsp+A0h] [xbp+A0h] BYREF
size_t v36; // [xsp+A8h] [xbp+A8h]
void *v37; // [xsp+B0h] [xbp+B0h]
v4 = *a2;
v5 = v4 >> 1;
if ( (v4 & 1) != 0 )
v5 = *((_QWORD *)a2 + 1);
if ( v5 )
{
v6 = *a3;
v35 = 0;
v36 = 0;
v37 = nullptr;
if ( (v6 & 1) != 0 )
{
std::string::__init(&v35, *((void **)a3 + 2), *((_QWORD *)a3 + 1));
}
else
{
v7 = *(_QWORD *)a3;
v8 = *((_QWORD *)a3 + 1);
v37 = *((void **)a3 + 2);
v35 = v7;
v36 = v8;
}
ArtistsInfo = MusicDownloadManager::createArtistsInfo(a1, (__int64)&v35);
if ( (v35 & 1) != 0 )
operator delete(v37);
v10 = a2 + 1;
if ( (*a2 & 1) != 0 )
v10 = *((const char **)a2 + 2);
v29 = (char *)v10;
v32 = 0;
v33 = 0;
v34 = nullptr;
v11 = strlen(v10);
std::string::__init(&v32, v29, v11);
v35 = 0;
v36 = 0;
v37 = nullptr;
std::string::__init(&v35, "~:~", 3u);
v28 = sub_966E30((__int64)&v32, (char *)&v35);
if ( (v35 & 1) != 0 )
operator delete(v37);
if ( (v32 & 1) != 0 )
operator delete(v34);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v28); ++i )
{
v13 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v28, i);
CString = (const char *)cocos2d::CCString::getCString(v13);
v32 = 0;
v30 = (char *)CString;
v33 = 0;
v34 = nullptr;
v15 = strlen(CString);
std::string::__init(&v32, v30, v15);
v35 = 0;
v36 = 0;
v37 = nullptr;
if ( (v32 & 1) != 0 )
{
std::string::__init(&v35, v34, v33);
}
else
{
v37 = v34;
v35 = v32;
v36 = v33;
}
v16 = MusicDownloadManager::addSongObjectFromString(a1, (char *)&v35);
if ( (v35 & 1) != 0 )
operator delete(v37);
if ( v16 && ArtistsInfo && v16[64] )
{
v35 = 0;
v36 = 0;
v37 = nullptr;
for ( j = v16[63]; j; j = *(_QWORD *)j )
{
v18 = *(_DWORD *)(j + 16);
v19 = cocos2d::CCDictionary::objectForKey(ArtistsInfo, (int)v18);
if ( v19 )
{
v20 = (unsigned __int8)v35 >> 1;
if ( (v35 & 1) != 0 )
v20 = v36;
if ( v20 )
std::string::append((__int64)&v35, &byte_1169BE0, 1u);
if ( (*(_BYTE *)(v19 + 64) & 1) != 0 )
v21 = *(_QWORD *)(v19 + 80);
else
v21 = v19 + 65;
v22 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i,%s",
(const char *)v18,
v21);
v31 = (char *)cocos2d::CCString::getCString(v22);
v23 = strlen(v31);
std::string::append((__int64)&v35, v31, v23);
}
}
if ( v16 + 58 != &v35 )
{
if ( (v35 & 1) != 0 )
{
v24 = (char *)v37;
v25 = v36;
}
else
{
v25 = (unsigned __int8)v35 >> 1;
v24 = (char *)&v35 + 1;
}
std::string::assign(v16 + 58, v24, v25);
}
if ( (v35 & 1) != 0 )
operator delete(v37);
}
if ( (v32 & 1) != 0 )
operator delete(v34);
}
}
return _stack_chk_guard;
}