//
// MusicDownloadManager::dataLoaded from 0x14033fa20 to 0x14033ff01 (1249 bytes)
//
// 2 xrefs:
// > GameManager::dataLoaded @ 0x1401872f2
// > ??> @ 0x1406d5720
//
// 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
//
// Hidden C++ exception states: #wind=3
void MusicDownloadManager::dataLoaded(MusicDownloadManager *a1, DS_Dictionary *a2)
{
struct cocos2d::CCDictionary *v4; // rax
cocos2d::CCDictionary *v5; // rbx
cocos2d::CCDictionary *m_songObjects; // rcx
struct cocos2d::CCDictionary *v7; // rax
cocos2d::CCDictionary *v8; // rbx
cocos2d::CCDictionary *m_MDLM003; // rcx
int m_songPriority; // ebx
int v11; // eax
int v12; // eax
cocos2d::CCDictionary *DictForKey; // r15
cocos2d::CCArray *v14; // r14
unsigned int i; // esi
cocos2d::CCString *v16; // rax
const char *CString; // rbx
size_t v18; // r8
__int64 v19; // rdi
void *v20; // rcx
size_t v21; // r8
size_t v22; // r8
__int64 v23; // rax
void *v24; // rcx
void *v25; // rcx
cocos2d::CCDictionary *v26; // r15
cocos2d::CCArray *v27; // r14
unsigned int j; // esi
cocos2d::CCString *v29; // rax
const char *v30; // rax
const char *v31; // rdi
size_t v32; // r8
__int64 v33; // rbx
size_t v34; // r8
size_t v35; // r8
__int64 v36; // rax
void *v37; // rcx
void *v38; // rcx
__int128 v39; // [rsp+20h] [rbp-50h] BYREF
__int64 v40; // [rsp+30h] [rbp-40h]
unsigned __int64 v41; // [rsp+38h] [rbp-38h]
__int128 v42; // [rsp+40h] [rbp-30h] BYREF
__int64 v43; // [rsp+50h] [rbp-20h]
unsigned __int64 v44; // [rsp+58h] [rbp-18h]
if ( a1->m_songObjects )
{
DictForKey = DS_Dictionary::getDictForKey(a2, "MDLM_001", 0);
v14 = cocos2d::CCDictionary::allKeys(DictForKey);
for ( i = 0; i < cocos2d::CCArray::count(v14); ++i )
{
v16 = cocos2d::CCArray::stringAtIndex(v14, i);
CString = cocos2d::CCString::getCString(v16);
v39 = 0;
v40 = 0;
v41 = 0;
v18 = -1;
do
++v18;
while ( CString[v18] );
sub_14003A930(&v39, CString, v18);
v19 = cocos2d::CCDictionary::objectForKey(a1->m_songObjects, &v39);
if ( v41 > 0xF )
{
v20 = (void *)v39;
if ( v41 + 1 >= 0x1000 )
{
v20 = *(void **)(v39 - 8);
if ( (unsigned __int64)(v39 - (_QWORD)v20 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v20);
}
if ( !v19 )
{
v42 = 0;
v43 = 0;
v44 = 0;
v21 = -1;
do
++v21;
while ( CString[v21] );
sub_14003A930(&v42, CString, v21);
v39 = 0;
v40 = 0;
v41 = 0;
v22 = -1;
do
++v22;
while ( CString[v22] );
sub_14003A930(&v39, CString, v22);
v23 = cocos2d::CCDictionary::objectForKey(DictForKey, &v39);
cocos2d::CCDictionary::setObject(a1->m_songObjects, v23, &v42);
if ( v41 > 0xF )
{
v24 = (void *)v39;
if ( v41 + 1 >= 0x1000 )
{
v24 = *(void **)(v39 - 8);
if ( (unsigned __int64)(v39 - (_QWORD)v24 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v24);
}
v40 = 0;
v41 = 15;
LOBYTE(v39) = 0;
if ( v44 > 0xF )
{
v25 = (void *)v42;
if ( v44 + 1 >= 0x1000 )
{
v25 = *(void **)(v42 - 8);
if ( (unsigned __int64)(v42 - (_QWORD)v25 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v25);
}
}
}
}
else
{
v4 = DS_Dictionary::getDictForKey(a2, "MDLM_001", 0);
v5 = v4;
if ( a1->m_songObjects != v4 )
{
if ( v4 )
cocos2d::CCObject::retain(v4);
m_songObjects = a1->m_songObjects;
if ( m_songObjects )
cocos2d::CCObject::release(m_songObjects);
a1->m_songObjects = v5;
}
}
if ( a1->m_MDLM003 )
{
v26 = DS_Dictionary::getDictForKey(a2, "MDLM_003", 0);
v27 = cocos2d::CCDictionary::allKeys(v26);
for ( j = 0; j < cocos2d::CCArray::count(v27); ++j )
{
v29 = cocos2d::CCArray::stringAtIndex(v27, j);
v30 = cocos2d::CCString::getCString(v29);
v31 = v30;
v42 = 0;
v43 = 0;
v44 = 0;
v32 = -1;
do
++v32;
while ( v30[v32] );
sub_14003A930(&v42, v30, v32);
v33 = cocos2d::CCDictionary::objectForKey(a1->m_MDLM003, &v42);
sub_14003A830((__int64)&v42);
if ( !v33 )
{
v42 = 0;
v43 = 0;
v44 = 0;
v34 = -1;
do
++v34;
while ( v31[v34] );
sub_14003A930(&v42, v31, v34);
v39 = 0;
v40 = 0;
v41 = 0;
v35 = -1;
do
++v35;
while ( v31[v35] );
sub_14003A930(&v39, v31, v35);
v36 = cocos2d::CCDictionary::objectForKey(v26, &v39);
cocos2d::CCDictionary::setObject(a1->m_MDLM003, v36, &v42);
if ( v41 > 0xF )
{
v37 = (void *)v39;
if ( v41 + 1 >= 0x1000 )
{
v37 = *(void **)(v39 - 8);
if ( (unsigned __int64)(v39 - (_QWORD)v37 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v37);
}
v40 = 0;
v41 = 15;
LOBYTE(v39) = 0;
if ( v44 > 0xF )
{
v38 = (void *)v42;
if ( v44 + 1 >= 0x1000 )
{
v38 = *(void **)(v42 - 8);
if ( (unsigned __int64)(v42 - (_QWORD)v38 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v38);
}
}
}
}
else
{
v7 = DS_Dictionary::getDictForKey(a2, "MDLM_003", 0);
v8 = v7;
if ( a1->m_MDLM003 != v7 )
{
if ( v7 )
cocos2d::CCObject::retain(v7);
m_MDLM003 = a1->m_MDLM003;
if ( m_MDLM003 )
cocos2d::CCObject::release(m_MDLM003);
a1->m_MDLM003 = v8;
}
}
m_songPriority = a1->m_songPriority;
DS_Dictionary::getIntegerForKey(a2, "MDLM_002");
if ( m_songPriority <= v11 )
{
DS_Dictionary::getIntegerForKey(a2, "MDLM_002");
m_songPriority = v12;
}
a1->m_songPriority = m_songPriority;
}