//
// GJLevelList::removeLevelFromList from 0x7363c4 to 0x736540 (380 bytes)
//
// 2 xrefs:
// > LevelListLayer::cellPerformedAction @ 0xa78b64
// > ??> @ 0xb30e8
//
// 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
//
void GJLevelList::removeLevelFromList(GJLevelList *a1, int a2)
{
int *m_start; // x0
int *m_finish; // x3
int *v6; // x1
int v7; // t1
cocos2d::CCDictionary *m_levelsDict; // x22
char *v9; // x0
const void *v10; // x1
std::vector *p_m_levels; // x22
unsigned int *v12; // x2
int v13; // w1
std::string v14; // [xsp+50h] [xbp+50h] BYREF
m_start = a1->m_levels.m_start;
m_finish = a1->m_levels.m_finish;
if ( m_start != m_finish )
{
if ( *m_start == a2 )
{
LABEL_8:
v10 = m_start + 1;
p_m_levels = &a1->m_levels;
if ( m_start + 1 != m_finish )
{
p_m_levels = &a1->m_levels;
if ( ((char *)m_finish - (_BYTE *)v10) >> 2 )
{
memmove(m_start, v10, (char *)m_finish - (_BYTE *)v10);
m_finish = a1->m_levels.m_finish;
}
}
p_m_levels->m_finish = m_finish - 1;
GJLevelList::updateLevelsString(a1);
}
else
{
v6 = m_start + 1;
while ( 1 )
{
m_start = v6;
if ( v6 == m_finish )
break;
v7 = *v6++;
if ( v7 == a2 )
goto LABEL_8;
}
}
}
m_levelsDict = a1->m_levelsDict;
GameToolbox::intToString((__int64 *)&v14, (GameToolbox *)(unsigned int)a2);
cocos2d::CCDictionary::removeObjectForKey(m_levelsDict, &v14);
v9 = (char *)v14.m_data.m_data - 24;
if ( (__int64 *)v14.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)((char *)v14.m_data.m_data - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *((_DWORD *)v14.m_data.m_data - 2);
*((_DWORD *)v14.m_data.m_data - 2) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v9);
}
a1->m_modified = 1;
}