//
// SelectArtLayer::init from 0x1002599e0 to 0x10025a402 (2594 bytes)
//
// 1 xrefs:
// > SelectArtLayer::create @ 0x10025927e
//
// This function is hookable on this platform (idp: pc, 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 12:27:28 +0000
//
__int64 __fastcall SelectArtLayer::init(__int64 a1, int a2, int a3)
{
__int64 result; // rax
const char *v6; // r14
int v7; // r13d
__int64 v8; // rsi
__int64 v9; // rax
__int64 v10; // r15
int v11; // edx
__int64 v12; // rax
double v13; // xmm1_8
__int64 v14; // r14
int v15; // edx
__int64 v16; // rax
int v17; // xmm0_4
__int64 v18; // rax
__int64 v19; // rdi
__int64 v20; // rax
int v21; // r15d
int v22; // eax
float v23; // xmm2_4
float v24; // xmm3_4
__int64 v25; // r14
double v26; // xmm0_8
unsigned int v27; // r13d
char *v28; // rdi
__int64 v29; // rax
__int64 CString; // rax
__int64 v31; // rsi
__int64 v32; // r15
unsigned int v33; // r14d
int v34; // eax
__int64 v35; // r15
unsigned int v36; // eax
unsigned int v37; // r14d
char *v38; // rax
__int64 v39; // r15
__int64 v40; // r12
int v41; // r13d
bool v42; // r15
__int64 v43; // rdi
__int64 v44; // rcx
_QWORD *v45; // rdi
_WORD *v46; // rsi
_QWORD *v47; // rax
__int64 v48; // rax
__int64 v49; // r14
char *v50; // r12
__int64 v51; // r15
__int64 v52; // r13
char *v53; // r12
__int64 v54; // r15
__int64 v55; // r13
char *v56; // r12
__int64 v57; // r15
__int64 v58; // r14
float v59; // [rsp+0h] [rbp-C0h]
__int64 v60; // [rsp+38h] [rbp-88h]
_DWORD v61[4]; // [rsp+44h] [rbp-7Ch] BYREF
unsigned int v62; // [rsp+54h] [rbp-6Ch]
float v63; // [rsp+58h] [rbp-68h]
int v64; // [rsp+5Ch] [rbp-64h]
_BYTE v65[8]; // [rsp+60h] [rbp-60h] BYREF
_BYTE v66[8]; // [rsp+68h] [rbp-58h] BYREF
float v67; // [rsp+70h] [rbp-50h]
float v68; // [rsp+74h] [rbp-4Ch]
_WORD v69[4]; // [rsp+78h] [rbp-48h] BYREF
float v70; // [rsp+80h] [rbp-40h] BYREF
float v71; // [rsp+84h] [rbp-3Ch]
__int64 v72; // [rsp+88h] [rbp-38h]
unsigned __int8 v73; // [rsp+97h] [rbp-29h]
v61[0] = -1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, v61);
if ( !(_BYTE)result )
return result;
v73 = result;
FLAlertLayer::incrementForcePrio(a1);
*(_DWORD *)(a1 + 688) = a2;
if ( a3 != -1 )
*(_DWORD *)(a1 + 680) = a3;
v72 = 0;
if ( a2 == 2 )
{
v6 = "Select Middleground";
v7 = 4;
goto LABEL_13;
}
if ( a2 == 1 )
{
v6 = "Select Ground";
v7 = 23;
v72 = 1;
if ( *(int *)(a1 + 680) <= 0 )
LABEL_10:
*(_DWORD *)(a1 + 680) = 1;
}
else
{
if ( a2 )
{
v6 = "Select Type";
v7 = 12;
goto LABEL_13;
}
v6 = "Select Background";
v7 = 60;
v72 = 1;
if ( *(int *)(a1 + 680) <= 0 )
goto LABEL_10;
}
LABEL_13:
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1000LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
v8 = cocos2d::CCDirector::sharedDirector(a1, 1);
cocos2d::CCDirector::getWinSize(&v70, v8);
v9 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 584) = v9;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v9);
sub_100278270(v61, 0.0, 0.0, COERCE_DOUBLE(1117782016), COERCE_DOUBLE(1117782016));
v10 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v61);
v11 = *(_DWORD *)(a1 + 688);
v12 = 0;
if ( v11 )
{
LOBYTE(v12) = v11 == 1;
*(_QWORD *)&v13 = *((unsigned int *)&unk_100A069F0 + v12);
}
else
{
*(_QWORD *)&v13 = 1133903872;
}
v68 = *(float *)&v13;
sub_100278260(v61, COERCE_DOUBLE(1135869952), v13);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v10 + 320LL))(v10, v61);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v10,
0xFFFFFFFFLL);
sub_100278250(v61, v70 * 0.5, v71 * 0.5);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v10 + 184LL))(v10, v61);
v14 = cocos2d::CCLabelBMFont::create_3(v6, "bigFont.fnt");
v68 = v68 * 0.5;
sub_100278250(v61, v70 * 0.5, (float)((float)(v71 * 0.5) + v68) + -20.0);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v14 + 184LL))(v14, v61);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v14);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v14 + 160LL))(v14, 0.80000001);
v15 = *(_DWORD *)(a1 + 688);
v16 = 0;
if ( v15 )
{
LOBYTE(v16) = v15 == 1;
v17 = dword_100A069F8[v16];
}
else
{
v17 = 1058642330;
}
v67 = *(float *)&v17;
v18 = sub_1007FE900(v14);
*(_QWORD *)(a1 + 664) = v18;
v19 = v18;
cocos2d::CCObject::retain(v18);
v60 = sub_1007FE900(v19);
v20 = cocos2d::CCMenu::create();
*(_QWORD *)(a1 + 552) = v20;
v21 = 10;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v20, 10);
v22 = *(_DWORD *)(a1 + 688);
if ( v22 )
{
if ( v22 == 1 )
{
v21 = 8;
v23 = 40.0;
v24 = 40.0;
}
else
{
v21 = 7;
v24 = 45.0;
v23 = 25.0;
}
}
else
{
v24 = 35.0;
v23 = 75.0;
}
v25 = *(_QWORD *)(a1 + 552);
v59 = v24 * 0.5;
sub_100278250(v69, v70 * 0.5, (float)((float)(v71 * 0.5) + (float)(v24 * 0.5)) + v23);
cocos2d::CCNode::convertToNodeSpace(v61, v25, v69);
v62 = v21;
HIDWORD(v26) = 0;
v64 = v72 - v7;
*(float *)&v26 = (float)((float)-v21 * 0.5) * v24;
v63 = *(float *)&v26;
v27 = 0;
do
{
v33 = v72 + v27;
v34 = *(_DWORD *)(a1 + 688);
switch ( v34 )
{
case 2:
v28 = "mgIcon_%02d_001.png";
goto LABEL_26;
case 1:
v28 = "gIcon_%02d_001.png";
LABEL_26:
v29 = sub_10088E820(v28, SLOBYTE(v59));
CString = cocos2d::CCString::getCString(v29);
goto LABEL_27;
case 0:
v28 = "bgIcon_%02d_001.png";
goto LABEL_26;
}
v35 = ObjectToolbox::sharedState(v26);
v36 = EditorUI::smartTypeForKey(v33);
CString = ObjectToolbox::intKeyToFrame(v35, v36);
LABEL_27:
v31 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
sub_1007FEBF0(*(_QWORD *)(a1 + 664), v31);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v31 + 160LL))(v31, v67);
v32 = CCMenuItemSpriteExtra::create(v31, 0, a1, SelectArtLayer::selectArt, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v32 + 72LL))(v32, v33);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v32);
sub_1007FEBF0(v60, v32);
HIDWORD(v26) = 0;
*(float *)&v26 = (float)((float)((float)(int)(v27 % v62) * v24) + v63) + v59;
sub_100278250(v66, *(float *)&v26, (float)(int)(v27 / v62) * (float)-v24);
sub_100278350(v69, v61, v66);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v32 + 184LL))(v32, v69);
++v27;
}
while ( v27 + v64 );
*(_DWORD *)(a1 + 640) = -1;
sub_1007FF190(v60);
v37 = 0;
v38 = ButtonSprite::create_1(
(__int64)"OK",
0x28u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0.80000001,
30.0);
v39 = CCMenuItemSpriteExtra::create(v38, 0, a1, SelectArtLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v39);
v40 = *(_QWORD *)(a1 + 552);
sub_100278250(v66, v70 * 0.5, (float)((float)(v71 * 0.5) - v68) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v69, v40, v66);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v39 + 184LL))(v39, v69);
v41 = 0;
v42 = *(_DWORD *)(a1 + 688) < 2u;
v43 = *(_QWORD *)(a1 + 664);
if ( (unsigned int)sub_1007FEF90(v43) )
{
LOBYTE(v41) = v42;
do
{
v47 = (_QWORD *)sub_1007FEFE0(*(_QWORD *)(a1 + 664), v37);
if ( v37 + v41 == *(_DWORD *)(a1 + 680) )
{
v44 = *v47;
v45 = v47;
v46 = &unk_100A06A06;
}
else
{
memset(v69, 125, 3);
v44 = *v47;
v45 = v47;
v46 = v69;
}
(*(void (__fastcall **)(_QWORD *, _WORD *))(v44 + 960))(v45, v46);
++v37;
v43 = *(_QWORD *)(a1 + 664);
}
while ( v37 < (unsigned int)sub_1007FEF90(v43) );
}
if ( *(_DWORD *)(a1 + 688) == 1 )
{
v48 = sub_1007FE900(v43);
*(_QWORD *)(a1 + 672) = v48;
cocos2d::CCObject::retain(v48);
v49 = cocos2d::CCLabelBMFont::create_3("Line", "goldFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v49 + 160LL))(v49, 0.69999999);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v49);
sub_100278250(v69, (float)(v70 * 0.5) + 130.0, (float)(0.5 * v71) + -45.0);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v49 + 184LL))(v49, v69);
v50 = ButtonSprite::create_1(
(__int64)"1",
0x14u,
0,
1u,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_04.png",
0.40000001,
20.0);
v51 = CCMenuItemSpriteExtra::create(v50, 0, a1, SelectArtLayer::onSelectCustom, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v51 + 72LL))(v51, 1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v51);
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v50);
v72 = *(_QWORD *)(a1 + 552);
v52 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v49 + 192LL))(v49);
sub_100278250(v65, -23.0, -25.0);
sub_100278350(v66, v52, v65);
cocos2d::CCNode::convertToNodeSpace(v69, v72, v66);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v51 + 184LL))(v51, v69);
v53 = ButtonSprite::create_1(
(__int64)"2",
0x14u,
0,
1u,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_04.png",
0.40000001,
20.0);
v54 = CCMenuItemSpriteExtra::create(v53, 0, a1, SelectArtLayer::onSelectCustom, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v54 + 72LL))(v54, 2);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v54);
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v53);
v72 = *(_QWORD *)(a1 + 552);
v55 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v49 + 192LL))(v49);
sub_100278250(v65, 23.0, -25.0);
sub_100278350(v66, v55, v65);
cocos2d::CCNode::convertToNodeSpace(v69, v72, v66);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v54 + 184LL))(v54, v69);
v56 = ButtonSprite::create_1(
(__int64)"3",
0x14u,
0,
1u,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_04.png",
0.40000001,
20.0);
v57 = CCMenuItemSpriteExtra::create(v56, 0, a1, SelectArtLayer::onSelectCustom, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v57 + 72LL))(v57, 3);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v57);
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v56);
v72 = *(_QWORD *)(a1 + 552);
v58 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v49 + 192LL))(v49);
sub_100278250(v65, -23.0, -50.0);
sub_100278350(v66, v58, v65);
cocos2d::CCNode::convertToNodeSpace(v69, v72, v66);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v57 + 184LL))(v57, v69);
}
*(_BYTE *)(a1 + 596) = 1;
return v73;
}