//
// EditLevelLayer::onShare from 0x100110518 to 0x1001107cc (692 bytes)
//
// 2 xrefs:
// > EditLevelLayer::FLAlert_Clicked @ 0x100112260
// > EditLevelLayer::init @ 0x10010f7a4
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 10:59:08 +0000
//
__int64 __fastcall EditLevelLayer::onShare(__int64 a1)
{
__int64 v2; // x0
__int64 v3; // x0
__int64 v4; // x0
__int64 v6; // x0
__int64 v7; // x8
__int128 *v8; // x8
__int64 v9; // x0
_BOOL4 v10; // w20
__int64 v11; // x19
void *v12; // x0
__int64 v13; // x8
__int128 *v14; // x8
_BOOL8 v15; // x0
_BOOL4 v16; // w20
__int64 v17; // x0
__int64 GameVariable; // x0
__int64 v19; // x0
__int64 v20; // x0
void *v21[2]; // [xsp+0h] [xbp-90h] BYREF
char v22; // [xsp+17h] [xbp-79h]
void *v23[2]; // [xsp+18h] [xbp-78h] BYREF
char v24; // [xsp+2Fh] [xbp-61h]
_QWORD v25[2]; // [xsp+30h] [xbp-60h] BYREF
char v26; // [xsp+47h] [xbp-49h]
void *__p[2]; // [xsp+48h] [xbp-48h] BYREF
char v28; // [xsp+5Fh] [xbp-31h]
__int128 __dst; // [xsp+60h] [xbp-30h] BYREF
__int64 v30; // [xsp+70h] [xbp-20h]
v2 = GameManager::sharedState(a1);
v3 = GameManager::safeModeEnabled(v2);
if ( (_DWORD)v3 )
{
v4 = GameManager::sharedState(v3);
return sub_1003B6200(v4);
}
v6 = GJAccountManager::sharedState(v3);
if ( *(_DWORD *)(v6 + 352) <= *(_DWORD *)(v6 + 356) )
{
v9 = GJAccountManager::sharedState(v6);
return GJAccountManager::showAccountNeededAlert(v9, "share levels");
}
v7 = *(_QWORD *)(a1 + 472);
if ( *(char *)(v7 + 415) < 0 )
{
sub_1000097D0(&__dst, *(void **)(v7 + 392), *(_QWORD *)(v7 + 400));
}
else
{
v8 = (__int128 *)(v7 + 392);
__dst = *v8;
v30 = *((_QWORD *)v8 + 2);
}
sub_100009900(__p, "");
v10 = sub_1000045BC(&__dst, __p);
if ( v28 < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v30) < 0 )
{
operator delete((void *)__dst);
if ( v10 )
{
LABEL_12:
sub_100009900(v25, "You cannot share an empty level.");
v11 = FLAlertLayer::create_1(0, "Empty", v25, "OK", 0, 380.0);
if ( v26 < 0 )
{
v12 = (void *)v25[0];
LABEL_24:
operator delete(v12);
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 1312LL))(v11);
}
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 1312LL))(v11);
}
}
else if ( v10 )
{
goto LABEL_12;
}
v13 = *(_QWORD *)(a1 + 472);
if ( *(char *)(v13 + 367) < 0 )
{
sub_1000097D0(&__dst, *(void **)(v13 + 344), *(_QWORD *)(v13 + 352));
}
else
{
v14 = (__int128 *)(v13 + 344);
__dst = *v14;
v30 = *((_QWORD *)v14 + 2);
}
sub_100009900(__p, "");
v15 = sub_1000045BC(&__dst, __p);
v16 = v15;
if ( v28 < 0 )
operator delete(__p[0]);
if ( (SHIBYTE(v30) & 0x80000000) == 0 )
{
if ( v16 )
goto LABEL_22;
LABEL_26:
v17 = GameManager::sharedState(v15);
GameVariable = GameManager::getGameVariable(v17, "0157");
if ( (GameVariable & 1) != 0 )
{
sub_100111734(a1);
v19 = ShareLevelLayer::create(*(_QWORD *)(a1 + 472));
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v19 + 1312LL))(v19);
}
v20 = GameManager::sharedState(GameVariable);
GameManager::setGameVariable(v20, "0157", 1);
sub_100009900(
v21,
"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.");
v11 = FLAlertLayer::create_1(a1 + 416, "Upload Guidelines", v21, "OK", 0, 380.0);
if ( v22 < 0 )
operator delete(v21[0]);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 72LL))(v11, 10);
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 1312LL))(v11);
}
operator delete((void *)__dst);
if ( !v16 )
goto LABEL_26;
LABEL_22:
sub_100009900(v23, "You must name your level before sharing it.");
v11 = FLAlertLayer::create_1(0, "No Name", v23, "OK", 0, 380.0);
if ( v24 < 0 )
{
v12 = v23[0];
goto LABEL_24;
}
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 1312LL))(v11);
}