//
// LevelEditorLayer::getSFXIDs from 0x374d04 to 0x374e30 (300 bytes)
//
// 2 xrefs:
// > EditorPauseLayer::init @ 0x3ff762
// > EditorPauseLayer::saveLevel @ 0x401528
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
LevelEditorLayer *__fastcall LevelEditorLayer::getSFXIDs(LevelEditorLayer *this, int a2)
{
int v4; // r3
_DWORD *v5; // r2
int *v6; // r5
int *v7; // r11
int v8; // r3
int v9; // t1
_DWORD *v10; // r7
int v11; // r3
int v12; // r11
int v13; // r0
char *v14; // r0
int v16; // [sp+8h] [bp-22Ch] BYREF
_DWORD v17[2]; // [sp+Ch] [bp-228h] BYREF
_BYTE v18[4]; // [sp+14h] [bp-220h] BYREF
_DWORD *v19[4]; // [sp+18h] [bp-21Ch] BYREF
int v20; // [sp+28h] [bp-20Ch]
unsigned int v21[3]; // [sp+2Ch] [bp-208h] BYREF
char v22; // [sp+38h] [bp-1FCh] BYREF
memset(v19, 0, sizeof(v19));
v20 = 0;
v4 = *(_DWORD *)(a2 + 2244);
v19[2] = v19;
v19[3] = v19;
if ( v4 )
{
v5 = *(_DWORD **)(v4 + 52);
if ( *v5 )
{
v6 = (int *)v5[3];
v7 = &v6[*v5 - 1];
while ( v6 <= v7 )
{
v9 = *v6++;
v8 = v9;
if ( !v9 )
break;
if ( *(_DWORD *)(v8 + 884) == 3602 )
{
v16 = *(_DWORD *)(v8 + 1640);
if ( v16 > 0 )
std::_Rb_tree,std::less,std::allocator>::_M_insert_unique(
(int)v17,
(int)v18,
&v16);
}
}
}
}
if ( v20 )
{
v10 = v19[2];
v21[0] = 0;
v21[1] = 500;
v21[2] = (unsigned int)&v22;
v11 = 1;
while ( v10 != v19 )
{
v12 = v10[4];
if ( !v11 )
{
v17[0] = ",";
v17[1] = 0;
fmt::BasicWriter::operator<<(v21, ",", 0);
}
fmt::BasicWriter::operator<<(v21, v12);
v13 = sub_761FE0(v10);
v11 = 0;
v10 = (_DWORD *)v13;
}
v14 = (char *)fmt::BasicWriter::c_str((int *)v21);
sub_776584((int)this, v14);
fmt::internal::Array::free((int)v21);
}
else
{
sub_776584((int)this, (char *)&unk_939830);
}
std::_Rb_tree,std::less,std::allocator>::_M_erase((int)v18, v19[1]);
return this;
}