//
// GJSpecialColorSelect::init from 0x100243e88 to 0x100244534 (1708 bytes)
//
// 1 xrefs:
// > GJSpecialColorSelect::create @ 0x100243e38
//
// 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:25 +0000
//
__int64 __fastcall GJSpecialColorSelect::init(__int64 a1, int a2, __int64 a3, int a4)
{
__int64 inited; // x19
__int64 v9; // x0
__int64 v10; // x22
__int64 v11; // x22
__int64 v12; // x0
__int64 v13; // x0
__int64 v14; // x22
__int64 v15; // x0
__int64 v16; // x0
__int64 v17; // x22
char *v18; // x22
__int64 v19; // x23
__int64 v20; // x24
__n128 v21; // q0
__int64 v22; // x22
__n128 v23; // q0
_QWORD *v24; // x0
__int64 v25; // x0
unsigned int v26; // w27
char *v27; // x0
unsigned __int64 v28; // x28
float v29; // s9
__int64 v30; // x25
const char *v31; // x0
void *v32; // x26
__int64 v33; // x24
double v34; // d0
float32x2_t v36; // [xsp+8h] [xbp-C8h] BYREF
unsigned int *v37; // [xsp+10h] [xbp-C0h] BYREF
char *v38; // [xsp+18h] [xbp-B8h]
__int64 v39; // [xsp+20h] [xbp-B0h]
float32x2_t v40; // [xsp+28h] [xbp-A8h] BYREF
float32x2_t v41; // [xsp+30h] [xbp-A0h] BYREF
void *__p[2]; // [xsp+38h] [xbp-98h] BYREF
char v43; // [xsp+4Fh] [xbp-81h]
void *v44[2]; // [xsp+50h] [xbp-80h] BYREF
char v45; // [xsp+67h] [xbp-69h]
__int64 v46; // [xsp+68h] [xbp-68h] BYREF
inited = FLAlertLayer::init_1(a1, 200);
if ( (_DWORD)inited )
{
*(_QWORD *)(a1 + 664) = a3;
*(_DWORD *)(a1 + 672) = a2;
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9, &v46);
sub_1000262CC((float *)&v37, 0.0, 0.0, 80.0, 80.0);
v10 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", &v37);
sub_1000262C4((float *)&v37, 360.0, 250.0);
(*(void (__fastcall **)(__int64, unsigned int **))(*(_QWORD *)v10 + 320LL))(v10, &v37);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v10,
0xFFFFFFFFLL);
sub_1000262BC((float *)&v37, *(float *)&v46 * 0.5, *((float *)&v46 + 1) * 0.5);
(*(void (__fastcall **)(__int64, unsigned int **))(*(_QWORD *)v10 + 184LL))(v10, &v37);
v11 = cocos2d::CCLabelBMFont::create_1("Special Color Select", "goldFont.fnt");
sub_1000262BC((float *)&v37, *(float *)&v46 * 0.5, (float)((float)(*((float *)&v46 + 1) * 0.5) + 125.0) + -25.0);
(*(void (__fastcall **)(__int64, unsigned int **))(*(_QWORD *)v11 + 184LL))(v11, &v37);
v12 = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v11);
v13 = cocos2d::CCMenu::create(v12);
*(_QWORD *)(a1 + 552) = v13;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v13, 10);
v14 = *(_QWORD *)(a1 + 584);
sub_1000262BC((float *)&v37, 0.0, -15.0);
(*(void (__fastcall **)(__int64, unsigned int **))(*(_QWORD *)v14 + 184LL))(v14, &v37);
v15 = sub_100067FAC((__int64)"OK");
v16 = CCMenuItemSpriteExtra::create(v15, 0, a1, GJSpecialColorSelect::onClose, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v16);
v17 = *(_QWORD *)(a1 + 552);
sub_1000262BC((float *)&v37, *(float *)&v46 * 0.5, (float)((float)(*((float *)&v46 + 1) * 0.5) + -125.0) + 25.0);
(*(void (__fastcall **)(__int64, unsigned int **))(*(_QWORD *)v17 + 184LL))(v17, &v37);
sub_100009900(v44, "Help");
sub_100009900(__p, "Select a special color channel as the target color ID.");
v18 = InfoAlertButton::create((__int64)v44, (__int64)__p, 1.0);
if ( v43 < 0 )
operator delete(__p[0]);
if ( v45 < 0 )
operator delete(v44[0]);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v18);
v19 = *(_QWORD *)(a1 + 552);
v20 = *(_QWORD *)(a1 + 584);
sub_1000262BC(
(float *)&v40,
(float)((float)(*(float *)&v46 * 0.5) + 180.0) + -18.0,
(float)((float)(*((float *)&v46 + 1) * 0.5) + 125.0) + -18.0);
cocos2d::CCNode::convertToWorldSpace(&v41, v20, &v40);
cocos2d::CCNode::convertToNodeSpace(&v37, v19, &v41, v21);
(*(void (__fastcall **)(char *, unsigned int **))(*(_QWORD *)v18 + 184LL))(v18, &v37);
v22 = *(_QWORD *)(a1 + 552);
sub_1000262BC((float *)&v37, *(float *)&v46 * 0.5, (float)(*((float *)&v46 + 1) * 0.5) + 35.0);
v24 = cocos2d::CCNode::convertToNodeSpace(&v41, v22, &v37, v23);
v25 = sub_1002E736C(v24);
*(_QWORD *)(a1 + 680) = v25;
cocos2d::CCObject::retain(v25);
v37 = nullptr;
v38 = nullptr;
v39 = 0;
if ( a4 == 2 )
{
v40.i32[0] = 1004;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1012;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1003;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1005;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1006;
sub_10000D038((__int64)&v37, (int *)&v40);
v26 = 3;
}
else
{
v40.i32[0] = 1000;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1001;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1009;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1002;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1004;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1003;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1013;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1014;
if ( a4 != 1 )
{
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1005;
sub_10000D038((__int64)&v37, (int *)&v40);
v40.i32[0] = 1006;
}
sub_10000D038((__int64)&v37, (int *)&v40);
v26 = 4;
}
v27 = (char *)v37;
if ( v38 != (char *)v37 )
{
v28 = 0;
v29 = vcvts_n_f32_u32(v26 - 1, 1u);
do
{
v30 = *(unsigned int *)&v27[4 * v28];
v31 = "Line";
if ( (_DWORD)v30 != 1002 )
v31 = (const char *)GJSpecialColorSelect::textForColorIdx(v30);
v32 = ButtonSprite::create_1(
(__int64)v31,
40,
0,
1,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_04.png",
0.4,
30.0);
v33 = CCMenuItemSpriteExtra::create(v32, 0, a1, sub_100244664, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v33 + 72LL))(v33, v30);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v32 + 72LL))(v32, v30);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v33);
sub_1002E74E0(*(_QWORD *)(a1 + 680), v32);
sub_1000262BC(
(float *)&v36,
(float)(70 * ((unsigned int)v28 % v26)) + (float)(v29 * -70.0),
(float)(int)(float)((unsigned int)v28 / v26) * -50.0);
*(float32x2_t *)&v34 = sub_100026318(&v41, &v36, &v40);
(*(void (__fastcall **)(__int64, float32x2_t *, double))(*(_QWORD *)v33 + 184LL))(v33, &v40, v34);
++v28;
v27 = (char *)v37;
}
while ( v28 < (v38 - (char *)v37) >> 2 );
}
if ( v27 )
{
v38 = v27;
operator delete(v27);
}
return (unsigned int)inited;
}
return inited;
}