//
// MusicDownloadManager::isSongDownloaded from 0x14033f250 to 0x14033f376 (294 bytes)
//
// 10 xrefs:
// > AudioAssetsBrowser::onInfo @ 0x14008407c
// > CustomSongWidget::updateSongInfo @ 0x1400cbbab
// > CustomSongWidget::updateWithMultiAssets @ 0x1400cc450
// > GameManager::getMenuMusicFile @ 0x14017b75c
// > GJSongBrowser::loadPage @ 0x1402b780c
// > LevelInfoLayer::onPlay @ 0x1402fc50f
// > MusicDownloadManager::getDownloadedSongs @ 0x14033e630
// > MusicDownloadManager::clearUnusedSongs @ 0x14033e88c
// > PlayLayer::togglePracticeMode @ 0x1403b9f94
// > ??> @ 0x1406d56cc
//
// 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
bool MusicDownloadManager::isSongDownloaded(MusicDownloadManager *a1, int a2)
{
__int64 v3; // r11
_QWORD *v5; // rax
size_t v6; // r8
__int64 v7; // rcx
__int64 v8; // rax
char v9; // bl
void *v10; // rcx
int v11; // [rsp+20h] [rbp-58h] BYREF
void *Block[2]; // [rsp+28h] [rbp-50h] BYREF
__m128i si128; // [rsp+38h] [rbp-40h]
_BYTE v14[32]; // [rsp+48h] [rbp-30h] BYREF
v11 = a2;
if ( sub_14005F8D0(&a1->m_resourceSongUnorderedSet._Traitsobj._Mypair._Myval2._Myval2, (unsigned __int8 *)&v11) )
return 1;
v5 = (_QWORD *)MusicDownloadManager::pathForSong(v3, v14, (unsigned int)a2);
if ( v5[3] > 0xFu )
v5 = (_QWORD *)*v5;
*(_OWORD *)Block = 0;
si128 = 0;
v6 = -1;
do
++v6;
while ( *((_BYTE *)v5 + v6) );
sub_14003A930(Block, v5, v6);
v8 = cocos2d::CCFileUtils::sharedFileUtils(v7);
v9 = (*(__int64 (__fastcall **)(__int64, void **))(*(_QWORD *)v8 + 152LL))(v8, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v10 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v10);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
sub_14003A830((__int64)v14);
return v9;
}