//
// GJColorSetupLayer::init from 0x9f7610 to 0x9f7ce0 (1744 bytes)
//
// 2 xrefs:
// > GJColorSetupLayer::create @ 0x9f7e74
// > ??> @ 0xcfb68
//
// This function is hookable on this platform (idp: arm, 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:59:15 +0000
//
__int64 __fastcall GJColorSetupLayer::init(GJColorSetupLayer *this, LevelSettingsObject *a2)
{
cocos2d::CCDirector *v5; // x0
cocos2d::CCDirector *v6; // x0
__int64 v7; // x21
void (__fastcall *v8)(__int64, _BYTE *); // x22
__int64 (__fastcall *v9)(__int64, _BYTE *); // x22
cocos2d::CCDictionary *v10; // x0
cocos2d::CCObject *v11; // x0
cocos2d::CCDictionary *v12; // x0
cocos2d::CCObject *v13; // x0
cocos2d::CCArray *v14; // x0
cocos2d::CCObject *v15; // x0
cocos2d::CCArray *v16; // x0
cocos2d::CCObject *v17; // x0
__int64 v18; // x0
const char *v19; // x2
__int64 v20; // x21
void (__fastcall *v21)(__int64, _BYTE *); // x22
float v22; // s0
const char *v23; // x2
int v24; // w21
cocos2d::CCObject *v25; // x26
ColorChannelSprite *v26; // x0
cocos2d::CCObject *v27; // x25
__int64 v28; // x25
cocos2d::CCNode *v29; // x28
void (__fastcall *v30)(__int64, __int64 *); // x27
__int64 v31; // x26
__int64 v32; // x1
cocos2d::CCNode *v33; // x24
const char *v34; // x1
__int64 v35; // x25
__int64 v36; // x0
__int64 v37; // x25
void (__fastcall *v38)(__int64, __int64 *); // x26
const char *v39; // x1
cocos2d::CCSprite *v40; // x24
__int64 v41; // x0
__int64 v42; // x21
void (__fastcall *v43)(__int64, __int64 *); // x24
const char *v44; // x6
__int64 v45; // x0
__int64 v46; // x21
cocos2d::CCNode *v47; // x24
void (__fastcall *v48)(__int64, __int64 *); // x23
int v49; // w1
unsigned __int8 v50; // [xsp+8Fh] [xbp+8Fh]
__int64 v51; // [xsp+B0h] [xbp+B0h] BYREF
_BYTE v52[8]; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v53; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v54; // [xsp+C8h] [xbp+C8h] BYREF
__int64 v55; // [xsp+D0h] [xbp+D0h] BYREF
_BYTE v56[16]; // [xsp+D8h] [xbp+D8h] BYREF
v50 = FLAlertLayer::init(this, 150);
if ( v50 )
{
*((_QWORD *)this + 85) = a2;
*((_BYTE *)this + 596) = 1;
v5 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(a2);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(&v51, v6);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v56, 0.0, 0.0, 80.0, 80.0);
v7 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v56);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v7 + 912LL))(v7, 0xFFFFFFFFLL);
v8 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v7 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v56, 450.0, 300.0);
v8(v7, v56);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v7,
4294967294LL);
v9 = *(__int64 (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v7 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, *(float *)&v51 * 0.5, *((float *)&v51 + 1) * 0.5);
v10 = (cocos2d::CCDictionary *)v9(v7, v56);
v11 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v10);
*((_QWORD *)this + 86) = v11;
v12 = (cocos2d::CCDictionary *)cocos2d::CCObject::retain(v11);
v13 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(v12);
*((_QWORD *)this + 87) = v13;
v14 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v13);
v15 = (cocos2d::CCObject *)cocos2d::CCArray::create(v14);
*((_QWORD *)this + 88) = v15;
v16 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v15);
v17 = (cocos2d::CCObject *)cocos2d::CCArray::create(v16);
*((_QWORD *)this + 89) = v17;
cocos2d::CCObject::retain(v17);
*((_DWORD *)this + 181) = 24;
*((_DWORD *)this + 182) = (unsigned int)&qword_28 + 2;
v18 = cocos2d::CCMenu::create((cocos2d::CCMenu *)((char *)&qword_28 + 2));
*((_QWORD *)this + 69) = v18;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v18,
10);
v20 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Select Custom Color:", "goldFont.fnt", v19);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v20 + 160LL))(v20, 0.8);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 73) + 456LL))(*((_QWORD *)this + 73), v20);
v21 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v56,
*(float *)&v51 * 0.5,
(float)(*((float *)&v51 + 1) * 0.5) + 130.0);
v21(v20, v56);
v22 = (float)(*(float *)&v51 * 0.5) - 132.5;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, v22, (float)(*((float *)&v51 + 1) * 0.5) + 100.0);
if ( *((int *)this + 181) > 0 )
{
v24 = 1;
do
{
v25 = (cocos2d::CCObject *)cocos2d::CCLabelBMFont::create(
(cocos2d::CCLabelBMFont *)&byte_11E1A70,
"bigFont.fnt",
v23);
(*(void (__fastcall **)(cocos2d::CCObject *, float))(*(_QWORD *)v25 + 160LL))(v25, 0.3);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 73) + 456LL))(
*((_QWORD *)this + 73),
v25);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 88), v25);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v56,
(float)((v24 - 1) % 6) * 53.0,
(float)-vcvtms_s32_f32((float)((v24 - 1) / 6)) * 53.0);
cocos2d::CCPoint::operator+(&v53, v52);
v26 = (ColorChannelSprite *)(*(__int64 (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v25 + 184LL))(
v25,
&v53);
v27 = (cocos2d::CCObject *)ColorChannelSprite::create(v26);
(*(void (__fastcall **)(cocos2d::CCObject *, float))(*(_QWORD *)v27 + 160LL))(v27, 0.8);
(*(void (__fastcall **)(cocos2d::CCObject *, void *))(*(_QWORD *)v27 + 960LL))(v27, &unk_116D6F0);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 89), v27);
v28 = CCMenuItemSpriteExtra::create((__int64)v27, 0, (__int64)this, (__int64)GJColorSetupLayer::onColor, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v28);
v29 = *((cocos2d::CCNode **)this + 69);
v30 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v28 + 184LL);
v31 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v25 + 192LL))(v25);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, 0.0, -22.0);
cocos2d::CCPoint::operator+(&v55, v31);
cocos2d::CCNode::convertToNodeSpace(&v54, v29, (const cocos2d::CCPoint *)&v55);
v30(v28, &v54);
v32 = (unsigned int)v24++;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v28 + 72LL))(v28, v32);
}
while ( v24 <= *((_DWORD *)this + 181) );
}
GJColorSetupLayer::updateSpriteColors(this);
v33 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, *(float *)&v51 * 0.5, *((float *)&v51 + 1) * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v54, v33, (const cocos2d::CCPoint *)v56);
v35 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_01_001.png", v34);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v35 + 160LL))(v35, 1.0);
v36 = CCMenuItemSpriteExtra::create(v35, 0, (__int64)this, (__int64)GJColorSetupLayer::onPage, 0);
*((_QWORD *)this + 92) = v36;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v36);
v37 = *((_QWORD *)this + 92);
v38 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v37 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, -190.0, 0.0);
cocos2d::CCPoint::operator+(&v55, &v54);
v38(v37, &v55);
CCMenuItemSpriteExtra::setSizeMult(*((_QWORD *)this + 92), 2.0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 92) + 72LL))(*((_QWORD *)this + 92), 1);
v40 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_arrow_01_001.png",
v39);
(*(void (__fastcall **)(cocos2d::CCSprite *, float))(*(_QWORD *)v40 + 160LL))(v40, 1.0);
cocos2d::CCSprite::setFlipX(v40, 1);
v41 = CCMenuItemSpriteExtra::create((__int64)v40, 0, (__int64)this, (__int64)GJColorSetupLayer::onPage, 0);
*((_QWORD *)this + 93) = v41;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v41);
v42 = *((_QWORD *)this + 93);
v43 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v42 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, 190.0, 0.0);
cocos2d::CCPoint::operator+(&v55, &v54);
v43(v42, &v55);
CCMenuItemSpriteExtra::setSizeMult(*((_QWORD *)this + 93), 2.0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 93) + 72LL))(*((_QWORD *)this + 93), 0);
v45 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v44,
30.0);
v46 = CCMenuItemSpriteExtra::create(v45, 0, (__int64)this, (__int64)GJColorSetupLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v46);
v47 = *((cocos2d::CCNode **)this + 69);
v48 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v46 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v56,
*(float *)&v51 * 0.5,
(float)(*((float *)&v51 + 1) * 0.5) + -126.0);
cocos2d::CCNode::convertToNodeSpace(&v55, v47, (const cocos2d::CCPoint *)v56);
v48(v46, &v55);
v49 = *(_DWORD *)(*((_QWORD *)this + 85) + 420LL);
*((_DWORD *)this + 180) = v49;
GJColorSetupLayer::showPage(this, v49);
}
return v50;
}