//
// MusicDownloadManager::onGetSongInfoCompleted from 0x10058a990 to 0x10058ac07 (631 bytes)
//
// 1 xrefs:
// > MusicDownloadManager::handleIt @ 0x10058a65a
//
// 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::onGetSongInfoCompleted(
MusicDownloadManager *a1,
unsigned __int8 *a2,
__int64 a3,
double a4)
{
const char *v4; // rdx
unsigned int v5; // r14d
cocos2d::CCString *v6; // rax
const char *CString; // rax
unsigned __int64 v8; // r15
const void *v9; // r12
unsigned __int64 v10; // rax
const void *v11; // rax
size_t v12; // r13
int v13; // eax
__int64 result; // rax
unsigned int v15; // r15d
__int64 v16; // rax
unsigned int v17; // r15d
__int64 v18; // rax
__int64 v19; // r15
unsigned int v20; // r14d
__int64 v21; // rax
unsigned int v22; // r15d
__int64 v23; // rax
char v24; // [rsp+0h] [rbp-80h]
_WORD __s2[11]; // [rsp+1h] [rbp-7Fh] BYREF
unsigned __int8 *v26; // [rsp+18h] [rbp-68h]
unsigned __int64 v27; // [rsp+20h] [rbp-60h]
const void *v28; // [rsp+28h] [rbp-58h]
__int128 v29; // [rsp+30h] [rbp-50h] BYREF
void *__p; // [rsp+40h] [rbp-40h]
int v31; // [rsp+50h] [rbp-30h]
bool v32; // [rsp+57h] [rbp-29h]
if ( (*(_BYTE *)a3 & 1) != 0 )
v4 = *(const char **)(a3 + 16);
else
v4 = (const char *)(a3 + 1);
v5 = atoi(v4);
v6 = (cocos2d::CCString *)sub_1007AB580("i_%i", v24);
CString = cocos2d::CCString::getCString(v6);
MusicDownloadManager::removeDLFromActive(a1, CString);
strcpy((char *)__s2, "-1");
v8 = *a2 >> 1;
v9 = a2 + 1;
v31 = *a2;
v10 = *((_QWORD *)a2 + 1);
v27 = v10;
if ( (v31 & 1) != 0 )
v8 = v10;
v26 = a2;
v11 = *((const void **)a2 + 2);
v28 = v11;
if ( (v31 & 1) != 0 )
v9 = v11;
v12 = 2;
if ( v8 < 2 )
v12 = v8;
v32 = v8 != 2;
v13 = memcmp(v9, __s2, v12);
if ( v32 || v13 != 0 )
{
strcpy((char *)__s2, "-2");
if ( (v8 != 2) | (memcmp(v9, __s2, v12) != 0) )
{
if ( (v31 & 1) != 0 )
{
sub_100006B70(&v29, v28, v27, a4);
}
else
{
__p = *((void **)v26 + 2);
v29 = *(_OWORD *)v26;
}
v19 = MusicDownloadManager::addSongObjectFromString(a1, &v29);
if ( (v29 & 1) != 0 )
operator delete(__p);
result = sub_100720070(a1->m_musicDownloadDelegates);
if ( v19 )
{
if ( (_DWORD)result )
{
v20 = 0;
do
{
v21 = sub_1007200C0(a1->m_musicDownloadDelegates, v20);
(***(void (__fastcall ****)(_QWORD, __int64))(v21 + 320))(*(_QWORD *)(v21 + 320), v19);
++v20;
result = sub_100720070(a1->m_musicDownloadDelegates);
}
while ( v20 < (unsigned int)result );
}
}
else if ( (_DWORD)result )
{
v22 = 0;
do
{
v23 = sub_1007200C0(a1->m_musicDownloadDelegates, v22);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(v23 + 320) + 8LL))(
*(_QWORD *)(v23 + 320),
v5,
1);
++v22;
result = sub_100720070(a1->m_musicDownloadDelegates);
}
while ( v22 < (unsigned int)result );
}
}
else
{
result = sub_100720070(a1->m_musicDownloadDelegates);
if ( (_DWORD)result )
{
v17 = 0;
do
{
v18 = sub_1007200C0(a1->m_musicDownloadDelegates, v17);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(v18 + 320) + 8LL))(
*(_QWORD *)(v18 + 320),
v5,
2);
++v17;
result = sub_100720070(a1->m_musicDownloadDelegates);
}
while ( v17 < (unsigned int)result );
}
}
}
else
{
result = sub_100720070(a1->m_musicDownloadDelegates);
if ( (_DWORD)result )
{
v15 = 0;
do
{
v16 = sub_1007200C0(a1->m_musicDownloadDelegates, v15);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(v16 + 320) + 8LL))(
*(_QWORD *)(v16 + 320),
v5,
1);
++v15;
result = sub_100720070(a1->m_musicDownloadDelegates);
}
while ( v15 < (unsigned int)result );
}
}
return result;
}