//
// ShareLevelSettingsLayer::onUnlisted from 0x6e66bc to 0x6e6838 (380 bytes)
//
// 3 xrefs:
// > ??> @ 0x53a78
// > ShareLevelSettingsLayer::init @ 0x6e5f38
// > ??> @ 0x122ab08
//
// 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 ShareLevelSettingsLayer::onUnlisted(ShareLevelSettingsLayer *a1, cocos2d::CCObject *a2)
{
__int64 v3; // x2
GameManager *v4; // x0
GJGameLevel *m_level; // x0
GameManager *v6; // x0
FLAlertLayer *v7; // x20
void *v8; // x0
unsigned int *v9; // x2
int v10; // w1
_QWORD v11[2]; // [xsp+40h] [xbp+40h] BYREF
v3 = _stack_chk_guard;
a1->m_level->m_unlisted ^= 1u;
v11[1] = v3;
v4 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v4, "0070") )
{
v6 = GameManager::sharedState();
GameManager::setGameVariable(v6, "0070", 1);
sub_D153B8(
(int)v11,
"An unlisted level can only be found by entering its levelID. Once a level is unlisted, it cannot change back to listed.");
v7 = FLAlertLayer::create(0, (__int64)"Unlisted", (__int64)v11);
v8 = (void *)(v11[0] - 24LL);
if ( (__int64 *)(v11[0] - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v11[0] - 8LL);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v11[0] - 8LL);
*(_DWORD *)(v11[0] - 8LL) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v8);
}
v7->show(v7);
}
m_level = a1->m_level;
if ( !m_level->m_unlisted )
m_level->m_friendsOnly = 0;
ShareLevelSettingsLayer::updateSettingsState(a1);
}