//
// GJColorSetupLayer::init from 0x14035eb60 to 0x14035f3de (2174 bytes)
//
// 2 xrefs:
// > GJColorSetupLayer::create @ 0x14035eb0f
// > ??> @ 0x14092126c
//
// 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 11:30:52 +0000
//
// Hidden C++ exception states: #wind=5
bool __fastcall GJColorSetupLayer::init(__int64 a1, cocos2d::CCObject *a2)
{
bool result; // al
__int64 v5; // rcx
__int64 v6; // rax
__int64 v7; // rax
__int64 *v8; // rdi
__int64 v9; // rdx
void (__fastcall *v10)(__int64 *, __int64); // r8
__int64 v11; // rbx
__int64 v12; // rax
__int64 v13; // rbx
__int64 v14; // rax
__int64 v15; // rcx
cocos2d::CCObject *v16; // rax
__int64 v17; // rcx
cocos2d::CCObject *v18; // rax
__int64 v19; // rcx
cocos2d::CCObject *v20; // rax
__int64 v21; // rcx
cocos2d::CCObject *v22; // rax
__int64 v23; // rcx
__int64 v24; // rax
struct cocos2d::CCLabelBMFont *v25; // rdi
__int64 v26; // rbx
__int64 v27; // rax
int v28; // r15d
struct cocos2d::CCObject *v29; // r14
float v30; // xmm0_4
__int64 v31; // rax
__int64 v32; // rdx
__int64 v33; // rcx
struct cocos2d::CCObject *v34; // rbx
__int64 *v35; // rax
cocos2d::CCObject *v36; // rdi
__int64 v37; // rax
__int64 v38; // rbx
__int64 v39; // rax
__int64 v40; // rbx
__int64 v41; // rax
__int64 v42; // rbx
__int64 v43; // rax
__int64 *v44; // rdi
__int64 *v45; // rax
cocos2d::CCObject *v46; // rbx
__int64 v47; // rax
cocos2d::CCSprite *v48; // rdi
__int64 *v49; // rax
cocos2d::CCObject *v50; // rbx
__int64 v51; // rax
cocos2d::CCObject *v52; // rbx
cocos2d::CCObject *v53; // r14
__int64 v54; // rdi
__int64 v55; // rbx
__int64 v56; // rax
__int64 v57; // rax
__int64 v58; // rdx
__int64 v59; // rdx
_BYTE v60[8]; // [rsp+58h] [rbp-69h] BYREF
_BYTE v61[8]; // [rsp+60h] [rbp-61h] BYREF
_BYTE v62[8]; // [rsp+68h] [rbp-59h] BYREF
_BYTE v63[8]; // [rsp+70h] [rbp-51h] BYREF
void *v64; // [rsp+78h] [rbp-49h]
_BYTE v65[8]; // [rsp+80h] [rbp-41h] BYREF
__int64 v66[12]; // [rsp+88h] [rbp-39h] BYREF
float v67; // [rsp+138h] [rbp+77h] BYREF
float v68; // [rsp+13Ch] [rbp+7Bh]
char v69; // [rsp+140h] [rbp+7Fh] BYREF
result = FLAlertLayer::init_1(a1, 150);
if ( result )
{
*(_BYTE *)(a1 + 596) = 1;
*(_QWORD *)(a1 + 680) = a2;
cocos2d::CCObject::retain(a2);
v6 = cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6, &v67);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v66, 0.0, 0.0, 80.0, 80.0);
v8 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v7);
v9 = v8[40];
v10 = *(void (__fastcall **)(__int64 *, __int64))(v9 + 40);
LOBYTE(v9) = -1;
v10(v8 + 40, v9);
v11 = *v8;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v62, 450.0, 300.0);
(*(void (__fastcall **)(__int64 *, __int64))(v11 + 312))(v8, v12);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v8,
4294967294LL);
v13 = *v8;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v67 * 0.5, v68 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v13 + 184))(v8, v14);
v16 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v15);
*(_QWORD *)(a1 + 688) = v16;
cocos2d::CCObject::retain(v16);
v18 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v17);
*(_QWORD *)(a1 + 696) = v18;
cocos2d::CCObject::retain(v18);
v20 = (cocos2d::CCObject *)cocos2d::CCArray::create(v19);
*(_QWORD *)(a1 + 704) = v20;
cocos2d::CCObject::retain(v20);
v22 = (cocos2d::CCObject *)cocos2d::CCArray::create(v21);
*(_QWORD *)(a1 + 712) = v22;
cocos2d::CCObject::retain(v22);
*(_DWORD *)(a1 + 724) = 24;
*(_DWORD *)(a1 + 728) = 42;
v24 = cocos2d::CCMenu::create(v23);
*(_QWORD *)(a1 + 552) = v24;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v24, 10);
v25 = cocos2d::CCLabelBMFont::create("Select Custom Color:", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v25 + 160LL))(v25);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v25);
v26 = *(_QWORD *)v25;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v67 * 0.5, (float)(v68 * 0.5) + 130.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v26 + 184))(v25, v27);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v60, (float)(v67 * 0.5) - 132.5, (float)(v68 * 0.5) + 100.0);
v28 = 1;
if ( *(int *)(a1 + 724) >= 1 )
{
while ( 1 )
{
v29 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_140704F78);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v29 + 160LL))(v29);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v29);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 704), v29);
v30 = floorf((float)((v28 - 1) / 6));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, (float)((v28 - 1) % 6) * 53.0, (float)-(int)v30 * 53.0);
cocos2d::CCPoint::operator+(v60, v61, v31);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _BYTE *))(*(_QWORD *)v29 + 184LL))(v29, v61);
v34 = (struct cocos2d::CCObject *)ColorChannelSprite::create(v33, v32);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v34 + 160LL))(v34);
(**((void (__fastcall ***)(__int64, void *))v34 + 40))((__int64)v34 + 320, &unk_140703450);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 712), v34);
v64 = operator new(0x208u);
v35 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v64);
v36 = (cocos2d::CCObject *)v35;
if ( !v35 )
goto LABEL_7;
if ( !CCMenuItemSpriteExtra::init(v35, (__int64 *)v34, 0, a1, (__int64)GJColorSetupLayer::onColor) )
break;
cocos2d::CCObject::autorelease(v36);
LABEL_8:
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v36);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, 0.0, -22.0);
v38 = v37;
v39 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v29 + 200LL))(v29);
cocos2d::CCPoint::operator+(v39, v62, v38);
v40 = *(_QWORD *)v36;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v66, v62);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v40 + 184))(v36, v41);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v36 + 64LL))(v36, (unsigned int)v28++);
if ( v28 > *(_DWORD *)(a1 + 724) )
goto LABEL_9;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v36 + 8LL))(v36, 1);
LABEL_7:
v36 = nullptr;
goto LABEL_8;
}
LABEL_9:
GJColorSetupLayer::updateSpriteColors(a1);
v42 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, v67 * 0.5, v68 * 0.5);
cocos2d::CCNode::convertToNodeSpace(v42, &v69, v43);
v44 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
(*(void (__fastcall **)(__int64 *))(*v44 + 160))(v44);
v66[0] = (__int64)operator new(0x208u);
v45 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v66[0]);
v46 = (cocos2d::CCObject *)v45;
if ( v45 )
{
if ( CCMenuItemSpriteExtra::init(v45, v44, 0, a1, (__int64)GJColorSetupLayer::onPage) )
{
cocos2d::CCObject::autorelease(v46);
goto LABEL_14;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v46 + 8LL))(v46, 1);
}
v46 = nullptr;
LABEL_14:
*(_QWORD *)(a1 + 736) = v46;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v46);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, -190.0, 0.0);
cocos2d::CCPoint::operator+(&v69, v62, v47);
(*(void (__fastcall **)(_QWORD, _BYTE *))(**(_QWORD **)(a1 + 736) + 184LL))(*(_QWORD *)(a1 + 736), v62);
*(_DWORD *)(*(_QWORD *)(a1 + 736) + 372LL) = 0x40000000;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 736) + 64LL))(*(_QWORD *)(a1 + 736), 1);
v48 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
(*(void (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v48 + 160LL))(v48);
cocos2d::CCSprite::setFlipX(v48, 1);
v66[0] = (__int64)operator new(0x208u);
v49 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v66[0]);
v50 = (cocos2d::CCObject *)v49;
if ( v49 )
{
if ( CCMenuItemSpriteExtra::init(v49, (__int64 *)v48, 0, a1, (__int64)GJColorSetupLayer::onPage) )
{
cocos2d::CCObject::autorelease(v50);
goto LABEL_19;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v50 + 8LL))(v50, 1);
}
v50 = nullptr;
LABEL_19:
*(_QWORD *)(a1 + 744) = v50;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v50);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, 190.0, 0.0);
cocos2d::CCPoint::operator+(&v69, v62, v51);
(*(void (__fastcall **)(_QWORD, _BYTE *))(**(_QWORD **)(a1 + 744) + 184LL))(*(_QWORD *)(a1 + 744), v62);
*(_DWORD *)(*(_QWORD *)(a1 + 744) + 372LL) = 0x40000000;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 744) + 64LL))(*(_QWORD *)(a1 + 744), 0);
v66[0] = (__int64)operator new(0x2C8u);
v52 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite(v66[0]);
if ( v52 )
{
if ( ButtonSprite::init_1(
(__int64)v52,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v52);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v52 + 8LL))(v52, 1);
v52 = nullptr;
}
}
v66[0] = (__int64)operator new(0x208u);
v53 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v66[0]);
if ( v53 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v53, (__int64 *)v52, 0, a1, (__int64)GJColorSetupLayer::onClose) )
{
cocos2d::CCObject::autorelease(v53);
LABEL_28:
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v53);
v54 = *(_QWORD *)v53;
v55 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, v67 * 0.5, (float)(v68 * 0.5) - 126.0);
cocos2d::CCNode::convertToNodeSpace(v55, v65, v56);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v54 + 184))(v53, v57);
LODWORD(v55) = *(_DWORD *)(*(_QWORD *)(a1 + 680) + 428LL);
*(_DWORD *)(a1 + 720) = v55;
LOBYTE(v58) = (_DWORD)v55 != 0;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 736) + 336LL))(*(_QWORD *)(a1 + 736), v58);
LOBYTE(v59) = (_DWORD)v55 != *(_DWORD *)(a1 + 728) - 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 744) + 336LL))(*(_QWORD *)(a1 + 744), v59);
*(_DWORD *)(*(_QWORD *)(a1 + 680) + 428LL) = v55;
GJColorSetupLayer::updateSpriteColors(a1);
return 1;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v53 + 8LL))(v53, 1);
}
v53 = nullptr;
goto LABEL_28;
}
return result;
}