//
// MusicDownloadManager::encodeDataTo from 0x96eb74 to 0x96f04c (1240 bytes)
//
// 2 xrefs:
// > GameManager::encodeDataTo @ 0x72a37c
// > ??> @ 0xd8628
//
// This function is hookable on this platform (idp: arm, 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 12:57:40 +0000
//
__int64 __fastcall MusicDownloadManager::encodeDataTo(MusicDownloadManager *this, DS_Dictionary *a2)
{
int *v4; // x0
__int64 v5; // x23
__int64 v6; // x23
__int64 v7; // x19
int v8; // w3
int v9; // w2
__int64 v10; // x1
size_t v11; // x0
int *v12; // x2
void *v13; // x19
void *v15; // [xsp+68h] [xbp+68h] BYREF
_QWORD v16[2]; // [xsp+70h] [xbp+70h] BYREF
__int64 v17; // [xsp+80h] [xbp+80h] BYREF
__int64 v18; // [xsp+88h] [xbp+88h]
void *v19; // [xsp+90h] [xbp+90h]
char s[32]; // [xsp+98h] [xbp+98h] BYREF
DS_Dictionary::setDictForKey(a2, "MDLM_001", *((cocos2d::CCDictionary **)this + 43));
DS_Dictionary::setDictForKey(a2, "MDLM_003", *((cocos2d::CCDictionary **)this + 44));
DS_Dictionary::setIntegerForKey(a2, "MDLM_002", *((_DWORD *)this + 90));
std::vector::vector *>>(
&v15,
*((_QWORD **)this + 78),
nullptr);
MusicDownloadManager::joinIDString((__int64 *)&v15, &v17);
DS_Dictionary::setStringForKey(a2, "MDLM_004", &v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
if ( v15 )
{
if ( v15 != (void *)v16[0] )
v16[0] += 4 * ~((unsigned __int64)(v16[0] - 4LL - (_QWORD)v15) >> 2);
operator delete(v15);
}
std::vector::vector *>>(
&v15,
*((_QWORD **)this + 88),
nullptr);
MusicDownloadManager::joinIDString((__int64 *)&v15, &v17);
DS_Dictionary::setStringForKey(a2, "MDLM_005", &v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
if ( v15 )
{
if ( v15 != (void *)v16[0] )
v16[0] += 4 * ~((unsigned __int64)(v16[0] - 4LL - (_QWORD)v15) >> 2);
operator delete(v15);
}
std::vector::vector *>>(
&v15,
*((_QWORD **)this + 83),
nullptr);
MusicDownloadManager::joinIDString((__int64 *)&v15, &v17);
DS_Dictionary::setStringForKey(a2, "MDLM_011", &v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
if ( v15 )
{
if ( v15 != (void *)v16[0] )
v16[0] += 4 * ~((unsigned __int64)(v16[0] - 4LL - (_QWORD)v15) >> 2);
operator delete(v15);
}
v4 = *((int **)this + 91);
v5 = *((_QWORD *)this + 92);
v17 = 0;
v18 = 0;
v19 = nullptr;
v6 = (v5 - (__int64)v4) >> 3;
if ( v6 )
{
v7 = 0;
v8 = v4[1];
v9 = *v4;
if ( v8 <= 0 )
goto LABEL_28;
LABEL_21:
sprintf(s, "%i:%i", v9, v8);
while ( 1 )
{
v10 = (unsigned __int8)v17 >> 1;
if ( (v17 & 1) != 0 )
v10 = v18;
if ( v10 )
std::string::append((__int64)&v17, &byte_1169BE0, 1u);
v11 = strlen(s);
std::string::append((__int64)&v17, s, v11);
if ( v6 == ++v7 )
break;
v12 = (int *)(*((_QWORD *)this + 91) + 8 * v7);
v8 = v12[1];
v9 = *v12;
if ( v8 > 0 )
goto LABEL_21;
LABEL_28:
sprintf(s, "%i", v9);
}
}
DS_Dictionary::setStringForKey(a2, "MDLM_006", &v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
MusicDownloadManager::joinIDString((__int64 *)this + 94, &v17);
DS_Dictionary::setStringForKey(a2, "MDLM_007", &v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
sub_965B44((_QWORD *)this + 97, &v17);
DS_Dictionary::setStringForKey(a2, "MDLM_008", &v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
sub_965B44((_QWORD *)this + 100, &v17);
DS_Dictionary::setStringForKey(a2, "MDLM_009", &v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
v16[0] = 0;
v16[1] = 0;
v15 = v16;
MusicDownloadManager::encodeCustomSFX((__int64)this, &v15, &v17);
DS_Dictionary::setStringForKey(a2, "MDLM_010", &v17);
if ( (v17 & 1) != 0 )
operator delete(v19);
v13 = (void *)v16[0];
if ( v16[0] )
{
std::__tree::destroy((__int64)&v15, *(_QWORD **)v16[0]);
std::__tree::destroy((__int64)&v15, *(_QWORD **)&byte_8[(_QWORD)v13]);
operator delete(v13);
}
return _stack_chk_guard;
}