//
// MusicDownloadManager::getSongInfo from 0x82d274 to 0x82d67c (1032 bytes)
//
// 4 xrefs:
// > CustomSongWidget::onGetSongInfo @ 0x743e64
// > CustomSongWidget::processNextMultiAsset @ 0x747ec0
// > CustomSongWidget::onDownload @ 0x7481b8
// > ??> @ 0x5a7e0
//
// 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::getSongInfo(MusicDownloadManager *a1, int a2, bool a3)
{
unsigned int v5; // w21
SongInfoObject *SongInfoObject; // x0
SongInfoObject *v7; // x20
int *p_m_unknown2; // x0
__int64 v9; // x24
const char *SongInfoKey; // x20
GameLevelManager *v11; // x0
cocos2d::CCString *v12; // x0
const char *CString; // x0
cocos2d::CCString *v14; // x0
size_t v15; // x0
cocos2d::CCString *v16; // x0
char *v17; // x0
int *v18; // x0
char *v19; // x0
char *v20; // x0
char *v21; // x0
unsigned int *v22; // x1
int v23; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
const char *v32; // [xsp+48h] [xbp+48h]
char *v33; // [xsp+78h] [xbp+78h] BYREF
const char *v34; // [xsp+80h] [xbp+80h] BYREF
const char *v35; // [xsp+88h] [xbp+88h] BYREF
cocos2d::extension::CCHttpClient *v36; // [xsp+90h] [xbp+90h] BYREF
v5 = a3;
SongInfoObject = MusicDownloadManager::getSongInfoObject(a1, a2);
v7 = SongInfoObject;
if ( !SongInfoObject || SongInfoObject->m_verified < v5 )
goto LABEL_7;
sub_D18D28(&v36);
p_m_unknown2 = &v36[-1].m_unknown2;
v9 = *(_QWORD *)&v36[-1].m_unknown2;
if ( &v36[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v36[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v36[-1]._timeoutForConnect;
v36[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
if ( v9 )
{
MusicDownloadManager::loadSongInfoFinished(a1, v7);
}
else
{
LABEL_7:
SongInfoKey = MusicDownloadManager::getSongInfoKey(a1, a2);
if ( !MusicDownloadManager::isDLActive(a1, SongInfoKey) )
{
MusicDownloadManager::addDLToActive(a1, SongInfoKey);
v11 = GameLevelManager::sharedState();
GameLevelManager::getBasePostString(v11, (__int64)&v33);
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
CString = cocos2d::CCString::getCString(v12);
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&songID=%i&secret=%s",
(const char *)(unsigned int)a2,
CString);
v32 = cocos2d::CCString::getCString(v14);
v15 = strlen(v32);
sub_D15FD4(&v33, v32, v15);
sub_D153B8((int)&v34, "https://www.boomlings.com/database/getGJSongInfo.php");
sub_D153B8((int)&v35, v33);
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)a2);
v17 = (char *)cocos2d::CCString::getCString(v16);
sub_D153B8((int)&v36, v17);
MusicDownloadManager::ProcessHttpRequest(a1, &v34, &v35, &v36, 19);
v18 = &v36[-1].m_unknown2;
if ( &v36[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)&v36[-1]._timeoutForConnect;
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = v36[-1]._timeoutForConnect;
v36[-1]._timeoutForConnect = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v18);
}
v19 = (char *)(v35 - 24);
if ( v35 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v35 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v35 - 2);
*((_DWORD *)v35 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v19);
}
v20 = (char *)(v34 - 24);
if ( v34 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v34 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v34 - 2);
*((_DWORD *)v34 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v20);
}
v21 = v33 - 24;
if ( v33 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v33 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v33 - 2);
*((_DWORD *)v33 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v21);
}
}
}
}