//
// MusicDownloadManager::isSongDownloaded from 0x1404845a0 to 0x1404846d4 (308 bytes)
//
// 9 xrefs:
// > AudioAssetsBrowser::onInfo @ 0x140099902
// > CustomSongWidget::updateSongInfo @ 0x14016cab5
// > CustomSongWidget::updateWithMultiAssets @ 0x14016d4b6
// > GameManager::getMenuMusicFile @ 0x1402765b3
// > LevelInfoLayer::onPlay @ 0x1404215c6
// > MusicDownloadManager::getDownloadedSongs @ 0x1404838e0
// > MusicDownloadManager::clearUnusedSongs @ 0x140483b3c
// > PlayLayer::playPracticeMusic @ 0x14051a1fe
// > ??> @ 0x140928ac0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:32:46 +0000
//
// Hidden C++ exception states: #wind=2
char __fastcall MusicDownloadManager::isSongDownloaded(__int64 a1, int a2)
{
__int64 v2; // r10
unsigned int v3; // r11d
_QWORD *v5; // rax
size_t v6; // r8
__int64 v7; // rcx
__int64 v8; // rax
char v9; // bl
void *v10; // r8
unsigned __int8 v11[8]; // [rsp+30h] [rbp-58h] BYREF
void *Block[2]; // [rsp+38h] [rbp-50h] BYREF
__m128i si128; // [rsp+48h] [rbp-40h]
_BYTE v14[32]; // [rsp+58h] [rbp-30h] BYREF
*(_DWORD *)v11 = a2;
if ( sub_140066B50((_QWORD *)(a1 + 584), v11) )
return 1;
v5 = (_QWORD *)MusicDownloadManager::pathForSong(v2, v14, v3);
if ( v5[3] > 0xFu )
v5 = (_QWORD *)*v5;
*(_OWORD *)Block = 0;
si128 = 0;
v6 = -1;
do
++v6;
while ( *((_BYTE *)v5 + v6) );
sub_14003D230(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 )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v10);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
sub_14003D310((__int64)v14);
return v9;
}