//
// MusicDownloadManager::addSongObjectFromString from 0x14033da40 to 0x14033dde0 (928 bytes)
//
// 3 xrefs:
// > MusicDownloadManager::onGetSongInfoCompleted @ 0x14033d9e1
// > MusicDownloadManager::createSongsInfo @ 0x14033dfdf
// > ??> @ 0x1406d560c
//
// 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
//
// Hidden C++ exception states: #wind=2
SongInfoObject *__fastcall MusicDownloadManager::addSongObjectFromString(__int64 a1, __int64 a2)
{
__int64 v4; // rax
__int64 v5; // rcx
cocos2d::CCDictionary *v6; // r15
SongInfoObject *v7; // rsi
int m_songID; // edx
cocos2d::CCString *v10; // rax
const char *CString; // rax
size_t v12; // rdi
size_t v13; // r8
_QWORD *v14; // rbx
void *v15; // rcx
void *v16; // rdx
void *v17; // rdx
void *v18; // rdx
void *v19; // rdx
void *v20; // rdx
void *v21; // rdx
cocos2d::CCString *v22; // rax
bool v23; // bl
void *v24; // rcx
cocos2d::CCString *v25; // rax
const char *v26; // rax
void *v27; // rcx
_BYTE v28[32]; // [rsp+28h] [rbp-58h] BYREF
__int64 v29; // [rsp+48h] [rbp-38h]
void *Block[2]; // [rsp+50h] [rbp-30h] BYREF
__m128i si128; // [rsp+60h] [rbp-20h]
v29 = a2;
v4 = sub_14003BDB0((__int64)v28, a2);
v6 = (cocos2d::CCDictionary *)MusicDownloadManager::responseToDict(v5, v4);
v7 = SongInfoObject::create_2(v6);
m_songID = v7->m_songID;
if ( m_songID )
{
v10 = cocos2d::CCString::createWithFormat("%i", m_songID);
CString = cocos2d::CCString::getCString(v10);
*(_OWORD *)Block = 0;
si128 = 0;
v12 = -1;
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_14003A930(Block, CString, v13);
v14 = (_QWORD *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 344), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v15 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v15 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v15 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v15);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( v14 )
{
if ( v14[51] && &v7->m_youtubeVideo != (std::string *)(v14 + 49) )
{
v16 = v14 + 49;
if ( v14[52] > 0xFu )
v16 = (void *)v14[49];
sub_14003CCE0((void **)&v7->m_youtubeVideo, v16, v14[51]);
}
if ( v14[55] && &v7->m_youtubeChannel != (std::string *)(v14 + 53) )
{
v17 = v14 + 53;
if ( v14[56] > 0xFu )
v17 = (void *)v14[53];
sub_14003CCE0((void **)&v7->m_youtubeChannel, v17, v14[55]);
}
if ( v14[63] && &v7->m_downloadLinkOverride != (std::string *)(v14 + 61) )
{
v18 = v14 + 61;
if ( v14[64] > 0xFu )
v18 = (void *)v14[61];
sub_14003CCE0((void **)&v7->m_downloadLinkOverride, v18, v14[63]);
}
if ( v14[59] && &v7->m_songUrl != (std::string *)(v14 + 57) )
{
v19 = v14 + 57;
if ( v14[60] > 0xFu )
v19 = (void *)v14[57];
sub_14003CCE0((void **)&v7->m_songUrl, v19, v14[59]);
}
if ( v14[69] && &v7->m_extraArtists != (std::string *)(v14 + 67) )
{
v20 = v14 + 67;
if ( v14[70] > 0xFu )
v20 = (void *)v14[67];
sub_14003CCE0((void **)&v7->m_extraArtists, v20, v14[69]);
}
if ( v14[77] && &v7->m_extraArtistNames != (std::string *)(v14 + 75) )
{
v21 = v14 + 75;
if ( v14[78] > 0xFu )
v21 = (void *)v14[75];
sub_14003CCE0((void **)&v7->m_extraArtistNames, v21, v14[77]);
}
}
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 1;
si128.m128i_i64[1] = 15;
LOWORD(Block[0]) = 56;
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v6, Block);
v23 = cocos2d::CCString::boolValue(v22);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v24 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v24);
}
v7->m_verified = !v23;
v25 = cocos2d::CCString::createWithFormat("%i", v7->m_songID);
v26 = cocos2d::CCString::getCString(v25);
*(_OWORD *)Block = 0;
si128 = 0;
do
++v12;
while ( v26[v12] );
sub_14003A930(Block, v26, v12);
cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 344), v7, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v27 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v27 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v27 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v27);
}
sub_14003A830(a2);
return v7;
}
else
{
sub_14003A830(a2);
return nullptr;
}
}