//
// ShareLevelSettingsLayer::init from 0x6e5ac8 to 0x6e6524 (2652 bytes)
//
// 2 xrefs:
// > ShareLevelSettingsLayer::create @ 0x6e661c
// > ??> @ 0x35220
//
// 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)
{
char v4; // w24
cocos2d::CCDirector *v6; // x0
cocos2d::CCNode *v7; // x21
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCLabelBMFont *v10; // x21
void (__fastcall *v11)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCMenu *v12; // x0
cocos2d::CCLayer *m_mainLayer; // x3
cocos2d::CCNode *v14; // x21
void *v15; // x0
void *v16; // x0
cocos2d::CCMenu *m_buttonMenu; // x25
void (__fastcall *v18)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v19; // x0
CCMenuItemSpriteExtra *v20; // x21
cocos2d::CCMenu *v21; // x25
void (__fastcall *v22)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCLabelBMFont *v23; // x0
cocos2d::CCLayer *v24; // x2
cocos2d::CCLabelBMFont *m_passwordLabel; // x21
void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v27; // x23
cocos2d::CCSprite *v28; // x26
CCMenuItemToggler *v29; // x25
void (__fastcall *v30)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
cocos2d::CCLabelBMFont *v31; // x21
float *v32; // x0
float width; // s0
void (__fastcall *v34)(cocos2d::CCLabelBMFont *__hidden, float); // x27
GJGameLevel *m_level; // x0
cocos2d::CCSprite *v36; // x21
cocos2d::CCSprite *v37; // x23
CCMenuItemToggler *v38; // x0
CCMenuItemToggler *m_friendsOnlyToggler; // x23
void (__fastcall *v40)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCLabelBMFont *v41; // x0
cocos2d::CCLayer *v42; // x2
cocos2d::CCLabelBMFont *m_friendsOnlyLabel; // x23
void (__fastcall *v44)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCLabelBMFont *v45; // x23
cocos2d::CCSprite *v46; // x0
const cocos2d::CCSize *(__fastcall *getContentSize)(const cocos2d::CCNode *__hidden); // x1
void (__fastcall *v48)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
float *v49; // x0
cocos2d::CCNode *v50; // x21
void *v51; // x25
void (__fastcall *v52)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
void (__fastcall *setScale)(cocos2d::CCLabelBMFont *__hidden, float); // x27
float *v54; // x0
unsigned int *v55; // x1
int v56; // w2
unsigned int *v57; // x23
int v58; // w0
unsigned int *v59; // x1
int v60; // w2
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // [xsp+98h] [xbp+98h]
void (__fastcall *v62)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+98h] [xbp+98h]
float v63; // [xsp+B8h] [xbp+B8h]
float v64; // [xsp+BCh] [xbp+BCh]
cocos2d::CCPoint v65; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v66; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCPoint v67; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCRect v68; // [xsp+D8h] [xbp+D8h] BYREF
std::string v69; // 0:x2.8
cocos2d::CCPoint v70; // 0:kr08_8.8
cocos2d::CCPoint v71; // 0:kr10_8.8
cocos2d::CCPoint v72; // 0:kr18_8.8
cocos2d::CCPoint v73; // 0:kr20_8.8
cocos2d::SEL_MenuHandler v74; // 0:x2.16
cocos2d::SEL_MenuHandler v75; // 0:x3.16
cocos2d::SEL_MenuHandler v76; // 0:x3.16
cocos2d::CCRect v77; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v4 = FLAlertLayer::init(a1, 0x4Bu);
if ( v4 )
{
a1->m_level = a2;
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
cocos2d::CCRect::CCRect(&v68, 0.0, 0.0, 80.0, 80.0);
v7 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v68,
v77);
setContentSize = v7->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v68, 360.0, 220.0);
setContentSize(v7, (const cocos2d::CCSize *)&v68);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v7, -1);
setPosition = v7->setPosition;
cocos2d::CCPoint::CCPoint(&v68.origin, v63 * 0.5, v64 * 0.5);
setPosition(v7, &v68.origin);
v10 = cocos2d::CCLabelBMFont::create();
v11 = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v68.origin, v63 * 0.5, (float)((float)(v64 * 0.5) + 110.0) - 20.0);
v11(v10, &v68.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v10);
a1->m_joystickConnected = -1;
v12 = cocos2d::CCMenu::create();
m_mainLayer = a1->m_mainLayer;
a1->m_buttonMenu = v12;
m_mainLayer->addChild_0(m_mainLayer, v12, 10);
sub_D153B8((int)&v67, "Help");
sub_D153B8(
(int)&v68,
"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.");
v14 = (cocos2d::CCNode *)InfoAlertButton::create((InfoAlertButton *)&v67, (std::string)&v68, v69, 1.0);
v15 = (void *)(*(_QWORD *)&v68.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v68.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v59 = (unsigned int *)(*(_QWORD *)&v68.origin - 8LL);
do
v60 = __ldaxr(v59);
while ( __stlxr(v60 - 1, v59) );
}
else
{
v60 = *(_DWORD *)(*(_QWORD *)&v68.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v68.origin - 8LL) = v60 - 1;
}
if ( v60 <= 0 )
operator delete(v15);
}
v16 = (void *)(*(_QWORD *)&v67 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v67 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(*(_QWORD *)&v67 - 8LL);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(*(_QWORD *)&v67 - 8LL);
*(_DWORD *)(*(_QWORD *)&v67 - 8LL) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v16);
}
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v14);
m_buttonMenu = a1->m_buttonMenu;
v18 = v14->setPosition;
cocos2d::CCPoint::CCPoint(
&v67,
(float)((float)(v63 * 0.5) + 180.0) - 20.0,
(float)((float)(v64 * 0.5) + 110.0) - 20.0);
v70 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v67);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *, float, float))v18)(v14, &v68, v70.x, v70.y);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v74.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v74.adj = (size_t)ShareLevelSettingsLayer::onClose;
v20 = CCMenuItemSpriteExtra::create(v19, nullptr, v74);
CCMenuItemSpriteExtra::setSizeMult(v20, 1.5);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v20);
v21 = a1->m_buttonMenu;
v22 = v20->setPosition;
cocos2d::CCPoint::CCPoint(
&v67,
(float)((float)(v63 * 0.5) + -180.0) + 5.0,
(float)((float)(v64 * 0.5) + 110.0) - 5.0);
v71 = cocos2d::CCNode::convertToNodeSpace(v21, &v67);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v22)(v20, &v68, v71.x, v71.y);
v23 = cocos2d::CCLabelBMFont::create();
v24 = a1->m_mainLayer;
a1->m_passwordLabel = v23;
v24->addChild(v24, v23);
m_passwordLabel = a1->m_passwordLabel;
v26 = m_passwordLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v68.origin, v63 * 0.5, (float)((float)(v64 * 0.5) + -110.0) + 80.0);
v26(m_passwordLabel, &v68.origin);
a1->m_passwordLabel->setScale(a1->m_passwordLabel, 0.6);
cocos2d::CCPoint::CCPoint(&v65, (float)(v63 * 0.5) + -140.0, (float)(v64 * 0.5) + 45.0);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
v27->setScale(v27, 0.8);
v28->setScale(v28, 0.8);
v75.adj = 0;
v75.ptr = (void (__cdecl *)(cocos2d::CCObject *))ShareLevelSettingsLayer::onUnlisted;
v29 = CCMenuItemToggler::create(v27, v28, a1, v75);
CCMenuItemToggler::toggle(v29, !a1->m_level->m_unlisted);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v29);
v30 = v29->setPosition;
v72 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v65);
((void (__fastcall *)(CCMenuItemToggler *, cocos2d::CCRect *, float, float))v30)(v29, &v68, v72.x, v72.y);
CCMenuItemToggler::setSizeMult(v29, 1.5);
v31 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v31);
setAnchorPoint = v31->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v68.origin, 0.0, 0.5);
setAnchorPoint(v31, &v68.origin);
v62 = v31->setPosition;
v32 = (float *)v27->getContentSize(v27);
cocos2d::CCPoint::CCPoint(&v67, (float)((float)(*v32 * 0.5) * 0.8) + 8.0, 0.0);
cocos2d::CCPoint::operator+(&v68, &v65, &v67);
v62(v31, &v68.origin);
width = v31->getContentSize(v31)->width;
if ( width > 110.0 )
{
setScale = v31->setScale;
v54 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v31->getContentSize)(v31, width);
setScale(v31, 110.0 / *v54);
}
v34 = v31->setScale;
if ( v31->getScale(v31) <= 0.35 )
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v31->getScale)(v31, 0.35);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v34)(v31);
m_level = a1->m_level;
if ( m_level->m_isUploaded || m_level->m_levelVersion > 1 )
{
v29->setEnabled(v29, 0);
v27->setColor(v27, (const cocos2d::ccColor3B *)&unk_EC9AF8);
v28->setColor(v28, (const cocos2d::ccColor3B *)&unk_EC9AF8);
v31->setColor(v31, (const cocos2d::ccColor3B *)&unk_EC9AF8);
}
cocos2d::CCPoint::CCPoint(&v66, (float)(v63 * 0.5) + 40.0, v65.y);
v36 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v37 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
v36->setScale(v36, 0.8);
v37->setScale(v37, 0.8);
v76.adj = 0;
v76.ptr = (void (__cdecl *)(cocos2d::CCObject *))ShareLevelSettingsLayer::onUnlistedFriendsOnly;
v38 = CCMenuItemToggler::create(v37, v36, a1, v76);
a1->m_friendsOnlyToggler = v38;
CCMenuItemToggler::toggle(v38, a1->m_level->m_friendsOnly);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, a1->m_friendsOnlyToggler);
m_friendsOnlyToggler = a1->m_friendsOnlyToggler;
v40 = m_friendsOnlyToggler->setPosition;
v73 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v66);
((void (__fastcall *)(CCMenuItemToggler *, cocos2d::CCRect *, float, float))v40)(
m_friendsOnlyToggler,
&v68,
v73.x,
v73.y);
CCMenuItemToggler::setSizeMult(a1->m_friendsOnlyToggler, 1.5);
v41 = cocos2d::CCLabelBMFont::create();
v42 = a1->m_mainLayer;
a1->m_friendsOnlyLabel = v41;
v42->addChild(v42, v41);
m_friendsOnlyLabel = a1->m_friendsOnlyLabel;
v44 = m_friendsOnlyLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v68.origin, 0.0, 0.5);
v44(m_friendsOnlyLabel, &v68.origin);
v45 = a1->m_friendsOnlyLabel;
v46 = v36;
getContentSize = v36->getContentSize;
v48 = v45->setPosition;
v49 = (float *)getContentSize(v46);
cocos2d::CCPoint::CCPoint(&v67, (float)((float)(*v49 * 0.5) * 0.8) + 8.0, 0.0);
cocos2d::CCPoint::operator+(&v68, &v66, &v67);
v48(v45, &v68.origin);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_friendsOnlyLabel, 110.0, 0.35, 0.0);
ShareLevelSettingsLayer::updateSettingsState(a1);
sub_D153B8((int)&v68, "Starting in 2.2, all new levels are free to copy.\n(Older levels retain any copy settings.)");
cocos2d::CCPoint::CCPoint(&v67, 0.5, 1.0);
v50 = (cocos2d::CCNode *)TextArea::create((__int64)&v68, "chatFont.fnt", &v67, 0, 1.0, 320.0, 20.0);
v51 = (void *)(*(_QWORD *)&v68.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v68.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v57 = (unsigned int *)(*(_QWORD *)&v68.origin - 8LL);
do
v58 = __ldaxr(v57);
while ( __stlxr(v58 - 1, v57) );
}
else
{
v58 = *(_DWORD *)(*(_QWORD *)&v68.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v68.origin - 8LL) = v58 - 1;
}
if ( v58 <= 0 )
operator delete(v51);
}
a1->m_mainLayer->addChild(a1->m_mainLayer, v50);
v52 = v50->setPosition;
cocos2d::CCPoint::CCPoint(&v68.origin, v63 * 0.5, (float)((float)(v64 * 0.5) + -110.0) + 35.0);
v52(v50, &v68.origin);
v50->setScale(v50, 0.65);
}
return v4;
}