//
// SelectSettingLayer::init from 0xa38f34 to 0xa394fc (1480 bytes)
//
// 2 xrefs:
// > SelectSettingLayer::create @ 0xa395e8
// > ??> @ 0x7f590
//
// 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 SelectSettingLayer::init(SelectSettingLayer *a1, SelectSettingType a2, int a3)
{
cocos2d::CCLayer *v7; // x0
cocos2d::CCMenu *v8; // x0
cocos2d::CCDirector *v9; // x0
cocos2d::CCMenu *m_buttonMenu; // x19
SelectSettingType m_type; // w0
float v12; // s8
float v13; // s11
int v14; // w23
int v15; // w19
cocos2d::CCNode *v16; // x21
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x28
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
cocos2d::CCLabelBMFont *v19; // x20
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
cocos2d::CCArray *v21; // x0
cocos2d::CCArray *v22; // x0
cocos2d::CCArray *v23; // x0
cocos2d::CCArray *v24; // x28
cocos2d::CCSprite *v25; // x21
CCMenuItemSpriteExtra *v26; // x0
cocos2d::CCNode *v27; // x20
void (__fastcall *v28)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
char *v29; // x0
unsigned int *v30; // x1
int v31; // w2
const char *v32; // x6
cocos2d::CCNode *v33; // x0
CCMenuItemSpriteExtra *v34; // x19
cocos2d::CCMenu *v35; // x21
void (__fastcall *v36)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
long double v37; // q0
long double v38; // q1
char v39; // [xsp+90h] [xbp+90h]
float v40; // [xsp+A8h] [xbp+A8h]
float v41; // [xsp+ACh] [xbp+ACh]
_BYTE v42[8]; // [xsp+B0h] [xbp+B0h] BYREF
const char *v43; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCPoint v44; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCRect v45; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCPoint v46; // 0:kr08_8.8
cocos2d::CCPoint v47; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v48; // 0:x2.16
cocos2d::SEL_MenuHandler v49; // 0:x2.16
cocos2d::CCRect v50; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v45.origin.x = -1.034e-25;
v39 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v45);
if ( !v39 )
return 0;
FLAlertLayer::incrementForcePrio(a1);
v7 = cocos2d::CCLayer::create();
a1->m_mainLayer = v7;
a1->addChild(a1, v7);
v8 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v8;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v8, 10);
a1->m_type = a2;
a1->m_settingID = SelectSettingLayer::valueToIdx(a2, a3);
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v45.origin, v40 * 0.5, (float)(v41 * 0.5) + 5.0);
v46 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v45.origin);
*(float *)&v37 = v46.x;
*(float *)&v38 = v46.y;
m_type = a1->m_type;
if ( (unsigned int)m_type <= StartingModePlatformer )
{
v12 = 42.0;
v14 = 8;
v13 = 0.9;
}
else
{
if ( m_type != StartingSpeed )
return 0;
v12 = 60.0;
v13 = 0.8;
v14 = 5;
}
v15 = 0;
((void (__fastcall *)(SelectSettingLayer *, __int64, long double, long double))a1->setTouchEnabled)(a1, 1, v37, v38);
a1->setKeypadEnabled(a1, 1);
cocos2d::CCRect::CCRect(&v45, 0.0, 0.0, 80.0, 80.0);
v16 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v45,
v50);
setContentSize = v16->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v45, 360.0, 160.0);
setContentSize(v16, (const cocos2d::CCSize *)&v45);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v16, -1);
setPosition = v16->setPosition;
cocos2d::CCPoint::CCPoint(&v45.origin, v40 * 0.5, v41 * 0.5);
setPosition(v16, &v45.origin);
v19 = cocos2d::CCLabelBMFont::create();
v20 = v19->setPosition;
cocos2d::CCPoint::CCPoint(&v45.origin, v40 * 0.5, (float)((float)(v41 * 0.5) + 80.0) - 20.0);
v20(v19, &v45.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v19);
v21 = (cocos2d::CCArray *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v19->setScale)(v19, 0.9);
v22 = (cocos2d::CCArray *)cocos2d::CCArray::create(v21);
a1->m_settingSprites = v22;
cocos2d::CCObject::retain(v22);
v24 = (cocos2d::CCArray *)cocos2d::CCArray::create(v23);
do
{
while ( 1 )
{
SelectSettingLayer::frameForItem(a1->m_type, v15, (__int64)&v43);
v25 = cocos2d::CCSprite::createWithSpriteFrameName(v43);
cocos2d::CCArray::addObject(a1->m_settingSprites, v25);
v25->setScale(v25, v13);
v48.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v48.adj = (size_t)SelectSettingLayer::onSelect;
v26 = CCMenuItemSpriteExtra::create(v25, nullptr, v48);
v27 = v26;
if ( a2 == StartingModePlatformer && (v15 == 7 || v15 == 4) )
{
v26->setEnabled(v26, 0);
v25->setOpacity(v25, 125);
}
v27->setTag(v27, v15);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v27);
cocos2d::CCArray::addObject(v24, v27);
v28 = v27->setPosition;
cocos2d::CCPoint::CCPoint(
&v44,
(float)((float)((float)(v15 % v14) * v12) + (float)((float)((float)-v14 * 0.5) * v12)) + (float)(v12 * 0.5),
floorf((float)(v15 / v14)) * -35.0);
cocos2d::CCPoint::operator+(&v45, v42, &v44);
v28(v27, &v45.origin);
v29 = (char *)(v43 - 24);
if ( v43 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(v43 - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *((_DWORD *)v43 - 2);
*((_DWORD *)v43 - 2) = v31 - 1;
}
if ( v31 <= 0 )
break;
}
if ( ++v15 == v14 )
goto LABEL_18;
}
++v15;
operator delete(v29);
}
while ( v15 != v14 );
LABEL_18:
a1->m_joystickConnected = -1;
cocos2d::CCArray::removeAllObjects(v24);
v33 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v32,
30.0);
v49.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v49.adj = (size_t)SelectSettingLayer::onClose;
v34 = CCMenuItemSpriteExtra::create(v33, nullptr, v49);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v34);
v35 = a1->m_buttonMenu;
v36 = v34->setPosition;
cocos2d::CCPoint::CCPoint(&v44, v40 * 0.5, (float)((float)(v41 * 0.5) + -80.0) + 25.0);
v47 = cocos2d::CCNode::convertToNodeSpace(v35, &v44);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v36)(v34, &v45, v47.x, v47.y);
SelectSettingLayer::onSelect(a1, nullptr);
a1->m_noElasticity = 1;
return v39;
}