//
// GJSpecialColorSelect::init from 0x5e8980 to 0x5e908a (1802 bytes)
//
// 1 xrefs:
// > GJSpecialColorSelect::create @ 0x5e91da
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:54:21 +0000
//
GameManager *__fastcall GJSpecialColorSelect::init(int a1, int a2, int a3, int a4)
{
GameManager *v8; // r0
int v9; // r5
void (__fastcall *v10)(int, void **); // r7
void (__fastcall *v11)(int, void **); // r7
const char *v12; // r2
int v13; // r5
void (__fastcall *v14)(int, void **); // r7
cocos2d::CCMenu *v15; // r0
int v16; // r0
int v17; // r5
void (__fastcall *v18)(int, void **); // r7
const char *v19; // r1
ButtonSprite *v20; // r0
int v21; // r0
int v22; // r7
void (__fastcall *v23)(int, void **); // r8
int v24; // r8
const cocos2d::CCPoint *v25; // r11
void (__fastcall *v26)(int, void **); // r10
const cocos2d::CCPoint *v27; // r8
cocos2d::CCArray *v28; // r0
cocos2d::CCObject *v29; // r0
int v30; // r2
int v31; // r1
int v32; // r5
signed int i; // r4
int v34; // r9
char *v35; // r0
cocos2d::CCObject *v36; // r10
int v37; // r8
float v38; // r0
void (__fastcall *v39)(int, _BYTE *); // r10
float v41; // [sp+10h] [bp-7Ch]
GameManager *v42; // [sp+14h] [bp-78h]
cocos2d::CCPoint *v43; // [sp+1Ch] [bp-70h]
float v44; // [sp+2Ch] [bp-60h] BYREF
float v45; // [sp+30h] [bp-5Ch]
_BYTE v46[8]; // [sp+34h] [bp-58h] BYREF
_BYTE v47[8]; // [sp+3Ch] [bp-50h] BYREF
_BYTE v48[8]; // [sp+44h] [bp-48h] BYREF
int (__fastcall *v49)(GJSpecialColorSelect *, cocos2d::CCObject *); // [sp+4Ch] [bp-40h]
int v50; // [sp+50h] [bp-3Ch]
_DWORD v51[2]; // [sp+54h] [bp-38h] BYREF
int v52[3]; // [sp+5Ch] [bp-30h] BYREF
int v53[3]; // [sp+68h] [bp-24h] BYREF
void *v54; // [sp+74h] [bp-18h] BYREF
int *v55; // [sp+78h] [bp-14h]
unsigned int v56; // [sp+7Ch] [bp-10h]
v8 = FLAlertLayer::init((FLAlertLayer *)a1, 200);
v42 = v8;
if ( !v8 )
return v42;
*(_DWORD *)(a1 + 520) = a3;
*(_DWORD *)(a1 + 524) = a2;
cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v44);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v54, 0.0, 0.0, 80.0, 80.0);
v9 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", &v54);
v10 = *(void (__fastcall **)(int, void **))(*(_DWORD *)v9 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v54, 360.0, 250.0);
v10(v9, &v54);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v9, -1);
v11 = *(void (__fastcall **)(int, void **))(*(_DWORD *)v9 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, v44 * 0.5, v45 * 0.5);
v11(v9, &v54);
v13 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Special Color Select", "goldFont.fnt", v12);
v14 = *(void (__fastcall **)(int, void **))(*(_DWORD *)v13 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, v44 * 0.5, (float)((float)(v45 * 0.5) + 125.0) - 25.0);
v14(v13, &v54);
v15 = (cocos2d::CCMenu *)(*(int (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 460) + 228))(
*(_DWORD *)(a1 + 460),
v13);
v16 = cocos2d::CCMenu::create(v15);
*(_DWORD *)(a1 + 444) = v16;
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v16, 10);
v17 = *(_DWORD *)(a1 + 460);
v18 = *(void (__fastcall **)(int, void **))(*(_DWORD *)v17 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, 0.0, -15.0);
v18(v17, &v54);
v20 = ButtonSprite::create((ButtonSprite *)"OK", v19);
v49 = GJSpecialColorSelect::onClose;
v50 = 0;
v21 = CCMenuItemSpriteExtra::create((int)v20, 0, a1, (int)GJSpecialColorSelect::onClose, 0);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v21);
v22 = *(_DWORD *)(a1 + 444);
v23 = *(void (__fastcall **)(int, void **))(*(_DWORD *)v22 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, v44 * 0.5, (float)((float)(v45 * 0.5) - 125.0) + 25.0);
v23(v22, &v54);
memset(v52, 0, sizeof(v52));
std::string::__init(v52, "Help", 4u);
memset(v53, 0, sizeof(v53));
std::string::__init(v53, "Select a special color channel as the target color ID.", 0x36u);
v24 = InfoAlertButton::create((char *)v52, (int)v53, 1065353216);
std::string::~string((int)v53);
std::string::~string((int)v52);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v24);
v25 = *(const cocos2d::CCPoint **)(a1 + 444);
v26 = *(void (__fastcall **)(int, void **))(*(_DWORD *)v24 + 92);
v43 = *(cocos2d::CCPoint **)(a1 + 460);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v48,
(float)((float)(v44 * 0.5) + 180.0) - 18.0,
(float)((float)(v45 * 0.5) + 125.0) - 18.0);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v51, v43);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v54, v25);
v26(v24, &v54);
v27 = *(const cocos2d::CCPoint **)(a1 + 444);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, v44 * 0.5, (float)(v45 * 0.5) + 35.0);
v28 = (cocos2d::CCArray *)cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v46, v27);
v29 = (cocos2d::CCObject *)cocos2d::CCArray::create(v28);
*(_DWORD *)(a1 + 528) = v29;
cocos2d::CCObject::retain(v29);
v54 = nullptr;
v55 = nullptr;
v56 = 0;
if ( a4 == 1 )
{
v51[0] = 1000;
std::vector::__push_back_slow_path((int)&v54, v51);
v51[0] = 1001;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1001;
++v55;
}
v51[0] = 1009;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1009;
++v55;
}
v51[0] = 1002;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1002;
++v55;
}
v51[0] = 1004;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1004;
++v55;
}
v51[0] = 1003;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1003;
++v55;
}
v51[0] = 1013;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1013;
++v55;
}
v30 = 1014;
}
else
{
if ( a4 == 2 )
{
v51[0] = 1004;
std::vector::__push_back_slow_path((int)&v54, v51);
v51[0] = 1012;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1012;
++v55;
}
v51[0] = 1003;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1003;
++v55;
}
v51[0] = 1005;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1005;
++v55;
}
v31 = v56;
v51[0] = 1006;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1006;
++v55;
}
v32 = 3;
goto LABEL_103;
}
v51[0] = 1000;
std::vector::__push_back_slow_path((int)&v54, v51);
v51[0] = 1001;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1001;
++v55;
}
v51[0] = 1009;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1009;
++v55;
}
v51[0] = 1002;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1002;
++v55;
}
v51[0] = 1004;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1004;
++v55;
}
v51[0] = 1003;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1003;
++v55;
}
v51[0] = 1013;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1013;
++v55;
}
v51[0] = 1014;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1014;
++v55;
}
v51[0] = 1005;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = 1005;
++v55;
}
v30 = 1006;
}
v31 = v56;
v51[0] = v30;
if ( (unsigned int)v55 >= v56 )
{
std::vector::__push_back_slow_path((int)&v54, v51);
}
else
{
if ( v55 )
*v55 = v30;
++v55;
}
v32 = 4;
LABEL_103:
for ( i = 0; i < (unsigned int)(((char *)v55 - (_BYTE *)v54) >> 2); ++i )
{
v34 = *((_DWORD *)v54 + i);
if ( v34 == 1002 )
v35 = "Line";
else
v35 = (char *)GJSpecialColorSelect::textForColorIdx(*((GJSpecialColorSelect **)v54 + i), v31);
v36 = ButtonSprite::create(
(ButtonSprite *)v35,
(const char *)&word_28,
0,
0.4,
1,
"bigFont.fnt",
"GJ_button_04.png",
(const char *)0x41F00000,
v41);
v51[0] = GJSpecialColorSelect::onSelectColor;
v51[1] = 0;
v37 = CCMenuItemSpriteExtra::create((int)v36, 0, a1, (int)GJSpecialColorSelect::onSelectColor, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v37 + 36))(v37, v34);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v36 + 36))(v36, v34);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v37);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 528), v36);
v38 = floorf((float)(i / v32));
v39 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v37 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v47,
(float)((float)((float)(v32 - 1) * 0.5) * -70.0) + (float)((float)(i % v32) * 70.0),
(float)(int)v38 * -50.0);
cocos2d::CCPoint::operator+(v48, v46, v47);
v39(v37, v48);
}
if ( v54 )
{
v55 -= (unsigned int)((char *)v55 - (_BYTE *)v54) >> 2;
operator delete(v54);
}
return v42;
}