//
// ShareLevelLayer::init from 0x3b8c84 to 0x3b9416 (1938 bytes)
//
// 1 xrefs:
// > ShareLevelLayer::create @ 0x3b9480
//
// 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 ShareLevelLayer::init(ShareLevelLayer *a1, GJGameLevel *a2)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCLayer *v5; // r0
ShareLevelLayer_vtbl *v6; // r3
cocos2d::CCNode *v7; // r7
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r8
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCLabelBMFont *v10; // r8
void (__fastcall *v11)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCNode *v12; // r11
void (__fastcall *v13)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
int v14; // r8
cocos2d::CCNode *v15; // r6
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r3
int v17; // r10
int i; // r2
int v19; // r7
unsigned int v20; // r3
float v21; // s17
cocos2d::CCNode *v22; // r7
cocos2d::CCNode *v23; // r9
void (__fastcall *v24)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCMenu *v25; // r0
cocos2d::CCArray *v26; // r0
cocos2d::CCArray *v27; // r4
const char *v28; // r1
ButtonSprite *v29; // r0
CCMenuItemSpriteExtra *v30; // r9
ButtonSprite *v31; // r0
CCMenuItemSpriteExtra *v32; // r9
cocos2d::CCMenu *m_buttonMenu; // r10
cocos2d::CCSprite *v34; // r4
CCMenuItemSpriteExtra *v35; // r4
void (__fastcall *v36)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
GameManager *v37; // r0
cocos2d::CCSprite *v38; // r7
cocos2d::CCMenu *v39; // r5
void (__fastcall *v40)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
const cocos2d::CCPoint *v41; // r0
float v43; // r2
float v44; // r3
int v45; // [sp+14h] [bp-88h]
cocos2d::CCPoint *v46; // [sp+18h] [bp-84h]
cocos2d::CCMenu *v47; // [sp+18h] [bp-84h]
char *v48; // [sp+24h] [bp-78h] BYREF
char *v49; // [sp+28h] [bp-74h] BYREF
int v50; // [sp+2Ch] [bp-70h] BYREF
int v51; // [sp+30h] [bp-6Ch] BYREF
cocos2d::CCSize v52; // [sp+34h] [bp-68h] BYREF
cocos2d::CCPoint v53; // [sp+3Ch] [bp-60h] BYREF
cocos2d::CCSize v54; // [sp+44h] [bp-58h] BYREF
cocos2d::CCPoint v55; // [sp+4Ch] [bp-50h] BYREF
cocos2d::CCPoint v56; // [sp+54h] [bp-48h] BYREF
cocos2d::CCPoint v57; // [sp+5Ch] [bp-40h] BYREF
void (*v58)(ShareLevelLayer *, cocos2d::CCObject *); // [sp+64h] [bp-38h]
int v59; // [sp+68h] [bp-34h]
cocos2d::CCPoint v60; // [sp+6Ch] [bp-30h] BYREF
cocos2d::CCRect v61; // [sp+74h] [bp-28h] BYREF
cocos2d::CCRect v62; // [sp+84h] [bp-18h] BYREF
cocos2d::CCSize v63; // 0:^0.8
cocos2d::CCRect v64; // 0:kr00_16.16
cocos2d::CCRect v65; // 0:r2.8,8:^0.8
v62.origin.x = -1.034e-25;
v45 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v62);
if ( !v45 )
return v45;
FLAlertLayer::incrementForcePrio(a1);
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v52, v4);
v5 = cocos2d::CCLayer::create();
v6 = a1->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_mainLayer = v5;
v6->addChild(a1, v5);
cocos2d::CCRect::CCRect(&v62, 0.0, 0.0, 80.0, 80.0);
v64.origin.x = v43;
v64.origin.y = v44;
v64.size = v63;
v7 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v62,
v64);
setContentSize = v7->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v62, 420.0, 300.0);
setContentSize(v7, (const cocos2d::CCSize *)&v62);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v7, -1);
setPosition = v7->setPosition;
cocos2d::CCPoint::CCPoint(&v62.origin, v52.width * 0.5, v52.height * 0.5);
setPosition(v7, &v62.origin);
sub_775C20(&v62, &a1->m_level->m_levelName);
v10 = cocos2d::CCLabelBMFont::create();
sub_774008(&v62);
a1->m_mainLayer->addChild(a1->m_mainLayer, v10);
v11 = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v62.origin, v52.width * 0.5, (float)((float)(v52.height * 0.5) + 150.0) - 20.0);
v11(v10, &v62.origin);
sub_776584((int)&v61, "You cannot change the name once it is shared.");
cocos2d::CCPoint::CCPoint(&v62.origin, 0.5, 1.0);
v12 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v61,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
1137180672,
&v62.origin,
(cocos2d::CCPoint)COERCE_UNSIGNED_INT(20.0));
sub_774008(&v61);
a1->m_mainLayer->addChild(a1->m_mainLayer, v12);
v13 = v12->setPosition;
v14 = (int)v10->getPosition(v10);
cocos2d::CCPoint::CCPoint(&v61.origin, 0.0, -20.0);
cocos2d::CCPoint::operator+(&v62, v14, &v61);
v13(v12, &v62.origin);
((void (__fastcall *)(cocos2d::CCNode *, int))v12->setScale)(v12, 1061997773);
cocos2d::CCPoint::CCPoint(&v53, v52.width * 0.5, (float)(v52.height * 0.5) + 60.0);
cocos2d::CCRect::CCRect(&v61, 0.0, 0.0, 80.0, 80.0);
cocos2d::CCRect::CCRect(&v62, &v61);
v15 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_001.png",
(const char *)&v62,
v65);
cocos2d::CCSize::CCSize(&v54, 380.0, 50.0);
v15->setContentSize(v15, &v54);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v15, -1);
v15->setPosition(v15, &v53);
getTag = v15->__vftable[1].getTag;
LOWORD(v62.origin.x) = 16514;
BYTE2(v62.origin.x) = 33;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v15, &v62);
sub_776584((int)&v48, "(No description provided)");
GJGameLevel::getUnpackedLevelDescription((GJGameLevel *)&v49);
sub_776584((int)&v55, (char *)&unk_939830);
v17 = sub_774DBC(&v49, &v55);
sub_774008(&v55);
if ( v17 )
sub_7753D4((int)&v48, v49);
sub_776584((int)&v50, byte_965AA5);
sub_776584((int)&v51, (char *)&unk_939830);
for ( i = 0; ; i = *(_DWORD *)(v51 - 12) + v19 )
{
v19 = sub_774834(&v48, &v50, i);
if ( v19 == -1 )
break;
sub_776454(&v48, v19, *(_DWORD *)(v50 - 12), &v51);
}
v20 = *((_DWORD *)v48 - 3);
if ( v20 > 0xB4 )
{
v20 = 180;
}
else if ( v20 <= 0x46 )
{
v21 = 1.0;
goto LABEL_13;
}
v21 = (float)((float)((float)(int)(180 - v20) / 180.0) * 0.3) + 0.7;
LABEL_13:
sub_776584((int)&v56, v48);
cocos2d::CCPoint::CCPoint(&v62.origin, 0.5, 0.5);
v22 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v56,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
COERCE_INT(335.0 / v21),
&v62.origin,
(cocos2d::CCPoint)0x141A00000LL);
sub_774008(&v56);
a1->m_mainLayer->addChild(a1->m_mainLayer, v22);
v46 = (cocos2d::CCPoint *)v22->setPosition;
cocos2d::CCPoint::CCPoint(&v60, 0.0, 1.0);
cocos2d::CCPoint::operator+(&v62, &v53, &v60);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))v46)(v22, &v62);
v22->setScale(v22, COERCE_FLOAT(LODWORD(v21)));
sub_776584(
(int)&v57,
"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(&v62.origin, 0.5, 1.0);
v23 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v57,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
1136525312,
&v62.origin,
(cocos2d::CCPoint)1101004800LL);
sub_774008(&v57);
a1->m_mainLayer->addChild(a1->m_mainLayer, v23);
v24 = v23->setPosition;
cocos2d::CCPoint::CCPoint(&v62.origin, v52.width * 0.5, (float)((float)(v52.height * 0.5) - 150.0) + 65.0);
v24(v23, &v62.origin);
((void (__fastcall *)(cocos2d::CCNode *, int))v23->setScale)(v23, 1059481190);
a1->m_joystickConnected = -1;
v25 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v25;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v25, 10);
ShareLevelLayer::setupStars(a1);
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v26);
v29 = ButtonSprite::create((ButtonSprite *)"Cancel", v28);
v59 = 0;
v58 = ShareLevelLayer::onClose;
v30 = CCMenuItemSpriteExtra::create(
v29,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ShareLevelLayer::onClose, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v30);
cocos2d::CCArray::addObject(v27, v30);
v31 = ButtonSprite::create("Share Level");
v60.y = 0.0;
LODWORD(v60.x) = ShareLevelLayer::onShare;
v32 = CCMenuItemSpriteExtra::create(
v31,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ShareLevelLayer::onShare, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v32);
cocos2d::CCArray::addObject(v27, v32);
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v57, v52.width * 0.5, (float)((float)(v52.height * 0.5) - 150.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(&v62.origin, m_buttonMenu, &v57);
GameToolbox::alignItemsHorisontally(v27, 15.0, (cocos2d::CCPoint)(unsigned int)&v62, 0);
v34 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_optionsBtn02_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v34->setScale)(v34, 1061997773);
LODWORD(v62.origin.x) = ShareLevelLayer::onSettings;
v62.origin.y = 0.0;
v35 = CCMenuItemSpriteExtra::create(
v34,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ShareLevelLayer::onSettings, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v35, 2.0);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v35);
v36 = v35->setPosition;
v47 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(
&v56,
(float)((float)(v52.width * 0.5) + 210.0) - 26.0,
(float)((float)(v52.height * 0.5) + 150.0) - 26.0);
cocos2d::CCNode::convertToNodeSpace(&v57, v47, &v56);
v36(v35, &v57);
v37 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v37, "0029") )
{
v38 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_optionsTxt_001.png");
a1->m_mainLayer->addChild(a1->m_mainLayer, v38);
v39 = a1->m_buttonMenu;
v40 = v38->setPosition;
v41 = v35->getPosition(v35);
cocos2d::CCNode::convertToWorldSpace(&v55, v39, v41);
cocos2d::CCPoint::CCPoint(&v56, -55.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v55, &v56);
v40(v38, &v57);
}
sub_774008(&v51);
sub_774008(&v50);
sub_774008(&v49);
sub_774008(&v48);
return v45;
}