//
// MusicDownloadManager::dataLoaded from 0x1005906f0 to 0x100590ced (1533 bytes)
//
// 1 xrefs:
// > GameManager::dataLoaded @ 0x100389955
//
// 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 __fastcall MusicDownloadManager::dataLoaded(MusicDownloadManager *a1, DS_Dictionary *a2)
{
double v2; // xmm0_8
MusicDownloadManager *v3; // r15
cocos2d::CCDictionary *m_songObjects; // rbx
cocos2d::CCDictionary *DictForKey; // rax
cocos2d::CCArray *v6; // rbx
unsigned int v7; // r13d
cocos2d::CCString *v8; // rax
char *CString; // rax
__int64 v10; // rbx
size_t v11; // rax
size_t v12; // r14
char *v13; // r12
__int64 v14; // rax
size_t v15; // r15
__int64 v16; // rbx
size_t v17; // rax
size_t v18; // rbx
char *v19; // r14
__int64 v20; // rax
size_t v21; // r15
cocos2d::CCObject *v22; // rbx
size_t v23; // rax
size_t v24; // r12
char *v25; // r14
__int64 v26; // rax
size_t v27; // rbx
cocos2d::CCDictionary *v28; // rdi
cocos2d::CCDictionary *v29; // rbx
cocos2d::CCDictionary *m_MDLM003; // rbx
cocos2d::CCDictionary *v31; // rax
cocos2d::CCArray *v32; // rbx
unsigned int v33; // r13d
cocos2d::CCString *v34; // rax
char *v35; // rax
__int64 v36; // rbx
size_t v37; // rax
size_t v38; // r14
char *v39; // r12
__int64 v40; // rax
size_t v41; // r15
__int64 v42; // rbx
size_t v43; // rax
size_t v44; // rbx
char *v45; // r14
__int64 v46; // rax
size_t v47; // r15
cocos2d::CCObject *v48; // rbx
size_t v49; // rax
size_t v50; // r12
char *v51; // r14
__int64 v52; // rax
size_t v53; // rbx
cocos2d::CCObject *v54; // rdi
cocos2d::CCDictionary *v55; // rbx
int m_songPriority; // ebx
int IntegerForKey; // eax
cocos2d::CCArray *v58; // [rsp+8h] [rbp-88h]
cocos2d::CCArray *v59; // [rsp+8h] [rbp-88h]
__int64 v60; // [rsp+10h] [rbp-80h]
__int64 v61; // [rsp+10h] [rbp-80h]
__int64 v62; // [rsp+18h] [rbp-78h]
__int64 v63; // [rsp+18h] [rbp-78h]
cocos2d::CCObject *v64; // [rsp+20h] [rbp-70h]
cocos2d::CCObject *v65; // [rsp+20h] [rbp-70h]
__int64 v67; // [rsp+30h] [rbp-60h] BYREF
size_t v68; // [rsp+38h] [rbp-58h]
void *v69; // [rsp+40h] [rbp-50h]
void *__src; // [rsp+48h] [rbp-48h]
size_t __dst; // [rsp+50h] [rbp-40h] BYREF
size_t v72; // [rsp+58h] [rbp-38h]
void *__p; // [rsp+60h] [rbp-30h]
v3 = a1;
m_songObjects = a1->m_songObjects;
DictForKey = DS_Dictionary::getDictForKey(a2, "MDLM_001", 0);
if ( m_songObjects )
{
v62 = (__int64)DictForKey;
v6 = cocos2d::CCDictionary::allKeys(DictForKey);
if ( (unsigned int)sub_100720070(v6) )
{
v7 = 0;
v58 = v6;
while ( 1 )
{
v8 = cocos2d::CCArray::stringAtIndex(v6, v7);
CString = (char *)cocos2d::CCString::getCString(v8);
v10 = (__int64)v3->m_songObjects;
__src = CString;
v11 = strlen(CString);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_87:
sub_100006BF0(v2);
v12 = v11;
if ( v11 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v11;
v13 = (char *)&__dst + 1;
if ( v11 )
goto LABEL_13;
LABEL_14:
v13[v12] = 0;
v16 = cocos2d::CCDictionary::objectForKey_1(v10, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v16 )
goto LABEL_5;
v17 = strlen((const char *)__src);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_87;
v18 = v17;
v60 = (__int64)v3->m_songObjects;
if ( v17 >= 0x17 )
{
v20 = v17 | 7;
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = v20 + 1;
v19 = (char *)operator new(v21);
__p = v19;
__dst = v21 + 1;
v72 = v18;
v3 = a1;
LABEL_23:
memmove(v19, __src, v18);
goto LABEL_24;
}
LOBYTE(__dst) = 2 * v17;
v19 = (char *)&__dst + 1;
if ( v17 )
goto LABEL_23;
LABEL_24:
v19[v18] = 0;
v22 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey_1(v62, (char *)&__dst);
v23 = strlen((const char *)__src);
if ( v23 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v24 = v23;
if ( v23 >= 0x17 )
{
v64 = v22;
v26 = v23 | 7;
v27 = 26;
if ( (v24 | 7) != 0x17 )
v27 = v26 + 1;
v25 = (char *)operator new(v27);
v69 = v25;
v67 = v27 | 1;
v68 = v24;
v22 = v64;
}
else
{
LOBYTE(v67) = 2 * v23;
v25 = (char *)&v67 + 1;
if ( !v23 )
goto LABEL_32;
}
memmove(v25, __src, v24);
LABEL_32:
v25[v24] = 0;
cocos2d::CCDictionary::setObject_1(v60, v22, (char *)&v67);
if ( (v67 & 1) != 0 )
operator delete(v69);
if ( (__dst & 1) != 0 )
operator delete(__p);
LABEL_5:
++v7;
v6 = v58;
if ( v7 >= (unsigned int)sub_100720070(v58) )
goto LABEL_42;
}
v14 = v11 | 7;
v15 = 26;
if ( (v12 | 7) != 0x17 )
v15 = v14 + 1;
v13 = (char *)operator new(v15);
__p = v13;
__dst = v15 + 1;
v72 = v12;
v3 = a1;
LABEL_13:
memmove(v13, __src, v12);
goto LABEL_14;
}
}
else
{
v28 = a1->m_songObjects;
if ( v28 != DictForKey )
{
v29 = DictForKey;
if ( DictForKey )
{
cocos2d::CCObject::retain(DictForKey);
v28 = v3->m_songObjects;
}
if ( v28 )
cocos2d::CCObject::release(v28);
v3->m_songObjects = v29;
}
}
LABEL_42:
m_MDLM003 = v3->m_MDLM003;
v31 = DS_Dictionary::getDictForKey(a2, "MDLM_003", 0);
if ( m_MDLM003 )
{
v63 = (__int64)v31;
v32 = cocos2d::CCDictionary::allKeys(v31);
if ( (unsigned int)sub_100720070(v32) )
{
v33 = 0;
v59 = v32;
while ( 1 )
{
v34 = cocos2d::CCArray::stringAtIndex(v32, v33);
v35 = (char *)cocos2d::CCString::getCString(v34);
v36 = (__int64)v3->m_MDLM003;
__src = v35;
v37 = strlen(v35);
if ( v37 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_87;
v38 = v37;
if ( v37 >= 0x17 )
break;
LOBYTE(__dst) = 2 * v37;
v39 = (char *)&__dst + 1;
if ( v37 )
goto LABEL_54;
LABEL_55:
v39[v38] = 0;
v42 = cocos2d::CCDictionary::objectForKey_1(v36, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v42 )
goto LABEL_46;
v43 = strlen((const char *)__src);
if ( v43 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_87;
v44 = v43;
v61 = (__int64)v3->m_MDLM003;
if ( v43 >= 0x17 )
{
v46 = v43 | 7;
v47 = 26;
if ( (v44 | 7) != 0x17 )
v47 = v46 + 1;
v45 = (char *)operator new(v47);
__p = v45;
__dst = v47 + 1;
v72 = v44;
v3 = a1;
LABEL_64:
memmove(v45, __src, v44);
goto LABEL_65;
}
LOBYTE(__dst) = 2 * v43;
v45 = (char *)&__dst + 1;
if ( v43 )
goto LABEL_64;
LABEL_65:
v45[v44] = 0;
v48 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey_1(v63, (char *)&__dst);
v49 = strlen((const char *)__src);
if ( v49 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v50 = v49;
if ( v49 >= 0x17 )
{
v65 = v48;
v52 = v49 | 7;
v53 = 26;
if ( (v50 | 7) != 0x17 )
v53 = v52 + 1;
v51 = (char *)operator new(v53);
v69 = v51;
v67 = v53 | 1;
v68 = v50;
v48 = v65;
}
else
{
LOBYTE(v67) = 2 * v49;
v51 = (char *)&v67 + 1;
if ( !v49 )
goto LABEL_73;
}
memmove(v51, __src, v50);
LABEL_73:
v51[v50] = 0;
cocos2d::CCDictionary::setObject_1(v61, v48, (char *)&v67);
if ( (v67 & 1) != 0 )
operator delete(v69);
if ( (__dst & 1) != 0 )
operator delete(__p);
LABEL_46:
++v33;
v32 = v59;
if ( v33 >= (unsigned int)sub_100720070(v59) )
goto LABEL_83;
}
v40 = v37 | 7;
v41 = 26;
if ( (v38 | 7) != 0x17 )
v41 = v40 + 1;
v39 = (char *)operator new(v41);
__p = v39;
__dst = v41 + 1;
v72 = v38;
v3 = a1;
LABEL_54:
memmove(v39, __src, v38);
goto LABEL_55;
}
}
else
{
v54 = v3->m_MDLM003;
if ( v54 != v31 )
{
v55 = v31;
if ( v31 )
{
cocos2d::CCObject::retain(v31);
v54 = v3->m_MDLM003;
}
if ( v54 )
cocos2d::CCObject::release(v54);
v3->m_MDLM003 = v55;
}
}
LABEL_83:
m_songPriority = v3->m_songPriority;
if ( m_songPriority >= DS_Dictionary::getIntegerForKey(a2, "MDLM_002") )
IntegerForKey = v3->m_songPriority;
else
IntegerForKey = DS_Dictionary::getIntegerForKey(a2, "MDLM_002");
v3->m_songPriority = IntegerForKey;
}