//
// EditLevelLayer::onShare from 0x6dfcac to 0x6e0304 (1624 bytes)
//
// 4 xrefs:
// > EditLevelLayer::FLAlert_Clicked @ 0x6e3194
// > ??> @ 0x6e130
// > EditLevelLayer::init @ 0x6e0b80
// > ??> @ 0x122b9e8
//
// 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 EditLevelLayer::onShare(EditLevelLayer *a1, cocos2d::CCObject *a2)
{
GJAccountManager *v3; // x0
_DWORD *v4; // x27
_DWORD *v5; // x28
unsigned __int64 v6; // x21
size_t v7; // x2
int v8; // w20
__int64 v9; // x21
char *v10; // x0
char *v11; // x0
FLAlertLayer *v12; // x0
_DWORD *v13; // x1
FLAlertLayer *v14; // x20
char *v15; // x0
_DWORD *v16; // x26
_DWORD *v17; // x27
unsigned __int64 v18; // x25
unsigned __int64 v19; // x28
size_t v20; // x2
int v21; // w20
__int64 v22; // x25
char *v23; // x0
char *v24; // x0
GameManager *v25; // x0
GameManager *v26; // x0
char *v27; // x0
char *v28; // x0
unsigned int *v29; // x2
int v30; // w1
FLAlertLayer *v31; // x0
unsigned int *v32; // x1
int v33; // w2
unsigned int *v34; // x27
int v35; // w1
ShareLevelLayer *v36; // x0
unsigned int *v37; // x28
int v38; // w1
unsigned int *v39; // x26
int v40; // w1
unsigned int *v41; // x1
unsigned int *v42; // x27
int v43; // w1
unsigned int *v44; // x1
int v45; // w2
unsigned __int64 v46; // [xsp+68h] [xbp+68h]
void *v47; // [xsp+88h] [xbp+88h] BYREF
void *v48; // [xsp+90h] [xbp+90h] BYREF
v3 = GJAccountManager::sharedState();
if ( v3->m_accountID - v3->m_unkInt1 <= 0 )
{
sub_D153B8(
(int)&v48,
"You need an account to share levels. You can create one for free from settings in the main menu.");
v14 = FLAlertLayer::create(0, (__int64)"Account Needed", (__int64)&v48);
v28 = (char *)v48 - 24;
if ( (char *)v48 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)((char *)v48 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *((_DWORD *)v48 - 2);
*((_DWORD *)v48 - 2) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v28);
}
goto LABEL_14;
}
sub_D18D28(&v47, &a1->m_level->m_levelString);
sub_D153B8((int)&v48, &byte_F288A0);
v4 = v47;
v5 = v48;
v6 = *((_QWORD *)v47 - 3);
v46 = *((_QWORD *)v48 - 3);
if ( v46 > v6 )
v7 = *((_QWORD *)v47 - 3);
else
v7 = *((_QWORD *)v48 - 3);
v8 = memcmp(v47, v48, v7);
if ( !v8 )
{
v8 = 0x7FFFFFFF;
v9 = v6 - v46;
if ( v9 <= 0x7FFFFFFF )
{
if ( v9 >= (__int64)0xFFFFFFFF80000000LL )
v8 = v9;
else
v8 = 0x80000000;
}
}
v10 = (char *)(v5 - 6);
if ( v5 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = v5 - 2;
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(v5 - 2);
*(v5 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v10);
v4 = v47;
}
v11 = (char *)(v4 - 6);
if ( v4 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_12;
if ( &pthread_create )
{
v34 = v4 - 2;
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(v4 - 2);
*(v4 - 2) = v35 - 1;
}
if ( v35 > 0 )
{
LABEL_12:
if ( !v8 )
goto LABEL_13;
}
else
{
operator delete(v11);
if ( !v8 )
{
LABEL_13:
sub_D153B8((int)&v48, "You cannot share an empty level.");
v12 = FLAlertLayer::create(0, (__int64)"Empty", (__int64)&v48);
v13 = v48;
v14 = v12;
v15 = (char *)v48 - 24;
if ( (char *)v48 - 24 == (char *)&qword_124B6B0 )
{
LABEL_14:
v14->show(v14);
return;
}
if ( &pthread_create )
{
v41 = (unsigned int *)((char *)v48 - 8);
do
v33 = __ldaxr(v41);
while ( __stlxr(v33 - 1, v41) );
goto LABEL_36;
}
LABEL_72:
v33 = *(v13 - 2);
*(v13 - 2) = v33 - 1;
LABEL_36:
if ( v33 <= 0 )
operator delete(v15);
goto LABEL_14;
}
}
sub_D18D28(&v47, &a1->m_level->m_levelName);
sub_D153B8((int)&v48, &byte_F288A0);
v16 = v47;
v17 = v48;
v18 = *((_QWORD *)v47 - 3);
v19 = *((_QWORD *)v48 - 3);
if ( v19 > v18 )
v20 = *((_QWORD *)v47 - 3);
else
v20 = *((_QWORD *)v48 - 3);
v21 = memcmp(v47, v48, v20);
if ( !v21 )
{
v21 = 0x7FFFFFFF;
v22 = v18 - v19;
if ( v22 <= 0x7FFFFFFF )
{
if ( v22 >= (__int64)0xFFFFFFFF80000000LL )
v21 = v22;
else
v21 = 0x80000000;
}
}
v23 = (char *)(v17 - 6);
if ( v17 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = v17 - 2;
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(v17 - 2);
*(v17 - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v23);
v16 = v47;
}
v24 = (char *)(v16 - 6);
if ( v16 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_22;
if ( &pthread_create )
{
v39 = v16 - 2;
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(v16 - 2);
*(v16 - 2) = v40 - 1;
}
if ( v40 > 0 )
{
LABEL_22:
if ( !v21 )
goto LABEL_32;
}
else
{
operator delete(v24);
if ( !v21 )
{
LABEL_32:
sub_D153B8((int)&v48, "You must name your level before sharing it.");
v31 = FLAlertLayer::create(0, (__int64)"No Name", (__int64)&v48);
v13 = v48;
v14 = v31;
v15 = (char *)v48 - 24;
if ( (char *)v48 - 24 == (char *)&qword_124B6B0 )
goto LABEL_14;
if ( &pthread_create )
{
v32 = (unsigned int *)((char *)v48 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
goto LABEL_36;
}
goto LABEL_72;
}
}
v25 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v25, "0157") )
{
v26 = GameManager::sharedState();
GameManager::setGameVariable(v26, "0157", 1);
sub_D153B8(
(int)&v48,
"Hateful, abusive, or otherwise inappropriate content, whether it is in the level, name, or description may lead to"
" deletion. The same applies to levels abusing cheats or exploits. Stealing assets from other levels is discouraged and may stop a level from being rated depending on the context, severity, credit, and more. Level"
"s verified with hacks cannot be rated.\n"
"These guidelines and their enforcement are entirely at RobTop's discretion.");
v14 = FLAlertLayer::create((int)a1 + 416, (__int64)"Upload Guidelines", (__int64)&v48);
v27 = (char *)v48 - 24;
if ( (char *)v48 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)((char *)v48 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *((_DWORD *)v48 - 2);
*((_DWORD *)v48 - 2) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v27);
}
v14->setTag(v14, 10);
goto LABEL_14;
}
EditLevelLayer::closeTextInputs(a1);
v36 = ShareLevelLayer::create(a1->m_level);
v36->show(v36);
}