//
// MusicDownloadManager::pathForSongFolder from 0x14033f380 to 0x14033f4c7 (327 bytes)
//
// 4 xrefs:
// > MusicDownloadManager::pathForSong @ 0x14033f4fc
// > MusicDownloadManager::onDownloadMusicLibraryCompleted @ 0x140340c9e
// > MusicDownloadManager::parseMusicLibrary @ 0x140340dd0
// > ??> @ 0x1406d56d8
//
// 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
_QWORD *__fastcall MusicDownloadManager::pathForSongFolder(__int64 a1, _QWORD *a2, int a3)
{
GameManager *v4; // rcx
__int64 v5; // rcx
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v11[2]; // [rsp+28h] [rbp-40h] BYREF
_BYTE v12[32]; // [rsp+38h] [rbp-30h] BYREF
v11[1] = (__int64)a2;
*(_OWORD *)a2 = 0;
a2[2] = 0;
a2[3] = 15;
*(_BYTE *)a2 = 0;
LODWORD(v11[0]) = a3;
if ( sub_14005F8D0((_QWORD *)(a1 + 544), (unsigned __int8 *)v11) )
{
sub_140041270(a2, "songs/", 6u);
}
else
{
v4 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v11[0] = (__int64)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v11[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v4, "0033") )
{
v6 = cocos2d::CCFileUtils::sharedFileUtils(v5);
v7 = (*(__int64 (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v6 + 144LL))(v6, v12);
sub_140051590((__int64)a2, v7);
sub_14003A830((__int64)v12);
sub_140041270(a2, "Resources\\", 0xAu);
}
else
{
v8 = cocos2d::CCFileUtils::sharedFileUtils(v5);
v9 = (*(__int64 (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v8 + 136LL))(v8, v12);
sub_140051590((__int64)a2, v9);
sub_14003A830((__int64)v12);
}
}
return a2;
}