//
// SelectSettingLayer::init from 0xb645c8 to 0xb64b38 (1392 bytes)
//
// 2 xrefs:
// > SelectSettingLayer::create @ 0xb64ca0
// > ??> @ 0xa9a98
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:02:14 +0000
//
__int64 __fastcall SelectSettingLayer::init(__int64 a1, int a2, unsigned int a3)
{
cocos2d::CCObject *v7; // x0
__int64 v8; // x0
cocos2d::CCMenu *v9; // x0
__int64 v10; // x0
cocos2d::CCDirector *v11; // x0
cocos2d::CCDirector *v12; // x0
cocos2d::CCNode *v13; // x19
unsigned int v14; // w0
float v15; // s8
float v16; // s11
int v17; // w24
char *v18; // x20
int v19; // w19
__int64 v20; // x21
void (__fastcall *v21)(__int64, __int64 *); // x28
void (__fastcall *v22)(__int64, __int64 *); // x28
const char *v23; // x2
__int64 v24; // x20
void (__fastcall *v25)(__int64, __int64 *); // x21
cocos2d::CCArray *v26; // x0
cocos2d::CCObject *v27; // x0
cocos2d::CCArray *v28; // x0
cocos2d::CCArray *v29; // x28
cocos2d::CCSprite *v30; // x0
cocos2d::CCObject *v31; // x21
__int64 v32; // x0
cocos2d::CCObject *v33; // x20
void (__fastcall *v34)(cocos2d::CCObject *, __int64 *); // x21
const char *v35; // x6
__int64 v36; // x0
__int64 v37; // x19
cocos2d::CCNode *v38; // x21
void (__fastcall *v39)(__int64, __int64 *); // x20
unsigned __int8 v40; // [xsp+90h] [xbp+90h]
__int64 v41; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v42; // [xsp+B0h] [xbp+B0h] BYREF
_BYTE v43[8]; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v44[2]; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v45[2]; // [xsp+D0h] [xbp+D0h] BYREF
void *v46; // [xsp+E0h] [xbp+E0h]
LODWORD(v44[0]) = -1778384896;
v40 = cocos2d::CCLayerColor::initWithColor(a1, v44);
if ( !v40 )
return 0;
v7 = FLAlertLayer::incrementForcePrio((cocos2d::CCObject *)a1);
v8 = cocos2d::CCLayer::create(v7);
*(_QWORD *)(a1 + 584) = v8;
v9 = (cocos2d::CCMenu *)(*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v8);
v10 = cocos2d::CCMenu::create(v9);
*(_QWORD *)(a1 + 552) = v10;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v10, 10);
*(_DWORD *)(a1 + 676) = a2;
v11 = (cocos2d::CCDirector *)SelectSettingLayer::valueToIdx(a2, a3);
*(_DWORD *)(a1 + 672) = (_DWORD)v11;
v12 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v11);
cocos2d::CCDirector::getWinSize(&v41, v12);
v13 = *(cocos2d::CCNode **)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v44, *(float *)&v41 * 0.5, (float)(*((float *)&v41 + 1) * 0.5) + 5.0);
cocos2d::CCNode::convertToNodeSpace(&v42, v13, (const cocos2d::CCPoint *)v44);
v14 = *(_DWORD *)(a1 + 676);
if ( v14 <= 1 )
{
v15 = 42.0;
v17 = 8;
v18 = "Select Mode";
v16 = 0.9;
}
else
{
if ( v14 != 2 )
return 0;
v15 = 60.0;
v16 = 0.8;
v17 = 5;
v18 = "Select Speed";
}
v19 = 0;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1000LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v44, 0.0, 0.0, 80.0, 80.0);
v20 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v44);
v21 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v20 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v44, 360.0, 160.0);
v21(v20, v44);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v20,
0xFFFFFFFFLL);
v22 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v44, *(float *)&v41 * 0.5, *((float *)&v41 + 1) * 0.5);
v22(v20, v44);
v24 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v18, "bigFont.fnt", v23);
v25 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v24 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v44,
*(float *)&v41 * 0.5,
(float)((float)(*((float *)&v41 + 1) * 0.5) + 80.0) - 20.0);
v25(v24, v44);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v24);
v26 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64, float))(*(_QWORD *)v24 + 160LL))(v24, 0.9);
v27 = (cocos2d::CCObject *)cocos2d::CCArray::create(v26);
*(_QWORD *)(a1 + 664) = v27;
v28 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v27);
v29 = (cocos2d::CCArray *)cocos2d::CCArray::create(v28);
do
{
SelectSettingLayer::frameForItem(*(_DWORD *)(a1 + 676), v19, v45);
v30 = (cocos2d::CCSprite *)((char *)v45 + 1);
if ( (v45[0] & 1) != 0 )
v30 = (cocos2d::CCSprite *)v46;
v31 = (cocos2d::CCObject *)cocos2d::CCSprite::createWithSpriteFrameName(v30, (const char *)LOBYTE(v45[0]));
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 664), v31);
(*(void (__fastcall **)(cocos2d::CCObject *, float))(*(_QWORD *)v31 + 160LL))(v31, v16);
v32 = CCMenuItemSpriteExtra::create((__int64)v31, 0, a1, (__int64)SelectSettingLayer::onSelect, 0);
v33 = (cocos2d::CCObject *)v32;
if ( a2 == 1 && (v19 == 7 || v19 == 4) )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v32 + 1056LL))(v32, 0);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v31 + 912LL))(v31, 125);
}
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v33 + 72LL))(v33, (unsigned int)v19);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v33);
cocos2d::CCArray::addObject(v29, v33);
v34 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v33 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v43,
(float)((float)((float)(v19 % v17) * v15) + (float)((float)((float)-v17 * 0.5) * v15)) + (float)(v15 * 0.5),
floorf((float)(v19 / v17)) * -35.0);
cocos2d::CCPoint::operator+(v44, &v42);
v34(v33, v44);
if ( (v45[0] & 1) != 0 )
operator delete(v46);
++v19;
}
while ( v19 != v17 );
*(_DWORD *)(a1 + 640) = -1;
cocos2d::CCArray::removeAllObjects(v29);
v36 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v35,
30.0);
v37 = CCMenuItemSpriteExtra::create(v36, 0, a1, (__int64)SelectSettingLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v37);
v38 = *(cocos2d::CCNode **)(a1 + 552);
v39 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v37 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v43,
*(float *)&v41 * 0.5,
(float)((float)(*((float *)&v41 + 1) * 0.5) + -80.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v44, v38, (const cocos2d::CCPoint *)v43);
v39(v37, v44);
SelectSettingLayer::onSelect((SelectSettingLayer *)a1, nullptr);
*(_BYTE *)(a1 + 596) = 1;
return v40;
}