//
// GameManager::getMenuMusicFile from 0x140276540 to 0x1402766b3 (371 bytes)
//
// 4 xrefs:
// > GameManager::playMenuMusic @ 0x1402767b9
// > GameManager::fadeInMenuMusic @ 0x140276a18
// > ??> @ 0x14091cd54
// > ??> @ 0x14091cd60
//
// 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:28:56 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall GameManager::getMenuMusicFile(__int64 a1, __int64 a2)
{
__int64 v4; // rcx
__int64 v5; // rcx
_QWORD *v6; // rax
size_t v7; // r8
void *v9; // [rsp+20h] [rbp-48h]
void *v10; // [rsp+20h] [rbp-48h]
_BYTE v11[32]; // [rsp+30h] [rbp-38h] BYREF
if ( *(int *)(a1 + 1164) > 0 )
{
v4 = qword_14090C070;
if ( !qword_14090C070 )
{
v9 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v4 = qword_14090C070;
}
if ( !(unsigned __int8)MusicDownloadManager::isSongDownloaded(v4, *(unsigned int *)(a1 + 1164)) )
*(_DWORD *)(a1 + 1164) = 0;
}
if ( *(int *)(a1 + 1164) <= 0 )
{
*(_OWORD *)a2 = 0;
*(_QWORD *)(a2 + 16) = 12;
*(_QWORD *)(a2 + 24) = 15;
strcpy((char *)a2, "menuLoop.mp3");
}
else
{
v5 = qword_14090C070;
if ( !qword_14090C070 )
{
v10 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v5 = qword_14090C070;
}
v6 = (_QWORD *)MusicDownloadManager::pathForSong(v5, v11, *(unsigned int *)(a1 + 1164));
if ( v6[3] > 0xFu )
v6 = (_QWORD *)*v6;
*(_OWORD *)a2 = 0;
*(_QWORD *)(a2 + 16) = 0;
*(_QWORD *)(a2 + 24) = 0;
v7 = -1;
do
++v7;
while ( *((_BYTE *)v6 + v7) );
sub_14003D230((_QWORD *)a2, v6, v7);
sub_14003D310((__int64)v11);
}
return a2;
}