//
// EditLevelLayer::onShare from 0x1001de8b0 to 0x1001dec3c (908 bytes)
//
// 2 xrefs:
// > EditLevelLayer::FLAlert_Clicked @ 0x1001e0d7a
// > EditLevelLayer::init @ 0x1001dd9f5
//
// This function is hookable on this platform (idp: pc, 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 12:26:27 +0000
//
void __fastcall EditLevelLayer::onShare(__int64 a1, const void *a2, __int64 a3)
{
double v4; // xmm0_8
__int128 *v5; // rax
__int128 *v6; // rdi
__int64 v7; // rdx
double v8; // xmm0_8
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rdx
__int64 v12; // rax
__int128 *v13; // rax
__int64 v14; // rax
__int128 *v15; // rax
__int64 v16; // r14
__int64 v17; // rbx
char *v18; // rdi
double v19; // xmm0_8
__int64 v20; // rax
__int64 v21; // rdi
__int64 v22; // rdx
unsigned int v23; // r14d
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // r14
__int64 v27; // rax
_QWORD v28[2]; // [rsp+8h] [rbp-78h] BYREF
char *v29; // [rsp+18h] [rbp-68h]
_QWORD v30[2]; // [rsp+20h] [rbp-60h] BYREF
void *v31; // [rsp+30h] [rbp-50h]
_QWORD v32[2]; // [rsp+38h] [rbp-48h] BYREF
void *v33; // [rsp+48h] [rbp-38h]
__int128 v34; // [rsp+50h] [rbp-30h] BYREF
void *__p; // [rsp+60h] [rbp-20h]
*(_QWORD *)&v4 = GameManager::sharedState(a1, a2, a3).u64[0];
v6 = v5;
if ( (unsigned __int8)GameManager::safeModeEnabled(v5, v4) )
{
*(_QWORD *)&v8 = GameManager::sharedState(v6, a2, v7).u64[0];
GameManager::showParentalRestrictedAlert(v9, v8);
return;
}
v10 = GJAccountManager::sharedState((__int64)v6, (__int64)a2);
if ( *(_DWORD *)(v10 + 352) <= *(_DWORD *)(v10 + 356) )
{
GJAccountManager::sharedState((__int64)v6, (__int64)a2);
sub_1000A24A0();
return;
}
v12 = *(_QWORD *)(a1 + 472);
if ( (*(_BYTE *)(v12 + 392) & 1) != 0 )
{
a2 = *(const void **)(v12 + 408);
v6 = &v34;
sub_10001AD30(&v34, a2, *(_QWORD *)(v12 + 400));
}
else
{
v13 = (__int128 *)(v12 + 392);
__p = *((void **)v13 + 2);
v34 = *v13;
}
if ( (v34 & 1) == 0 )
{
if ( (unsigned __int8)v34 >> 1 )
goto LABEL_10;
LABEL_13:
v29 = (char *)operator new(0x28u);
v28[0] = 41;
v28[1] = 32;
strcpy(v29, "You cannot share an empty level.");
v17 = FLAlertLayer::create_1(0, "Empty", v28, "OK", 0, 380.0);
if ( (v28[0] & 1) != 0 )
{
v18 = v29;
LABEL_26:
operator delete(v18);
}
LABEL_30:
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 1312LL))(v17);
return;
}
v16 = *((_QWORD *)&v34 + 1);
v6 = (__int128 *)__p;
operator delete(__p);
if ( !v16 )
goto LABEL_13;
LABEL_10:
v14 = *(_QWORD *)(a1 + 472);
if ( (*(_BYTE *)(v14 + 344) & 1) != 0 )
{
a2 = *(const void **)(v14 + 360);
v6 = &v34;
sub_10001AD30(&v34, a2, *(_QWORD *)(v14 + 352));
}
else
{
v15 = (__int128 *)(v14 + 344);
__p = *((void **)v15 + 2);
v34 = *v15;
}
if ( (v34 & 1) == 0 )
{
if ( (unsigned __int8)v34 >> 1 )
goto LABEL_18;
LABEL_24:
v31 = operator new(0x30u);
v30[0] = 49;
v30[1] = 43;
strcpy((char *)v31, "You must name your level before sharing it.");
v17 = FLAlertLayer::create_1(0, "No Name", v30, "OK", 0, 380.0);
if ( (v30[0] & 1) != 0 )
{
v18 = (char *)v31;
goto LABEL_26;
}
goto LABEL_30;
}
v26 = *((_QWORD *)&v34 + 1);
v6 = (__int128 *)__p;
operator delete(__p);
if ( !v26 )
goto LABEL_24;
LABEL_18:
*(_QWORD *)&v19 = GameManager::sharedState(v6, a2, v11).u64[0];
v21 = v20;
if ( !(unsigned __int8)GameManager::getGameVariable(v20, "0157") )
{
GameManager::sharedState(v21, "0157", v22);
GameManager::setGameVariable(v27, "0157", 1);
v33 = operator new(0x1D8u);
v32[0] = 473;
v32[1] = 464;
strcpy(
(char *)v33,
"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.");
v17 = FLAlertLayer::create_1(a1 + 416, "Upload Guidelines", v32, "OK", 0, 380.0);
if ( (v32[0] & 1) != 0 )
operator delete(v33);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 72LL))(v17, 10);
goto LABEL_30;
}
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 480)) )
{
v23 = 0;
do
{
v24 = sub_1007FEFE0(*(_QWORD *)(a1 + 480), v23);
(*(void (__fastcall **)(__int64, _QWORD, double))(*(_QWORD *)v24 + 1160LL))(v24, 0, v19);
++v23;
}
while ( v23 < (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 480)) );
}
v25 = ShareLevelLayer::create(*(_QWORD *)(a1 + 472), v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v25 + 1312LL))(v25);
}