//
// ShareLevelSettingsLayer::init from 0x3b9a7c to 0x3ba164 (1768 bytes)
//
// 1 xrefs:
// > ShareLevelSettingsLayer::create @ 0x3ba202
//
// 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 ShareLevelSettingsLayer::init(ShareLevelSettingsLayer *a1, GJGameLevel *a2)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCNode *v5; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r8
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCLabelBMFont *v8; // r6
void (__fastcall *v9)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCMenu *v10; // r0
float v11; // r3
cocos2d::CCNode *v12; // r6
cocos2d::CCMenu *m_buttonMenu; // r9
void (__fastcall *v14)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCSprite *v15; // r0
CCMenuItemSpriteExtra *v16; // r8
cocos2d::CCMenu *v17; // r10
void (__fastcall *v18)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v19; // r0
cocos2d::CCLabelBMFont *m_passwordLabel; // r7
void (__fastcall *v21)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCSprite *v22; // r7
cocos2d::CCSprite *v23; // r9
CCMenuItemToggler *v24; // r8
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
cocos2d::CCLabelBMFont *v26; // r11
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r6
float *v28; // r0
void (__fastcall *setScale)(cocos2d::CCLabelBMFont *__hidden, float); // r5
float *v30; // r0
void (__fastcall *v31)(cocos2d::CCLabelBMFont *__hidden, float); // r5
int v32; // r1
GJGameLevel *m_level; // r3
cocos2d::CCSprite *v34; // r5
cocos2d::CCSprite *v35; // r8
CCMenuItemToggler *v36; // r0
bool m_friendsOnly; // r1
CCMenuItemToggler *m_friendsOnlyToggler; // r8
void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v40; // r0
cocos2d::CCLabelBMFont *m_friendsOnlyLabel; // r8
void (__fastcall *v42)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v43; // r8
void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
float *v45; // r0
cocos2d::CCNode *v46; // r7
void (__fastcall *v47)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4
float v49; // r2
float v50; // r3
int v51; // [sp+14h] [bp-60h]
void (__fastcall *v52)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+1Ch] [bp-58h]
cocos2d::CCSize v53; // [sp+24h] [bp-50h] BYREF
cocos2d::CCPoint v54; // [sp+2Ch] [bp-48h] BYREF
cocos2d::CCPoint v55; // [sp+34h] [bp-40h] BYREF
cocos2d::CCPoint v56; // [sp+3Ch] [bp-38h] BYREF
cocos2d::CCPoint v57; // [sp+44h] [bp-30h] BYREF
void (*v58)(ShareLevelSettingsLayer *, cocos2d::CCObject *); // [sp+4Ch] [bp-28h]
int v59; // [sp+50h] [bp-24h]
cocos2d::CCPoint v60; // [sp+54h] [bp-20h] BYREF
cocos2d::CCRect v61; // [sp+5Ch] [bp-18h] BYREF
cocos2d::CCSize v62; // 0:^0.8
cocos2d::CCRect v63; // 0:kr00_16.16
cocos2d::SEL_MenuHandler v64; // 0:r3.4,4:^0.4
cocos2d::SEL_MenuHandler v65; // 0:r3.4,4:^0.4
v51 = FLAlertLayer::init(a1, (cocos2d::_ccColor4B)75);
if ( v51 )
{
a1->m_level = a2;
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v53, v4);
cocos2d::CCRect::CCRect(&v61, 0.0, 0.0, 80.0, 80.0);
v63.origin.x = v49;
v63.origin.y = v50;
v63.size = v62;
v5 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v61,
v63);
setContentSize = v5->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v61, 360.0, 220.0);
setContentSize(v5, (const cocos2d::CCSize *)&v61);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v5, -1);
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint(&v61.origin, v53.width * 0.5, v53.height * 0.5);
setPosition(v5, &v61.origin);
v8 = cocos2d::CCLabelBMFont::create();
v9 = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v61.origin, v53.width * 0.5, (float)((float)(v53.height * 0.5) + 110.0) - 20.0);
v9(v8, &v61.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v8);
a1->m_joystickConnected = -1;
v10 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v10;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v10, 10);
sub_776584((int)&v60, "Help");
sub_776584(
(int)&v61,
"Unlisted makes it so that your level can only be found by searching for the exact ID. It will "
"not be visible on your profile, from search, or anywhere else. Unlisted levels do not have to be v"
"erified to be uploaded.\n"
"Friends Only makes it so that only friends who search the exact ID can find it.");
v12 = (cocos2d::CCNode *)InfoAlertButton::create(
(InfoAlertButton *)&v60,
(std::string)&v61,
(std::string)1065353216,
v11);
sub_774008(&v61);
sub_774008(&v60);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v12);
m_buttonMenu = a1->m_buttonMenu;
v14 = v12->setPosition;
cocos2d::CCPoint::CCPoint(
&v60,
(float)((float)(v53.width * 0.5) + 180.0) - 20.0,
(float)((float)(v53.height * 0.5) + 110.0) - 20.0);
cocos2d::CCNode::convertToNodeSpace(&v61.origin, m_buttonMenu, &v60);
v14(v12, &v61.origin);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v58 = ShareLevelSettingsLayer::onClose;
v59 = 0;
v16 = CCMenuItemSpriteExtra::create(
v15,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ShareLevelSettingsLayer::onClose, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v16, 1.5);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v16);
v17 = a1->m_buttonMenu;
v18 = v16->setPosition;
cocos2d::CCPoint::CCPoint(
&v60,
(float)((float)(v53.width * 0.5) - 180.0) + 5.0,
(float)((float)(v53.height * 0.5) + 110.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace(&v61.origin, v17, &v60);
v18(v16, &v61.origin);
v19 = cocos2d::CCLabelBMFont::create();
a1->m_passwordLabel = v19;
a1->m_mainLayer->addChild(a1->m_mainLayer, v19);
m_passwordLabel = a1->m_passwordLabel;
v21 = m_passwordLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v61.origin, v53.width * 0.5, (float)((float)(v53.height * 0.5) - 110.0) + 80.0);
v21(m_passwordLabel, &v61.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_passwordLabel->setScale)(a1->m_passwordLabel, 1058642330);
cocos2d::CCPoint::CCPoint(&v54, (float)(v53.width * 0.5) - 140.0, (float)(v53.height * 0.5) + 45.0);
v22 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v23 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v22->setScale)(v22, 1061997773);
((void (__fastcall *)(cocos2d::CCSprite *, int))v23->setScale)(v23, 1061997773);
v64.adj = 0;
v64.ptr = (void (__cdecl *)(cocos2d::CCObject *))ShareLevelSettingsLayer::onUnlisted;
LODWORD(v60.x) = ShareLevelSettingsLayer::onUnlisted;
v60.y = 0.0;
v24 = CCMenuItemToggler::create(v22, v23, a1, v64);
CCMenuItemToggler::toggle(v24, !a1->m_level->m_unlisted);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v24);
v25 = v24->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v61.origin, a1->m_buttonMenu, &v54);
v25(v24, &v61.origin);
CCMenuItemToggler::setSizeMult(v24, 1.5);
v26 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v26);
setAnchorPoint = v26->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v61.origin, 0.0, 0.5);
setAnchorPoint(v26, &v61.origin);
v52 = v26->setPosition;
v28 = (float *)v22->getContentSize(v22);
cocos2d::CCPoint::CCPoint(&v57, (float)((float)(*v28 * 0.5) * 0.8) + 8.0, 0.0);
cocos2d::CCPoint::operator+(&v61, &v54, &v57);
v52(v26, &v61.origin);
if ( v26->getContentSize(v26)->width > 110.0 )
{
setScale = v26->setScale;
v30 = (float *)v26->getContentSize(v26);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _DWORD))setScale)(v26, 110.0 / *v30);
}
v31 = v26->setScale;
if ( v26->getScale(v26) > 0.35 )
v32 = 1051931443;
else
v32 = ((int (__fastcall *)(cocos2d::CCLabelBMFont *))v26->getScale)(v26);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v31)(v26, v32);
m_level = a1->m_level;
if ( m_level->m_isUploaded || m_level->m_levelVersion > 1 )
{
v24->setEnabled(v24, 0);
v22->setColor(v22, (const cocos2d::ccColor3B *)&unk_9AAA92);
v23->setColor(v23, (const cocos2d::ccColor3B *)&unk_9AAA92);
v26->setColor(v26, (const cocos2d::ccColor3B *)&unk_9AAA92);
}
cocos2d::CCPoint::CCPoint(&v55, (float)(v53.width * 0.5) + 40.0, v54.y);
v34 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v35 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v34->setScale)(v34, 1061997773);
((void (__fastcall *)(cocos2d::CCSprite *, int))v35->setScale)(v35, 1061997773);
v65.ptr = (void (__cdecl *)(cocos2d::CCObject *))ShareLevelSettingsLayer::onUnlistedFriendsOnly;
v61.origin.y = 0.0;
v65.adj = 0;
LODWORD(v61.origin.x) = ShareLevelSettingsLayer::onUnlistedFriendsOnly;
v36 = CCMenuItemToggler::create(v35, v34, a1, v65);
m_friendsOnly = a1->m_level->m_friendsOnly;
a1->m_friendsOnlyToggler = v36;
CCMenuItemToggler::toggle(v36, m_friendsOnly);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, a1->m_friendsOnlyToggler);
m_friendsOnlyToggler = a1->m_friendsOnlyToggler;
v39 = m_friendsOnlyToggler->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v57, a1->m_buttonMenu, &v55);
v39(m_friendsOnlyToggler, &v57);
CCMenuItemToggler::setSizeMult(a1->m_friendsOnlyToggler, 1.5);
v40 = cocos2d::CCLabelBMFont::create();
a1->m_friendsOnlyLabel = v40;
a1->m_mainLayer->addChild(a1->m_mainLayer, v40);
m_friendsOnlyLabel = a1->m_friendsOnlyLabel;
v42 = m_friendsOnlyLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v57, 0.0, 0.5);
v42(m_friendsOnlyLabel, &v57);
v43 = a1->m_friendsOnlyLabel;
v44 = v43->setPosition;
v45 = (float *)v34->getContentSize(v34);
cocos2d::CCPoint::CCPoint(&v56, (float)((float)(*v45 * 0.5) * 0.8) + 8.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v55, &v56);
v44(v43, &v57);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_friendsOnlyLabel, 110.0, 0.35, 0.0);
ShareLevelSettingsLayer::updateSettingsState(a1);
sub_776584((int)&v56, "Starting in 2.2, all new levels are free to copy.\n(Older levels retain any copy settings.)");
cocos2d::CCPoint::CCPoint(&v57, 0.5, 1.0);
v46 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v56,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
1134559232,
&v57,
(cocos2d::CCPoint)1101004800LL);
sub_774008(&v56);
a1->m_mainLayer->addChild(a1->m_mainLayer, v46);
v47 = v46->setPosition;
cocos2d::CCPoint::CCPoint(&v57, v53.width * 0.5, (float)((float)(v53.height * 0.5) - 110.0) + 35.0);
v47(v46, &v57);
((void (__fastcall *)(cocos2d::CCNode *, int))v46->setScale)(v46, 1059481190);
}
return v51;
}