//
// sub_1006527D0 from 0x1006527d0 to 0x1006529be (494 bytes)
//
// 5 xrefs:
// > SFXBrowser::refreshLevelIDList @ 0x1004305ee
// > SFXBrowser::refreshLevelIDList @ 0x100430693
// > SetupSFXPopup::createSFXWidget @ 0x1004b3052
// > SFXSearchResult::updateObjects @ 0x100669b65
// > EditorSFXActionConfigLayer::refreshRows @ 0x1008e006b
//
// 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
//
char *__fastcall sub_1006527D0(__int64 a1, int a2, unsigned int a3, const std::string *a4)
{
__int64 v6; // rax
char *v7; // r14
unsigned int v8; // eax
__int64 v9; // rdi
__int64 v10; // r14
int v11; // ecx
int v12; // r8d
std::string::size_type v14; // rax
size_t v15; // r15
unsigned int v16; // eax
size_t size; // rax
std::string::pointer data; // rbx
char *v19; // r12
size_t v20; // r13
std::string v21; // [rsp+0h] [rbp-70h] BYREF
std::string v22; // [rsp+18h] [rbp-58h] BYREF
_QWORD __dst[2]; // [rsp+30h] [rbp-40h] BYREF
void *v24; // [rsp+40h] [rbp-30h]
if ( a2 <= 0 || (int)a3 <= 0 )
return nullptr;
if ( *(_QWORD *)(a1 + 824) )
{
v6 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 824), a3);
if ( v6 )
{
v7 = (char *)v6;
if ( !*(_BYTE *)(v6 + 72) && *(_DWORD *)(v6 + 56) == a2 )
return v7;
}
}
v8 = (unsigned int)a4->__r_.__value_.__l.0;
if ( (v8 & 1) != 0 )
{
if ( a4->__r_.__value_.__l.__size_ )
goto LABEL_8;
return nullptr;
}
if ( !(v8 >> 1) )
return nullptr;
LABEL_8:
v9 = *(_QWORD *)(a1 + 400);
if ( v9 )
{
v10 = cocos2d::CCDictionary::objectForKey_1(v9, (unsigned int)a2);
MusicDownloadManager::customSFXPathLeaf(&v22, a4);
if ( v10 )
{
v11 = *(_DWORD *)(v10 + 64);
v12 = *(_DWORD *)(v10 + 68);
goto LABEL_16;
}
}
else
{
MusicDownloadManager::customSFXPathLeaf(&v22, a4);
}
v11 = 0;
v12 = 0;
LABEL_16:
v7 = SFXInfoObject::create(a2, &v22, 0, v11, v12);
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v22.__r_.__value_.__l.__data_);
*((_DWORD *)v7 + 19) = a3;
v14 = std::string::rfind(a4, 47, 0xFFFFFFFFFFFFFFFFLL);
if ( v14 != -1 )
{
v15 = v14;
v16 = (unsigned int)a4->__r_.__value_.__l.0;
if ( (v16 & 1) != 0 )
{
size = a4->__r_.__value_.__l.__size_;
data = a4->__r_.__value_.__l.__data_;
}
else
{
size = v16 >> 1;
data = a4->__r_.__value_.__s.__data_;
}
if ( size < v15 )
v15 = size;
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v15 >= 0x17 )
{
v20 = 26;
if ( (v15 | 7) != 0x17 )
v20 = (v15 | 7) + 1;
v19 = (char *)operator new(v20);
v24 = v19;
__dst[0] = v20 + 1;
__dst[1] = v15;
}
else
{
LOBYTE(__dst[0]) = 2 * v15;
v19 = (char *)__dst + 1;
if ( !v15 )
goto LABEL_32;
}
memmove(v19, data, v15);
LABEL_32:
v19[v15] = 0;
MusicDownloadManager::customSFXPathDisplay(&v21);
if ( (v7[128] & 1) != 0 )
operator delete(*((void **)v7 + 18));
*(std::string *)(v7 + 128) = v21;
*(_WORD *)&v21.__r_.__value_.__l.0 = 0;
if ( (__dst[0] & 1) != 0 )
operator delete(v24);
}
return v7;
}