//
// LevelEditorLayer::getSongIDs from 0x374b38 to 0x374cf8 (448 bytes)
//
// 2 xrefs:
// > EditorPauseLayer::init @ 0x3ff710
// > EditorPauseLayer::saveLevel @ 0x40150c
//
// 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::getSongIDs(LevelEditorLayer *this, bool *a2, bool *a3)
{
int v6; // r3
int v7; // r5
int v8; // r9
_BOOL4 v9; // r5
int v10; // r0
int v11; // r3
bool v12; // r3
_DWORD *v13; // r2
int *v14; // r5
int v15; // r3
int v16; // t1
_DWORD *v17; // r8
int v18; // r3
int v19; // r11
int v20; // r0
char *v21; // r0
int *v23; // [sp+0h] [bp-23Ch]
int v24; // [sp+8h] [bp-234h] BYREF
int v25; // [sp+Ch] [bp-230h] BYREF
int v26; // [sp+10h] [bp-22Ch]
_DWORD v27[2]; // [sp+14h] [bp-228h] BYREF
_BYTE v28[4]; // [sp+1Ch] [bp-220h] BYREF
_DWORD *v29[4]; // [sp+20h] [bp-21Ch] BYREF
unsigned int v30; // [sp+30h] [bp-20Ch]
unsigned int v31[3]; // [sp+34h] [bp-208h] BYREF
char v32; // [sp+40h] [bp-1FCh] BYREF
memset(v29, 0, sizeof(v29));
v30 = 0;
v6 = *((_DWORD *)a2 + 386);
v29[2] = v29;
v29[3] = v29;
v7 = *(_DWORD *)(v6 + 356);
if ( v7 > 0 )
{
v27[0] = *(_DWORD *)(v6 + 356);
std::_Rb_tree,std::less,std::allocator>::_M_get_insert_unique_pos(
&v25,
(int)v28,
v27);
v8 = v26;
if ( v26 )
{
v9 = v25 || (_DWORD **)v26 == v29 || v7 < *(_DWORD *)(v26 + 16);
v10 = operator new(0x14u);
*(_DWORD *)(v10 + 16) = v27[0];
sub_7620E8(v9, v10, v8, v29);
++v30;
}
}
v11 = *((_DWORD *)a2 + 561);
if ( v11 )
{
v13 = *(_DWORD **)(v11 + 52);
if ( *v13 )
{
v14 = (int *)v13[3];
v23 = &v14[*v13 - 1];
while ( v14 <= v23 )
{
v16 = *v14++;
v15 = v16;
if ( !v16 )
break;
if ( *(_DWORD *)(v15 + 884) == 1934 )
{
v24 = *(_DWORD *)(v15 + 1640);
if ( v24 > 0 )
std::_Rb_tree,std::less,std::allocator>::_M_insert_unique(
(int)v27,
(int)v28,
&v24);
}
}
}
}
if ( *(int *)(*((_DWORD *)a2 + 386) + 356) <= 0 )
v12 = v30 != 0;
else
v12 = v30 > 1;
*a3 = v12;
if ( v30 )
{
v17 = v29[2];
v31[0] = 0;
v31[1] = 500;
v31[2] = (unsigned int)&v32;
v18 = 1;
while ( v17 != v29 )
{
v19 = v17[4];
if ( !v18 )
{
v27[0] = ",";
v27[1] = 0;
fmt::BasicWriter::operator<<(v31, ",", 0);
}
fmt::BasicWriter::operator<<(v31, v19);
v20 = sub_761FE0(v17);
v18 = 0;
v17 = (_DWORD *)v20;
}
v21 = (char *)fmt::BasicWriter::c_str((int *)v31);
sub_776584((int)this, v21);
fmt::internal::Array::free((int)v31);
}
else
{
sub_776584((int)this, (char *)&unk_939830);
}
std::_Rb_tree,std::less,std::allocator>::_M_erase((int)v28, v29[1]);
return this;
}