//
// SelectArtLayer::init from 0x6a9660 to 0x6a9d92 (1842 bytes)
//
// 1 xrefs:
// > SelectArtLayer::create @ 0x6a9e76
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:56:34 +0000
//
int __fastcall SelectArtLayer::init(int a1, int a2, int a3)
{
int v6; // r8
int v7; // r10
char *v8; // r6
cocos2d::CCDirector *v9; // r0
cocos2d::CCLayer *WinSize; // r0
int v11; // r0
int v12; // r3
int v13; // r0
int v14; // r3
int v15; // r7
float v16; // s16
void (__fastcall *v17)(int, _BYTE *); // r9
void (__fastcall *v18)(int, _BYTE *); // r9
const char *v19; // r2
float v20; // s16
int v21; // r6
void (__fastcall *v22)(int, _BYTE *); // r7
cocos2d::CCArray *v23; // r0
int v24; // r3
int v25; // s21
cocos2d::CCObject *v26; // r0
cocos2d::CCArray *v27; // r0
int v28; // r0
int v29; // r3
float v30; // s15
int v31; // r3
float v32; // s18
const cocos2d::CCPoint *v33; // r6
const char *v34; // r9
ObjectToolbox *v35; // r0
int v36; // r3
char *v37; // r0
cocos2d::CCString *v38; // r0
char *CString; // r0
const char *v40; // r1
ObjectToolbox *v41; // r5
int v42; // r1
int v43; // r0
int v44; // r7
cocos2d::CCObject *v45; // r6
int v46; // r0
const char *v47; // r1
cocos2d::CCObject *v48; // r11
float v49; // s23
ButtonSprite *v50; // r0
int v51; // r11
const cocos2d::CCPoint *v52; // r10
void (__fastcall *v53)(int, _BYTE *); // r9
cocos2d::CCArray *v54; // r0
cocos2d::CCObject *v55; // r0
const char *v56; // r2
int v57; // r8
void (__fastcall *v58)(int, _BYTE *); // r9
ButtonSprite *v59; // r0
cocos2d::CCObject *v60; // r10
int v61; // r11
int v62; // r10
ButtonSprite *v63; // r0
int v64; // r11
ButtonSprite *v65; // r0
cocos2d::CCObject *v66; // r11
int v67; // r5
const cocos2d::CCPoint *v68; // r11
void (__fastcall *v69)(int, _BYTE *); // r9
int v70; // r8
float v72; // [sp+10h] [bp-84h]
float v73; // [sp+10h] [bp-84h]
float v74; // [sp+10h] [bp-84h]
cocos2d::CCMenu *v75; // [sp+14h] [bp-80h]
int v76; // [sp+1Ch] [bp-78h]
cocos2d::CCObject *v77; // [sp+20h] [bp-74h]
cocos2d::CCObject *v78; // [sp+20h] [bp-74h]
cocos2d::CCObject *v79; // [sp+20h] [bp-74h]
cocos2d::CCPoint *v80; // [sp+28h] [bp-6Ch]
cocos2d::CCPoint *v81; // [sp+28h] [bp-6Ch]
cocos2d::CCPoint *v82; // [sp+2Ch] [bp-68h]
cocos2d::CCPoint *v83; // [sp+2Ch] [bp-68h]
float v84; // [sp+34h] [bp-60h] BYREF
float v85; // [sp+38h] [bp-5Ch]
_BYTE v86[8]; // [sp+3Ch] [bp-58h] BYREF
unsigned int (__fastcall *v87)(SelectArtLayer *, cocos2d::CCObject *); // [sp+44h] [bp-50h]
int v88; // [sp+48h] [bp-4Ch]
int (__fastcall ***(__fastcall *v89)(SelectArtLayer *, cocos2d::CCObject *))(_DWORD, SelectArtLayer *); // [sp+4Ch] [bp-48h]
int v90; // [sp+50h] [bp-44h]
unsigned int (__fastcall *v91)(SelectArtLayer *, cocos2d::CCObject *); // [sp+54h] [bp-40h]
int v92; // [sp+58h] [bp-3Ch]
unsigned int (__fastcall *v93)(SelectArtLayer *, cocos2d::CCObject *); // [sp+5Ch] [bp-38h]
int v94; // [sp+60h] [bp-34h]
unsigned int (__fastcall *v95)(SelectArtLayer *, cocos2d::CCObject *); // [sp+64h] [bp-30h]
int v96; // [sp+68h] [bp-2Ch]
_BYTE v97[8]; // [sp+6Ch] [bp-28h] BYREF
_BYTE v98[8]; // [sp+74h] [bp-20h] BYREF
_BYTE v99[16]; // [sp+7Ch] [bp-18h] BYREF
v99[0] = 0;
v99[1] = 0;
v99[2] = 0;
v99[3] = -106;
v76 = cocos2d::CCLayerColor::initWithColor(a1, v99);
if ( !v76 )
return v76;
FLAlertLayer::incrementForcePrio((cocos2d::CCObject *)a1);
*(_DWORD *)(a1 + 536) = a2;
if ( a3 != -1 )
*(_DWORD *)(a1 + 528) = a3;
if ( a2 )
{
if ( a2 == 1 )
{
v6 = 1;
if ( *(int *)(a1 + 528) <= 0 )
*(_DWORD *)(a1 + 528) = 1;
v7 = 22;
v8 = "Select Ground";
}
else
{
v6 = 0;
if ( a2 == 2 )
{
v7 = 3;
v8 = "Select Middleground";
}
else
{
v7 = 11;
v8 = "Select Type";
}
}
}
else
{
v6 = 1;
if ( *(int *)(a1 + 528) <= 0 )
*(_DWORD *)(a1 + 528) = 1;
v7 = 59;
v8 = "Select Background";
}
(*(void (__fastcall **)(int, int))(*(_DWORD *)a1 + 500))(a1, 1);
v9 = (cocos2d::CCDirector *)(*(int (__fastcall **)(int, int))(*(_DWORD *)a1 + 536))(a1, 1);
cocos2d::CCDirector::sharedDirector(v9);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v84);
v11 = cocos2d::CCLayer::create(WinSize);
v12 = *(_DWORD *)a1;
*(_DWORD *)(a1 + 460) = v11;
(*(void (__fastcall **)(int, int))(v12 + 228))(a1, v11);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v99, 0.0, 0.0, 80.0, 80.0);
v13 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v99);
v14 = *(_DWORD *)(a1 + 536);
v15 = v13;
if ( v14 )
{
v16 = 260.0;
if ( v14 != 1 )
v16 = 240.0;
}
else
{
v16 = 300.0;
}
v17 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v13 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v99, 360.0, v16);
v17(v15, v99);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v15, -1);
v18 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v15 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, v84 * 0.5, v85 * 0.5);
v18(v15, v99);
v20 = v16 * 0.5;
v21 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v8, "bigFont.fnt", v19);
v22 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v21 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, v84 * 0.5, (float)(v20 + (float)(v85 * 0.5)) - 20.0);
v22(v21, v99);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 460) + 228))(*(_DWORD *)(a1 + 460), v21);
v23 = (cocos2d::CCArray *)(*(int (__fastcall **)(int, int))(*(_DWORD *)v21 + 80))(v21, 1061997773);
v24 = *(_DWORD *)(a1 + 536);
if ( v24 )
{
v25 = 1061997773;
if ( v24 == 1 )
v25 = 1060320051;
}
else
{
v25 = 1058642330;
}
v26 = (cocos2d::CCObject *)cocos2d::CCArray::create(v23);
*(_DWORD *)(a1 + 520) = v26;
v27 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v26);
v75 = (cocos2d::CCMenu *)cocos2d::CCArray::create(v27);
v28 = cocos2d::CCMenu::create(v75);
*(_DWORD *)(a1 + 444) = v28;
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v28, 10);
v29 = *(_DWORD *)(a1 + 536);
if ( v29 )
{
if ( v29 == 1 )
{
v30 = 40.0;
v31 = 8;
v32 = 40.0;
}
else
{
v30 = 25.0;
v31 = 7;
v32 = 45.0;
}
}
else
{
v30 = 75.0;
v31 = 10;
v32 = 35.0;
}
v33 = *(const cocos2d::CCPoint **)(a1 + 444);
v72 = *(float *)&v31;
v34 = (const char *)v6;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, v84 * 0.5, (float)((float)(v32 * 0.5) + (float)(v85 * 0.5)) + v30);
v35 = (ObjectToolbox *)cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v86, v33);
do
{
v36 = *(_DWORD *)(a1 + 536);
switch ( v36 )
{
case 0:
v37 = "bgIcon_%02d_001.png";
LABEL_33:
v38 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)v37, v34);
CString = (char *)cocos2d::CCString::getCString(v38);
goto LABEL_37;
case 1:
v37 = "gIcon_%02d_001.png";
goto LABEL_33;
case 2:
v37 = "mgIcon_%02d_001.png";
goto LABEL_33;
}
v41 = (ObjectToolbox *)ObjectToolbox::sharedState(v35);
v43 = EditorUI::smartTypeForKey((unsigned int)v34, v42);
CString = ObjectToolbox::intKeyToFrame(v41, v43);
LABEL_37:
v44 = (int)&v34[-v6];
v45 = (cocos2d::CCObject *)cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)CString, v40);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 520), v45);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v45 + 80))(v45, v25);
v87 = SelectArtLayer::selectArt;
v88 = 0;
v46 = CCMenuItemSpriteExtra::create((int)v45, 0, a1, (int)SelectArtLayer::selectArt, 0);
v47 = v34++;
v48 = (cocos2d::CCObject *)v46;
(*(void (__fastcall **)(int, const char *))(*(_DWORD *)v46 + 36))(v46, v47);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v48);
cocos2d::CCArray::addObject(v75, v48);
v82 = *(cocos2d::CCPoint **)(*(_DWORD *)v48 + 92);
v49 = floorf((float)(v44 / SLODWORD(v72)));
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v99,
(float)((float)((float)((float)-LODWORD(v72) * 0.5) * v32) + (float)((float)(v44 % SLODWORD(v72)) * v32))
+ (float)(v32 * 0.5),
-(float)(v32 * v49));
cocos2d::CCPoint::operator+(v98, v86, v99);
v35 = (ObjectToolbox *)((int (__fastcall *)(cocos2d::CCObject *, _BYTE *))v82)(v48, v98);
}
while ( (int)v34 <= v7 );
*(_DWORD *)(a1 + 500) = -1;
cocos2d::CCArray::removeAllObjects(v75);
v50 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_01.png",
(const char *)0x41F00000,
v72);
v89 = SelectArtLayer::onClose;
v90 = 0;
v51 = CCMenuItemSpriteExtra::create((int)v50, 0, a1, (int)SelectArtLayer::onClose, 0);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v51);
v52 = *(const cocos2d::CCPoint **)(a1 + 444);
v53 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v51 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, v84 * 0.5, (float)((float)(v85 * 0.5) - v20) + 25.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v98, v52);
v53(v51, v98);
v54 = (cocos2d::CCArray *)SelectArtLayer::selectArt((SelectArtLayer *)a1, nullptr);
if ( *(_DWORD *)(a1 + 536) == 1 )
{
v55 = (cocos2d::CCObject *)cocos2d::CCArray::create(v54);
*(_DWORD *)(a1 + 524) = v55;
cocos2d::CCObject::retain(v55);
v57 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Line", "goldFont.fnt", v56);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v57 + 80))(v57, 1060320051);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 460) + 228))(*(_DWORD *)(a1 + 460), v57);
v58 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v57 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, (float)(v84 * 0.5) + 130.0, (float)(v85 * 0.5) - 45.0);
v58(v57, v99);
v59 = ButtonSprite::create(
(ButtonSprite *)a1i2r3e45s789g,
(const char *)&dword_14,
0,
0.4,
1,
"bigFont.fnt",
"GJ_button_04.png",
COERCE_CONST_CHAR_(20.0),
COERCE_FLOAT(1));
v91 = SelectArtLayer::onSelectCustom;
v92 = 0;
v60 = v59;
v61 = CCMenuItemSpriteExtra::create((int)v59, 0, a1, (int)SelectArtLayer::onSelectCustom, 0);
(*(void (__fastcall **)(int, float))(*(_DWORD *)v61 + 36))(v61, COERCE_FLOAT(LODWORD(v73)));
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v61);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 524), v60);
v77 = *(cocos2d::CCObject **)(*(_DWORD *)v61 + 92);
v80 = *(cocos2d::CCPoint **)(a1 + 444);
v62 = (*(int (__fastcall **)(int))(*(_DWORD *)v57 + 96))(v57);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, -23.0, -25.0);
cocos2d::CCPoint::operator+(v98, v62, v99);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v97, v80);
((void (__fastcall *)(int, _BYTE *))v77)(v61, v97);
v63 = ButtonSprite::create(
(ButtonSprite *)&a1i2r3e45s789g[2],
(const char *)&dword_14,
0,
0.4,
SLODWORD(v73),
"bigFont.fnt",
"GJ_button_04.png",
COERCE_CONST_CHAR_(20.0),
v73);
v93 = SelectArtLayer::onSelectCustom;
v94 = 0;
v78 = v63;
v64 = CCMenuItemSpriteExtra::create((int)v63, 0, a1, (int)SelectArtLayer::onSelectCustom, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v64 + 36))(v64, 2);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v64);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 524), v78);
v79 = *(cocos2d::CCObject **)(*(_DWORD *)v64 + 92);
v83 = *(cocos2d::CCPoint **)(a1 + 444);
v81 = (cocos2d::CCPoint *)(*(int (__fastcall **)(int))(*(_DWORD *)v57 + 96))(v57);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, 23.0, -25.0);
cocos2d::CCPoint::operator+(v98, v81, v99);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v97, v83);
((void (__fastcall *)(int, _BYTE *))v79)(v64, v97);
v65 = ButtonSprite::create(
(ButtonSprite *)&a1i2r3e45s789g[4],
(const char *)&dword_14,
0,
0.4,
SLODWORD(v74),
"bigFont.fnt",
"GJ_button_04.png",
COERCE_CONST_CHAR_(20.0),
v74);
v95 = SelectArtLayer::onSelectCustom;
v96 = 0;
v66 = v65;
v67 = CCMenuItemSpriteExtra::create((int)v65, 0, a1, (int)SelectArtLayer::onSelectCustom, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v67 + 36))(v67, 3);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v67);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 524), v66);
v68 = *(const cocos2d::CCPoint **)(a1 + 444);
v69 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v67 + 92);
v70 = (*(int (__fastcall **)(int))(*(_DWORD *)v57 + 96))(v57);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, -23.0, -50.0);
cocos2d::CCPoint::operator+(v98, v70, v99);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v97, v68);
v69(v67, v97);
}
*(_BYTE *)(a1 + 468) = 1;
return v76;
}