//
// EditorSoundBrowserLayer::setTextPopupClosed from 0x1008f15e0 to 0x1008f1839 (601 bytes)
//
// 2 xrefs:
// > sub_1008F1870 @ 0x1008f187c
// > ??> @ 0x100bb5160
//
// 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:37:56 +0000
//
void __fastcall EditorSoundBrowserLayer::setTextPopupClosed(__int64 a1, __int64 a2, std::string *a3)
{
int v4; // r15d
std::string::value_type *data; // r12
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v6; // al
__int64 v7; // rcx
__int64 v8; // rcx
std::string::size_type size; // rcx
std::string::pointer v10; // rdx
std::string::size_type v11; // rcx
__int64 v12; // rax
__int64 v13; // rax
void *v14; // rdi
__int64 v15; // rax
__int128 v16; // [rsp+0h] [rbp-50h] BYREF
void *__p; // [rsp+10h] [rbp-40h]
__int128 v18[3]; // [rsp+18h] [rbp-38h] BYREF
v4 = *(_DWORD *)(a1 + 1184);
*(_DWORD *)(a1 + 1184) = 0;
data = a3->__r_.__value_.__s.__data_;
while ( 1 )
{
while ( 1 )
{
v6 = a3->__r_.__value_.__s.0;
if ( (*(_BYTE *)&a3->__r_.__value_.__s.0 & 1) != 0 )
break;
if ( !*(_BYTE *)&v6 )
goto LABEL_10;
v7 = *(unsigned __int8 *)&v6 >> 1;
if ( *((_BYTE *)&a3->__r_.__value_.__s.0 + v7) != 32 )
goto LABEL_10;
v8 = v7 - 1;
a3->__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v8);
data[v8] = 0;
}
size = a3->__r_.__value_.__l.__size_;
if ( !size )
break;
v10 = a3->__r_.__value_.__l.__data_;
if ( v10[size - 1] != 32 )
break;
v11 = size - 1;
a3->__r_.__value_.__l.__size_ = v11;
v10[v11] = 0;
}
LABEL_10:
while ( (*(_BYTE *)&v6 & 1) == 0 )
{
if ( !*(_BYTE *)&v6 || *data != 32 )
goto LABEL_16;
LABEL_9:
std::string::erase(a3, 0, 1u);
v6 = a3->__r_.__value_.__s.0;
}
if ( a3->__r_.__value_.__l.__size_ && *a3->__r_.__value_.__l.__data_ == 32 )
goto LABEL_9;
LABEL_16:
if ( v4 == 2 )
{
if ( (*(_BYTE *)&v6 & 1) != 0 )
{
if ( !a3->__r_.__value_.__l.__size_ )
return;
}
else if ( !(*(unsigned __int8 *)&v6 >> 1) )
{
return;
}
std::string::operator=((std::string *)(a1 + 1120), a3);
sub_1008F0880(a1, 9);
}
else
{
if ( v4 != 1 )
return;
if ( (*(_BYTE *)&v6 & 1) != 0 )
{
if ( a3->__r_.__value_.__l.__size_ )
goto LABEL_20;
}
else if ( *(unsigned __int8 *)&v6 >> 1 )
{
LABEL_20:
if ( EditorSFXManager::sharedState() )
{
v12 = EditorSFXManager::sharedState();
if ( EditorSFXManager::createMyConfigFromLive(v12, (__int64)a3) )
{
sub_1008F0880(a1, 1);
return;
}
}
__p = operator new(0x38u);
*(_QWORD *)&v16 = 57;
*((_QWORD *)&v16 + 1) = 51;
strcpy((char *)__p, "You already have 50 sound packs. Delete some first.");
v15 = sub_100493AB0(0, (__int64)"Limit Reached", &v16, (__int64)"OK", 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v15 + 1312LL))(v15);
if ( (v16 & 1) != 0 )
{
v14 = __p;
LABEL_34:
operator delete(v14);
}
return;
}
strcpy((char *)v18, "(Please enter a name.");
v13 = sub_100493AB0(0, (__int64)"Error", v18, (__int64)"OK", 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 1312LL))(v13);
if ( (v18[0] & 1) != 0 )
{
v14 = *(void **)&v18[1];
goto LABEL_34;
}
}
}