//
// SFXFolderPickerPopup::pickFolder from 0x1400c6010 to 0x1400c6265 (597 bytes)
//
// 2 xrefs:
// > SFXFolderPickerPopup::onConfirm @ 0x1400c63e1
// > ??> @ 0x140913d30
//
// 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:26:20 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall SFXFolderPickerPopup::pickFolder(_QWORD *a1, unsigned int a2)
{
__int64 v4; // rax
_BYTE *v5; // rax
size_t v6; // r8
void **v7; // rax
char v8; // di
void *v9; // rcx
void *v10; // rcx
void (__fastcall ***v11)(_QWORD, _QWORD *, _QWORD, void **); // rcx
__int64 v12; // rax
__int64 v13; // rdx
void *v14; // rcx
void *Block[2]; // [rsp+38h] [rbp-80h] BYREF
__m128i si128; // [rsp+48h] [rbp-70h]
void *v17[2]; // [rsp+58h] [rbp-60h] BYREF
__int128 v18; // [rsp+68h] [rbp-50h]
void *v19[2]; // [rsp+78h] [rbp-40h] BYREF
__int128 v20; // [rsp+88h] [rbp-30h]
v4 = a1[91];
if ( v4 )
{
v5 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(v4 + 592) + 600LL) + 8LL))(*(_QWORD *)(v4 + 592) + 600LL);
*(_OWORD *)v17 = 0;
v18 = 0;
v6 = -1;
do
++v6;
while ( v5[v6] );
sub_14003D230(v17, v5, v6);
v7 = v17;
v8 = 5;
}
else
{
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
v7 = Block;
v8 = 2;
}
*(_OWORD *)v19 = *(_OWORD *)v7;
v20 = *((_OWORD *)v7 + 1);
v7[2] = nullptr;
v7[3] = (void *)15;
*(_BYTE *)v7 = 0;
if ( (v8 & 2) != 0 )
{
v8 &= ~2u;
if ( si128.m128i_i64[1] > 0xFuLL )
{
v9 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
}
if ( (v8 & 1) != 0 && *((_QWORD *)&v18 + 1) > 0xFu )
{
v10 = v17[0];
if ( (unsigned __int64)(*((_QWORD *)&v18 + 1) + 1LL) >= 0x1000 )
{
v10 = *((void **)v17[0] - 1);
if ( (unsigned __int64)((char *)v17[0] - (char *)v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v10);
}
dword_140909790 = a2;
v11 = (void (__fastcall ***)(_QWORD, _QWORD *, _QWORD, void **))a1[90];
if ( v11 )
(**v11)(v11, a1, a2, v19);
v12 = a1[91];
if ( v12 )
{
*(_QWORD *)(v12 + 600) = 0;
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)a1[91] + 1032LL))(a1[91], 0);
}
(*(void (__fastcall **)(_QWORD *, _QWORD))(*a1 + 992LL))(a1, 0);
LOBYTE(v13) = 1;
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 520LL))(a1, v13);
if ( *((_QWORD *)&v20 + 1) > 0xFu )
{
v14 = v19[0];
if ( (unsigned __int64)(*((_QWORD *)&v20 + 1) + 1LL) >= 0x1000 )
{
v14 = *((void **)v19[0] - 1);
if ( (unsigned __int64)((char *)v19[0] - (char *)v14 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v14);
}
}