//
// GJSpecialColorSelect::init from 0x1001aed9c to 0x1001af448 (1708 bytes)
//
// 1 xrefs:
// > GJSpecialColorSelect::create @ 0x1001aed4c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool __fastcall GJSpecialColorSelect::init(
GJSpecialColorSelect *a1,
int a2,
GJSpecialColorSelectDelegate *a3,
ColorSelectType a4)
{
_BOOL4 inited; // w19
cocos2d::CCDirector *v9; // x0
cocos2d::extension::CCScale9Sprite *v10; // x22
__n128 v11; // q0
__n128 v12; // q1
cocos2d::CCLabelBMFont *v13; // x22
__n128 v14; // q0
__n128 v15; // q1
cocos2d::CCMenu *v16; // x0
__n128 v17; // q0
cocos2d::CCLayer *m_mainLayer; // x22
__n128 v19; // q1
ButtonSprite *v20; // x0
CCMenuItemSpriteExtra *v21; // x0
__n128 v22; // q0
cocos2d::CCMenu *m_buttonMenu; // x22
__n128 v24; // q1
char *v25; // x22
__n128 v26; // q0
cocos2d::CCMenu *v27; // x23
cocos2d::CCLayer *v28; // x24
__n128 v29; // q1
__n128 v30; // q0
cocos2d::CCMenu *v31; // x22
__n128 v32; // q1
__int64 v33; // x0
cocos2d::CCArray *v34; // x0
unsigned int v35; // w27
unsigned int *v36; // x0
unsigned __int64 v37; // x28
float v38; // s9
__int64 v39; // x25
const char *v40; // x0
ButtonSprite *v41; // x26
CCMenuItemSpriteExtra *v42; // x24
__n128 v43; // q0
__n128 v44; // q1
double v45; // d0
float32x2_t v47; // [xsp+8h] [xbp-C8h] BYREF
unsigned int *v48; // [xsp+10h] [xbp-C0h] BYREF
unsigned int *v49; // [xsp+18h] [xbp-B8h]
__int64 v50; // [xsp+20h] [xbp-B0h]
float32x2_t v51; // [xsp+28h] [xbp-A8h] BYREF
float32x2_t v52; // [xsp+30h] [xbp-A0h] BYREF
void *__p[2]; // [xsp+38h] [xbp-98h] BYREF
char v54; // [xsp+4Fh] [xbp-81h]
void *v55[2]; // [xsp+50h] [xbp-80h] BYREF
char v56; // [xsp+67h] [xbp-69h]
float v57; // [xsp+68h] [xbp-68h]
float v58; // [xsp+6Ch] [xbp-64h]
cocos2d::CCPoint v59; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v60; // 0:x3.16
cocos2d::SEL_MenuHandler v61; // 0:x3.16
cocos2d::CCRect v62; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
inited = FLAlertLayer::init_1(a1, 200);
if ( inited )
{
a1->m_delegate = a3;
a1->m_colorID = a2;
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
sub_100022990((float *)&v48, 0.0, 0.0, 80.0, 80.0);
v10 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v62);
sub_100022988((float *)&v48, 360.0, 250.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, unsigned int **))v10->setContentSize)(v10, &v48);
v11 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v10,
0xFFFFFFFFLL);
v11.n128_f32[0] = v57 * 0.5;
v12.n128_f32[0] = v58 * 0.5;
sub_100022980(v11, v12, &v48);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, unsigned int **))v10->setPosition)(v10, &v48);
v13 = cocos2d::CCLabelBMFont::create_1("Special Color Select", "goldFont.fnt");
v14.n128_f32[0] = v57 * 0.5;
v15.n128_f32[0] = (float)((float)(v58 * 0.5) + 125.0) + -25.0;
sub_100022980(v14, v15, &v48);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned int **))v13->setPosition)(v13, &v48);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v13);
v16 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v16;
v17 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v16,
10);
m_mainLayer = a1->m_mainLayer;
v17.n128_u32[0] = 0;
v19.n128_u32[0] = -15.0;
sub_100022980(v17, v19, &v48);
((void (__fastcall *)(cocos2d::CCLayer *, unsigned int **))m_mainLayer->setPosition)(m_mainLayer, &v48);
v20 = sub_10005F294("OK");
v60.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJSpecialColorSelect::onClose;
v60.adj = 0;
v21 = CCMenuItemSpriteExtra::create(v20, nullptr, a1, v60);
v22 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v21);
m_buttonMenu = a1->m_buttonMenu;
v22.n128_f32[0] = v57 * 0.5;
v24.n128_f32[0] = (float)((float)(v58 * 0.5) + -125.0) + 25.0;
sub_100022980(v22, v24, &v48);
((void (__fastcall *)(cocos2d::CCMenu *, unsigned int **))m_buttonMenu->setPosition)(m_buttonMenu, &v48);
sub_100009900(v55, "Help");
sub_100009900(__p, "Select a special color channel as the target color ID.");
v25 = InfoAlertButton::create((__int64)v55, (__int64)__p, 1.0);
if ( v54 < 0 )
operator delete(__p[0]);
if ( v56 < 0 )
operator delete(v55[0]);
v26 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, char *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v25);
v27 = a1->m_buttonMenu;
v28 = a1->m_mainLayer;
v26.n128_f32[0] = (float)((float)(v57 * 0.5) + 180.0) + -18.0;
v29.n128_f32[0] = (float)((float)(v58 * 0.5) + 125.0) + -18.0;
sub_100022980(v26, v29, &v51);
cocos2d::CCNode::convertToWorldSpace(v28, (const cocos2d::CCPoint *)&v51);
v59 = cocos2d::CCNode::convertToNodeSpace(v27, (const cocos2d::CCPoint *)&v52);
v30 = ((__n128 (__fastcall *)(char *, unsigned int **, float, float))*(_QWORD *)(*(_QWORD *)v25 + 184LL))(
v25,
&v48,
v59.x,
v59.y);
v31 = a1->m_buttonMenu;
v30.n128_f32[0] = v57 * 0.5;
v32.n128_f32[0] = (float)(v58 * 0.5) + 35.0;
sub_100022980(v30, v32, &v48);
cocos2d::CCNode::convertToNodeSpace(v31, (const cocos2d::CCPoint *)&v48);
v34 = (cocos2d::CCArray *)sub_10024A15C(v33);
a1->m_buttonSprites = v34;
cocos2d::CCObject::retain(v34);
v48 = nullptr;
v49 = nullptr;
v50 = 0;
if ( a4 == Filter )
{
v51.i32[0] = 1004;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1012;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1003;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1005;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1006;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v35 = 3;
}
else
{
v51.i32[0] = 1000;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1001;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1009;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1002;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1004;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1003;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1013;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1014;
if ( a4 != Color )
{
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1005;
sub_10000CBA8((__int64)&v48, (int *)&v51);
v51.i32[0] = 1006;
}
sub_10000CBA8((__int64)&v48, (int *)&v51);
v35 = 4;
}
v36 = v48;
if ( v49 != v48 )
{
v37 = 0;
v38 = vcvts_n_f32_u32(v35 - 1, 1u);
do
{
v39 = v36[v37];
v40 = "Line";
if ( (_DWORD)v39 != 1002 )
v40 = GJSpecialColorSelect::textForColorIdx(v39);
v41 = ButtonSprite::create_1(v40, 40, 0, 0.4, 1, "bigFont.fnt", "GJ_button_04.png", 30.0);
v61.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJSpecialColorSelect::onSelectColor;
v61.adj = 0;
v42 = CCMenuItemSpriteExtra::create(v41, nullptr, a1, v61);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v42->setTag)(v42, v39);
((void (__fastcall *)(ButtonSprite *, __int64))v41->setTag)(v41, v39);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v42);
v43 = sub_10024A2D0(a1->m_buttonSprites, v41);
v43.n128_f32[0] = (float)(70 * ((unsigned int)v37 % v35)) + (float)(v38 * -70.0);
v44.n128_f32[0] = (float)(int)(float)((unsigned int)v37 / v35) * -50.0;
sub_100022980(v43, v44, &v47);
*(float32x2_t *)&v45 = sub_1000229DC(&v52, &v47, &v51);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v42->setPosition)(v42, &v51, v45);
++v37;
v36 = v48;
}
while ( v37 < v49 - v48 );
}
if ( v36 )
{
v49 = v36;
operator delete(v36);
}
}
return inited;
}