//
// MusicDownloadManager::dataLoaded from 0x14048af10 to 0x14048b621 (1809 bytes)
//
// 2 xrefs:
// > GameManager::dataLoaded @ 0x1402832d9
// > ??> @ 0x140928d60
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:32:48 +0000
//
// Hidden C++ exception states: #wind=4
void __fastcall MusicDownloadManager::dataLoaded(__int64 a1, DS_Dictionary *a2)
{
cocos2d::CCObject *v4; // rax
cocos2d::CCObject *v5; // rbx
cocos2d::CCObject *v6; // rcx
cocos2d::CCObject *v7; // rax
cocos2d::CCObject *v8; // rbx
cocos2d::CCObject *v9; // rcx
int v10; // ebx
int v11; // eax
int v12; // eax
_QWORD *StringForKey; // rax
__int64 v14; // r8
__int64 v15; // r9
unsigned __int8 *v16; // rdi
unsigned __int8 *v17; // rbx
_QWORD *v18; // rax
__int64 v19; // r8
__int64 v20; // r9
unsigned __int8 *v21; // rdi
unsigned __int8 *v22; // rbx
_QWORD *v23; // rax
__int64 v24; // r8
__int64 v25; // r9
unsigned __int8 *v26; // rdi
unsigned __int8 *k; // rbx
_QWORD *v28; // rax
__int64 v29; // r8
__int64 v30; // r9
_QWORD *v31; // rax
__int64 v32; // r8
__int64 v33; // r9
_QWORD *v34; // rax
__int64 v35; // r8
__int64 v36; // r9
_QWORD *v37; // rax
__int64 v38; // r8
__int64 v39; // r9
__int64 *v40; // rax
cocos2d::CCDictionary *DictForKey; // r12
cocos2d::CCArray *v42; // r15
unsigned int i; // esi
cocos2d::CCString *v44; // rax
const char *CString; // rax
const char *v46; // rbx
size_t v47; // r8
__int64 v48; // rdi
void *v49; // r8
size_t v50; // r8
size_t v51; // r8
__int64 v52; // rbx
__int64 v53; // rax
void *v54; // rcx
cocos2d::CCDictionary *v55; // r12
cocos2d::CCArray *v56; // r15
unsigned int j; // esi
cocos2d::CCString *v58; // rax
const char *v59; // rax
const char *v60; // rbx
size_t v61; // r8
__int64 v62; // rdi
void *v63; // r8
size_t v64; // r8
size_t v65; // r8
__int64 v66; // rbx
__int64 v67; // rax
__int128 v68; // [rsp+30h] [rbp-39h] BYREF
__int64 v69; // [rsp+40h] [rbp-29h]
void *Block[2]; // [rsp+48h] [rbp-21h] BYREF
__int128 v71; // [rsp+58h] [rbp-11h]
__int128 v72; // [rsp+68h] [rbp-1h] BYREF
__int128 v73; // [rsp+78h] [rbp+Fh]
if ( *(_QWORD *)(a1 + 344) )
{
DictForKey = DS_Dictionary::getDictForKey(a2, "MDLM_001", 0);
v42 = cocos2d::CCDictionary::allKeys(DictForKey);
for ( i = 0; i < cocos2d::CCArray::count(v42); ++i )
{
v44 = cocos2d::CCArray::stringAtIndex(v42, i);
CString = cocos2d::CCString::getCString(v44);
v46 = CString;
*(_OWORD *)Block = 0;
v71 = 0;
v47 = -1;
do
++v47;
while ( CString[v47] );
sub_14003D230(Block, CString, v47);
v48 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 344), Block);
if ( *((_QWORD *)&v71 + 1) > 0xFu )
{
v49 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v71 + 1) + 1LL) >= 0x1000 )
{
v49 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v49 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v49);
}
if ( !v48 )
{
*(_OWORD *)Block = 0;
v71 = 0;
v50 = -1;
do
++v50;
while ( v46[v50] );
sub_14003D230(Block, v46, v50);
v72 = 0;
v73 = 0;
v51 = -1;
do
++v51;
while ( v46[v51] );
sub_14003D230(&v72, v46, v51);
v52 = *(_QWORD *)(a1 + 344);
v53 = cocos2d::CCDictionary::objectForKey(DictForKey, &v72);
cocos2d::CCDictionary::setObject(v52, v53, Block);
sub_14003D310((__int64)&v72);
if ( *((_QWORD *)&v71 + 1) > 0xFu )
{
v54 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v71 + 1) + 1LL) >= 0x1000 )
{
v54 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v54 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v54);
}
}
}
}
else
{
v4 = DS_Dictionary::getDictForKey(a2, "MDLM_001", 0);
v5 = v4;
if ( *(cocos2d::CCObject **)(a1 + 344) != v4 )
{
if ( v4 )
cocos2d::CCObject::retain(v4);
v6 = *(cocos2d::CCObject **)(a1 + 344);
if ( v6 )
cocos2d::CCObject::release(v6);
*(_QWORD *)(a1 + 344) = v5;
}
}
if ( *(_QWORD *)(a1 + 352) )
{
v55 = DS_Dictionary::getDictForKey(a2, "MDLM_003", 0);
v56 = cocos2d::CCDictionary::allKeys(v55);
for ( j = 0; j < cocos2d::CCArray::count(v56); ++j )
{
v58 = cocos2d::CCArray::stringAtIndex(v56, j);
v59 = cocos2d::CCString::getCString(v58);
v60 = v59;
*(_OWORD *)Block = 0;
v71 = 0;
v61 = -1;
do
++v61;
while ( v59[v61] );
sub_14003D230(Block, v59, v61);
v62 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 352), Block);
if ( *((_QWORD *)&v71 + 1) > 0xFu )
{
v63 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v71 + 1) + 1LL) >= 0x1000 )
{
v63 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v63 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v63);
}
if ( !v62 )
{
*(_OWORD *)Block = 0;
v71 = 0;
v64 = -1;
do
++v64;
while ( v60[v64] );
sub_14003D230(Block, v60, v64);
v72 = 0;
v73 = 0;
v65 = -1;
do
++v65;
while ( v60[v65] );
sub_14003D230(&v72, v60, v65);
v66 = *(_QWORD *)(a1 + 352);
v67 = cocos2d::CCDictionary::objectForKey(v55, &v72);
cocos2d::CCDictionary::setObject(v66, v67, Block);
sub_14003D310((__int64)&v72);
sub_14003D310((__int64)Block);
}
}
}
else
{
v7 = DS_Dictionary::getDictForKey(a2, "MDLM_003", 0);
v8 = v7;
if ( *(cocos2d::CCObject **)(a1 + 352) != v7 )
{
if ( v7 )
cocos2d::CCObject::retain(v7);
v9 = *(cocos2d::CCObject **)(a1 + 352);
if ( v9 )
cocos2d::CCObject::release(v9);
*(_QWORD *)(a1 + 352) = v8;
}
}
v10 = *(_DWORD *)(a1 + 360);
DS_Dictionary::getIntegerForKey(a2, "MDLM_002");
if ( v10 <= v11 )
{
DS_Dictionary::getIntegerForKey(a2, "MDLM_002");
v10 = v12;
}
*(_DWORD *)(a1 + 360) = v10;
v68 = 0;
v69 = 0;
StringForKey = (_QWORD *)DS_Dictionary::getStringForKey(a2, &v72, "MDLM_004");
MusicDownloadManager::splitIDString(StringForKey, &v68, v14, v15);
sub_14003D310((__int64)&v72);
v16 = *((unsigned __int8 **)&v68 + 1);
v17 = (unsigned __int8 *)v68;
if ( (_QWORD)v68 != *((_QWORD *)&v68 + 1) )
{
do
{
sub_140068190(a1 + 648, (__int64)Block, v17);
v17 += 4;
}
while ( v17 != v16 );
if ( (_QWORD)v68 != *((_QWORD *)&v68 + 1) )
*((_QWORD *)&v68 + 1) = v68;
}
v18 = (_QWORD *)DS_Dictionary::getStringForKey(a2, &v72, "MDLM_005");
MusicDownloadManager::splitIDString(v18, &v68, v19, v20);
sub_14003D310((__int64)&v72);
v21 = *((unsigned __int8 **)&v68 + 1);
v22 = (unsigned __int8 *)v68;
if ( (_QWORD)v68 != *((_QWORD *)&v68 + 1) )
{
do
{
sub_140068190(a1 + 776, (__int64)Block, v22);
v22 += 4;
}
while ( v22 != v21 );
if ( (_QWORD)v68 != *((_QWORD *)&v68 + 1) )
*((_QWORD *)&v68 + 1) = v68;
}
v23 = (_QWORD *)DS_Dictionary::getStringForKey(a2, &v72, "MDLM_011");
MusicDownloadManager::splitIDString(v23, &v68, v24, v25);
sub_14003D310((__int64)&v72);
v26 = *((unsigned __int8 **)&v68 + 1);
for ( k = (unsigned __int8 *)v68; k != v26; k += 4 )
sub_140068190(a1 + 712, (__int64)Block, k);
if ( *(_QWORD *)(a1 + 840) == *(_QWORD *)(a1 + 848) )
{
v28 = (_QWORD *)DS_Dictionary::getStringForKey(a2, &v72, "MDLM_006");
common_expand_argv_wildcards(v28, (const void **)(a1 + 840), v29, v30);
sub_14003D310((__int64)&v72);
}
if ( *(_QWORD *)(a1 + 864) == *(_QWORD *)(a1 + 872) )
{
v31 = (_QWORD *)DS_Dictionary::getStringForKey(a2, &v72, "MDLM_007");
MusicDownloadManager::splitIDString(v31, (_BYTE *)(a1 + 864), v32, v33);
sub_14003D310((__int64)&v72);
}
if ( !*(_QWORD *)(a1 + 896) )
{
v34 = (_QWORD *)DS_Dictionary::getStringForKey(a2, &v72, "MDLM_008");
construct_environment_block(v34, (__int64 *)(a1 + 888), v35, v36);
sub_14003D310((__int64)&v72);
}
if ( !*(_QWORD *)(a1 + 912) )
{
v37 = (_QWORD *)DS_Dictionary::getStringForKey(a2, &v72, "MDLM_009");
construct_environment_block(v37, (__int64 *)(a1 + 904), v38, v39);
sub_14003D310((__int64)&v72);
}
v40 = (__int64 *)DS_Dictionary::getStringForKey(a2, &v72, "MDLM_010");
MusicDownloadManager::decodeCustomSFX(a1, v40);
sub_14003D310((__int64)&v72);
sub_140069730((__int64)&v68);
}