//
// MusicDownloadManager::customSFXPathLeaf from 0x1006529f0 to 0x100652b36 (326 bytes)
//
// 2 xrefs:
// > sub_1006527D0 @ 0x10065285b
// > sub_1006527D0 @ 0x100652892
//
// 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 12:34:50 +0000
//
std::string *__fastcall MusicDownloadManager::customSFXPathLeaf(std::string *a1, const std::string *a2)
{
std::string *v2; // rbx
std::string::size_type v3; // rax
unsigned int v4; // ecx
std::string::size_type size; // rcx
std::string::pointer data; // r14
std::string::size_type v7; // rax
std::string::size_type v8; // r15
char *v9; // r12
size_t v10; // r13
std::string::size_type v11; // rbx
std::string __dst[2]; // [rsp+10h] [rbp-40h] BYREF
v2 = a1;
v3 = std::string::rfind(a2, 47, 0xFFFFFFFFFFFFFFFFLL);
if ( v3 != -1 )
{
v4 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v4 & 1) != 0 )
{
size = a2->__r_.__value_.__l.__size_;
if ( size > v3 )
{
data = a2->__r_.__value_.__l.__data_;
LABEL_9:
v7 = v3 + 1;
v8 = size - v7;
if ( size - v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v8 >= 0x17 )
{
v10 = 26;
if ( (v8 | 7) != 0x17 )
v10 = (v8 | 7) + 1;
v11 = v7;
v9 = (char *)operator new(v10);
v7 = v11;
v2 = a1;
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v9;
__dst[0].__r_.__value_.__r.__words[0] = v10 + 1;
__dst[0].__r_.__value_.__l.__size_ = v8;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v8);
v9 = __dst[0].__r_.__value_.__s.__data_;
if ( size == v7 )
goto LABEL_17;
}
memmove(v9, &data[v7], v8);
LABEL_17:
v9[v8] = 0;
goto LABEL_19;
}
}
else
{
size = v4 >> 1;
if ( v3 < size )
{
data = a2->__r_.__value_.__s.__data_;
goto LABEL_9;
}
}
sub_100056810();
}
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(__dst, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
else
__dst[0] = *a2;
LABEL_19:
LevelTools::base64DecodeString(v2, __dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
return v2;
}