//
// MusicDownloadManager::dataLoaded from 0x100157124 to 0x1001573ac (648 bytes)
//
// 1 xrefs:
// > GameManager::dataLoaded @ 0x10031bad0
//
// 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)
{
cocos2d::CCDictionary *m_songObjects; // x22
cocos2d::CCDictionary *DictForKey; // x0
cocos2d::CCDictionary *v6; // x21
cocos2d::CCArray *v7; // x22
unsigned int i; // w23
cocos2d::CCString *v9; // x0
char *CString; // x24
cocos2d::CCDictionary *v11; // x25
__int64 v12; // x0
__int64 v13; // x25
cocos2d::CCDictionary *v14; // x25
__int64 v15; // x26
cocos2d::CCDictionary *m_MDLM003; // x22
cocos2d::CCDictionary *v17; // x0
cocos2d::CCDictionary *v18; // x21
cocos2d::CCArray *v19; // x22
unsigned int j; // w23
cocos2d::CCString *v21; // x0
char *v22; // x24
cocos2d::CCDictionary *v23; // x25
__int64 v24; // x0
__int64 v25; // x25
cocos2d::CCDictionary *v26; // x25
__int64 v27; // x26
int m_songPriority; // w21
int IntegerForKey; // w0
void *v30[2]; // [xsp+0h] [xbp-70h] BYREF
char v31; // [xsp+17h] [xbp-59h]
void *__p[2]; // [xsp+18h] [xbp-58h] BYREF
char v33; // [xsp+2Fh] [xbp-41h]
m_songObjects = a1->m_songObjects;
DictForKey = DS_Dictionary::getDictForKey(a2, "MDLM_001", 0);
v6 = DictForKey;
if ( m_songObjects )
{
v7 = cocos2d::CCDictionary::allKeys(DictForKey);
if ( (unsigned int)sub_10024A36C(v7) )
{
for ( i = 0; i < (unsigned int)sub_10024A36C(v7); ++i )
{
v9 = cocos2d::CCArray::stringAtIndex(v7, i);
CString = (char *)cocos2d::CCString::getCString(v9);
v11 = a1->m_songObjects;
sub_100009900(__p, CString);
v12 = cocos2d::CCDictionary::objectForKey_1(v11, __p);
v13 = v12;
if ( v33 < 0 )
{
operator delete(__p[0]);
if ( !v13 )
{
LABEL_8:
v14 = a1->m_songObjects;
sub_100009900(__p, CString);
v15 = cocos2d::CCDictionary::objectForKey_1(v6, __p);
sub_100009900(v30, CString);
cocos2d::CCDictionary::setObject_1(v14, v15, v30);
if ( v31 < 0 )
operator delete(v30[0]);
if ( v33 < 0 )
operator delete(__p[0]);
}
}
else if ( !v12 )
{
goto LABEL_8;
}
}
}
}
else
{
sub_10009A998((__int64)a1, DictForKey);
}
m_MDLM003 = a1->m_MDLM003;
v17 = DS_Dictionary::getDictForKey(a2, "MDLM_003", 0);
v18 = v17;
if ( m_MDLM003 )
{
v19 = cocos2d::CCDictionary::allKeys(v17);
if ( (unsigned int)sub_10024A36C(v19) )
{
for ( j = 0; j < (unsigned int)sub_10024A36C(v19); ++j )
{
v21 = cocos2d::CCArray::stringAtIndex(v19, j);
v22 = (char *)cocos2d::CCString::getCString(v21);
v23 = a1->m_MDLM003;
sub_100009900(__p, v22);
v24 = cocos2d::CCDictionary::objectForKey_1(v23, __p);
v25 = v24;
if ( v33 < 0 )
{
operator delete(__p[0]);
if ( !v25 )
{
LABEL_22:
v26 = a1->m_MDLM003;
sub_100009900(__p, v22);
v27 = cocos2d::CCDictionary::objectForKey_1(v18, __p);
sub_100009900(v30, v22);
cocos2d::CCDictionary::setObject_1(v26, v27, v30);
if ( v31 < 0 )
operator delete(v30[0]);
if ( v33 < 0 )
operator delete(__p[0]);
}
}
else if ( !v24 )
{
goto LABEL_22;
}
}
}
}
else
{
sub_10009AA28((__int64)a1, v17);
}
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;
}