//
// LevelBrowserLayer::onMyOnlineLevels from 0x6ec7b0 to 0x6eca9c (748 bytes)
//
// 3 xrefs:
// > ??> @ 0xb95b0
// > LevelBrowserLayer::init @ 0x6eb5c4
// > ??> @ 0x122e6a8
//
// 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::onMyOnlineLevels(LevelBrowserLayer *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
GJSearchObject *v4; // x22
void *v5; // x0
char *v6; // x0
cocos2d::CCDirector *v7; // x19
cocos2d::CCScene *v8; // x0
cocos2d::CCTransitionFade *v9; // x0
GJAccountManager *v10; // x0
void *v11; // x0
char *v12; // x0
unsigned int *v13; // x1
int v14; // w2
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x1
int v20; // w2
char *v21; // [xsp+48h] [xbp+48h] BYREF
__int64 v22; // [xsp+50h] [xbp+50h] BYREF
a1->setKeypadEnabled(a1, 0);
a1->setKeyboardEnabled(a1, 0);
if ( a1->m_searchObject->m_searchType == MyLists )
{
v10 = GJAccountManager::sharedState();
GameToolbox::intToString((__int64 *)&v21, (GameToolbox *)(unsigned int)(v10->m_accountID - v10->m_unkInt1));
sub_D153B8((int)&v22, v21);
v4 = GJSearchObject::create(UsersLevels);
v11 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v22 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v22 - 8);
*(_DWORD *)(v22 - 8) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v11);
}
v12 = v21 - 24;
if ( v21 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v21 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v21 - 2);
*((_DWORD *)v21 - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v12);
}
v4->m_searchMode = 1;
}
else
{
v3 = GameManager::sharedState();
GameToolbox::intToString(
(__int64 *)&v21,
(GameToolbox *)(unsigned int)(v3->m_playerUserID.random - v3->m_playerUserID.seed));
sub_D153B8((int)&v22, v21);
v4 = GJSearchObject::create(UsersLevels);
v5 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v22 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(v22 - 8);
*(_DWORD *)(v22 - 8) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v5);
}
v6 = v21 - 24;
if ( v21 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v21 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v21 - 2);
*((_DWORD *)v21 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v6);
}
}
v7 = cocos2d::CCDirector::sharedDirector();
v8 = LevelBrowserLayer::scene(v4);
v9 = cocos2d::CCTransitionFade::create(0.5, v8);
cocos2d::CCDirector::replaceScene(v7, v9);
}