//
// SelectArtLayer::init from 0x10020dab8 to 0x10020e3b0 (2296 bytes)
//
// 1 xrefs:
// > SelectArtLayer::create @ 0x10020d78c
//
// 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 11:01:01 +0000
//
__int64 __fastcall SelectArtLayer::init(__int64 a1, int a2, int a3)
{
__int64 result; // x0
__n128 v7; // q0
__int64 v8; // x21
const char *v9; // x22
int v10; // w28
__int64 v11; // x0
void *v12; // x0
__int64 v13; // x23
int v14; // w8
float v15; // s0
float v16; // s8
__int64 v17; // x22
__int64 v18; // x0
int v19; // w8
float v20; // s9
__int64 v21; // x0
__int64 v22; // x0
__int64 v23; // x22
__int64 v24; // x0
int v25; // w8
float v26; // s1
float v27; // s2
float v28; // s3
int v29; // w9
float v30; // s11
unsigned int v31; // w20
__int64 v32; // x23
__n128 v33; // q0
__n128 v34; // q0
unsigned int v35; // w23
float v36; // s13
int v37; // w8
__int64 v38; // x0
__int64 CString; // x0
__int64 v40; // x27
__int64 v41; // x0
__int64 v42; // x27
__int64 v43; // x27
double v44; // d0
void *v45; // x0
__int64 v46; // x21
__int64 v47; // x22
__n128 v48; // q0
__int64 v49; // x0
__int64 v50; // x0
__int64 v51; // x21
void *v52; // x25
__int64 v53; // x26
__n128 v54; // q0
__int64 v55; // x25
float32x2_t *v56; // x27
__n128 v57; // q0
void *v58; // x25
__int64 v59; // x26
__n128 v60; // q0
__int64 v61; // x25
float32x2_t *v62; // x27
__n128 v63; // q0
void *v64; // x23
__int64 v65; // x22
__n128 v66; // q0
__int64 v67; // x23
float32x2_t *v68; // x21
__n128 v69; // q0
unsigned int v70; // [xsp+Ch] [xbp-C4h]
float32x2_t v71; // [xsp+10h] [xbp-C0h] BYREF
float32x2_t v72; // [xsp+18h] [xbp-B8h] BYREF
float32x2_t v73; // [xsp+20h] [xbp-B0h] BYREF
float32x2_t v74[2]; // [xsp+28h] [xbp-A8h] BYREF
__int64 v75; // [xsp+38h] [xbp-98h] BYREF
v74[0].i32[0] = -1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, (__int64)v74);
if ( !(_DWORD)result )
return result;
v70 = result;
FLAlertLayer::incrementForcePrio(a1, v7);
*(_DWORD *)(a1 + 688) = a2;
if ( a3 != -1 )
*(_DWORD *)(a1 + 680) = a3;
if ( a2 == 2 )
{
v8 = 0;
v9 = "Select Middleground";
v10 = 4;
}
else if ( a2 == 1 )
{
v8 = 1;
if ( *(int *)(a1 + 680) <= 0 )
*(_DWORD *)(a1 + 680) = 1;
v9 = "Select Ground";
v10 = 23;
}
else if ( a2 )
{
v8 = 0;
v9 = "Select Type";
v10 = 12;
}
else
{
v8 = 1;
if ( *(int *)(a1 + 680) <= 0 )
*(_DWORD *)(a1 + 680) = 1;
v9 = "Select Background";
v10 = 60;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1000LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v11, &v75);
v12 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 584) = v12;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)a1 + 456LL))(a1, v12);
sub_1000262CC((float *)v74, 0.0, 0.0, 80.0, 80.0);
v13 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v74);
v14 = *(_DWORD *)(a1 + 688);
v15 = 240.0;
if ( v14 == 1 )
v15 = 260.0;
if ( v14 )
v16 = v15;
else
v16 = 300.0;
sub_1000262C4((float *)v74, 360.0, v16);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v13 + 320LL))(v13, v74);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v13,
0xFFFFFFFFLL);
sub_1000262BC((float *)v74, *(float *)&v75 * 0.5, *((float *)&v75 + 1) * 0.5);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v13 + 184LL))(v13, v74);
v17 = cocos2d::CCLabelBMFont::create_1(v9, "bigFont.fnt");
sub_1000262BC(
(float *)v74,
*(float *)&v75 * 0.5,
(float)((float)(v16 * 0.5) + (float)(*((float *)&v75 + 1) * 0.5)) + -20.0);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v17 + 184LL))(v17, v74);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v17);
v18 = (*(__int64 (__fastcall **)(__int64, float))(*(_QWORD *)v17 + 160LL))(v17, 0.8);
v19 = *(_DWORD *)(a1 + 688);
if ( v19 )
v20 = flt_100761AB0[v19 == 1];
else
v20 = 0.6;
v21 = sub_1002E736C(v18);
*(_QWORD *)(a1 + 664) = v21;
v22 = cocos2d::CCObject::retain(v21);
v23 = sub_1002E736C(v22);
v24 = cocos2d::CCMenu::create(v23);
*(_QWORD *)(a1 + 552) = v24;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v24, 10);
v25 = *(_DWORD *)(a1 + 688);
v26 = 75.0;
v27 = 25.0;
v28 = 45.0;
if ( v25 == 1 )
{
v27 = 40.0;
v28 = 40.0;
v29 = 8;
}
else
{
v29 = 7;
}
if ( v25 )
{
v26 = v27;
v30 = v28;
}
else
{
v30 = 35.0;
}
if ( v25 )
v31 = v29;
else
v31 = 10;
v32 = *(_QWORD *)(a1 + 552);
sub_1000262BC(
(float *)&v73,
*(float *)&v75 * 0.5,
v26 + (float)((float)(v30 * 0.5) + (float)(*((float *)&v75 + 1) * 0.5)));
cocos2d::CCNode::convertToNodeSpace(v74, v32, &v73, v33);
v35 = 0;
v36 = vcvts_n_f32_s32(-v31, 1u);
do
{
v37 = *(_DWORD *)(a1 + 688);
switch ( v37 )
{
case 2:
v38 = sub_1003065B0("mgIcon_%02d_001.png");
goto LABEL_39;
case 1:
v38 = sub_1003065B0("gIcon_%02d_001.png");
goto LABEL_39;
case 0:
v38 = sub_1003065B0("bgIcon_%02d_001.png");
LABEL_39:
CString = cocos2d::CCString::getCString(v38);
goto LABEL_41;
}
v40 = ObjectToolbox::sharedState(v34);
v41 = EditorUI::smartTypeForKey(v8);
CString = ObjectToolbox::intKeyToFrame(v40, v41);
LABEL_41:
v42 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
sub_1002E74E0(*(_QWORD *)(a1 + 664), v42);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v42 + 160LL))(v42, v20);
v43 = CCMenuItemSpriteExtra::create(v42, 0, a1, sub_10020E3B0, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v43 + 72LL))(v43, v8);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v43);
sub_1002E74E0(v23, v43);
sub_1000262BC(
(float *)&v72,
(float)(v30 * 0.5) + (float)((float)(v30 * (float)(v35 % v31)) + (float)(v36 * v30)),
(float)-v30 * (float)(v35 / v31));
*(float32x2_t *)&v44 = sub_100026318(v74, &v72, &v73);
(*(void (__fastcall **)(__int64, float32x2_t *, double))(*(_QWORD *)v43 + 184LL))(v43, &v73, v44);
v8 = (unsigned int)(v8 + 1);
++v35;
}
while ( v10 != (_DWORD)v8 );
*(_DWORD *)(a1 + 640) = -1;
sub_1002E7674(v23);
v45 = ButtonSprite::create_1((__int64)"OK", 40, 0, 1, (__int64)"goldFont.fnt", (__int64)"GJ_button_01.png", 0.8, 30.0);
v46 = CCMenuItemSpriteExtra::create(v45, 0, a1, sub_10020E480, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v46);
v47 = *(_QWORD *)(a1 + 552);
sub_1000262BC(
(float *)&v72,
*(float *)&v75 * 0.5,
(float)((float)(*((float *)&v75 + 1) * 0.5) - (float)(v16 * 0.5)) + 25.0);
cocos2d::CCNode::convertToNodeSpace(&v73, v47, &v72, v48);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v46 + 184LL))(v46, &v73);
v49 = sub_10020E3B0(a1, 0);
if ( *(_DWORD *)(a1 + 688) == 1 )
{
v50 = sub_1002E736C(v49);
*(_QWORD *)(a1 + 672) = v50;
cocos2d::CCObject::retain(v50);
v51 = cocos2d::CCLabelBMFont::create_1("Line", "goldFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v51 + 160LL))(v51, 0.7);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v51);
sub_1000262BC((float *)&v73, (float)(*(float *)&v75 * 0.5) + 130.0, (float)(*((float *)&v75 + 1) * 0.5) + -45.0);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v51 + 184LL))(v51, &v73);
v52 = ButtonSprite::create_1((__int64)"1", 20, 0, 1, (__int64)"bigFont.fnt", (__int64)"GJ_button_04.png", 0.4, 20.0);
v53 = CCMenuItemSpriteExtra::create(v52, 0, a1, sub_10020E4E0, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v53 + 72LL))(v53, 1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v53);
v54 = sub_1002E74E0(*(_QWORD *)(a1 + 672), v52);
v55 = *(_QWORD *)(a1 + 552);
v56 = (float32x2_t *)(*(__int64 (__fastcall **)(__int64, __n128))(*(_QWORD *)v51 + 192LL))(v51, v54);
sub_1000262BC((float *)&v71, -23.0, -25.0);
v57.n128_u64[0] = (unsigned __int64)sub_100026318(v56, &v71, &v72);
cocos2d::CCNode::convertToNodeSpace(&v73, v55, &v72, v57);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v53 + 184LL))(v53, &v73);
v58 = ButtonSprite::create_1((__int64)"2", 20, 0, 1, (__int64)"bigFont.fnt", (__int64)"GJ_button_04.png", 0.4, 20.0);
v59 = CCMenuItemSpriteExtra::create(v58, 0, a1, sub_10020E4E0, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v59 + 72LL))(v59, 2);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v59);
v60 = sub_1002E74E0(*(_QWORD *)(a1 + 672), v58);
v61 = *(_QWORD *)(a1 + 552);
v62 = (float32x2_t *)(*(__int64 (__fastcall **)(__int64, __n128))(*(_QWORD *)v51 + 192LL))(v51, v60);
sub_1000262BC((float *)&v71, 23.0, -25.0);
v63.n128_u64[0] = (unsigned __int64)sub_100026318(v62, &v71, &v72);
cocos2d::CCNode::convertToNodeSpace(&v73, v61, &v72, v63);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v59 + 184LL))(v59, &v73);
v64 = ButtonSprite::create_1((__int64)"3", 20, 0, 1, (__int64)"bigFont.fnt", (__int64)"GJ_button_04.png", 0.4, 20.0);
v65 = CCMenuItemSpriteExtra::create(v64, 0, a1, sub_10020E4E0, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v65 + 72LL))(v65, 3);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v65);
v66 = sub_1002E74E0(*(_QWORD *)(a1 + 672), v64);
v67 = *(_QWORD *)(a1 + 552);
v68 = (float32x2_t *)(*(__int64 (__fastcall **)(__int64, __n128))(*(_QWORD *)v51 + 192LL))(v51, v66);
sub_1000262BC((float *)&v71, -23.0, -50.0);
v69.n128_u64[0] = (unsigned __int64)sub_100026318(v68, &v71, &v72);
cocos2d::CCNode::convertToNodeSpace(&v73, v67, &v72, v69);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v65 + 184LL))(v65, &v73);
}
*(_BYTE *)(a1 + 596) = 1;
return v70;
}