//
// LevelBrowserLayer::onRemoveAllFavorites from 0x6e6c74 to 0x6e6e7c (520 bytes)
//
// 3 xrefs:
// > ??> @ 0x424f8
// > LevelBrowserLayer::init @ 0x6ebddc
// > ??> @ 0x122a178
//
// 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 LevelBrowserLayer::onRemoveAllFavorites(LevelBrowserLayer *a1, cocos2d::CCObject *a2)
{
int v2; // w21
GJSearchObject *m_searchObject; // x1
FLAlertLayer *v4; // x21
void *v5; // x0
char *v6; // x0
unsigned int *v7; // x1
int v8; // w2
unsigned int *v9; // x1
int v10; // w2
char *v11; // [xsp+48h] [xbp+48h] BYREF
__int64 v12; // [xsp+50h] [xbp+50h] BYREF
v2 = (int)a1;
m_searchObject = a1->m_searchObject;
v11 = &byte_124B6C8;
if ( m_searchObject && m_searchObject->m_searchType == FavouriteLists )
sub_D1798C(&v11, "Remove all lists from favorites?\nSearch and folder filters apply.", 73);
else
sub_D1798C(
&v11,
"Remove all levels from favorites?\nSearch and folder filters apply.\nLevels will not be deleted.",
110);
sub_D18D28(&v12, &v11);
v4 = FLAlertLayer::create(v2 + 552, (__int64)"Remove Favorites", (__int64)&v12);
v5 = (void *)(v12 - 24);
if ( (__int64 *)(v12 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(v12 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *(_DWORD *)(v12 - 8);
*(_DWORD *)(v12 - 8) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v5);
}
v4->setTag(v4, 2);
v4->show(v4);
v6 = v11 - 24;
if ( v11 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v11 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *((_DWORD *)v11 - 2);
*((_DWORD *)v11 - 2) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v6);
}
}