//
// EditLevelLayer::onShare from 0x1400d8450 to 0x1400d8af3 (1699 bytes)
//
// 3 xrefs:
// > EditLevelLayer::FLAlert_Clicked @ 0x1400d8ef7
// > EditLevelLayer::init @ 0x1400d5f60
// > ??> @ 0x1406c8820
//
// 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
//
// Hidden C++ exception states: #wind=6
void EditLevelLayer::onShare(EditLevelLayer *a1, cocos2d::CCObject *a2)
{
GJAccountManager *v3; // rax
__int64 v4; // rax
FLAlertLayer *v5; // rbx
void **v6; // rcx
__int64 v7; // rsi
size_t v8; // r8
__int64 v9; // rbx
__int64 v10; // rax
void **v11; // rcx
__int64 v12; // rsi
size_t v13; // r8
__int64 v14; // rbx
__int64 v15; // rax
GameManager *v16; // rcx
GameManager *v17; // rcx
_BYTE *v18; // rax
_OWORD *v19; // rcx
const char *v20; // rdx
__int64 v21; // r8
__int64 v22; // rax
FLAlertLayer *v23; // rbx
GJGameLevel *m_level; // rbx
ShareLevelLayer *v25; // rdi
void (*show)(FLAlertLayer *); // rdx
void *v27; // [rsp+50h] [rbp-19h]
void *v28; // [rsp+50h] [rbp-19h]
void *Buf1[2]; // [rsp+60h] [rbp-9h] BYREF
__int64 v30; // [rsp+70h] [rbp+7h]
unsigned __int64 v31; // [rsp+78h] [rbp+Fh]
__int128 Buf2; // [rsp+80h] [rbp+17h] BYREF
__int64 v33; // [rsp+90h] [rbp+27h]
__int64 v34; // [rsp+98h] [rbp+2Fh]
v3 = GJAccountManager::sharedState();
if ( v3->m_accountID - v3->m_unkInt1 <= 0 )
{
*(_OWORD *)Buf1 = 0;
v30 = 0;
v31 = 15;
Buf1[0] = sub_14003AA10(0x80u);
v30 = 112;
v31 = 127;
strcpy(
(char *)Buf1[0],
"You need an account to share levels. You can create one for free from settings in the main menu.");
v4 = sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
v5 = FLAlertLayer::create(0, (int)"Account Needed", v4, (__int64)"Close", 0, 1133903872, 0, 0, 1065353216);
LABEL_19:
sub_14003A830((__int64)Buf1);
v5->show(v5);
return;
}
Buf2 = 0;
v33 = 0;
v34 = 15;
LOBYTE(Buf2) = 0;
sub_14003BDB0((__int64)Buf1, (__int64)&a1->m_level->m_levelString);
v6 = Buf1;
if ( v31 > 0xF )
v6 = (void **)Buf1[0];
v7 = v30;
v8 = v30;
if ( v30 )
v8 = 0;
LODWORD(v9) = memcmp(v6, &Buf2, v8);
if ( !(_DWORD)v9 )
v9 = v7 != 0;
sub_14003A830((__int64)Buf1);
if ( !(_DWORD)v9 )
{
*(_OWORD *)Buf1 = 0;
v30 = 0;
v31 = 15;
Buf1[0] = sub_14003AA10(0x30u);
v30 = 32;
v31 = 47;
strcpy((char *)Buf1[0], "You cannot share an empty level.");
v10 = sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
v5 = FLAlertLayer::create(0, (int)"Empty", v10, (__int64)"OK", 0, 1136525312, 0, 0, 1065353216);
goto LABEL_19;
}
Buf2 = 0;
v33 = 0;
v34 = 15;
LOBYTE(Buf2) = 0;
sub_14003BDB0((__int64)Buf1, (__int64)&a1->m_level->m_levelName);
v11 = Buf1;
if ( v31 > 0xF )
v11 = (void **)Buf1[0];
v12 = v30;
v13 = v30;
if ( v30 )
v13 = 0;
LODWORD(v14) = memcmp(v11, &Buf2, v13);
if ( !(_DWORD)v14 )
v14 = v12 != 0;
sub_14003A830((__int64)Buf1);
if ( !(_DWORD)v14 )
{
*(_OWORD *)Buf1 = 0;
v30 = 0;
v31 = 15;
Buf1[0] = sub_14003AA10(0x30u);
v30 = 43;
v31 = 47;
strcpy((char *)Buf1[0], "You must name your level before sharing it.");
v15 = sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
v5 = FLAlertLayer::create(0, (int)"No Name", v15, (__int64)"OK", 0, 1136525312, 0, 0, 1065353216);
goto LABEL_19;
}
v16 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v27 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v27);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v16 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v16, "0157") )
{
EditLevelLayer::closeTextInputs(a1);
m_level = a1->m_level;
v25 = (ShareLevelLayer *)operator new(0x298u);
FLAlertLayer::FLAlertLayer(v25);
v25->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (ShareLevelLayer_vtbl *)&ShareLevelLayer::`vftable';
v25->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable = (cocos2d::CCTouchDelegate_vtbl *)&ShareLevelLayer::`vftable';
v25->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable = (cocos2d::CCAccelerometerDelegate_vtbl *)&ShareLevelLayer::`vftable';
v25->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable = (cocos2d::CCKeypadDelegate_vtbl *)&ShareLevelLayer::`vftable';
v25->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeyboardDelegate::__vftable = (cocos2d::CCKeyboardDelegate_vtbl *)&ShareLevelLayer::`vftable';
v25->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable = (cocos2d::CCMouseDelegate_vtbl *)&ShareLevelLayer::`vftable';
v25->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCRGBAProtocol::__vftable = (cocos2d::CCRGBAProtocol_vtbl *)&ShareLevelLayer::`vftable';
v25->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCBlendProtocol::__vftable = (cocos2d::CCBlendProtocol_vtbl *)&ShareLevelLayer::`vftable';
v25->m_level = nullptr;
v25->m_starsRequested = 0;
v25->m_starButtons = nullptr;
if ( ShareLevelLayer::init(v25, m_level) )
{
cocos2d::CCObject::autorelease(v25);
}
else
{
((void (__fastcall *)(ShareLevelLayer *, __int64))v25->~ShareLevelLayer)(v25, 1);
v25 = nullptr;
}
show = (void (*)(FLAlertLayer *))v25->show;
if ( show == FLAlertLayer::show )
FLAlertLayer::show(v25);
else
show(v25);
}
else
{
v17 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v28 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v17 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v17, "0157", 1);
*(_OWORD *)Buf1 = 0;
v30 = 0;
v31 = 15;
v18 = sub_14003AA10(0x1E0u);
Buf1[0] = v18;
v30 = 464;
v31 = 479;
v19 = v18;
v20 = "Hateful, abusive, or otherwise inappropriate content, whether it is in the level, name, or description may lea"
"d to deletion. The same applies to levels abusing cheats or exploits. Stealing assets from other level"
"s is discouraged and may stop a level from being rated depending on the context, severity, credit, and"
" more. Levels verified with hacks cannot be rated.\n"
"These guidelines and their enforcement are entirely at RobTop's discretion.";
v21 = 3;
do
{
*v19 = *(_OWORD *)v20;
v19[1] = *((_OWORD *)v20 + 1);
v19[2] = *((_OWORD *)v20 + 2);
v19[3] = *((_OWORD *)v20 + 3);
v19[4] = *((_OWORD *)v20 + 4);
v19[5] = *((_OWORD *)v20 + 5);
v19[6] = *((_OWORD *)v20 + 6);
v19 += 8;
*(v19 - 1) = *((_OWORD *)v20 + 7);
v20 += 128;
--v21;
}
while ( v21 );
*v19 = *(_OWORD *)v20;
v19[1] = *((_OWORD *)v20 + 1);
v19[2] = *((_OWORD *)v20 + 2);
v19[3] = *((_OWORD *)v20 + 3);
v19[4] = *((_OWORD *)v20 + 4);
v18[464] = 0;
v22 = sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
v23 = FLAlertLayer::create(
(int)a1 + 416,
(int)"Upload Guidelines",
v22,
(__int64)"OK",
0,
1136525312,
0,
0,
1065353216);
sub_14003A830((__int64)Buf1);
v23->setTag(v23, 10);
v23->show(v23);
}
}