//
// MusicDownloadManager::resolveSFXPlacement from 0x140486700 to 0x1404868b9 (441 bytes)
//
// 6 xrefs:
// > EditorSFXActionConfigLayer::refreshRows @ 0x1401841e7
// > SFXSearchResult::updateObjects @ 0x14049b75d
// > SetupSFXPopup::createSFXWidget @ 0x1405de11b
// > SFXBrowser::refreshLevelIDList @ 0x14061bafc
// > ??> @ 0x140928c34
// > ??> @ 0x140928c40
//
// 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=1
struct cocos2d::CCObject *__fastcall MusicDownloadManager::resolveSFXPlacement(__int64 a1, int a2, int a3, __int64 *a4)
{
__int64 v6; // rdi
cocos2d::CCDictionary *v8; // rcx
struct cocos2d::CCObject *result; // rax
cocos2d::CCDictionary *v10; // rcx
struct cocos2d::CCObject *v11; // rax
int v12; // ebp
int v13; // r14d
int v14; // eax
__int64 v15; // rdi
__int64 v16; // r8
__int64 v17; // rcx
size_t v18; // rax
__int64 v19; // rax
void *v20; // rcx
_BYTE v21[32]; // [rsp+38h] [rbp-90h] BYREF
void *Block[2]; // [rsp+58h] [rbp-70h] BYREF
__int128 v23; // [rsp+68h] [rbp-60h]
_BYTE Src[32]; // [rsp+78h] [rbp-50h] BYREF
v6 = a2;
if ( a2 <= 0 || a3 <= 0 )
return nullptr;
v8 = *(cocos2d::CCDictionary **)(a1 + 920);
if ( v8 )
{
result = cocos2d::CCDictionary::objectForKey(v8, a3);
if ( result )
{
if ( !*((_BYTE *)result + 72) && *((_DWORD *)result + 14) == (_DWORD)v6 )
return result;
}
}
if ( !a4[2] )
return nullptr;
v10 = *(cocos2d::CCDictionary **)(a1 + 408);
if ( v10 && (v11 = cocos2d::CCDictionary::objectForKey(v10, v6)) != nullptr )
{
v12 = *((_DWORD *)v11 + 17);
v13 = *((_DWORD *)v11 + 16);
}
else
{
v12 = 0;
v13 = 0;
}
v14 = MusicDownloadManager::customSFXPathLeaf(v21, a4);
v15 = SFXInfoObject::create(v6, v14, 0, v13, v12);
*(_DWORD *)(v15 + 76) = a3;
v17 = (__int64)a4;
if ( (unsigned __int64)a4[3] > 0xF )
v17 = *a4;
v18 = sub_14007B240(v17, a4[2], v16, 0x2Fu);
if ( v18 != -1 )
{
*(_OWORD *)Block = 0;
v23 = 0;
if ( a4[2] < v18 )
v18 = a4[2];
if ( (unsigned __int64)a4[3] > 0xF )
a4 = (__int64 *)*a4;
sub_14003D230(Block, a4, v18);
v19 = MusicDownloadManager::customSFXPathDisplay(Src);
sub_140059C40(v15 + 144, v19);
sub_14003D310((__int64)Src);
if ( *((_QWORD *)&v23 + 1) > 0xFu )
{
v20 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v23 + 1) + 1LL) >= 0x1000 )
{
v20 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
}
}
return (struct cocos2d::CCObject *)v15;
}