//
// MusicDownloadManager::getCustomContentURL from 0x82a430 to 0x82a684 (596 bytes)
//
// 10 xrefs:
// > CustomSongWidget::onDownload @ 0x748210
// > MusicBrowser::onUpdateLibrary @ 0xa5a458
// > MusicBrowser::setupMusicBrowser @ 0xa5b4d0
// > MusicBrowser::trySetupMusicBrowser @ 0xa5b530
// > SFXBrowser::onUpdateLibrary @ 0xa5ce98
// > SFXBrowser::setupSFXBrowser @ 0xa5de2c
// > SFXBrowser::trySetupSFXBrowser @ 0xa5dea0
// > AudioAssetsBrowser::trySetupAudioBrowser @ 0xa8f57c
// > AudioAssetsBrowser::trySetupAudioBrowser @ 0xa8f5bc
// > ??> @ 0x50ec8
//
// 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 MusicDownloadManager::getCustomContentURL(MusicDownloadManager *a1)
{
GameLevelManager *v2; // x0
int *p_m_unknown2; // x0
char *v4; // x0
char *v5; // x0
unsigned int *v6; // x1
int v7; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v10; // x1
int v11; // w2
const char *v12; // [xsp+60h] [xbp+60h] BYREF
const char *v13; // [xsp+68h] [xbp+68h] BYREF
cocos2d::extension::CCHttpClient *v14; // [xsp+70h] [xbp+70h] BYREF
if ( !MusicDownloadManager::isDLActive(a1, "get_c_url") )
{
MusicDownloadManager::addDLToActive(a1, "get_c_url");
sub_D153B8((int)&v13, "https://www.boomlings.com/database/getCustomContentURL.php");
v2 = GameLevelManager::sharedState();
GameLevelManager::getBasePostString(v2, (__int64)&v12);
sub_D153B8((int)&v14, "get_c_url");
MusicDownloadManager::ProcessHttpRequest(a1, &v13, &v12, &v14, 59);
p_m_unknown2 = &v14[-1].m_unknown2;
if ( &v14[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v14[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v14[-1]._timeoutForConnect;
v14[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v4 = (char *)(v12 - 24);
if ( v12 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v12 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *((_DWORD *)v12 - 2);
*((_DWORD *)v12 - 2) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v4);
}
v5 = (char *)(v13 - 24);
if ( v13 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v6 = (unsigned int *)(v13 - 8);
do
v7 = __ldaxr(v6);
while ( __stlxr(v7 - 1, v6) );
}
else
{
v7 = *((_DWORD *)v13 - 2);
*((_DWORD *)v13 - 2) = v7 - 1;
}
if ( v7 <= 0 )
operator delete(v5);
}
}
}