//
// ShareLevelLayer::init from 0x4a3db4 to 0x4a461c (2152 bytes)
//
// 1 xrefs:
// > ShareLevelLayer::create @ 0x4a4714
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:49:53 +0000
//
int __fastcall ShareLevelLayer::init(ShareLevelLayer *this, GJGameLevel *a2)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCLayer *WinSize; // r0
int v6; // r0
int v7; // r3
int v8; // r9
void (__fastcall *v9)(int, _DWORD *); // r10
void (__fastcall *v10)(int, _DWORD *); // r10
int v11; // r3
int *v12; // r3
int v13; // r1
cocos2d::CCLabelBMFont *v14; // r2
cocos2d::CCLabelBMFont *v15; // r0
int v16; // r9
void (__fastcall *v17)(int, _DWORD *); // r6
int v18; // r6
void (__fastcall *v19)(int, _DWORD *); // r10
int v20; // r9
int v21; // r6
void (__fastcall *v22)(int, _DWORD *); // r3
char *v23; // r8
int v24; // r3
size_t v25; // r11
unsigned int v26; // r10
char *v27; // r0
char *v28; // r1
size_t v29; // r2
int v30; // r3
EmoteSprite *v31; // r0
char *v32; // r1
int v33; // r0
int v34; // r2
int v35; // r3
EmoteSprite *v36; // r0
int v37; // r0
int v38; // r2
int v39; // r3
int v40; // r0
float v41; // s17
size_t v42; // r0
EmoteSprite *v43; // r0
int v44; // r0
int v45; // r8
void (__fastcall *v46)(int, _DWORD *); // r11
int v47; // r8
void (__fastcall *v48)(int, _DWORD *); // r11
cocos2d::CCMenu *v49; // r0
int v50; // r0
cocos2d::CCArray *v51; // r0
cocos2d::CCArray *v52; // r8
const char *v53; // r1
ButtonSprite *v54; // r0
cocos2d::CCObject *v55; // r5
char *v56; // r3
ButtonSprite *v57; // r0
cocos2d::CCObject *v58; // r5
const cocos2d::CCPoint *v59; // r5
const char *v60; // r1
int v61; // r5
int v62; // r8
const cocos2d::CCPoint *v63; // r11
void (__fastcall *v64)(int, _DWORD *); // r10
const char *v65; // r1
int v66; // r9
int v67; // r9
const cocos2d::CCPoint *v68; // r11
int (__fastcall *v69)(int, _BYTE *); // r10
GameManager *v70; // r0
GameManager *v71; // r0
const char *v72; // r1
int v73; // r9
const cocos2d::CCPoint *v74; // r4
void (__fastcall *v75)(int, _BYTE *); // r10
char *v77; // [sp+Ch] [bp-C0h]
int v78; // [sp+10h] [bp-BCh]
int v79; // [sp+1Ch] [bp-B0h]
float v80; // [sp+20h] [bp-ACh] BYREF
float v81; // [sp+24h] [bp-A8h]
_BYTE v82[8]; // [sp+28h] [bp-A4h] BYREF
_BYTE v83[8]; // [sp+30h] [bp-9Ch] BYREF
_BYTE v84[8]; // [sp+38h] [bp-94h] BYREF
_BYTE v85[8]; // [sp+40h] [bp-8Ch] BYREF
_BYTE v86[8]; // [sp+48h] [bp-84h] BYREF
int (__fastcall *v87)(ShareLevelLayer *, cocos2d::CCObject *); // [sp+50h] [bp-7Ch]
int v88; // [sp+54h] [bp-78h]
int (__fastcall *v89)(ShareLevelLayer *, cocos2d::CCObject *); // [sp+58h] [bp-74h]
int v90; // [sp+5Ch] [bp-70h]
_DWORD v91[2]; // [sp+60h] [bp-6Ch] BYREF
int v92[2]; // [sp+68h] [bp-64h] BYREF
char *v93; // [sp+70h] [bp-5Ch]
unsigned __int8 v94; // [sp+74h] [bp-58h] BYREF
_BYTE v95[3]; // [sp+75h] [bp-57h] BYREF
size_t v96; // [sp+78h] [bp-54h]
char *v97; // [sp+7Ch] [bp-50h]
int v98; // [sp+80h] [bp-4Ch] BYREF
unsigned int v99; // [sp+84h] [bp-48h]
char *v100; // [sp+88h] [bp-44h]
int v101[3]; // [sp+8Ch] [bp-40h] BYREF
int v102; // [sp+98h] [bp-34h] BYREF
int v103; // [sp+9Ch] [bp-30h]
cocos2d::CCLabelBMFont *v104; // [sp+A0h] [bp-2Ch]
_BYTE v105[16]; // [sp+A4h] [bp-28h] BYREF
_DWORD v106[4]; // [sp+B4h] [bp-18h] BYREF
v106[0] = -1778384896;
v78 = cocos2d::CCLayerColor::initWithColor(this, v106);
if ( !v78 )
return v78;
FLAlertLayer::incrementForcePrio(this);
*((_DWORD *)this + 130) = a2;
cocos2d::CCObject::retain(a2);
(*(void (__fastcall **)(ShareLevelLayer *, int))(*(_DWORD *)this + 500))(this, 1);
v4 = (cocos2d::CCDirector *)(*(int (__fastcall **)(ShareLevelLayer *, int))(*(_DWORD *)this + 536))(this, 1);
cocos2d::CCDirector::sharedDirector(v4);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v80);
v6 = cocos2d::CCLayer::create(WinSize);
v7 = *(_DWORD *)this;
*((_DWORD *)this + 115) = v6;
(*(void (__fastcall **)(ShareLevelLayer *, int))(v7 + 228))(this, v6);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v106, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v106);
v9 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v8 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v106, 420.0, 300.0);
v9(v8, v106);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v8, -1);
v10 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v8 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v106, v80 * 0.5, v81 * 0.5);
v10(v8, v106);
v11 = *((_DWORD *)this + 130);
v102 = 0;
v103 = 0;
v104 = nullptr;
if ( (*(_BYTE *)(v11 + 280) & 1) != 0 )
{
std::string::__init(&v102, *(const void **)(v11 + 288), *(_DWORD *)(v11 + 284));
}
else
{
v12 = (int *)(v11 + 280);
v13 = v12[1];
v14 = (cocos2d::CCLabelBMFont *)v12[2];
v102 = *v12;
v103 = v13;
v104 = v14;
}
if ( (v102 & 1) != 0 )
v15 = v104;
else
v15 = (cocos2d::CCLabelBMFont *)((char *)&v102 + 1);
v16 = cocos2d::CCLabelBMFont::create(v15, "goldFont.fnt", (const char *)v14);
std::string::~string((int)&v102);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v16);
v17 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v16 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v106, v80 * 0.5, (float)((float)(v81 * 0.5) + 150.0) - 20.0);
v17(v16, v106);
v102 = 0;
v103 = 0;
v104 = nullptr;
std::string::__init(&v102, "You cannot change the name once it is shared.", 0x35u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v106, 0.5, 1.0);
v18 = TextArea::create(
(int)&v102,
"chatFont.fnt",
1065353216,
1137180672,
(const cocos2d::CCPoint *)v106,
COERCE_INT(20.0),
0,
0);
std::string::~string((int)&v102);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v18);
v19 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v18 + 92);
v20 = (*(int (__fastcall **)(int))(*(_DWORD *)v16 + 96))(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v105, 0.0, -20.0);
cocos2d::CCPoint::operator+(v106, v20, v105);
v19(v18, v106);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v18 + 80))(v18, 1061997773);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v82, v80 * 0.5, (float)(v81 * 0.5) + 60.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v105, 0.0, 0.0, 80.0, 80.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v106, (const cocos2d::CCRect *)v105);
v21 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v106);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v83, 380.0, 50.0);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v21 + 160))(v21, v83);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v21, -1);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v21 + 92))(v21, v82);
v22 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v21 + 480);
LOWORD(v106[0]) = 16514;
BYTE2(v106[0]) = 33;
v22(v21, v106);
v92[0] = 0;
v92[1] = 0;
v93 = nullptr;
std::string::__init(v92, "(No description provided)", 0x19u);
GJGameLevel::getUnpackedLevelDescription((GJGameLevel *)&v94);
v98 = 0;
v99 = 0;
v100 = nullptr;
v23 = (char *)&v98;
std::string::__init(&v98, &unk_B6B226, 0);
v24 = v94 & 1;
if ( v24 )
v25 = v96;
else
v25 = (int)v94 >> 1;
if ( (v98 & 1) != 0 )
{
v26 = v99;
if ( !v24 )
{
v27 = v95;
LABEL_16:
v28 = v100;
goto LABEL_19;
}
}
else
{
v26 = (int)(unsigned __int8)v98 >> 1;
if ( !v24 )
{
v27 = v95;
goto LABEL_18;
}
}
v27 = v97;
if ( (v98 & 1) != 0 )
goto LABEL_16;
LABEL_18:
v28 = (char *)&v98 + 1;
LABEL_19:
v29 = v26;
if ( v26 >= v25 )
v29 = v25;
if ( !v29 || (v30 = memcmp(v27, v28, v29)) == 0 )
{
if ( v25 < v26 )
v30 = -1;
else
v30 = v25 > v26;
}
v79 = v30;
std::string::~string((int)&v98);
if ( v79 )
{
if ( (v94 & 1) != 0 )
v32 = v97;
else
v32 = v95;
std::string::assign(v92, v32);
}
v31 = (EmoteSprite *)GameToolbox::stripNonBreakingSpaces(v92);
v33 = EmoteSprite::maxEmotesComment(v31);
v36 = (EmoteSprite *)EmoteSprite::effectiveLength((unsigned __int8 *)v92, v33, v34, v35);
if ( (int)v36 > 180 )
{
v40 = 180;
}
else
{
v37 = EmoteSprite::maxEmotesComment(v36);
v40 = EmoteSprite::effectiveLength((unsigned __int8 *)v92, v37, v38, v39);
if ( v40 <= 70 )
{
v41 = 1.0;
goto LABEL_38;
}
}
v41 = (float)((float)((float)(180 - v40) / 180.0) * 0.3) + 0.7;
LABEL_38:
if ( (v92[0] & 1) == 0 )
v23 = (char *)v92 + 1;
v101[0] = 0;
if ( (v92[0] & 1) != 0 )
v23 = v93;
v101[1] = 0;
v101[2] = 0;
v42 = strlen(v23);
std::string::__init(v101, v23, v42);
v43 = (EmoteSprite *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v106, 0.5, 0.5);
v44 = EmoteSprite::maxEmotesComment(v43);
v45 = TextArea::create(
(int)v101,
"chatFont.fnt",
1065353216,
COERCE_INT(368.5 / v41),
(const cocos2d::CCPoint *)v106,
COERCE_INT(20.0),
1,
v44);
std::string::~string((int)v101);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v45);
v46 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v45 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v91, 0.0, 1.0);
cocos2d::CCPoint::operator+(v106, v82, v91);
v46(v45, v106);
(*(void (__fastcall **)(int, float))(*(_DWORD *)v45 + 80))(v45, COERCE_FLOAT(LODWORD(v41)));
v102 = 0;
v103 = 0;
v104 = nullptr;
std::string::__init(
&v102,
"By sharing a level you give the rights to use the level\n(in any way) to the creators of Geometry Dash.",
0x66u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v106, 0.5, 1.0);
v47 = TextArea::create(
(int)&v102,
"chatFont.fnt",
1065353216,
1136525312,
(const cocos2d::CCPoint *)v106,
COERCE_INT(20.0),
0,
0);
std::string::~string((int)&v102);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v47);
v48 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v47 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v106, v80 * 0.5, (float)((float)(v81 * 0.5) - 150.0) + 65.0);
v48(v47, v106);
v49 = (cocos2d::CCMenu *)(*(int (__fastcall **)(int, int))(*(_DWORD *)v47 + 80))(v47, 1059481190);
*((_DWORD *)this + 125) = -1;
v50 = cocos2d::CCMenu::create(v49);
*((_DWORD *)this + 111) = v50;
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v50, 10);
v51 = (cocos2d::CCArray *)ShareLevelLayer::setupStars((const cocos2d::CCPoint **)this);
v52 = (cocos2d::CCArray *)cocos2d::CCArray::create(v51);
v54 = ButtonSprite::create((ButtonSprite *)"Cancel", v53);
v88 = 0;
v87 = ShareLevelLayer::onClose;
v55 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create((int)v54, 0, (int)this, (int)ShareLevelLayer::onClose, 0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v55);
cocos2d::CCArray::addObject(v52, v55);
if ( *(_BYTE *)(*((_DWORD *)this + 130) + 609) )
v56 = "GJ_button_04.png";
else
v56 = "GJ_button_01.png";
v57 = ButtonSprite::create((ButtonSprite *)"Share Level", nullptr, 0, 1.0, 0.0, "goldFont.fnt", v56, v77);
v90 = 0;
v89 = ShareLevelLayer::onShare;
v58 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create((int)v57, 0, (int)this, (int)ShareLevelLayer::onShare, 0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v58);
cocos2d::CCArray::addObject(v52, v58);
v59 = *((const cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v91, v80 * 0.5, (float)((float)(v81 * 0.5) - 150.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v106, v59);
GameToolbox::alignItemsHorisontally(*(float *)&v52, 15.0, (int)v106, 0);
v61 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_optionsBtn02_001.png", v60);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v61 + 80))(v61, 1061997773);
v91[1] = 0;
v91[0] = ShareLevelLayer::onSettings;
v62 = CCMenuItemSpriteExtra::create(v61, 0, (int)this, (int)ShareLevelLayer::onSettings, 0);
CCMenuItemSpriteExtra::setSizeMult(v62, 2.0);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v62);
v63 = *((const cocos2d::CCPoint **)this + 111);
v64 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v62 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v86,
(float)((float)(v80 * 0.5) + 210.0) - 26.0,
(float)((float)(v81 * 0.5) + 150.0) - 26.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v106, v63);
v64(v62, v106);
v66 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_reportBtn_001.png", v65);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v66 + 80))(v66, 1058642330);
v106[1] = 0;
v106[0] = ShareLevelLayer::onGuidelines;
v67 = CCMenuItemSpriteExtra::create(v66, 0, (int)this, (int)ShareLevelLayer::onGuidelines, 0);
CCMenuItemSpriteExtra::setSizeMult(v67, 1.2);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v67);
v68 = *((const cocos2d::CCPoint **)this + 111);
v69 = *(int (__fastcall **)(int, _BYTE *))(*(_DWORD *)v67 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v85,
(float)((float)(v80 * 0.5) - 210.0) + 26.0,
(float)((float)(v81 * 0.5) + 150.0) - 26.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v86, v68);
v70 = (GameManager *)v69(v67, v86);
v71 = (GameManager *)GameManager::sharedState(v70);
if ( !GameManager::getGameVariable(v71, "0029") )
{
v73 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_optionsTxt_001.png", v72);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v73);
v74 = *((const cocos2d::CCPoint **)this + 111);
v75 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v73 + 92);
(*(void (__fastcall **)(int))(*(_DWORD *)v62 + 96))(v62);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v84, v74);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v85, -55.0, 0.0);
cocos2d::CCPoint::operator+(v86, v84, v85);
v75(v73, v86);
}
std::string::~string((int)&v94);
std::string::~string((int)v92);
return v78;
}