//
// GJSpecialColorSelect::init from 0x100702a00 to 0x1007032ee (2286 bytes)
//
// 1 xrefs:
// > GJSpecialColorSelect::create @ 0x10070299e
//
// 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:35:59 +0000
//
__int64 __fastcall GJSpecialColorSelect::init(__int64 a1, int a2, __int64 a3, int a4)
{
__int64 result; // rax
__int64 v8; // rax
void *v9; // rbx
void *v10; // rbx
__int64 v11; // rdi
__int64 v12; // rdx
__int64 v13; // rcx
__int64 v14; // rax
__int64 v15; // rbx
__int64 v16; // rax
void *v17; // rax
__int64 v18; // rbx
char *v19; // r15
__int64 v20; // rbx
__int64 v21; // r12
__int64 v22; // r13
__int64 v23; // rbx
__int64 v24; // rax
_DWORD *v25; // rbx
_QWORD *v26; // r14
_DWORD *v27; // r15
char *v28; // r13
char *v29; // r15
int v30; // eax
_DWORD *v31; // rbx
_QWORD *v32; // r14
_DWORD *v33; // r15
void *v34; // rdi
_DWORD *v35; // rbx
_QWORD *v36; // r15
_DWORD *v37; // r14
char *v38; // r13
char *v39; // rbx
char *v40; // rbx
__int64 v41; // r15
unsigned int v42; // ebx
const std::string::value_type *v43; // rdi
char *v44; // r12
void *v45; // r14
__m128 v46; // xmm1
unsigned int v47; // [rsp+0h] [rbp-B0h]
__int64 v48; // [rsp+8h] [rbp-A8h]
__int128 v49; // [rsp+10h] [rbp-A0h] BYREF
void *v50; // [rsp+20h] [rbp-90h]
__int128 v51; // [rsp+28h] [rbp-88h] BYREF
void *__p; // [rsp+38h] [rbp-78h]
double v53; // [rsp+44h] [rbp-6Ch] BYREF
unsigned __int64 v54; // [rsp+4Ch] [rbp-64h] BYREF
float v55; // [rsp+54h] [rbp-5Ch]
unsigned __int64 v56[2]; // [rsp+58h] [rbp-58h] BYREF
__int64 v57; // [rsp+68h] [rbp-48h]
__int64 v58; // [rsp+74h] [rbp-3Ch] BYREF
unsigned __int8 v59; // [rsp+7Fh] [rbp-31h]
char *v60; // [rsp+80h] [rbp-30h]
result = FLAlertLayer::init_1((_BYTE *)a1, 200);
if ( (_BYTE)result )
{
v59 = result;
*(_QWORD *)(a1 + 664) = a3;
*(_DWORD *)(a1 + 672) = a2;
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v58, v8);
sub_100278270((__int64)v56, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v9 = cocos2d::extension::CCScale9Sprite::create_2((__int64)"GJ_square01.png", v56);
sub_100278260((float *)v56, 360.0, 250.0);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v9 + 320LL))(v9, v56);
(*(void (__fastcall **)(_QWORD, void *, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v9,
0xFFFFFFFFLL);
sub_100278250((float *)v56, *(float *)&v58 * 0.5, *((float *)&v58 + 1) * 0.5);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v9 + 184LL))(v9, v56);
v10 = cocos2d::CCLabelBMFont::create_3((__int64)"Special Color Select", (__int64)"goldFont.fnt");
sub_100278250((float *)v56, *(float *)&v58 * 0.5, (float)((float)(*((float *)&v58 + 1) * 0.5) + 125.0) + -25.0);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v10 + 184LL))(v10, v56);
v11 = *(_QWORD *)(a1 + 584);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v11 + 456LL))(v11, v10);
v14 = cocos2d::CCMenu::create(v11, v10, v12, v13);
*(_QWORD *)(a1 + 552) = v14;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v14, 10);
v15 = *(_QWORD *)(a1 + 584);
sub_100278250((float *)v56, 0.0, -15.0);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v15 + 184LL))(v15, v56);
v16 = sub_100059E00((__int64)"OK");
v17 = CCMenuItemSpriteExtra::create(v16, 0, a1, (__int64)GJSpecialColorSelect::onClose, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v17);
v18 = *(_QWORD *)(a1 + 552);
sub_100278250((float *)v56, *(float *)&v58 * 0.5, (float)((float)(*((float *)&v58 + 1) * 0.5) + -125.0) + 25.0);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v18 + 184LL))(v18, v56);
LOBYTE(v49) = 8;
strcpy((char *)&v49 + 1, "Help");
__p = operator new(0x38u);
*(_QWORD *)&v51 = 57;
*((_QWORD *)&v51 + 1) = 54;
strcpy((char *)__p, "Select a special color channel as the target color ID.");
v19 = InfoAlertButton::create(&v49, &v51, 1.0);
if ( (v51 & 1) != 0 )
operator delete(__p);
LODWORD(v60) = a4;
if ( (v49 & 1) != 0 )
operator delete(v50);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v19);
v20 = *(_QWORD *)(a1 + 552);
v21 = *(_QWORD *)(a1 + 584);
v57 = a1;
sub_100278250(
(float *)&v54,
(float)((float)(*(float *)&v58 * 0.5) + 180.0) + -18.0,
(float)((float)(*((float *)&v58 + 1) * 0.5) + 125.0) + -18.0);
v22 = v57;
cocos2d::CCNode::convertToWorldSpace(&v53, v21, (unsigned int *)&v54);
cocos2d::CCNode::convertToNodeSpace((double *)v56, v20, (unsigned int *)&v53);
(*(void (__fastcall **)(char *, unsigned __int64 *))(*(_QWORD *)v19 + 184LL))(v19, v56);
v23 = *(_QWORD *)(v22 + 552);
sub_100278250((float *)&v53, *(float *)&v58 * 0.5, (float)(0.5 * *((float *)&v58 + 1)) + 35.0);
cocos2d::CCNode::convertToNodeSpace((double *)v56, v23, (unsigned int *)&v53);
v24 = sub_1007FE900(v56);
*(_QWORD *)(v22 + 680) = v24;
cocos2d::CCObject::retain(v24);
if ( (_DWORD)v60 == 2 )
{
v31 = operator new(4u);
*v31 = 1004;
v32 = operator new(8u);
*v32 = 0x3F4000003ECLL;
operator delete(v31);
v33 = operator new(0x10u);
v33[2] = 1003;
*(_QWORD *)v33 = *v32;
operator delete(v32);
v33[3] = 1005;
v28 = (char *)operator new(0x20u);
*((_DWORD *)v28 + 4) = 1006;
*(_OWORD *)v28 = *(_OWORD *)v33;
v34 = v33;
v29 = v28 + 20;
operator delete(v34);
v30 = 3;
goto LABEL_15;
}
if ( (_DWORD)v60 == 1 )
{
v25 = operator new(4u);
*v25 = 1000;
v26 = operator new(8u);
*v26 = 0x3E9000003E8LL;
operator delete(v25);
v27 = operator new(0x10u);
v27[2] = 1009;
*(_QWORD *)v27 = *v26;
operator delete(v26);
v27[3] = 1002;
v28 = (char *)operator new(0x20u);
*((_DWORD *)v28 + 4) = 1004;
*(_OWORD *)v28 = *(_OWORD *)v27;
operator delete(v27);
*(_QWORD *)(v28 + 20) = 0x3F5000003EBLL;
*((_DWORD *)v28 + 7) = 1014;
v29 = v28 + 32;
v30 = 4;
goto LABEL_15;
}
v35 = operator new(4u);
*v35 = 1000;
v36 = operator new(8u);
*v36 = 0x3E9000003E8LL;
operator delete(v35);
v37 = operator new(0x10u);
v37[2] = 1009;
*(_QWORD *)v37 = *v36;
operator delete(v36);
v37[3] = 1002;
v38 = (char *)operator new(0x20u);
*((_DWORD *)v38 + 4) = 1004;
*(_OWORD *)v38 = *(_OWORD *)v37;
operator delete(v37);
*(_QWORD *)(v38 + 20) = 0x3F5000003EBLL;
*((_DWORD *)v38 + 7) = 1014;
v39 = (char *)operator new(0x40u);
*((_DWORD *)v39 + 8) = 1005;
memcpy(v39, v38, 0x20u);
operator delete(v38);
v28 = v39;
if ( v39 + 36 < v39 + 64 )
{
*((_DWORD *)v39 + 9) = 1006;
v29 = v39 + 40;
v30 = 4;
if ( v39 + 40 != v39 )
goto LABEL_15;
}
else
{
v40 = (char *)operator new(0x80u);
*((_DWORD *)v40 + 9) = 1006;
v29 = v40 + 40;
memcpy(v40, v28, 0x24u);
operator delete(v28);
v28 = v40;
v30 = 4;
if ( v40 + 40 != v40 )
{
LABEL_15:
v60 = v28;
v47 = v30;
v48 = ((v29 - v28) >> 2 == 0) + ((v29 - v28) >> 2);
v41 = 0;
v55 = (float)((float)(v30 - 1) * 0.5) * -70.0;
do
{
v42 = *(_DWORD *)&v60[4 * v41];
v43 = "NA";
if ( v42 - 1000 <= 0xE )
v43 = (char *)dword_100A11CB4 + dword_100A11CB4[v42 - 1000];
v44 = ButtonSprite::create_1(
(__int64)v43,
0x28u,
0,
1u,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_04.png",
0.40000001,
30.0);
v45 = CCMenuItemSpriteExtra::create((__int64)v44, 0, v57, (__int64)GJSpecialColorSelect::onSelectColor, 0);
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v45 + 72LL))(v45, v42);
(*(void (__fastcall **)(char *, _QWORD))(*(_QWORD *)v44 + 72LL))(v44, v42);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v57 + 552) + 456LL))(*(_QWORD *)(v57 + 552), v45);
sub_1007FEBF0(*(_QWORD *)(v57 + 680), v44);
v46 = 0;
v46.f32[0] = (float)(int)((unsigned int)v41 / v47);
sub_100278250(
(float *)&v54,
(float)(int)(70 * ((unsigned int)v41 % v47)) + v55,
_mm_cvtepi32_ps(_mm_cvttps_epi32(v46)).f32[0] * -50.0);
sub_100278350(&v53, v56, &v54);
(*(void (__fastcall **)(void *, double *))(*(_QWORD *)v45 + 184LL))(v45, &v53);
++v41;
}
while ( v48 != v41 );
v28 = v60;
}
}
operator delete(v28);
return v59;
}
return result;
}