//
// EditorSoundBrowserLayer::setTextPopupClosed from 0xccaa78 to 0xccad28 (688 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'EditorSoundBrowserLayer::setTextPopupClosed @ 0xccad2c
// > ??> @ 0x101da0
// > ??> @ 0x14fde30
//
// This function is hookable on this platform (idp: arm, 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 13:06:23 +0000
//
__int64 __fastcall EditorSoundBrowserLayer::setTextPopupClosed(
EditorSoundBrowserLayer *this,
__int64 a2,
unsigned __int8 *a3)
{
unsigned __int8 *v3; // x3
int v6; // w23
__int64 v7; // x0
int v8; // w2
__int64 v9; // x0
__int64 v10; // x1
int v11; // w1
__int64 v12; // x19
unsigned __int8 *v13; // x3
const void *v15; // x1
size_t v16; // x2
size_t v17; // x19
__int64 v18; // x0
EditorSFXManager *v19; // x0
__int64 v20; // x0
__int64 v21; // x0
__int64 v22; // [xsp+40h] [xbp+40h] BYREF
__int64 v23; // [xsp+48h] [xbp+48h]
void *v24; // [xsp+50h] [xbp+50h]
__int64 v25; // [xsp+58h] [xbp+58h]
v3 = a3 + 1;
v6 = *((_DWORD *)this + 296);
v7 = _stack_chk_guard;
*((_DWORD *)this + 296) = 0;
v25 = v7;
while ( 1 )
{
while ( 1 )
{
v8 = *a3;
if ( (v8 & 1) == 0 )
break;
v9 = *((_QWORD *)a3 + 1);
if ( !v9 )
goto LABEL_5;
--v9;
v10 = *((_QWORD *)a3 + 2);
if ( *(_BYTE *)(v10 + v9) != 32 )
goto LABEL_5;
*((_QWORD *)a3 + 1) = v9;
*(_BYTE *)(v10 + v9) = 0;
}
v9 = (int)*a3 >> 1;
if ( !(_DWORD)v9 )
break;
v9 = (int)v9 - 1LL;
if ( v3[v9] != 32 )
break;
*a3 = 2 * v9;
v3[v9] = 0;
}
while ( 1 )
{
LABEL_5:
v11 = v8 & 1;
if ( (v8 & 1) != 0 )
{
v12 = *((_QWORD *)a3 + 1);
if ( !v12 || (v13 = *((unsigned __int8 **)a3 + 2), v9 = *v13, (_DWORD)v9 != 32) )
{
if ( v6 != 1 )
{
v11 = 1;
if ( v6 != 2 )
return _stack_chk_guard;
LABEL_19:
if ( v12 )
{
if ( a3 != (unsigned __int8 *)((char *)this + 1120) )
{
if ( v11 )
{
v15 = *((const void **)a3 + 2);
v16 = *((_QWORD *)a3 + 1);
}
else
{
v15 = a3 + 1;
v16 = (unsigned __int8)v8 >> 1;
}
std::string::assign((__int64 *)this + 140, v15, v16);
}
EditorSoundBrowserLayer::setMode(this, 9);
}
return _stack_chk_guard;
}
goto LABEL_33;
}
v17 = v12 - 1;
if ( !v17 )
goto LABEL_31;
goto LABEL_30;
}
LODWORD(v12) = v8 >> 1;
if ( !(v8 >> 1) )
break;
v9 = a3[1];
if ( (_DWORD)v9 != 32 )
break;
v13 = a3 + 1;
v17 = (int)v12 - 1LL;
if ( !v17 )
goto LABEL_27;
LABEL_30:
v13 = (unsigned __int8 *)memmove(v13, v13 + 1, v17);
v9 = *a3;
if ( (v9 & 1) == 0 )
{
LABEL_27:
v9 = (unsigned int)(2 * v17);
*a3 = 2 * v17;
goto LABEL_28;
}
LABEL_31:
*((_QWORD *)a3 + 1) = v17;
LABEL_28:
v13[v17] = 0;
v8 = *a3;
}
if ( v6 != 1 )
{
if ( v6 != 2 )
return _stack_chk_guard;
v12 = (int)v12;
goto LABEL_19;
}
v12 = (int)v12;
LABEL_33:
if ( v12 )
{
v19 = (EditorSFXManager *)EditorSFXManager::sharedState((EditorSFXManager *)v9);
if ( v19 )
{
v20 = EditorSFXManager::sharedState(v19);
if ( EditorSFXManager::createMyConfigFromLive(v20, (__int64)a3) )
{
EditorSoundBrowserLayer::setMode(this, 1);
return _stack_chk_guard;
}
}
v22 = 0;
v23 = 0;
v24 = nullptr;
std::string::__init(&v22, "You already have 50 sound packs. Delete some first.", 0x33u);
v21 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Limit Reached",
(char *)&v22,
(ButtonSprite *)"OK",
nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v21 + 1312LL))(v21);
}
else
{
v22 = 0;
v23 = 0;
v24 = nullptr;
std::string::__init(&v22, "Please enter a name.", 0x14u);
v18 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Error", (char *)&v22, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v18 + 1312LL))(v18);
}
if ( (v22 & 1) != 0 )
operator delete(v24);
return _stack_chk_guard;
}