//
// LevelEditorLayer::getSongIDs from 0x6793d0 to 0x679704 (820 bytes)
//
// 3 xrefs:
// > EditorPauseLayer::init @ 0x78b4ec
// > EditorPauseLayer::saveLevel @ 0x78e470
// > ??> @ 0x55920
//
// 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
//
__int64 __usercall LevelEditorLayer::getSongIDs@(LevelEditorLayer *this@, bool *a2@, __int64 a3@)
{
int m_songID; // w19
__int64 v7; // x0
cocos2d::CCArray *m_objects; // x1
unsigned __int64 v9; // x0
cocos2d::ccArray *data; // x1
int *v11; // x19
int v12; // w25
unsigned int v13; // w22
size_t v14; // x25
size_t v15; // x24
size_t v16; // x19
__int64 v17; // x19
void *v18; // x0
cocos2d::CCObject **arr; // x19
cocos2d::CCObject **v21; // x22
cocos2d::CCObject *v22; // x0
int m_unknown2; // [xsp+60h] [xbp+60h] BYREF
__int64 v24; // [xsp+68h] [xbp+68h] BYREF
int v25; // [xsp+70h] [xbp+70h] BYREF
__int64 v26; // [xsp+78h] [xbp+78h]
int *v27; // [xsp+80h] [xbp+80h]
int *v28; // [xsp+88h] [xbp+88h]
unsigned __int64 v29; // [xsp+90h] [xbp+90h]
size_t v30; // [xsp+98h] [xbp+98h] BYREF
unsigned __int64 v31; // [xsp+A0h] [xbp+A0h]
char *v32; // [xsp+A8h] [xbp+A8h]
_BYTE v33[504]; // [xsp+B0h] [xbp+B0h] BYREF
m_songID = this->m_level->m_songID;
v25 = 0;
v26 = 0;
v29 = 0;
v27 = &v25;
v28 = &v25;
if ( m_songID <= 0 )
{
m_objects = this->m_objects;
v9 = 0;
if ( !m_objects )
goto LABEL_7;
goto LABEL_3;
}
v7 = operator new(0x28u);
*(_DWORD *)(v7 + 32) = m_songID;
sub_CFAD74(1, v7, &v25, &v25);
m_objects = this->m_objects;
v9 = ++v29;
if ( m_objects )
{
LABEL_3:
data = m_objects->data;
if ( data->num )
{
arr = data->arr;
v21 = &arr[data->num - 1];
if ( arr <= v21 )
{
v22 = *arr;
if ( *arr )
{
if ( HIDWORD(v22[18].__vftable) == 1934 )
goto LABEL_29;
while ( v21 >= ++arr )
{
v22 = *arr;
if ( !*arr )
break;
if ( HIDWORD(v22[18].__vftable) == 1934 )
{
LABEL_29:
m_unknown2 = v22[32].m_unknown2;
if ( m_unknown2 > 0 )
std::_Rb_tree,std::less,std::allocator>::_M_insert_unique(
&v24,
&m_unknown2);
}
}
}
}
}
v9 = v29;
}
if ( this->m_level->m_songID <= 0 )
LOBYTE(m_objects) = v9 != 0;
else
LOBYTE(m_objects) = v9 > 1;
LABEL_7:
*a2 = (char)m_objects;
if ( v9 )
{
v11 = v27;
v30 = 0;
v31 = 500;
v32 = v33;
if ( v27 == &v25 )
{
v16 = 0;
}
else
{
v12 = 1;
do
{
v13 = v11[8];
if ( !v12 )
{
v14 = v30;
v15 = v30 + 1;
if ( v30 + 1 > v31 )
fmt::internal::Array::grow(&v30, v30 + 1);
v30 = v15;
v32[v14] = 44;
}
m_unknown2 = v13;
fmt::BasicWriter::FormatInt,char>>(&v30, v13);
v12 = 0;
v11 = (int *)sub_CFAB74(v11);
}
while ( v11 != &v25 );
v16 = v30;
if ( v30 + 1 > v31 )
fmt::internal::Array::grow(&v30, v30 + 1);
}
v32[v16] = 0;
sub_D153B8(a3, v32);
if ( v32 != v33 && v32 )
operator delete[](v32);
}
else
{
sub_D153B8(a3, &byte_F288A0);
}
v17 = v26;
while ( v17 )
{
std::_Rb_tree,std::less,std::allocator>::_M_erase(
(__int64)&v24,
*(_QWORD **)(v17 + 24));
v18 = (void *)v17;
v17 = *(_QWORD *)(v17 + 16);
operator delete(v18);
}
return a3;
}