//
// MusicDownloadManager::downloadCustomSong from 0x570098 to 0x5701de (326 bytes)
//
// 1 xrefs:
// > MusicDownloadManager::downloadSong @ 0x57020a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:36 +0000
//
int __fastcall MusicDownloadManager::downloadCustomSong(int this, const char *a2)
{
MusicDownloadManager *v2; // r4
int v4; // r3
int v5; // r3
const char *SongDownloadKey; // r9
char *v7; // r1
size_t v8; // r2
int v9; // r3
cocos2d::CCObject *Request; // [sp+14h] [bp-60h]
unsigned __int8 v11; // [sp+24h] [bp-50h] BYREF
char v12; // [sp+25h] [bp-4Fh] BYREF
size_t v13; // [sp+28h] [bp-4Ch]
char *v14; // [sp+2Ch] [bp-48h]
int v15[3]; // [sp+30h] [bp-44h] BYREF
int v16[3]; // [sp+3Ch] [bp-38h] BYREF
int v17[3]; // [sp+48h] [bp-2Ch] BYREF
int v18[3]; // [sp+54h] [bp-20h] BYREF
int v19[3]; // [sp+60h] [bp-14h] BYREF
v2 = (MusicDownloadManager *)this;
v4 = *(unsigned __int8 *)(this + 288);
if ( (v4 & 1) != 0 )
v5 = *(_DWORD *)(this + 292);
else
v5 = v4 >> 1;
if ( v5 )
{
SongDownloadKey = (const char *)MusicDownloadManager::getSongDownloadKey((MusicDownloadManager *)this, a2);
this = MusicDownloadManager::isDLActive(v2, SongDownloadKey);
if ( !this )
{
MusicDownloadManager::downloadSongStarted((cocos2d::CCArray **)v2, (int)a2);
GameToolbox::intToString((GameToolbox *)&v11, (int)a2);
memset(v15, 0, sizeof(v15));
std::string::__init(v15, "/music/", 7u);
if ( (v11 & 1) != 0 )
{
v7 = v14;
v8 = v13;
}
else
{
v8 = (int)v11 >> 1;
v7 = &v12;
}
std::string::append(v15, v7, v8);
std::string::append(v15, ".ogg");
std::string::basic_string(v17, (int)v15);
MusicDownloadManager::generateCustomContentURL(v16, (int)v2, (int)v17);
std::string::~string((int)v17);
std::string::basic_string(v18, (int)v16);
std::string::basic_string(v19, (int)&v11);
Request = (cocos2d::CCObject *)MusicDownloadManager::ProcessHttpGetRequest(
v2,
(int)v18,
(int)v19,
(int)MusicDownloadManager::onDownloadSongCompleted,
0,
0,
0);
std::string::~string((int)v19);
std::string::~string((int)v18);
MusicDownloadManager::addDLToActive(v2, SongDownloadKey, Request, v9);
std::string::~string((int)v16);
std::string::~string((int)v15);
return std::string::~string((int)&v11);
}
}
return this;
}