//
// ShareLevelSettingsLayer::init from 0x1404910e0 to 0x140491af6 (2582 bytes)
//
// 2 xrefs:
// > ShareLevelLayer::onSettings @ 0x140490218
// > ??> @ 0x1406dc0c8
//
// 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
//
// Hidden C++ exception states: #wind=2
bool ShareLevelSettingsLayer::init(ShareLevelSettingsLayer *a1, GJGameLevel *a2)
{
bool result; // al
__int64 v5; // rcx
cocos2d::CCDirector *v6; // rax
struct cocos2d::CCRect *v7; // rax
struct cocos2d::extension::CCScale9Sprite *v8; // rdi
cocos2d::extension::CCScale9Sprite_vtbl *v9; // rbx
const cocos2d::CCSize *v10; // rax
float v11; // xmm0_4
cocos2d::extension::CCScale9Sprite_vtbl *v12; // rbx
double v13; // xmm0_8
const cocos2d::CCPoint *v14; // rax
struct cocos2d::CCLabelBMFont *v15; // rdi
cocos2d::CCLabelBMFont_vtbl *v16; // rbx
const cocos2d::CCPoint *v17; // rax
__int64 v18; // rcx
cocos2d::CCMenu *v19; // rax
_QWORD *v20; // r9
_QWORD *v21; // rcx
const char *v22; // rdx
__int64 v23; // r8
char *v24; // rdi
float v25; // xmm0_4
__int64 v26; // rbx
struct cocos2d::CCPoint v27; // rax
struct cocos2d::CCSprite *v28; // rax
CCMenuItemSpriteExtra *v29; // rdi
float v30; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v31; // rbx
struct cocos2d::CCPoint v32; // rax
cocos2d::CCLabelBMFont *v33; // rax
float v34; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v35; // rbx
const cocos2d::CCPoint *v36; // rax
float v37; // xmm0_4
struct cocos2d::CCSprite *v38; // r15
struct cocos2d::CCSprite *v39; // r12
CCMenuItemToggler *v40; // r14
CCMenuItemToggler_vtbl *v41; // rbx
struct cocos2d::CCPoint v42; // rax
struct cocos2d::CCLabelBMFont *v43; // rdi
float v44; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v45; // rbx
double v46; // xmm0_8
const cocos2d::CCPoint *v47; // rax
float *v48; // rax
cocos2d::CCLabelBMFont_vtbl *v49; // rbx
float v50; // xmm0_4
GJGameLevel *m_level; // rax
struct cocos2d::CCSprite *v52; // rdi
struct cocos2d::CCSprite *v53; // rbx
CCMenuItemToggler *v54; // rax
CCMenuItemToggler_vtbl *v55; // rbx
struct cocos2d::CCPoint v56; // rax
CCMenuItemToggler *m_friendsOnlyToggler; // rcx
cocos2d::CCLabelBMFont *v58; // rax
float v59; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v60; // rbx
double v61; // xmm0_8
const cocos2d::CCPoint *v62; // rax
float *v63; // rax
const struct cocos2d::CCPoint *v64; // rax
char *v65; // rdi
float v66; // xmm0_4
__int64 v67; // rbx
__int64 v68; // rax
char v69[8]; // [rsp+48h] [rbp-69h] BYREF
__int128 *v70; // [rsp+50h] [rbp-61h] BYREF
cocos2d::CCRect v71; // [rsp+58h] [rbp-59h] BYREF
__int128 v72; // [rsp+68h] [rbp-49h] BYREF
__int64 v73; // [rsp+78h] [rbp-39h]
__int64 v74; // [rsp+80h] [rbp-31h]
__int128 v75; // [rsp+88h] [rbp-29h] BYREF
__int64 v76; // [rsp+98h] [rbp-19h]
__int64 v77; // [rsp+A0h] [rbp-11h]
float v78; // [rsp+128h] [rbp+77h]
char v79; // [rsp+130h] [rbp+7Fh] BYREF
result = FLAlertLayer::init_1(a1, 75);
if ( result )
{
a1->m_level = a2;
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
cocos2d::CCRect::CCRect(&v71, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v7);
v9 = v8->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v70, 360.0, 220.0);
v9->setContentSize(v8, v10);
v11 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v8,
0xFFFFFFFFLL);
v12 = v8->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v13 = cocos2d::CCPoint::CCPoint(v11, v78 * 0.5);
v12->setPosition_0(v8, v14);
v15 = cocos2d::CCLabelBMFont::create("Settings", &qword_14052A4D8);
v16 = v15->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v13, v78 * 0.5);
v16->setPosition_0(v15, v17);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v15);
a1->m_joystickConnected = -1;
v19 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v18);
a1->m_buttonMenu = v19;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v19, 10);
v70 = &v72;
v72 = 0;
v73 = 0;
v74 = 15;
v20 = sub_14003AA10(0x160u);
*(_QWORD *)&v72 = v20;
v73 = 351;
v74 = 351;
v21 = v20;
v22 = "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 verified to be uploaded.\n"
"Friends Only makes it so that only friends who search the exact ID can find it.";
v23 = 2;
do
{
*(_OWORD *)v21 = *(_OWORD *)v22;
*((_OWORD *)v21 + 1) = *((_OWORD *)v22 + 1);
*((_OWORD *)v21 + 2) = *((_OWORD *)v22 + 2);
*((_OWORD *)v21 + 3) = *((_OWORD *)v22 + 3);
*((_OWORD *)v21 + 4) = *((_OWORD *)v22 + 4);
*((_OWORD *)v21 + 5) = *((_OWORD *)v22 + 5);
*((_OWORD *)v21 + 6) = *((_OWORD *)v22 + 6);
v21 += 16;
*((_OWORD *)v21 - 1) = *((_OWORD *)v22 + 7);
v22 += 128;
--v23;
}
while ( v23 );
*(_OWORD *)v21 = *(_OWORD *)v22;
*((_OWORD *)v21 + 1) = *((_OWORD *)v22 + 1);
*((_OWORD *)v21 + 2) = *((_OWORD *)v22 + 2);
*((_OWORD *)v21 + 3) = *((_OWORD *)v22 + 3);
*((_OWORD *)v21 + 4) = *((_OWORD *)v22 + 4);
v21[10] = *((_QWORD *)v22 + 10);
*((_DWORD *)v21 + 22) = *((_DWORD *)v22 + 22);
*((_WORD *)v21 + 46) = *((_WORD *)v22 + 46);
*((_BYTE *)v21 + 94) = v22[94];
*((_BYTE *)v20 + 351) = 0;
v75 = 0;
v76 = 4;
v77 = 15;
strcpy((char *)&v75, "Help");
v24 = InfoAlertButton::create((__int64)&v75, (__int64)&v72);
v25 = ((float (__fastcall *)(cocos2d::CCMenu *, char *))a1->m_buttonMenu->addChild_1)(a1->m_buttonMenu, v24);
v26 = *(_QWORD *)v24;
cocos2d::CCPoint::CCPoint(v25, (float)((float)(v78 * 0.5) + 180.0) - 20.0);
v27 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v71.origin);
(*(void (__fastcall **)(char *, struct cocos2d::CCPoint))(v26 + 184))(v24, v27);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v29 = CCMenuItemSpriteExtra::create(v28, nullptr, a1, (cocos2d::SEL_MenuHandler *)ShareLevelSettingsLayer::onClose);
HIDWORD(v29->m_pfnSelector.adj) = 1069547520;
v30 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v29);
v31 = v29->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v30, (float)((float)(v78 * 0.5) - 180.0) + 5.0);
v32 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v70);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v31->setPosition_0)(v29, v32);
v33 = cocos2d::CCLabelBMFont::create(byte_140518980, "goldFont.fnt");
a1->m_passwordLabel = v33;
v34 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild_1)(
a1->m_mainLayer,
v33);
v35 = a1->m_passwordLabel->__vftable;
cocos2d::CCPoint::CCPoint(v34, v78 * 0.5);
v35->setPosition_0(a1->m_passwordLabel, v36);
v37 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_passwordLabel->setScale_0)(a1->m_passwordLabel);
cocos2d::CCPoint::CCPoint(v37, (float)(v78 * 0.5) - 140.0);
v38 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v39 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v38->setScale_0)(v38);
((void (__fastcall *)(struct cocos2d::CCSprite *))v39->setScale_0)(v39);
v40 = CCMenuItemToggler::create(v38, v39, a1, (cocos2d::SEL_MenuHandler *)ShareLevelSettingsLayer::onUnlisted);
CCMenuItemToggler::toggle(v40, !a1->m_level->m_unlisted);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v40);
v41 = v40->cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v42 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v71.origin);
((void (__fastcall *)(CCMenuItemToggler *, struct cocos2d::CCPoint))v41->setPosition_0)(v40, v42);
*(_DWORD *)(*(_QWORD *)&v40->m_nScriptTapHandler + 372LL) = 1069547520;
HIDWORD(v40->m_offButton->m_pfnSelector.adj) = 1069547520;
CCMenuItemToggler::toggle(v40, (bool)v40->m_onButton);
v43 = cocos2d::CCLabelBMFont::create("Unlisted", &qword_14052A4D8);
v44 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild_1)(
a1->m_mainLayer,
v43);
v45 = v43->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v46 = cocos2d::CCPoint::CCPoint(v44, 0.0);
v45->setAnchorPoint(v43, v47);
v48 = (float *)v38->getContentSize(v38);
cocos2d::CCPoint::CCPoint(*(float *)&v46, (float)((float)(*v48 * 0.5) * 0.80000001) + 8.0);
cocos2d::CCPoint::operator+(&v79, &v70);
v43->setPosition_0(v43, (const cocos2d::CCPoint *)&v70);
if ( v43->getContentSize(v43)->width > 110.0 )
{
v49 = v43->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v43->getContentSize(v43);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v49->setScale_0)(v43);
}
v50 = fminf(
COERCE_FLOAT(COERCE_UNSIGNED_INT64(((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v43->getScale)(v43))),
0.34999999);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v43->setScale_0)(v43);
m_level = a1->m_level;
if ( m_level->m_isUploaded || m_level->m_levelVersion > 1 )
{
v40->setEnabled(v40, 0);
v38->setColor(&v38->cocos2d::CCRGBAProtocol, &stru_140529C88);
v39->setColor(&v39->cocos2d::CCRGBAProtocol, &stru_140529C88);
v50 = ((float (__fastcall *)(cocos2d::CCRGBAProtocol *, cocos2d::ccColor3B *))v43->setColor)(
&v43->cocos2d::CCRGBAProtocol,
&stru_140529C88);
}
cocos2d::CCPoint::CCPoint(v50, (float)(v78 * 0.5) + 40.0);
v52 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v53 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v52->setScale_0)(v52);
((void (__fastcall *)(struct cocos2d::CCSprite *))v53->setScale_0)(v53);
v54 = CCMenuItemToggler::create(
v53,
v52,
a1,
(cocos2d::SEL_MenuHandler *)ShareLevelSettingsLayer::onUnlistedFriendsOnly);
a1->m_friendsOnlyToggler = v54;
CCMenuItemToggler::toggle(v54, a1->m_level->m_friendsOnly);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, a1->m_friendsOnlyToggler);
v55 = a1->m_friendsOnlyToggler->__vftable;
v56 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v71.origin);
((void (__fastcall *)(CCMenuItemToggler *, struct cocos2d::CCPoint))v55->setPosition_0)(
a1->m_friendsOnlyToggler,
v56);
m_friendsOnlyToggler = a1->m_friendsOnlyToggler;
*(_DWORD *)(*(_QWORD *)&m_friendsOnlyToggler->m_nScriptTapHandler + 372LL) = 1069547520;
HIDWORD(m_friendsOnlyToggler->m_offButton->m_pfnSelector.adj) = 1069547520;
CCMenuItemToggler::toggle(m_friendsOnlyToggler, (bool)m_friendsOnlyToggler->m_onButton);
v58 = cocos2d::CCLabelBMFont::create((const char *)&qword_140588B88, &qword_14052A4D8);
a1->m_friendsOnlyLabel = v58;
v59 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild_1)(
a1->m_mainLayer,
v58);
v60 = a1->m_friendsOnlyLabel->__vftable;
v61 = cocos2d::CCPoint::CCPoint(v59, 0.0);
v60->setAnchorPoint(a1->m_friendsOnlyLabel, v62);
v63 = (float *)v52->getContentSize(v52);
cocos2d::CCPoint::CCPoint(*(float *)&v61, (float)((float)(*v63 * 0.5) * 0.80000001) + 8.0);
cocos2d::CCPoint::operator+(v69, &v70);
a1->m_friendsOnlyLabel->setPosition_0(a1->m_friendsOnlyLabel, (const cocos2d::CCPoint *)&v70);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_friendsOnlyLabel, 110.0, 0.34999999, 0.0);
ShareLevelSettingsLayer::updateSettingsState(a1);
v71.origin = (cocos2d::CCPoint)&v72;
v72 = 0;
v73 = 0;
v74 = 15;
*(_QWORD *)&v72 = sub_14003AA10(0x60u);
v73 = 90;
v74 = 95;
strcpy((char *)v72, "Starting in 2.2, all new levels are free to copy.\n(Older levels retain any copy settings.)");
cocos2d::CCPoint::CCPoint(7.7452275e31, 0.5);
v65 = TextArea::create((__int64)&v72, "chatFont.fnt", 1.0, 320.0, v64, 1101004800, 0);
v66 = ((float (__fastcall *)(cocos2d::CCLayer *, char *))a1->m_mainLayer->addChild_1)(a1->m_mainLayer, v65);
v67 = *(_QWORD *)v65;
cocos2d::CCPoint::CCPoint(v66, v78 * 0.5);
(*(void (__fastcall **)(char *, __int64))(v67 + 184))(v65, v68);
(*(void (__fastcall **)(char *))(*(_QWORD *)v65 + 160LL))(v65);
return 1;
}
return result;
}