//
// GJColorSetupLayer::init from 0x1001ee8b0 to 0x1001eefb2 (1794 bytes)
//
// 1 xrefs:
// > GJColorSetupLayer::create @ 0x1001ee875
//
// 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:26:32 +0000
//
__int64 __fastcall GJColorSetupLayer::init(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v4; // rax
__int64 v5; // r14
__int64 v6; // rax
__int64 v7; // rdi
__int64 v8; // rax
__int64 v9; // rdi
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // r14
unsigned __int64 v15; // rsi
__int64 v16; // rdx
__int64 v17; // rcx
unsigned int v18; // r13d
__int64 v19; // r14
unsigned __int64 v20; // r14
int v21; // r12d
__int64 v22; // r15
__int64 v23; // r14
__int64 v24; // r14
__int64 v25; // r15
__int64 v26; // r12
__int64 v27; // r15
__int64 v28; // r13
__int64 v29; // rax
__int64 v30; // r13
__int64 v31; // r14
__int64 v32; // rax
__int64 v33; // r14
char *v34; // rax
__int64 v35; // r14
__int64 v36; // r15
__int64 v37; // rdi
int v38; // ebx
_BOOL8 v39; // rsi
__int64 v40; // rdx
__int64 v41; // rcx
_BYTE v42[8]; // [rsp+8h] [rbp-78h] BYREF
__int64 v43; // [rsp+10h] [rbp-70h]
__int64 v44; // [rsp+18h] [rbp-68h]
_BYTE v45[16]; // [rsp+24h] [rbp-5Ch] BYREF
_BYTE v46[8]; // [rsp+34h] [rbp-4Ch] BYREF
_BYTE v47[8]; // [rsp+3Ch] [rbp-44h] BYREF
_BYTE v48[8]; // [rsp+44h] [rbp-3Ch] BYREF
float v49; // [rsp+4Ch] [rbp-34h] BYREF
float v50; // [rsp+50h] [rbp-30h]
unsigned __int8 v51; // [rsp+57h] [rbp-29h]
result = FLAlertLayer::init_1(a1, 150);
if ( (_BYTE)result )
{
v51 = result;
*(_BYTE *)(a1 + 596) = 1;
*(_QWORD *)(a1 + 680) = a2;
cocos2d::CCObject::retain(a2);
v4 = cocos2d::CCDirector::sharedDirector(a2, 150);
cocos2d::CCDirector::getWinSize(&v49, v4);
sub_100278270(v45, 0.0, 0.0, COERCE_DOUBLE(1117782016), COERCE_DOUBLE(1117782016));
v5 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v45);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v5 + 912LL))(v5, 255);
sub_100278260(v45, COERCE_DOUBLE(1138819072), COERCE_DOUBLE(1133903872));
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v5 + 320LL))(v5, v45);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v5,
4294967294LL);
sub_100278250(v45, v49 * 0.5, v50 * 0.5);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v5 + 184LL))(v5, v45);
v6 = cocos2d::CCDictionary::create(v5, v45);
*(_QWORD *)(a1 + 688) = v6;
v7 = v6;
cocos2d::CCObject::retain(v6);
v8 = cocos2d::CCDictionary::create(v7, v45);
*(_QWORD *)(a1 + 696) = v8;
v9 = v8;
cocos2d::CCObject::retain(v8);
v10 = sub_1007FE900(v9);
*(_QWORD *)(a1 + 704) = v10;
v11 = v10;
cocos2d::CCObject::retain(v10);
v12 = sub_1007FE900(v11);
*(_QWORD *)(a1 + 712) = v12;
cocos2d::CCObject::retain(v12);
*(_QWORD *)(a1 + 724) = 0x2A00000018LL;
v13 = cocos2d::CCMenu::create();
*(_QWORD *)(a1 + 552) = v13;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v13, 10);
v14 = cocos2d::CCLabelBMFont::create_3("Select Custom Color:", "goldFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v14 + 160LL))(v14, 0.80000001);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v14);
sub_100278250(v45, v49 * 0.5, (float)(v50 * 0.5) + 130.0);
v15 = (unsigned __int64)v45;
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v14 + 184LL))(v14, v45);
sub_100278250(v45, (float)(v49 * 0.5) + -132.5, (float)(v50 * 0.5) + 100.0);
if ( *(int *)(a1 + 724) > 0 )
{
v17 = 0;
v18 = 0;
do
{
v43 = v17;
v19 = v18++;
v20 = (unsigned __int64)(2863311531LL * v19) >> 34;
v21 = v17 - 318 * v20;
v22 = cocos2d::CCLabelBMFont::create_3(" ", "bigFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v22 + 160LL))(v22, 0.30000001);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v22);
sub_1007FEBF0(*(_QWORD *)(a1 + 704), v22);
sub_100278250(v48, (float)v21, (float)-(int)(float)(int)v20 * 53.0);
sub_100278350(v46, v45, v48);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v22 + 184LL))(v22, v46);
v23 = ColorChannelSprite::create();
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v23 + 160LL))(v23, 0.80000001);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v23 + 960LL))(v23, &unk_100A05CC0);
sub_1007FEBF0(*(_QWORD *)(a1 + 712), v23);
v24 = CCMenuItemSpriteExtra::create(v23, 0, a1, GJColorSetupLayer::onColor, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v24);
v44 = *(_QWORD *)(a1 + 552);
v25 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v22 + 192LL))(v22);
sub_100278250(v42, 0.0, -22.0);
sub_100278350(v47, v25, v42);
cocos2d::CCNode::convertToNodeSpace(v48, v44, v47);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v24 + 184LL))(v24, v48);
v15 = v18;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v24 + 72LL))(v24, v18);
v17 = (unsigned int)(v43 + 53);
}
while ( (signed int)v18 < *(_DWORD *)(a1 + 724) );
}
v26 = a1;
GJColorSetupLayer::updateSpriteColors(a1, v15, v16, v17);
v27 = *(_QWORD *)(a1 + 552);
sub_100278250(v48, v49 * 0.5, v50 * 0.5);
cocos2d::CCNode::convertToNodeSpace(v46, v27, v48);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v28 + 160LL))(v28, 1.0);
v29 = CCMenuItemSpriteExtra::create(v28, 0, a1, GJColorSetupLayer::onPage, 0);
*(_QWORD *)(a1 + 736) = v29;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v26 + 552) + 456LL))(*(_QWORD *)(v26 + 552), v29);
v30 = *(_QWORD *)(a1 + 736);
sub_100278250(v47, -190.0, 0.0);
sub_100278350(v48, v46, v47);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v30 + 184LL))(v30, v48);
CCMenuItemSpriteExtra::setSizeMult(*(_QWORD *)(a1 + 736), 2.0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v26 + 736) + 72LL))(*(_QWORD *)(v26 + 736), 1);
v31 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v31 + 160LL))(v31, 1.0);
cocos2d::CCSprite::setFlipX(v31, 1);
v32 = CCMenuItemSpriteExtra::create(v31, 0, a1, GJColorSetupLayer::onPage, 0);
*(_QWORD *)(a1 + 744) = v32;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v26 + 552) + 456LL))(*(_QWORD *)(v26 + 552), v32);
v33 = *(_QWORD *)(a1 + 744);
sub_100278250(v47, 190.0, 0.0);
sub_100278350(v48, v46, v47);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v33 + 184LL))(v33, v48);
CCMenuItemSpriteExtra::setSizeMult(*(_QWORD *)(a1 + 744), 2.0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v26 + 744) + 72LL))(*(_QWORD *)(v26 + 744), 0);
v34 = ButtonSprite::create_1(
(__int64)"OK",
0x28u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0.80000001,
30.0);
v35 = CCMenuItemSpriteExtra::create(v34, 0, a1, GJColorSetupLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v26 + 552) + 456LL))(*(_QWORD *)(v26 + 552), v35);
v36 = *(_QWORD *)(a1 + 552);
sub_100278250(v47, v49 * 0.5, (float)(0.5 * v50) + -126.0);
cocos2d::CCNode::convertToNodeSpace(v48, v36, v47);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v35 + 184LL))(v35, v48);
v37 = *(_QWORD *)(a1 + 736);
v38 = *(_DWORD *)(*(_QWORD *)(a1 + 680) + 420LL);
*(_DWORD *)(v26 + 720) = v38;
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v37 + 344LL))(v37, v38 != 0);
v39 = *(_DWORD *)(v26 + 728) - 1 != v38;
(*(void (__fastcall **)(_QWORD, _BOOL8))(**(_QWORD **)(v26 + 744) + 344LL))(*(_QWORD *)(v26 + 744), v39);
*(_DWORD *)(*(_QWORD *)(v26 + 680) + 420LL) = v38;
GJColorSetupLayer::updateSpriteColors(v26, v39, v40, v41);
return v51;
}
return result;
}