//
// MusicDownloadManager::dataLoaded from 0x4582a4 to 0x4584a4 (512 bytes)
//
// 1 xrefs:
// > GameManager::dataLoaded @ 0x32898c
//
// 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 MusicDownloadManager::dataLoaded(MusicDownloadManager *a1, DS_Dictionary *a2)
{
cocos2d::CCDictionary *v4; // r0
cocos2d::CCDictionary *v5; // r5
cocos2d::CCDictionary *v6; // r0
unsigned int v7; // r8
cocos2d::CCArray *v8; // r10
cocos2d::CCString *v9; // r0
char *CString; // r0
cocos2d::CCDictionary *m_songObjects; // r11
char *v12; // r9
int v13; // r11
cocos2d::CCObject *v14; // r11
cocos2d::CCDictionary *v15; // r0
cocos2d::CCDictionary *v16; // r5
cocos2d::CCDictionary *v17; // r0
unsigned int v18; // r8
cocos2d::CCArray *v19; // r10
cocos2d::CCString *v20; // r0
char *v21; // r0
cocos2d::CCDictionary *m_MDLM003; // r11
char *v23; // r9
int v24; // r11
cocos2d::CCObject *v25; // r11
int m_songPriority; // r7
int IntegerForKey; // r0
cocos2d::CCDictionary *DictForKey; // [sp+0h] [bp-2Ch]
cocos2d::CCDictionary *v29; // [sp+0h] [bp-2Ch]
cocos2d::CCDictionary *v30; // [sp+4h] [bp-28h]
cocos2d::CCDictionary *v31; // [sp+4h] [bp-28h]
std::string v32; // [sp+1Ch] [bp-10h] BYREF
std::string v33; // [sp+20h] [bp-Ch] BYREF
if ( a1->m_songObjects )
{
v7 = 0;
DictForKey = DS_Dictionary::getDictForKey(a2, "MDLM_001", 0);
v8 = cocos2d::CCDictionary::allKeys(DictForKey);
while ( v7 < cocos2d::CCArray::count(v8) )
{
v9 = cocos2d::CCArray::stringAtIndex(v8, v7);
CString = (char *)cocos2d::CCString::getCString(v9);
m_songObjects = a1->m_songObjects;
v12 = CString;
sub_776584((int)&v33, CString);
v13 = cocos2d::CCDictionary::objectForKey(m_songObjects, &v33);
sub_774008(&v33);
if ( !v13 )
{
v30 = a1->m_songObjects;
sub_776584((int)&v32, v12);
v14 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(DictForKey, &v32);
sub_776584((int)&v33, v12);
cocos2d::CCDictionary::setObject((int)v30, v14);
sub_774008(&v33);
sub_774008(&v32);
}
++v7;
}
}
else
{
v4 = DS_Dictionary::getDictForKey(a2, "MDLM_001", 0);
v5 = v4;
if ( a1->m_songObjects != v4 )
{
if ( v4 )
cocos2d::CCObject::retain(v4);
v6 = a1->m_songObjects;
if ( v6 )
cocos2d::CCObject::release(v6);
a1->m_songObjects = v5;
}
}
if ( a1->m_MDLM003 )
{
v18 = 0;
v29 = DS_Dictionary::getDictForKey(a2, "MDLM_003", 0);
v19 = cocos2d::CCDictionary::allKeys(v29);
while ( v18 < cocos2d::CCArray::count(v19) )
{
v20 = cocos2d::CCArray::stringAtIndex(v19, v18);
v21 = (char *)cocos2d::CCString::getCString(v20);
m_MDLM003 = a1->m_MDLM003;
v23 = v21;
sub_776584((int)&v33, v21);
v24 = cocos2d::CCDictionary::objectForKey(m_MDLM003, &v33);
sub_774008(&v33);
if ( !v24 )
{
v31 = a1->m_MDLM003;
sub_776584((int)&v32, v23);
v25 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v29, &v32);
sub_776584((int)&v33, v23);
cocos2d::CCDictionary::setObject((int)v31, v25);
sub_774008(&v33);
sub_774008(&v32);
}
++v18;
}
}
else
{
v15 = DS_Dictionary::getDictForKey(a2, "MDLM_003", 0);
v16 = v15;
if ( a1->m_MDLM003 != v15 )
{
if ( v15 )
cocos2d::CCObject::retain(v15);
v17 = a1->m_MDLM003;
if ( v17 )
cocos2d::CCObject::release(v17);
a1->m_MDLM003 = v16;
}
}
m_songPriority = a1->m_songPriority;
if ( m_songPriority >= DS_Dictionary::getIntegerForKey(a2, "MDLM_002") )
IntegerForKey = a1->m_songPriority;
else
IntegerForKey = DS_Dictionary::getIntegerForKey(a2, "MDLM_002");
a1->m_songPriority = IntegerForKey;
}