//
// EditorSoundConfigInfoLayer::onDownloadSFX from 0x1401967a0 to 0x140196a2c (652 bytes)
//
// 2 xrefs:
// > EditorSoundConfigInfoLayer::init @ 0x140193cda
// > ??> @ 0x140919520
//
// 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:27:45 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall EditorSoundConfigInfoLayer::onDownloadSFX(__int64 *a1)
{
_QWORD *v2; // rax
__int64 v3; // rbx
__int64 v4; // rbx
__int64 v5; // rdx
__int64 v6; // r8
__int64 v7; // rax
cocos2d::CCString *v8; // rax
const char *CString; // rax
size_t v10; // rbx
size_t v11; // r8
int v12; // r14d
void **v13; // rdx
__int64 v14; // rax
cocos2d::CCObject *v15; // rbx
void *v16; // rcx
__int128 v17; // [rsp+50h] [rbp-39h] BYREF
__int64 v18; // [rsp+60h] [rbp-29h]
__int64 v19; // [rsp+68h] [rbp-21h]
__int128 *v20; // [rsp+70h] [rbp-19h]
void **v21; // [rsp+78h] [rbp-11h]
_BYTE v22[32]; // [rsp+80h] [rbp-9h] BYREF
void *Block[2]; // [rsp+A0h] [rbp+17h] BYREF
__int128 v24; // [rsp+B0h] [rbp+27h]
v2 = (_QWORD *)EditorSoundConfigInfoLayer::missingSFXIDs((__int64)a1, (__int64)&v17);
v3 = (__int64)(v2[1] - *v2) >> 2;
sub_140069730((__int64)&v17);
if ( (_DWORD)v3 )
{
v8 = cocos2d::CCString::createWithFormat("Download %i SFX from this pack?", v3);
CString = cocos2d::CCString::getCString(v8);
*(_OWORD *)Block = 0;
v24 = 0;
v10 = -1;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003D230(Block, CString, v11);
v12 = (_DWORD)a1 + 1016;
if ( !a1 )
v12 = 0;
v13 = Block;
if ( *((_QWORD *)&v24 + 1) > 0xFu )
v13 = (void **)Block[0];
v17 = 0;
v18 = 0;
v19 = 0;
do
++v10;
while ( *((_BYTE *)v13 + v10) );
sub_14003D230(&v17, v13, v10);
v20 = &v17;
v14 = sub_14003F4F0((__int64)v22, (__int64)&v17);
v15 = FLAlertLayer::create(
v12,
(int)"Download SFX",
v14,
(__int64)"Cancel",
(__int64)"Download",
1133903872,
0,
0,
1065353216);
sub_14003D310((__int64)&v17);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v15 + 64LL))(v15, 7007);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v15 + 1064LL))(v15);
if ( *((_QWORD *)&v24 + 1) > 0xFu )
{
v16 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v24 + 1) + 1LL) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
}
else
{
v21 = Block;
*(_OWORD *)Block = 0;
*(_QWORD *)&v24 = 0;
*((_QWORD *)&v24 + 1) = 15;
LOBYTE(Block[0]) = 0;
v17 = 0;
v18 = 0;
v19 = 0;
*(_QWORD *)&v17 = sub_14003D460(0x20u);
v18 = 18;
v19 = 31;
strcpy((char *)v17, "All SFX downloaded");
v4 = *a1;
v7 = TextAlertPopup::create(&v17, v5, v6, 150, Block);
(*(void (__fastcall **)(__int64 *, __int64, __int64))(v4 + 456))(a1, v7, 100);
}
}