//
// MusicDownloadManager::getSongInfo from 0x10058b700 to 0x10058bab6 (950 bytes)
//
// 4 xrefs:
// > CustomSongWidget::onDownload @ 0x10061bcf9
// > CustomSongWidget::onGetSongInfo @ 0x10061becc
// > CustomSongWidget::getSongInfoIfUnloaded @ 0x10061ed39
// > CustomSongWidget::processNextMultiAsset @ 0x1006212b4
//
// 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 __fastcall MusicDownloadManager::getSongInfo(MusicDownloadManager *a1, int a2, bool a3)
{
__m128 v3; // xmm0
SongInfoObject *SongInfoObject; // rax
SongInfoObject *v6; // r15
unsigned int v7; // r14d
__int64 v8; // rax
std::string::size_type size; // r12
cocos2d::CCString *v10; // rax
const char *CString; // r15
cocos2d::CCNode *v12; // rax
cocos2d::CCString *v13; // rax
cocos2d::CCString *v14; // rax
const char *v15; // rax
const char *data; // r15
size_t v17; // rax
size_t v18; // r12
char *v19; // r13
size_t v20; // r15
cocos2d::CCString *v21; // rax
const char *v22; // r14
size_t v23; // rax
size_t v24; // r15
char *v25; // r12
size_t v26; // r13
char v27; // [rsp+0h] [rbp-A0h]
char v28; // [rsp+0h] [rbp-A0h]
char v29; // [rsp+0h] [rbp-A0h]
const char *v30; // [rsp+10h] [rbp-90h]
_QWORD v31[2]; // [rsp+18h] [rbp-88h] BYREF
void *v32; // [rsp+28h] [rbp-78h]
_QWORD __dst[2]; // [rsp+30h] [rbp-70h] BYREF
void *v34; // [rsp+40h] [rbp-60h]
_QWORD v35[2]; // [rsp+48h] [rbp-58h] BYREF
void *__p; // [rsp+58h] [rbp-48h]
std::string v37; // [rsp+60h] [rbp-40h] BYREF
SongInfoObject = MusicDownloadManager::getSongInfoObject(a1, a2);
if ( !SongInfoObject )
goto LABEL_14;
v6 = SongInfoObject;
if ( a3 && !SongInfoObject->m_verified )
goto LABEL_14;
if ( (SongInfoObject->m_songUrl.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v37,
SongInfoObject->m_songUrl.m_data.m_long.longStorage,
SongInfoObject->m_songUrl.m_data.m_long.size,
*(double *)v3.i64);
}
else
{
v37.__r_.__value_.__r.__words[2] = (std::string::size_type)SongInfoObject->m_songUrl.m_data.m_long.longStorage;
v3 = *(__m128 *)&SongInfoObject->m_songUrl.m_data.m_short.sizex2;
*(__m128 *)&v37.__r_.__value_.__l.0 = v3;
}
if ( (*(_BYTE *)&v37.__r_.__value_.__s.0 & 1) == 0 )
{
if ( *(_BYTE *)&v37.__r_.__value_.__l.0 >> 1 )
goto LABEL_9;
LABEL_14:
v10 = (cocos2d::CCString *)sub_1007AB580("i_%i", v27);
CString = cocos2d::CCString::getCString(v10);
if ( MusicDownloadManager::getDLObject(a1, CString) )
return;
v12 = cocos2d::CCNode::create();
MusicDownloadManager::addDLToActive(a1, CString, v12);
GameLevelManager::sharedState();
GameLevelManager::getBasePostString(&v37, v3);
v13 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v13);
v14 = (cocos2d::CCString *)sub_1007AB580("&songID=%i&secret=%s", v28);
v15 = cocos2d::CCString::getCString(v14);
std::string::append(&v37, v15);
v32 = operator new(0x38u);
v31[0] = 57;
v31[1] = 52;
strcpy((char *)v32, "https://www.boomlings.com/database/getGJSongInfo.php");
if ( (*(_BYTE *)&v37.__r_.__value_.__s.0 & 1) != 0 )
data = v37.__r_.__value_.__l.__data_;
else
data = v37.__r_.__value_.__s.__data_;
v17 = strlen(data);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(2.057594829120962e-81);
v18 = v17;
if ( v17 >= 0x17 )
{
v30 = data;
v20 = 26;
if ( (v17 | 7) != 0x17 )
v20 = (v17 | 7) + 1;
v19 = (char *)operator new(v20);
v34 = v19;
__dst[0] = v20 | 1;
__dst[1] = v18;
data = v30;
}
else
{
LOBYTE(__dst[0]) = 2 * v17;
v19 = (char *)__dst + 1;
if ( !v17 )
{
LABEL_26:
v19[v18] = 0;
v21 = (cocos2d::CCString *)sub_1007AB580("%i", v29);
v22 = cocos2d::CCString::getCString(v21);
v23 = strlen(v22);
if ( v23 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(2.057594829120962e-81);
v24 = v23;
if ( v23 >= 0x17 )
{
v26 = 26;
if ( (v23 | 7) != 0x17 )
v26 = (v23 | 7) + 1;
v25 = (char *)operator new(v26);
__p = v25;
v35[0] = v26 | 1;
v35[1] = v24;
}
else
{
LOBYTE(v35[0]) = 2 * v23;
v25 = (char *)v35 + 1;
if ( !v23 )
{
LABEL_34:
v25[v24] = 0;
MusicDownloadManager::ProcessHttpRequest(a1, (__int64)v31, (__int64)__dst, (__int64)v35, 19);
if ( (v35[0] & 1) != 0 )
{
operator delete(__p);
if ( (__dst[0] & 1) == 0 )
{
LABEL_36:
if ( (v31[0] & 1) == 0 )
goto LABEL_37;
goto LABEL_42;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_36;
}
operator delete(v34);
if ( (v31[0] & 1) == 0 )
{
LABEL_37:
if ( (*(_BYTE *)&v37.__r_.__value_.__s.0 & 1) == 0 )
return;
goto LABEL_38;
}
LABEL_42:
operator delete(v32);
if ( (*(_BYTE *)&v37.__r_.__value_.__s.0 & 1) == 0 )
return;
LABEL_38:
operator delete(v37.__r_.__value_.__l.__data_);
return;
}
}
memmove(v25, v22, v24);
goto LABEL_34;
}
}
memmove(v19, data, v18);
goto LABEL_26;
}
size = v37.__r_.__value_.__l.__size_;
operator delete(v37.__r_.__value_.__l.__data_);
if ( !size )
goto LABEL_14;
LABEL_9:
if ( (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) )
{
v7 = 0;
do
{
v8 = sub_1007200C0(a1->m_musicDownloadDelegates, v7);
(***(void (__fastcall ****)(_QWORD, SongInfoObject *))(v8 + 320))(*(_QWORD *)(v8 + 320), v6);
++v7;
}
while ( v7 < (unsigned int)sub_100720070(a1->m_musicDownloadDelegates) );
}
}