// // MusicDownloadManager::downloadSong from 0x831b5c to 0x831ff8 (1180 bytes) // // 4 xrefs: // > CustomSongWidget::startDownload @ 0x74413c // > CustomSongWidget::processNextMultiAsset @ 0x747ee8 // > CustomSongWidget::loadSongInfoFinished @ 0x749504 // > @ 0x5f370 // // 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::downloadSong(MusicDownloadManager *a1, int a2) { char *SongDownloadKey; // x24 MusicDownloadManager *v5; // x0 double v6; // d0 void *v7; // x0 cocos2d::CCString *v8; // x0 size_t v9; // x0 cocos2d::CCString *v10; // x0 char *v11; // x0 __int64 v12; // x20 __int64 v13; // x2 __int64 v14; // x2 char *v15; // x1 size_t v16; // x0 double v17; // d0 cocos2d::CCString *v18; // x0 size_t v19; // x0 cocos2d::extension::CCHttpClient *Instance; // x0 void *v21; // x0 char *v22; // x21 unsigned int *v23; // x20 int v24; // w0 unsigned int *v25; // x1 int v26; // w2 unsigned int *v27; // x1 int v28; // w2 const char *v29; // [xsp+60h] [xbp+60h] const char *v30; // [xsp+60h] [xbp+60h] const char *CString; // [xsp+68h] [xbp+68h] char *v32; // [xsp+80h] [xbp+80h] BYREF __int64 v33; // [xsp+88h] [xbp+88h] BYREF __int64 v34; // [xsp+90h] [xbp+90h] BYREF if ( a2 <= 10000000 ) { SongDownloadKey = (char *)MusicDownloadManager::getSongDownloadKey(a1, a2); if ( !MusicDownloadManager::isDLActive(a1, SongDownloadKey) ) { MusicDownloadManager::downloadSongStarted(a1, a2); sub_D153B8((int)&v32, &byte_F288A0); v5 = MusicDownloadManager::sharedState(); if ( MusicDownloadManager::getSongInfoObject(v5, a2) ) { sub_D18D28(&v33); sub_D163D4(&v32, &v33); v7 = (void *)(v33 - 24); if ( (__int64 *)(v33 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v27 = (unsigned int *)(v33 - 8); do v28 = __ldaxr(v27); while ( __stlxr(v28 - 1, v27) ); } else { v28 = *(_DWORD *)(v33 - 8); *(_DWORD *)(v33 - 8) = v28 - 1; } if ( v28 <= 0 ) operator delete(v7); } } if ( !*((_QWORD *)v32 - 3) ) { v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"https://www.newgrounds.com/audio/download/%i", (const char *)(unsigned int)a2); CString = cocos2d::CCString::getCString(v8); v9 = strlen(CString); *(_QWORD *)&v6 = sub_D1798C(&v32, CString, v9).n128_u64[0]; } v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%i.mp3", (const char *)(unsigned int)a2, v6); v11 = (char *)cocos2d::CCString::getCString(v10); sub_D153B8((int)&v34, v11); v12 = operator new(0xB8u); cocos2d::CCObject::CCObject((cocos2d::CCObject *)v12); *(_QWORD *)v12 = &off_115DF30; *(_QWORD *)(v12 + 72) = 0; *(_QWORD *)(v12 + 80) = 0; *(_QWORD *)(v12 + 64) = &byte_124B6C8; *(_QWORD *)(v12 + 88) = 0; *(_QWORD *)(v12 + 96) = &byte_124B6C8; *(_QWORD *)(v12 + 136) = 0; v13 = qword_124B6B0; *(_QWORD *)(v12 + 144) = 0; *(_QWORD *)(v12 + 152) = 0; *(_DWORD *)(v12 + 56) = 5; sub_D174B8(v12 + 64, 0, v13, 0); v14 = *(_QWORD *)(v12 + 96); *(_QWORD *)(v12 + 80) = *(_QWORD *)(v12 + 72); sub_D174B8(v12 + 96, 0, *(_QWORD *)(v14 - 24), 0); v15 = v32; *(_QWORD *)(v12 + 104) = 0; *(_DWORD *)(v12 + 172) = 120; *(_QWORD *)(v12 + 112) = 0; *(_QWORD *)(v12 + 120) = 0; *(_QWORD *)(v12 + 128) = 0; *(_DWORD *)(v12 + 160) = 0; *(_BYTE *)(v12 + 164) = 0; *(_DWORD *)(v12 + 168) = 0; *(_DWORD *)(v12 + 176) = 0; v29 = v15; v16 = strlen(v15); *(_QWORD *)&v17 = sub_D1798C(v12 + 64, v29, v16).n128_u64[0]; *(_DWORD *)(v12 + 56) = 0; *(_QWORD *)(v12 + 104) = a1; *(_QWORD *)(v12 + 112) = MusicDownloadManager::onDownloadSongCompleted; *(_QWORD *)(v12 + 120) = 0; if ( a1 ) cocos2d::CCObject::retain(a1); v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%i", (const char *)(unsigned int)a2, v17); v30 = cocos2d::CCString::getCString(v18); v19 = strlen(v30); sub_D1798C(v12 + 96, v30, v19); Instance = cocos2d::extension::CCHttpClient::getInstance(); cocos2d::extension::CCHttpClient::send(Instance, (cocos2d::extension::CCHttpRequest *)v12); cocos2d::CCObject::release((cocos2d::CCObject *)v12); MusicDownloadManager::addDLToActive(a1, SongDownloadKey, (cocos2d::CCObject *)v12); v21 = (void *)(v34 - 24); if ( (__int64 *)(v34 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v25 = (unsigned int *)(v34 - 8); do v26 = __ldaxr(v25); while ( __stlxr(v26 - 1, v25) ); } else { v26 = *(_DWORD *)(v34 - 8); *(_DWORD *)(v34 - 8) = v26 - 1; } if ( v26 <= 0 ) operator delete(v21); } v22 = v32 - 24; if ( v32 - 24 != (char *)&qword_124B6B0 ) { if ( &pthread_create ) { v23 = (unsigned int *)(v32 - 8); do v24 = __ldaxr(v23); while ( __stlxr(v24 - 1, v23) ); } else { v24 = *((_DWORD *)v32 - 2); *((_DWORD *)v32 - 2) = v24 - 1; } if ( v24 <= 0 ) operator delete(v22); } } } else { MusicDownloadManager::downloadCustomSong(a1, a2); } }
GD Web Decomp Icon

GD Web Decomp

Raw Source