//
// SelectSettingLayer::init from 0x10017cf58 to 0x10017d450 (1272 bytes)
//
// 1 xrefs:
// > SelectSettingLayer::create @ 0x10017bc04
//
// 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 SelectSettingLayer::init(SelectSettingLayer *a1, SelectSettingType a2, int a3)
{
_BOOL4 v6; // w0
cocos2d::CCLayer *v7; // x0
cocos2d::CCMenu *v8; // x0
cocos2d::CCDirector *v9; // x0
cocos2d::CCMenu *m_buttonMenu; // x21
__n128 v11; // q0
__n128 v12; // q1
unsigned __int64 m_type; // x8
float v14; // s10
float v15; // s8
unsigned int v16; // w28
const char *v17; // x22
cocos2d::extension::CCScale9Sprite *v18; // x23
__n128 v19; // q0
__n128 v20; // q1
cocos2d::CCLabelBMFont *v21; // x22
__n128 v22; // q0
__n128 v23; // q1
__int64 v24; // x0
cocos2d::CCArray *v25; // x0
__int64 v26; // x0
__int64 v27; // x22
__int64 v28; // x23
float v29; // s9
void **v30; // x0
cocos2d::CCSprite *v31; // x26
CCMenuItemSpriteExtra *v32; // x0
CCMenuItemSpriteExtra *v33; // x25
__n128 v34; // q0
__n128 v35; // q1
double v36; // d0
ButtonSprite *v37; // x0
CCMenuItemSpriteExtra *v38; // x20
__n128 v39; // q0
cocos2d::CCMenu *v40; // x22
__n128 v41; // q1
__n128 v42; // q0
__n128 v43; // q1
bool v45; // [xsp+4h] [xbp-ACh]
float32x2_t v46; // [xsp+8h] [xbp-A8h] BYREF
float32x2_t v47; // [xsp+10h] [xbp-A0h] BYREF
void *__p[2]; // [xsp+18h] [xbp-98h] BYREF
char v49; // [xsp+2Fh] [xbp-81h]
float32x2_t v50; // [xsp+30h] [xbp-80h] BYREF
float v51; // [xsp+38h] [xbp-78h]
float v52; // [xsp+3Ch] [xbp-74h]
cocos2d::CCPoint v53; // 0:kr08_8.8
cocos2d::CCPoint v54; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v55; // 0:x3.16
cocos2d::SEL_MenuHandler v56; // 0:x3.16
cocos2d::CCRect v57; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
LODWORD(__p[0]) = -1778384896;
v6 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)__p);
if ( v6 )
{
FLAlertLayer::incrementForcePrio(a1);
v7 = cocos2d::CCLayer::create();
a1->m_mainLayer = v7;
((void (__fastcall *)(SelectSettingLayer *, cocos2d::CCLayer *))a1->addChild)(a1, v7);
v8 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v8;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v8,
10);
a1->m_type = a2;
if ( a2 == StartingSpeed )
{
if ( (unsigned int)a3 > 4 )
a3 = 1;
else
a3 = dword_100638F1C[a3];
}
a1->m_settingID = a3;
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
m_buttonMenu = a1->m_buttonMenu;
v11.n128_f32[0] = v51 * 0.5;
v12.n128_f32[0] = (float)(v52 * 0.5) + 5.0;
sub_100022980(v11, v12, __p);
v53 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)__p);
v42.n128_u32[0] = LODWORD(v53.x);
v43.n128_u32[0] = LODWORD(v53.y);
m_type = (unsigned int)a1->m_type;
LOBYTE(v6) = m_type < 3;
if ( (unsigned int)m_type <= 2 )
{
v45 = m_type < 3;
v14 = flt_100638EF8[m_type];
v15 = flt_100638F04[m_type];
v16 = dword_100638F10[m_type];
v17 = off_1007A2A58[m_type];
((void (__fastcall *)(SelectSettingLayer *, __int64, __n128, __n128))a1->setTouchEnabled)(a1, 1, v42, v43);
((void (__fastcall *)(SelectSettingLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
sub_100022990((float *)__p, 0.0, 0.0, 80.0, 80.0);
v18 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v57);
sub_100022988((float *)__p, 360.0, 160.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v18->setContentSize)(v18, __p);
v19 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v18,
0xFFFFFFFFLL);
v19.n128_f32[0] = v51 * 0.5;
v20.n128_f32[0] = v52 * 0.5;
sub_100022980(v19, v20, __p);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void **))v18->setPosition)(v18, __p);
v21 = cocos2d::CCLabelBMFont::create_1(v17, "bigFont.fnt");
v22.n128_f32[0] = v51 * 0.5;
v23.n128_f32[0] = (float)((float)(v52 * 0.5) + 80.0) + -20.0;
sub_100022980(v22, v23, __p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v21->setPosition)(v21, __p);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v21);
v24 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v21->setScale)(v21, 0.9);
v25 = (cocos2d::CCArray *)sub_10024A15C(v24);
a1->m_settingSprites = v25;
cocos2d::CCObject::retain(v25);
v27 = sub_10024A15C(v26);
v28 = 0;
v29 = vcvts_n_f32_s32(-v16, 1u);
do
{
SelectSettingLayer::frameForItem(__p, (unsigned int)a1->m_type, v28);
if ( v49 >= 0 )
v30 = __p;
else
v30 = (void **)__p[0];
v31 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v30);
sub_10024A2D0(a1->m_settingSprites, v31);
((void (__fastcall *)(cocos2d::CCSprite *, float))v31->setScale)(v31, v15);
v55.ptr = (void (__cdecl *)(cocos2d::CCObject *))SelectSettingLayer::onSelect;
v55.adj = 0;
v32 = CCMenuItemSpriteExtra::create(v31, nullptr, a1, v55);
v33 = v32;
if ( a2 == StartingModePlatformer && ((_DWORD)v28 == 7 || (_DWORD)v28 == 4) )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v32->setEnabled)(v32, 0);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v31->setOpacity)(v31, 125);
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v33->setTag)(v33, v28);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v33);
v34 = sub_10024A2D0(v27, v33);
v34.n128_f32[0] = (float)(v14 * 0.5) + (float)((float)(v14 * (float)(unsigned int)v28) + (float)(v29 * v14));
v35.n128_f32[0] = (float)((unsigned int)v28 / v16) * -35.0;
sub_100022980(v34, v35, &v46);
*(float32x2_t *)&v36 = sub_1000229DC(&v50, &v46, &v47);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v33->setPosition)(v33, &v47, v36);
if ( v49 < 0 )
operator delete(__p[0]);
v28 = (unsigned int)(v28 + 1);
}
while ( v16 != (_DWORD)v28 );
a1->m_joystickConnected = -1;
sub_10024A45C(v27);
v37 = ButtonSprite::create_1("OK", 40, 0, 0.8, 1, "goldFont.fnt", "GJ_button_01.png", 30.0);
v56.ptr = (void (__cdecl *)(cocos2d::CCObject *))SelectSettingLayer::onClose;
v56.adj = 0;
v38 = CCMenuItemSpriteExtra::create(v37, nullptr, a1, v56);
v39 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v38);
v40 = a1->m_buttonMenu;
v39.n128_f32[0] = v51 * 0.5;
v41.n128_f32[0] = (float)((float)(v52 * 0.5) + -80.0) + 25.0;
sub_100022980(v39, v41, &v47);
v54 = cocos2d::CCNode::convertToNodeSpace(v40, (const cocos2d::CCPoint *)&v47);
((void (__fastcall *)(CCMenuItemSpriteExtra *, void **, float, float))v38->setPosition)(v38, __p, v54.x, v54.y);
SelectSettingLayer::onSelect(a1, nullptr);
a1->m_noElasticity = 1;
LOBYTE(v6) = v45;
}
}
return v6;
}