//
// ShareLevelLayer::onShare from 0x6e57e0 to 0x6e59c4 (484 bytes)
//
// 3 xrefs:
// > ??> @ 0x70890
// > ShareLevelLayer::init @ 0x6e4938
// > ??> @ 0x122bb58
//
// 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 ShareLevelLayer::onShare(ShareLevelLayer *a1, cocos2d::CCObject *a2)
{
GJGameLevel *m_level; // x0
FLAlertLayer *v4; // x0
__int64 v5; // x2
FLAlertLayer *v6; // x20
void *v7; // x0
UploadPopup *v8; // x0
FLAlertLayer *v9; // x0
unsigned int *v10; // x2
int v11; // w1
unsigned int *v12; // x2
__int64 v13; // [xsp+30h] [xbp+30h] BYREF
m_level = a1->m_level;
if ( m_level->m_isUploaded )
{
sub_D153B8((int)&v13, "This version has already been submitted");
v9 = FLAlertLayer::create(0, (__int64)"Uploaded", (__int64)&v13);
v5 = v13;
v6 = v9;
v7 = (void *)(v13 - 24);
if ( (__int64 *)(v13 - 24) == &qword_124B6B0 )
goto LABEL_5;
if ( &pthread_create )
{
v10 = (unsigned int *)(v13 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
goto LABEL_12;
}
goto LABEL_18;
}
if ( m_level->m_isVerified.random - m_level->m_isVerified.seed != 1 && !m_level->m_unlisted )
{
sub_D153B8(
(int)&v13,
"You cannot share a level until you have completed it.\n"
"Complete the level in Normal mode to verify that it can be beaten!\n"
"A level cannot be verified if it has a Start Pos.\n"
"Unlisted levels do not need to be verified.");
v4 = FLAlertLayer::create(0, (__int64)"Unverified", (__int64)&v13);
v5 = v13;
v6 = v4;
v7 = (void *)(v13 - 24);
if ( (__int64 *)(v13 - 24) == &qword_124B6B0 )
{
LABEL_5:
v6->show(v6);
return;
}
if ( &pthread_create )
{
v12 = (unsigned int *)(v13 - 8);
do
v11 = __ldaxr(v12);
while ( __stlxr(v11 - 1, v12) );
goto LABEL_12;
}
LABEL_18:
v11 = *(_DWORD *)(v5 - 8);
*(_DWORD *)(v5 - 8) = v11 - 1;
LABEL_12:
if ( v11 <= 0 )
operator delete(v7);
goto LABEL_5;
}
v8 = UploadPopup::create(m_level);
v8->show(v8);
ShareLevelLayer::onClose(a1, nullptr);
}