//
// ShareLevelLayer::init from 0x140630540 to 0x140631222 (3298 bytes)
//
// 2 xrefs:
// > EditLevelLayer::onShare @ 0x14017bfc8
// > ??> @ 0x140930ab8
//
// 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 11:35:28 +0000
//
// Hidden C++ exception states: #wind=6
bool __fastcall ShareLevelLayer::init(__int64 a1, cocos2d::CCObject *a2)
{
bool result; // al
__int64 v5; // rdx
__int64 v6; // rdx
__int64 v7; // rcx
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 *v11; // rdi
__int64 v12; // rbx
__int64 v13; // rax
__int64 v14; // rbx
__int64 v15; // rax
const char *p_Buf2; // rcx
struct cocos2d::CCLabelBMFont *v17; // rsi
__int64 v18; // rbx
__int64 v19; // rax
const struct cocos2d::CCPoint *v20; // rax
char *v21; // rdi
__int64 v22; // rax
__int64 v23; // rbx
__int64 v24; // rax
__int64 v25; // rax
void (__fastcall ***v26)(_QWORD, _QWORD); // rbx
_WORD *v27; // rax
size_t v28; // rbx
unsigned __int64 v29; // rdi
__int64 v30; // rax
void **v31; // rcx
void **v32; // rsi
size_t v33; // r8
void **v34; // rdx
size_t v35; // r8
float v36; // xmm6_4
__int64 v37; // rdx
__int64 v38; // rcx
__int64 v39; // r8
__int64 v40; // r8
__int64 v41; // rdx
__int64 v42; // rcx
__int64 v43; // r8
__int64 v44; // r8
int v45; // eax
void **v46; // rdx
size_t v47; // r8
__int64 v48; // rdx
__int64 v49; // rcx
__int64 v50; // r8
int v51; // ebx
const struct cocos2d::CCPoint *v52; // rax
char *v53; // rbx
__int64 v54; // rax
const struct cocos2d::CCPoint *v55; // rax
char *v56; // rdi
__int64 v57; // rbx
__int64 v58; // rax
__int64 v59; // rcx
__int64 v60; // rax
__int64 v61; // rcx
cocos2d::CCArray *v62; // rsi
const char *v63; // rdi
int v64; // eax
struct cocos2d::CCObject *v65; // rbx
int v66; // eax
struct cocos2d::CCObject *v67; // rbx
__int64 v68; // rbx
__int64 v69; // rax
__int64 v70; // rax
struct cocos2d::CCSprite *v71; // rax
cocos2d::CCObject *v72; // r15
__int64 v73; // rdi
__int64 v74; // rbx
__int64 v75; // rax
__int64 v76; // rax
struct cocos2d::CCSprite *v77; // rax
cocos2d::CCObject *v78; // rsi
__int64 v79; // rdi
__int64 v80; // rbx
__int64 v81; // rax
__int64 v82; // rax
__int64 v83; // rcx
struct cocos2d::CCSprite *v84; // rsi
__int64 v85; // rax
__int64 v86; // rdi
__int64 v87; // rbx
__int64 v88; // rax
__int64 v89; // rax
void *v90; // rcx
void *v91; // rcx
__int128 *v92; // [rsp+40h] [rbp-C0h] BYREF
float v93; // [rsp+48h] [rbp-B8h] BYREF
float v94; // [rsp+4Ch] [rbp-B4h]
char v95[8]; // [rsp+50h] [rbp-B0h] BYREF
_QWORD v96[2]; // [rsp+58h] [rbp-A8h] BYREF
__int128 v97; // [rsp+68h] [rbp-98h] BYREF
__int64 v98; // [rsp+78h] [rbp-88h]
__int64 v99; // [rsp+80h] [rbp-80h]
char v100[8]; // [rsp+88h] [rbp-78h] BYREF
char v101[8]; // [rsp+90h] [rbp-70h] BYREF
_BYTE v102[16]; // [rsp+98h] [rbp-68h] BYREF
void *Buf1[2]; // [rsp+A8h] [rbp-58h] BYREF
size_t v104; // [rsp+B8h] [rbp-48h]
unsigned __int64 v105; // [rsp+C0h] [rbp-40h]
void *Block[2]; // [rsp+C8h] [rbp-38h] BYREF
__int64 v107; // [rsp+D8h] [rbp-28h]
unsigned __int64 v108; // [rsp+E0h] [rbp-20h]
__int128 Buf2; // [rsp+E8h] [rbp-18h] BYREF
__int64 v110; // [rsp+F8h] [rbp-8h]
unsigned __int64 v111; // [rsp+100h] [rbp+0h]
LODWORD(v92) = -1778384896;
result = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v92);
if ( !result )
return result;
FLAlertLayer::incrementForcePrio((struct cocos2d::CCObject *)a1);
*(_QWORD *)(a1 + 664) = a2;
cocos2d::CCObject::retain(a2);
LOBYTE(v5) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 920LL))(a1, v5);
LOBYTE(v6) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v6);
v8 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8, &v93);
v9 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 584) = v9;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v9);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v96, 0.0, 0.0, 80.0, 80.0);
v11 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v10);
v12 = *v11;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v92, 420.0, 300.0);
(*(void (__fastcall **)(__int64 *, __int64))(v12 + 312))(v11, v13);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v11,
0xFFFFFFFFLL);
v14 = *v11;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v92, v93 * 0.5, v94 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v14 + 184))(v11, v15);
sub_14003F4F0((__int64)&Buf2, *(_QWORD *)(a1 + 664) + 344LL);
p_Buf2 = (const char *)&Buf2;
if ( v111 > 0xF )
p_Buf2 = (const char *)Buf2;
v17 = cocos2d::CCLabelBMFont::create(p_Buf2, "goldFont.fnt");
sub_14003D310((__int64)&Buf2);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v17);
v18 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v92, v93 * 0.5, (float)((float)(v94 * 0.5) + 150.0) - 20.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v18 + 184))(v17, v19);
v92 = &v97;
v97 = 0;
v98 = 0;
v99 = 0;
*(_QWORD *)&v97 = sub_14003D460(0x40u);
v98 = 53;
v99 = 63;
strcpy((char *)v97, "You cannot change the name once it is shared.");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, 0.5, 1.0);
v21 = TextArea::create((__int64)&v97, "chatFont.fnt", 1.0, 400.0, v20, 1101004800, 0, 0);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v21);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v96, 0.0, -20.0);
v23 = v22;
v24 = (*(__int64 (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v17 + 200LL))(v17);
cocos2d::CCPoint::operator+(v24, &v92, v23);
(*(void (__fastcall **)(char *, __int128 **))(*(_QWORD *)v21 + 184LL))(v21, &v92);
(*(void (__fastcall **)(char *))(*(_QWORD *)v21 + 160LL))(v21);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, v93 * 0.5, (float)(v94 * 0.5) + 60.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v102, 0.0, 0.0, 80.0, 80.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v96, (const struct cocos2d::CCRect *)v102);
v26 = (void (__fastcall ***)(_QWORD, _QWORD))cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v25);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v101, 380.0, 50.0);
((void (__fastcall **)(_QWORD, char *))*v26)[39](v26, v101);
(*(void (__fastcall **)(_QWORD, void (__fastcall ***)(_QWORD, _QWORD), __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v26,
0xFFFFFFFFLL);
((void (__fastcall **)(_QWORD, char *))*v26)[23](v26, v100);
LOWORD(v92) = 16514;
BYTE2(v92) = 33;
(*v26[40])(v26 + 40, &v92);
*(_OWORD *)Block = 0;
v107 = 0;
v108 = 0;
v27 = sub_14003D460(0x20u);
Block[0] = v27;
v107 = 25;
v108 = 31;
qmemcpy(v27, "(No description provided", 24);
v27[12] = (unsigned __int8)aNoDescriptionP[24];
if ( *((_QWORD *)a2 + 49) )
{
v30 = sub_14003F4F0((__int64)&Buf2, (__int64)a2 + 376);
LevelTools::base64DecodeString((__int64)Buf1, v30);
v29 = v105;
v28 = v104;
}
else
{
*(_OWORD *)Buf1 = 0;
v28 = 0;
v104 = 0;
v29 = 15;
v105 = 15;
LOBYTE(Buf1[0]) = 0;
}
Buf2 = 0;
v110 = 0;
v111 = 15;
LOBYTE(Buf2) = 0;
v31 = Buf1;
v32 = (void **)Buf1[0];
if ( v29 > 0xF )
v31 = (void **)Buf1[0];
v33 = v28;
if ( v28 )
v33 = 0;
if ( memcmp(v31, &Buf2, v33) || v28 )
{
v34 = Buf1;
if ( v29 > 0xF )
v34 = v32;
v35 = -1;
do
++v35;
while ( *((_BYTE *)v34 + v35) );
sub_1400405A0(Block, v34, v35);
}
GameToolbox::stripNonBreakingSpaces((unsigned __int64 *)Block);
v36 = 1.0;
ensureEmotesAreLoaded(v38, v37, v39, COERCE_DOUBLE(1117782016));
if ( (int)EmoteSprite::effectiveLength(Block, dword_1408FE3A4, v40, COERCE_DOUBLE(1117782016)) >= 180 )
{
v45 = 180;
LABEL_22:
v36 = (float)((float)((float)(180 - v45) / 180.0) * 0.30000001) + 0.69999999;
goto LABEL_23;
}
ensureEmotesAreLoaded(v42, v41, v43, COERCE_DOUBLE(1117782016));
v45 = EmoteSprite::effectiveLength(Block, dword_1408FE3A4, v44, COERCE_DOUBLE(1117782016));
if ( v45 > 70 )
goto LABEL_22;
LABEL_23:
v96[0] = &v97;
v46 = Block;
if ( v108 > 0xF )
v46 = (void **)Block[0];
v97 = 0;
v98 = 0;
v99 = 0;
v47 = -1;
do
++v47;
while ( *((_BYTE *)v46 + v47) );
sub_14003D230(&v97, v46, v47);
ensureEmotesAreLoaded(v49, v48, v50, COERCE_DOUBLE(1117782016));
v51 = dword_1408FE3A4;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, 0.5, 0.5);
v53 = TextArea::create((__int64)&v97, "chatFont.fnt", 1.0, 368.5 / v36, v52, 1101004800, 1, v51);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v53);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v96, 0.0, 1.0);
cocos2d::CCPoint::operator+(v100, &v92, v54);
(*(void (__fastcall **)(char *, __int128 **))(*(_QWORD *)v53 + 184LL))(v53, &v92);
(*(void (__fastcall **)(char *))(*(_QWORD *)v53 + 160LL))(v53);
v96[0] = &v97;
v97 = 0;
v98 = 0;
v99 = 0;
*(_QWORD *)&v97 = sub_14003D460(0x70u);
v98 = 102;
v99 = 111;
strcpy(
(char *)v97,
"By sharing a level you give the rights to use the level\n(in any way) to the creators of Geometry Dash.");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, 0.5, 1.0);
v56 = TextArea::create((__int64)&v97, "chatFont.fnt", 1.0, 380.0, v55, 1101004800, 0, 0);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v56);
v57 = *(_QWORD *)v56;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v96, v93 * 0.5, (float)((float)(v94 * 0.5) - 150.0) + 65.0);
(*(void (__fastcall **)(char *, __int64))(v57 + 184))(v56, v58);
(*(void (__fastcall **)(char *))(*(_QWORD *)v56 + 160LL))(v56);
*(_DWORD *)(a1 + 640) = -1;
v60 = cocos2d::CCMenu::create(v59);
*(_QWORD *)(a1 + 552) = v60;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v60, 10);
ShareLevelLayer::setupStars(a1);
v62 = (cocos2d::CCArray *)cocos2d::CCArray::create(v61);
v63 = "GJ_button_01.png";
v64 = (unsigned int)ButtonSprite::create_1(
(int)"Cancel",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v65 = CCMenuItemSpriteExtra::create(v64, 0, a1, (__int64)PagedListPopup::onClose);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v65);
cocos2d::CCArray::addObject(v62, v65);
if ( *(_BYTE *)(*(_QWORD *)(a1 + 664) + 857LL) )
v63 = "GJ_button_04.png";
v66 = (unsigned int)ButtonSprite::create_1((int)"Share Level", 0, 0, 1.0, 0, (__int64)"goldFont.fnt", (__int64)v63, 0);
v67 = CCMenuItemSpriteExtra::create(v66, 0, a1, (__int64)ShareLevelLayer::onShare);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v67);
cocos2d::CCArray::addObject(v62, v67);
v68 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v96, v93 * 0.5, (float)((float)(v94 * 0.5) - 150.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v68, v95, v69);
GameToolbox::alignItemsHorisontally((__int64)v62, 15.0, v70, 0);
v71 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_optionsBtn02_001.png");
LODWORD(v68) = (_DWORD)v71;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v71 + 160LL))(v71);
v72 = CCMenuItemSpriteExtra::create(v68, 0, a1, (__int64)ShareLevelLayer::onSettings);
*((_DWORD *)v72 + 93) = 0x40000000;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v72);
v73 = *(_QWORD *)v72;
v74 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v96,
(float)((float)(v93 * 0.5) + 210.0) - 26.0,
(float)((float)(v94 * 0.5) + 150.0) - 26.0);
cocos2d::CCNode::convertToNodeSpace(v74, v95, v75);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v73 + 184))(v72, v76);
v77 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_reportBtn_001.png");
LODWORD(v74) = (_DWORD)v77;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v77 + 160LL))(v77);
v78 = CCMenuItemSpriteExtra::create(v74, 0, a1, (__int64)ShareLevelLayer::onGuidelines);
*((_DWORD *)v78 + 93) = 1067030938;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v78);
v79 = *(_QWORD *)v78;
v80 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v96,
(float)((float)(v93 * 0.5) - 210.0) + 26.0,
(float)((float)(v94 * 0.5) + 150.0) - 26.0);
cocos2d::CCNode::convertToNodeSpace(v80, v95, v81);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v79 + 184))(v78, v82);
v83 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v92 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v92);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v83 = qword_14090BFD0;
}
if ( !GameManager::getGameVariable(v83, "0029") )
{
v84 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_optionsTxt_001.png");
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCSprite *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v84);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v96, -55.0, 0.0);
v86 = v85;
v87 = *(_QWORD *)(a1 + 552);
v88 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v72 + 200LL))(v72);
cocos2d::CCNode::convertToWorldSpace(v87, v95, v88);
cocos2d::CCPoint::operator+(v89, &v92, v86);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int128 **))(*(_QWORD *)v84 + 184LL))(v84, &v92);
}
if ( v105 > 0xF )
{
v90 = Buf1[0];
if ( v105 + 1 >= 0x1000 )
{
v90 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v90 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v90);
}
v104 = 0;
v105 = 15;
LOBYTE(Buf1[0]) = 0;
if ( v108 > 0xF )
{
v91 = Block[0];
if ( v108 + 1 >= 0x1000 )
{
v91 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v91 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v91);
}
return 1;
}