//
// ShareLevelLayer::init from 0x100280190 to 0x100280d63 (3027 bytes)
//
// 1 xrefs:
// > ShareLevelLayer::create @ 0x100280154
//
// 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
//
bool __fastcall ShareLevelLayer::init(ShareLevelLayer *a1, GJGameLevel *a2)
{
bool v3; // al
bool v4; // bl
cocos2d::CCLayer *v5; // rax
cocos2d::extension::CCScale9Sprite *v6; // r12
double v7; // xmm0_8
GJGameLevel *m_level; // rax
const char *data; // rdi
cocos2d::CCLabelBMFont *v10; // r12
__int64 v11; // r13
__int64 v12; // rbx
cocos2d::extension::CCScale9Sprite *v13; // r13
double v14; // xmm0_8
const std::string::value_type *p_s; // rsi
unsigned __int64 v16; // r12
std::string::size_type size; // rbx
const char *v18; // r14
std::string::pointer v19; // r15
unsigned __int8 v20; // r13
signed __int64 v21; // rax
size_t v22; // rdx
char *v23; // rbx
char *v24; // rax
char *v25; // rax
std::string::size_type v26; // rax
const std::string::value_type *v27; // rcx
std::string::size_type v28; // r8
std::string::size_type v29; // rbx
std::string::size_type v30; // rax
unsigned __int128 v31; // kr00_16
int v32; // eax
size_t v33; // rax
size_t v34; // r12
char *v35; // r13
size_t v36; // rbx
__int64 v37; // r15
ShareLevelLayer *v38; // rbx
void *v39; // rax
ShareLevelLayer *v40; // r14
__int64 v41; // r15
cocos2d::CCMenu *v42; // rax
cocos2d::CCMenu *v43; // rsi
cocos2d::CCArray *v44; // r15
ButtonSprite *v45; // rax
CCMenuItemSpriteExtra *v46; // r12
const char *v47; // r9
ButtonSprite *v48; // rax
CCMenuItemSpriteExtra *v49; // r12
const cocos2d::CCPoint *m_buttonMenu; // r12
cocos2d::CCPoint v51; // xmm1_8
cocos2d::CCSprite *v52; // r15
CCMenuItemSpriteExtra *v53; // r15
const cocos2d::CCPoint *v54; // r12
GameManager *v55; // rax
cocos2d::CCSprite *v56; // r12
const cocos2d::CCPoint *v57; // r14
char v59[16]; // [rsp+8h] [rbp-118h] BYREF
char v60[8]; // [rsp+18h] [rbp-108h] BYREF
char v61[8]; // [rsp+20h] [rbp-100h] BYREF
char v62[8]; // [rsp+28h] [rbp-F8h] BYREF
_QWORD v63[2]; // [rsp+30h] [rbp-F0h] BYREF
void *v64; // [rsp+40h] [rbp-E0h]
_QWORD v65[2]; // [rsp+48h] [rbp-D8h] BYREF
void *v66; // [rsp+58h] [rbp-C8h]
std::string::size_type v67; // [rsp+60h] [rbp-C0h]
unsigned __int8 v68; // [rsp+68h] [rbp-B8h] BYREF
std::string::value_type __s; // [rsp+69h] [rbp-B7h] BYREF
__int64 v70; // [rsp+70h] [rbp-B0h]
void *v71; // [rsp+78h] [rbp-A8h]
std::string::value_type v72[8]; // [rsp+80h] [rbp-A0h] BYREF
std::string::size_type v73; // [rsp+88h] [rbp-98h]
void *v74; // [rsp+90h] [rbp-90h]
_QWORD __dst[2]; // [rsp+98h] [rbp-88h] BYREF
void *__p; // [rsp+A8h] [rbp-78h]
ShareLevelLayer *v77; // [rsp+B0h] [rbp-70h]
char v78; // [rsp+BCh] [rbp-64h] BYREF
float v79; // [rsp+C4h] [rbp-5Ch]
float v80; // [rsp+C8h] [rbp-58h] BYREF
float v81; // [rsp+CCh] [rbp-54h]
std::string __src; // [rsp+D0h] [rbp-50h] BYREF
_BYTE v83[10]; // [rsp+ECh] [rbp-34h] BYREF
bool v84; // [rsp+F6h] [rbp-2Ah]
bool v85; // [rsp+F7h] [rbp-29h]
double v86; // 0:xmm0_8.8
double v87; // 0:xmm0_8.8
cocos2d::CCRect v88; // 0:xmm0_8.8,8:xmm1_8.8
cocos2d::CCRect v89; // 0:xmm0_8.8,8:xmm1_8.8
*(_DWORD *)&__src.__r_.__value_.__l.0 = -1778384896;
v3 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)&__src);
v4 = v3;
if ( !v3 )
return v4;
v84 = v3;
FLAlertLayer::incrementForcePrio(a1);
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
((void (__fastcall *)(ShareLevelLayer *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(ShareLevelLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v86 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v80);
v5 = cocos2d::CCLayer::create();
a1->m_mainLayer = v5;
((void (__fastcall *)(ShareLevelLayer *, cocos2d::CCLayer *, double))a1->addChild)(a1, v5, v86);
v88.origin = 0;
v88.size = 0;
sub_10028CC00(&__src, 0.0, 0.0, 80.0, 80.0);
v6 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v88);
sub_10028CBF0(&__src, 420.0, 300.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v6->setContentSize)(v6, &__src);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v6,
0xFFFFFFFFLL);
*(_QWORD *)&v7 = LODWORD(v80);
*(float *)&v7 = v80 * 0.5;
sub_10028CBE0(&__src, v80 * 0.5, v81 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v6->setPosition)(v6, &__src);
m_level = a1->m_level;
if ( (m_level->m_levelName.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&__src, m_level->m_levelName.m_data.m_long.longStorage, m_level->m_levelName.m_data.m_long.size, v7);
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_4;
}
else
{
__src = (std::string)m_level->m_levelName;
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_4:
data = __src.__r_.__value_.__s.__data_;
goto LABEL_7;
}
}
data = __src.__r_.__value_.__l.__data_;
LABEL_7:
v10 = cocos2d::CCLabelBMFont::create_3(data, "goldFont.fnt");
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__src.__r_.__value_.__l.__data_);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v10);
sub_10028CBE0(&__src, v80 * 0.5, (float)((float)(v81 * 0.5) + 150.0) + -20.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v10->setPosition)(v10, &__src);
v64 = operator new(0x38u);
v63[0] = 57;
v63[1] = 53;
strcpy((char *)v64, "You cannot change the name once it is shared.");
sub_10028CBE0(&__src, 0.5, 1.0);
v79 = 1.0;
v11 = TextArea::create(v63, "chatFont.fnt", &__src, 0, 1.0, 400.0, 20.0);
v77 = (ShareLevelLayer *)a2;
if ( (v63[0] & 1) != 0 )
operator delete(v64);
((void (__fastcall *)(cocos2d::CCLayer *, __int64))a1->m_mainLayer->addChild)(a1->m_mainLayer, v11);
v12 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v10->getPosition)(v10);
sub_10028CBE0(&v68, 0.0, -20.0);
sub_10028CCE0(&__src, v12);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v11 + 184LL))(v11, &__src);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v11 + 160LL))(v11, 0.80000001);
sub_10028CBE0(v61, v80 * 0.5, (float)(0.5 * v81) + 60.0);
v89.size = 0;
sub_10028CC00(v59, 0.0, 0.0, 80.0, 80.0);
*(double *)&v89.origin = sub_10028D180(&__src);
v13 = cocos2d::extension::CCScale9Sprite::create_2("square02b_001.png", v89);
sub_10028CBF0(v60, 380.0, 50.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, char *))v13->setContentSize)(v13, v60);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v13,
0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, char *))v13->setPosition)(v13, v61);
__src.__r_.__value_.__s.__data_[1] = 33;
*(_WORD *)&__src.__r_.__value_.__l.0 = 16514;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v13->setColor)(v13, &__src);
__src.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x20u);
__src.__r_.__value_.__r.__words[0] = 33;
__src.__r_.__value_.__l.__size_ = 25;
v14 = *(double *)"(No description provided)";
strcpy(__src.__r_.__value_.__l.__data_, "(No description provided)");
GJGameLevel::getUnpackedLevelDescription(&v68, v77);
if ( (v68 & 1) != 0 )
{
if ( !v70 )
goto LABEL_19;
LABEL_15:
if ( (v68 & 1) != 0 )
p_s = (const std::string::value_type *)v71;
else
p_s = &__s;
std::string::assign(&__src, p_s);
goto LABEL_19;
}
if ( v68 >> 1 )
goto LABEL_15;
LABEL_19:
v77 = a1;
*(_WORD *)v72 = 0;
v16 = *(_BYTE *)&__src.__r_.__value_.__l.0 >> 1;
size = __src.__r_.__value_.__l.__size_;
v67 = __src.__r_.__value_.__l.__size_;
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0 )
size = *(_BYTE *)&__src.__r_.__value_.__l.0 >> 1;
v18 = __src.__r_.__value_.__l.__data_;
v19 = __src.__r_.__value_.__l.__data_;
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0 )
v19 = __src.__r_.__value_.__s.__data_;
v85 = (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0;
v20 = 0;
v21 = 0;
LABEL_24:
v22 = size - v21;
if ( (__int64)size > v21 )
{
v23 = &v19[size];
v24 = &v19[v21];
do
{
v25 = (char *)memchr(v24, -96, v22);
if ( !v25 )
break;
if ( *v25 == -96 )
{
if ( v25 != v23 )
{
v26 = v25 - v19;
if ( v26 != -1 )
{
if ( (v20 & 1) != 0 )
{
v27 = (const std::string::value_type *)v74;
v28 = v73;
}
else
{
v28 = v20 >> 1;
v27 = &v72[1];
}
v29 = v26;
std::string::replace(&__src, v26, 1u, v27, v28);
v20 = v72[0];
if ( (v72[0] & 1) != 0 )
v30 = v73;
else
v30 = (unsigned __int8)v72[0] >> 1;
v21 = v29 + v30;
v16 = *(_BYTE *)&__src.__r_.__value_.__l.0 >> 1;
v85 = (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0;
v18 = __src.__r_.__value_.__l.__data_;
v31 = *(_OWORD *)&__src.__r_.__value_.__r.__words[1];
v19 = (std::string::pointer)(v31 >> 64);
size = v31;
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0 )
v19 = __src.__r_.__value_.__s.__data_;
v67 = __src.__r_.__value_.__l.__size_;
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0 )
size = *(_BYTE *)&__src.__r_.__value_.__l.0 >> 1;
if ( size >= v21 )
goto LABEL_24;
}
}
break;
}
v24 = v25 + 1;
v22 = v23 - v24;
}
while ( v23 - v24 > 0 );
}
if ( !v85 && (v32 = 180, v16 = v67, v67 > 0xB4) || (v32 = v16, v16 >= 0x47) )
{
HIDWORD(v14) = 0;
*(float *)&v14 = (float)((float)((float)(180 - v32) / 180.0) * 0.30000001) + 0.69999999;
v79 = *(float *)&v14;
}
if ( v85 )
v18 = __src.__r_.__value_.__s.__data_;
v33 = strlen(v18);
if ( v33 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v14);
v34 = v33;
if ( v33 >= 0x17 )
{
v36 = 26;
if ( (v33 | 7) != 0x17 )
v36 = (v33 | 7) + 1;
v35 = (char *)operator new(v36);
__p = v35;
__dst[0] = v36 | 1;
__dst[1] = v34;
goto LABEL_56;
}
LOBYTE(__dst[0]) = 2 * v33;
v35 = (char *)__dst + 1;
if ( v33 )
LABEL_56:
memmove(v35, v18, v34);
v35[v34] = 0;
sub_10028CBE0(v83, 0.5, 0.5);
v37 = TextArea::create(__dst, "chatFont.fnt", v83, 1, 1.0, 335.0 / v79, 20.0);
v38 = v77;
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
((void (__fastcall *)(cocos2d::CCLayer *, __int64))v38->m_mainLayer->addChild)(v38->m_mainLayer, v37);
sub_10028CBE0(&v78, 0.0, 1.0);
sub_10028CCE0(v83, v61);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v37 + 184LL))(v37, v83);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v37 + 160LL))(v37, v79);
v39 = operator new(0x68u);
v4 = v84;
v40 = v77;
v66 = v39;
v65[0] = 105;
v65[1] = 102;
strcpy(
(char *)v39,
"By sharing a level you give the rights to use the level\n(in any way) to the creators of Geometry Dash.");
sub_10028CBE0(v83, 0.5, 1.0);
v41 = TextArea::create(v65, "chatFont.fnt", v83, 0, 1.0, 380.0, 20.0);
if ( (v65[0] & 1) != 0 )
operator delete(v66);
((void (__fastcall *)(cocos2d::CCLayer *, __int64))v40->m_mainLayer->addChild)(v40->m_mainLayer, v41);
sub_10028CBE0(v83, v80 * 0.5, (float)((float)(v81 * 0.5) + -150.0) + 65.0);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v41 + 184LL))(v41, v83);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v41 + 160LL))(v41, 0.64999998);
v40->m_joystickConnected = -1;
v42 = cocos2d::CCMenu::create();
v40->m_buttonMenu = v42;
v43 = v42;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))v40->m_mainLayer->addChild_0)(
v40->m_mainLayer,
v42,
10);
ShareLevelLayer::setupStars(v40);
v44 = (cocos2d::CCArray *)sub_10071F9E0(v40, v43);
v45 = sub_100092A30("Cancel");
v46 = CCMenuItemSpriteExtra::create(
v45,
nullptr,
v40,
(cocos2d::SEL_MenuHandler)(unsigned __int64)ShareLevelLayer::onClose);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v40->m_buttonMenu->addChild)(v40->m_buttonMenu, v46);
sub_10071FCD0(v44, v46);
v47 = "GJ_button_01.png";
if ( v40->m_level->m_isUploaded )
v47 = "GJ_button_04.png";
v48 = sub_100092BF0("Share Level", 0, 0, 0, "goldFont.fnt", v47, 1.0);
v49 = CCMenuItemSpriteExtra::create(
v48,
nullptr,
v40,
(cocos2d::SEL_MenuHandler)(unsigned __int64)ShareLevelLayer::onShare);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v40->m_buttonMenu->addChild)(v40->m_buttonMenu, v49);
sub_10071FCD0(v44, v49);
m_buttonMenu = (const cocos2d::CCPoint *)v40->m_buttonMenu;
v51 = (cocos2d::CCPoint)LODWORD(v81);
v51.x = (float)((float)(v81 * 0.5) + -150.0) + 25.0;
sub_10028CBE0(&v78, v80 * 0.5, v51.x);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v83, m_buttonMenu);
GameToolbox::alignItemsHorisontally(v44, 15.0, v51, (bool)v83);
v52 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_optionsBtn02_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v52->setScale)(v52, 0.80000001);
v53 = CCMenuItemSpriteExtra::create(
v52,
nullptr,
v40,
(cocos2d::SEL_MenuHandler)(unsigned __int64)ShareLevelLayer::onSettings);
CCMenuItemSpriteExtra::setSizeMult(v53, 2.0);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v40->m_buttonMenu->addChild)(v40->m_buttonMenu, v53);
v54 = (const cocos2d::CCPoint *)v40->m_buttonMenu;
sub_10028CBE0(&v78, (float)((float)(v80 * 0.5) + 210.0) + -26.0, (float)((float)(0.5 * v81) + 150.0) + -26.0);
*(cocos2d::CCPoint *)&v87 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v83, v54);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BYTE *, double))v53->setPosition)(v53, v83, v87);
v55 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v55, "0029") )
{
v56 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_optionsTxt_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *))v40->m_mainLayer->addChild)(v40->m_mainLayer, v56);
v57 = (const cocos2d::CCPoint *)v40->m_buttonMenu;
((void (__fastcall *)(CCMenuItemSpriteExtra *))v53->getPosition)(v53);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v78, v57);
sub_10028CBE0(v62, -55.0, 0.0);
sub_10028CCE0(v83, &v78);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *))v56->setPosition)(v56, v83);
}
if ( (v72[0] & 1) == 0 )
{
if ( (v68 & 1) == 0 )
goto LABEL_67;
LABEL_71:
operator delete(v71);
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) == 0 )
return v4;
goto LABEL_68;
}
operator delete(v74);
if ( (v68 & 1) != 0 )
goto LABEL_71;
LABEL_67:
if ( (*(_BYTE *)&__src.__r_.__value_.__s.0 & 1) != 0 )
LABEL_68:
operator delete(__src.__r_.__value_.__l.__data_);
return v4;
}