//
// GJSpecialColorSelect::init from 0x100626070 to 0x10062695e (2286 bytes)
//
// 1 xrefs:
// > GJSpecialColorSelect::create @ 0x100626024
//
// 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)
{
bool result; // al
cocos2d::extension::CCScale9Sprite *v7; // rbx
cocos2d::CCLabelBMFont *v8; // rbx
cocos2d::CCMenu *v9; // rax
cocos2d::CCLayer *m_mainLayer; // rbx
ButtonSprite *v11; // rax
CCMenuItemSpriteExtra *v12; // rax
cocos2d::CCMenu *m_buttonMenu; // rbx
char *v14; // r15
cocos2d::CCMenu *v15; // rbx
cocos2d::CCLayer *v16; // r12
GJSpecialColorSelect *v17; // r13
const cocos2d::CCPoint *v18; // rbx
cocos2d::CCObject *v19; // rax
_DWORD *v20; // rbx
_QWORD *v21; // r14
_DWORD *v22; // r15
char *v23; // r13
char *v24; // r15
int v25; // eax
_DWORD *v26; // rbx
_QWORD *v27; // r14
_DWORD *v28; // r15
void *v29; // rdi
_DWORD *v30; // rbx
_QWORD *v31; // r15
_DWORD *v32; // r14
char *v33; // r13
char *v34; // rbx
char *v35; // rbx
__int64 v36; // r15
unsigned int v37; // ebx
const char *v38; // rdi
ButtonSprite *v39; // r12
CCMenuItemSpriteExtra *v40; // r14
__m128 v41; // xmm1
unsigned int v42; // [rsp+0h] [rbp-B0h]
__int64 v43; // [rsp+8h] [rbp-A8h]
__int128 v44; // [rsp+10h] [rbp-A0h] BYREF
void *v45; // [rsp+20h] [rbp-90h]
std::string v46; // [rsp+28h] [rbp-88h] BYREF
double v47; // [rsp+44h] [rbp-6Ch] BYREF
unsigned __int64 v48; // [rsp+4Ch] [rbp-64h] BYREF
float v49; // [rsp+54h] [rbp-5Ch]
unsigned __int64 v50[2]; // [rsp+58h] [rbp-58h] BYREF
GJSpecialColorSelect *v51; // [rsp+68h] [rbp-48h]
float v52; // [rsp+74h] [rbp-3Ch] BYREF
float v53; // [rsp+78h] [rbp-38h]
bool v54; // [rsp+7Fh] [rbp-31h]
char *v55; // [rsp+80h] [rbp-30h]
double v56; // 0:xmm0_8.8
cocos2d::CCRect v57; // 0:xmm0_8.8,8:xmm1_8.8
result = FLAlertLayer::init_1(a1, 200);
if ( result )
{
v54 = result;
a1->m_delegate = a3;
a1->m_colorID = a2;
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v52);
v57.origin = 0;
v57.size = 0;
sub_10028CC00((__int64)v50, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v7 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v57);
sub_10028CBF0((float *)v50, 360.0, 250.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, unsigned __int64 *))v7->setContentSize)(v7, v50);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v7,
0xFFFFFFFFLL);
sub_10028CBE0((float *)v50, v52 * 0.5, v53 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, unsigned __int64 *))v7->setPosition)(v7, v50);
v8 = cocos2d::CCLabelBMFont::create_3("Special Color Select", "goldFont.fnt");
sub_10028CBE0((float *)v50, v52 * 0.5, (float)((float)(v53 * 0.5) + 125.0) + -25.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v8->setPosition)(v8, v50);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v8);
v9 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v9;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v9,
10);
m_mainLayer = a1->m_mainLayer;
sub_10028CBE0((float *)v50, 0.0, -15.0);
((void (__fastcall *)(cocos2d::CCLayer *, unsigned __int64 *))m_mainLayer->setPosition)(m_mainLayer, v50);
v11 = sub_100092A30("OK");
v12 = CCMenuItemSpriteExtra::create(
v11,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)GJSpecialColorSelect::onClose);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v12);
m_buttonMenu = a1->m_buttonMenu;
sub_10028CBE0((float *)v50, v52 * 0.5, (float)((float)(v53 * 0.5) + -125.0) + 25.0);
((void (__fastcall *)(cocos2d::CCMenu *, unsigned __int64 *))m_buttonMenu->setPosition)(m_buttonMenu, v50);
LOBYTE(v44) = 8;
strcpy((char *)&v44 + 1, "Help");
v46.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v46.__r_.__value_.__r.__words[0] = 57;
v46.__r_.__value_.__l.__size_ = 54;
strcpy(v46.__r_.__value_.__l.__data_, "Select a special color channel as the target color ID.");
v14 = InfoAlertButton::create(&v44, &v46, 1.0);
if ( (*(_BYTE *)&v46.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v46.__r_.__value_.__l.__data_);
LODWORD(v55) = a4;
if ( (v44 & 1) != 0 )
operator delete(v45);
((void (__fastcall *)(cocos2d::CCMenu *, char *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v14);
v15 = a1->m_buttonMenu;
v16 = a1->m_mainLayer;
v51 = a1;
sub_10028CBE0(
(float *)&v48,
(float)((float)(v52 * 0.5) + 180.0) + -18.0,
(float)((float)(v53 * 0.5) + 125.0) + -18.0);
v17 = v51;
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v47, (const cocos2d::CCPoint *)v16);
*(cocos2d::CCPoint *)&v56 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)v50,
(const cocos2d::CCPoint *)v15);
(*(void (__fastcall **)(char *, unsigned __int64 *, double))(*(_QWORD *)v14 + 184LL))(v14, v50, v56);
v18 = (const cocos2d::CCPoint *)v17->m_buttonMenu;
sub_10028CBE0((float *)&v47, v52 * 0.5, (float)(0.5 * v53) + 35.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v50, v18);
v19 = (cocos2d::CCObject *)sub_10071F9E0(v50, v18);
v17->m_buttonSprites = (cocos2d::CCArray *)v19;
cocos2d::CCObject::retain(v19);
if ( (_DWORD)v55 == 2 )
{
v26 = operator new(4u);
*v26 = 1004;
v27 = operator new(8u);
*v27 = 0x3F4000003ECLL;
operator delete(v26);
v28 = operator new(0x10u);
v28[2] = 1003;
*(_QWORD *)v28 = *v27;
operator delete(v27);
v28[3] = 1005;
v23 = (char *)operator new(0x20u);
*((_DWORD *)v23 + 4) = 1006;
*(_OWORD *)v23 = *(_OWORD *)v28;
v29 = v28;
v24 = v23 + 20;
operator delete(v29);
v25 = 3;
goto LABEL_15;
}
if ( (_DWORD)v55 == 1 )
{
v20 = operator new(4u);
*v20 = 1000;
v21 = operator new(8u);
*v21 = 0x3E9000003E8LL;
operator delete(v20);
v22 = operator new(0x10u);
v22[2] = 1009;
*(_QWORD *)v22 = *v21;
operator delete(v21);
v22[3] = 1002;
v23 = (char *)operator new(0x20u);
*((_DWORD *)v23 + 4) = 1004;
*(_OWORD *)v23 = *(_OWORD *)v22;
operator delete(v22);
*(_QWORD *)(v23 + 20) = 0x3F5000003EBLL;
*((_DWORD *)v23 + 7) = 1014;
v24 = v23 + 32;
v25 = 4;
goto LABEL_15;
}
v30 = operator new(4u);
*v30 = 1000;
v31 = operator new(8u);
*v31 = 0x3E9000003E8LL;
operator delete(v30);
v32 = operator new(0x10u);
v32[2] = 1009;
*(_QWORD *)v32 = *v31;
operator delete(v31);
v32[3] = 1002;
v33 = (char *)operator new(0x20u);
*((_DWORD *)v33 + 4) = 1004;
*(_OWORD *)v33 = *(_OWORD *)v32;
operator delete(v32);
*(_QWORD *)(v33 + 20) = 0x3F5000003EBLL;
*((_DWORD *)v33 + 7) = 1014;
v34 = (char *)operator new(0x40u);
*((_DWORD *)v34 + 8) = 1005;
memcpy(v34, v33, 0x20u);
operator delete(v33);
v23 = v34;
if ( v34 + 36 < v34 + 64 )
{
*((_DWORD *)v34 + 9) = 1006;
v24 = v34 + 40;
v25 = 4;
if ( v34 + 40 != v34 )
goto LABEL_15;
}
else
{
v35 = (char *)operator new(0x80u);
*((_DWORD *)v35 + 9) = 1006;
v24 = v35 + 40;
memcpy(v35, v23, 0x24u);
operator delete(v23);
v23 = v35;
v25 = 4;
if ( v35 + 40 != v35 )
{
LABEL_15:
v55 = v23;
v42 = v25;
v43 = ((v24 - v23) >> 2 == 0) + ((v24 - v23) >> 2);
v36 = 0;
v49 = (float)((float)(v25 - 1) * 0.5) * -70.0;
do
{
v37 = *(_DWORD *)&v55[4 * v36];
v38 = "NA";
if ( v37 - 1000 <= 0xE )
v38 = (char *)dword_1008226A0 + dword_1008226A0[v37 - 1000];
v39 = ButtonSprite::create_1(v38, 40, 0, 0.40000001, 1, "bigFont.fnt", "GJ_button_04.png", 30.0);
v40 = CCMenuItemSpriteExtra::create(
v39,
nullptr,
v51,
(cocos2d::SEL_MenuHandler)(unsigned __int64)GJSpecialColorSelect::onSelectColor);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v40->setTag)(v40, v37);
((void (__fastcall *)(ButtonSprite *, _QWORD))v39->setTag)(v39, v37);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v51->m_buttonMenu->addChild)(
v51->m_buttonMenu,
v40);
sub_10071FCD0(v51->m_buttonSprites, v39);
v41 = 0;
v41.f32[0] = (float)(int)((unsigned int)v36 / v42);
sub_10028CBE0(
(float *)&v48,
(float)(int)(70 * ((unsigned int)v36 % v42)) + v49,
_mm_cvtepi32_ps(_mm_cvttps_epi32(v41)).f32[0] * -50.0);
sub_10028CCE0(&v47, v50, &v48);
((void (__fastcall *)(CCMenuItemSpriteExtra *, double *))v40->setPosition)(v40, &v47);
++v36;
}
while ( v43 != v36 );
v23 = v55;
}
}
operator delete(v23);
return v54;
}
return result;
}