//
// EditorSoundBrowserLayer::setTextPopupClosed from 0x783588 to 0x78372a (418 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'EditorSoundBrowserLayer::setTextPopupClosed @ 0x78374c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:59:30 +0000
//
EditorSFXManager *__fastcall EditorSoundBrowserLayer::setTextPopupClosed(int a1, int a2, unsigned __int8 *a3)
{
int v4; // r2
int v6; // r8
int v7; // r3
EditorSFXManager *result; // r0
int v9; // r2
unsigned __int8 *v10; // r4
int v11; // r4
_BYTE *v12; // r2
int v13; // r4
EditorSFXManager *v14; // r3
int v15; // r1
size_t v16; // r4
int v17; // r2
int v18; // r3
int v19; // r3
int v20; // r4
int *v21; // r0
EditorSFXManager *v22; // r0
int *v23; // r0
int v24; // r0
EditorSoundBrowserLayer *v25; // r0
int v26; // r1
int v27; // r4
int v28; // [sp+8h] [bp-14h] BYREF
int v29; // [sp+Ch] [bp-10h]
int v30; // [sp+10h] [bp-Ch]
int v31; // [sp+14h] [bp-8h]
v4 = _stack_chk_guard;
v6 = *(_DWORD *)(a1 + 800);
*(_DWORD *)(a1 + 800) = 0;
v31 = v4;
while ( 1 )
{
v7 = *a3;
result = (EditorSFXManager *)(v7 & 1);
if ( (v7 & 1) != 0 )
{
v9 = *((_DWORD *)a3 + 1);
if ( !v9 )
break;
v10 = *((unsigned __int8 **)a3 + 2);
}
else
{
v9 = v7 >> 1;
if ( !(v7 >> 1) )
break;
v10 = a3 + 1;
}
if ( v10[v9 - 1] != 32 )
break;
if ( (v7 & 1) != 0 )
{
v17 = *((_DWORD *)a3 + 2);
v18 = *((_DWORD *)a3 + 1) - 1;
*((_DWORD *)a3 + 1) = v18;
*(_BYTE *)(v17 + v18) = 0;
}
else
{
v19 = (v7 >> 1) - 1;
*a3 = 2 * v19;
a3[v19 + 1] = 0;
}
}
while ( 1 )
{
v11 = *a3;
if ( (v11 & 1) == 0 )
break;
if ( !*((_DWORD *)a3 + 1) )
{
if ( v6 == 1 )
{
LABEL_30:
v20 = *((_DWORD *)a3 + 1);
goto LABEL_33;
}
if ( v6 == 2 )
goto LABEL_42;
return result;
}
v12 = *((_BYTE **)a3 + 2);
LABEL_13:
if ( *v12 != 32 )
{
if ( v6 == 1 )
{
if ( (v11 & 1) != 0 )
goto LABEL_30;
LABEL_32:
v20 = v11 >> 1;
LABEL_33:
if ( !v20 )
{
v28 = 0;
v29 = 0;
v30 = 0;
std::string::__init(&v28, "Please enter a name.", 0x14u);
v21 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Error", (int)&v28, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(int *))(*v21 + 656))(v21);
return (EditorSFXManager *)std::string::~string((int)&v28);
}
v22 = (EditorSFXManager *)EditorSFXManager::sharedState(result);
if ( !v22 || (v24 = EditorSFXManager::sharedState(v22), !EditorSFXManager::createMyConfigFromLive(v24, (int)a3)) )
{
v28 = 0;
v29 = 0;
v30 = 0;
std::string::__init(&v28, "You already have 50 sound packs. Delete some first.", 0x33u);
v23 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Limit Reached",
(int)&v28,
(ButtonSprite *)"OK",
nullptr);
(*(void (__fastcall **)(int *))(*v23 + 656))(v23);
return (EditorSFXManager *)std::string::~string((int)&v28);
}
v25 = (EditorSoundBrowserLayer *)a1;
v26 = 1;
return (EditorSFXManager *)EditorSoundBrowserLayer::setMode(v25, v26);
}
if ( v6 != 2 )
return result;
if ( (v11 & 1) != 0 )
{
LABEL_42:
v27 = *((_DWORD *)a3 + 1);
LABEL_45:
if ( !v27 )
return result;
std::string::operator=((unsigned __int8 *)(a1 + 768), a3);
v25 = (EditorSoundBrowserLayer *)a1;
v26 = 9;
return (EditorSFXManager *)EditorSoundBrowserLayer::setMode(v25, v26);
}
LABEL_44:
v27 = v11 >> 1;
goto LABEL_45;
}
if ( (v11 & 1) != 0 )
{
v13 = *((_DWORD *)a3 + 1);
v14 = *((EditorSFXManager **)a3 + 2);
}
else
{
v13 = v11 >> 1;
v14 = (EditorSFXManager *)(a3 + 1);
}
v15 = v13;
if ( v13 )
v15 = 1;
v16 = v13 - v15;
if ( v16 )
{
result = (EditorSFXManager *)memmove(v14, (char *)v14 + v15, v16);
v14 = result;
}
if ( (*a3 & 1) != 0 )
*((_DWORD *)a3 + 1) = v16;
else
*a3 = 2 * v16;
*((_BYTE *)v14 + v16) = 0;
}
if ( (unsigned int)v11 >> 1 )
{
v12 = a3 + 1;
goto LABEL_13;
}
if ( v6 == 1 )
goto LABEL_32;
if ( v6 == 2 )
goto LABEL_44;
return result;
}