//
// CharacterColorPage::init from 0xb523b8 to 0xb52df4 (2620 bytes)
//
// 3 xrefs:
// > CharacterColorPage::create @ 0xb52f7c
// > ??> @ 0xb4328
// > ??> @ 0x14c0ca0
//
// 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 13:01:59 +0000
//
__int64 __fastcall CharacterColorPage::init(cocos2d::CCNode **this)
{
cocos2d::CCDirector *v3; // x0
int v4; // w22
__int64 v5; // x21
void (__fastcall *v6)(__int64, __int64 *); // x28
void (__fastcall *v7)(__int64, __int64 *); // x28
const char *v8; // x1
__int64 v9; // x21
cocos2d::CCMenu *v10; // x21
__int64 v11; // x21
float v12; // s0
void (__fastcall *v13)(__int64, __int64 *); // x28
cocos2d::CCArray *v14; // x0
cocos2d::CCObject *v15; // x0
GameManager *v16; // x0
__int64 v17; // x0
__int64 v18; // x21
__int64 v19; // x2
__int64 v20; // x0
int v21; // w21
void (__fastcall *v22)(__int64, __int64 *); // x2
__int64 v23; // x0
__int64 v24; // x0
int v25; // w28
int v26; // w24
cocos2d::CCObject *v27; // x27
cocos2d::CCArray *updated; // x0
cocos2d::CCObject *v29; // x0
int v30; // w28
unsigned int v31; // w22
const char *v32; // x6
ButtonSprite *v33; // x0
cocos2d::CCObject *v34; // x26
__int64 v35; // x24
void (__fastcall *v36)(__int64, __int64 *); // x27
const char *v37; // x1
__int64 v38; // x21
const char *v39; // x1
__int64 v40; // x22
GameManager *v41; // x0
CCMenuItemToggler *v42; // x21
__int64 v43; // x0
__int64 v44; // x21
void (__fastcall *v45)(__int64, __int64 *); // x22
const char *v46; // x2
__int64 v47; // x0
__int64 v48; // x21
void (__fastcall *v49)(__int64, __int64 *); // x22
__int64 v50; // x21
void (__fastcall *v51)(__int64, __int64 *); // x22
__int64 v52; // x0
int v53; // w28
cocos2d::CCObject *v54; // x21
__int64 v55; // x24
void (__fastcall *v56)(__int64, __int64 *); // x27
void (__fastcall *v57)(cocos2d::CCObject *, __int64 *); // x27
void (__fastcall *v58)(__int64, __int64 *); // x27
__int64 v59; // x1
float v60; // s0
int v61; // w24
int v62; // w1
__int64 v63; // x1
__int64 v64; // x0
__int64 v65; // x0
__int64 v66; // x0
__int64 v67; // x0
unsigned __int8 v68; // [xsp+A7h] [xbp+A7h]
unsigned int v69; // [xsp+B8h] [xbp+B8h]
cocos2d::CCNode *v70; // [xsp+B8h] [xbp+B8h]
__int64 v71; // [xsp+C0h] [xbp+C0h] BYREF
_BYTE v72[8]; // [xsp+C8h] [xbp+C8h] BYREF
_BYTE v73[8]; // [xsp+D0h] [xbp+D0h] BYREF
_BYTE v74[8]; // [xsp+D8h] [xbp+D8h] BYREF
__int64 v75; // [xsp+E0h] [xbp+E0h] BYREF
_BYTE v76[8]; // [xsp+E8h] [xbp+E8h] BYREF
__int64 v77[2]; // [xsp+F0h] [xbp+F0h] BYREF
__int64 v78[2]; // [xsp+100h] [xbp+100h] BYREF
void *v79; // [xsp+110h] [xbp+110h]
v68 = FLAlertLayer::init((FLAlertLayer *)this, 150);
if ( v68 )
{
v3 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)v68);
cocos2d::CCDirector::getWinSize(&v71, v3);
v4 = 1;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v77, 0.0, 0.0, 80.0, 80.0);
v5 = cocos2d::extension::CCScale9Sprite::create("GJ_square05.png", v77);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v5 + 912LL))(v5, 0xFFFFFFFFLL);
*((_DWORD *)this + 167) = 1138819072;
*((_DWORD *)this + 166) = 1133903872;
v6 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v5 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v77, 450.0, 300.0);
v6(v5, v77);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v5, 0xFFFFFFFFLL);
v7 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v5 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v77, *(float *)&v71 * 0.5, *((float *)&v71 + 1) * 0.5);
v7(v5, v77);
v9 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v8);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v9 + 160LL))(v9, 0.8);
v10 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(
v9,
0,
(__int64)this,
(__int64)CharacterColorPage::onClose,
0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v10, 1.6);
v11 = cocos2d::CCMenu::create(v10, nullptr);
v12 = *((float *)this + 167);
*(this + 69) = (cocos2d::CCNode *)v11;
v13 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v11 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v77,
10.0 - (float)((float)(v12 * 0.5) - (float)(*(float *)&v71 * 0.5)),
(float)((float)(*((float *)this + 166) * 0.5) + (float)(*((float *)&v71 + 1) * 0.5)) - 10.0);
v13(v11, v77);
v14 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD, _QWORD, __int64))(*(_QWORD *)*(this + 73) + 464LL))(
*(this + 73),
*(this + 69),
10);
v15 = (cocos2d::CCObject *)cocos2d::CCArray::create(v14);
*(this + 84) = v15;
cocos2d::CCObject::retain(v15);
v16 = (GameManager *)cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v72,
*(float *)&v71 * 0.5,
(float)((float)(*((float *)this + 166) * 0.5) + (float)(*((float *)&v71 + 1) * 0.5)) - 62.0);
v17 = GameManager::sharedState(v16);
v69 = *(_DWORD *)(v17 + 716) - *(_DWORD *)(v17 + 720);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v77, 0.0, 0.0, 80.0, 80.0);
v18 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v77);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v18 + 912LL))(v18, 45);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v73, *((float *)this + 167) - 30.0, 60.0);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v18 + 320LL))(v18, v73);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v18, 8);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v18 + 184LL))(v18, v72);
v19 = *(_QWORD *)v18;
v20 = v18;
v21 = 0;
v22 = *(void (__fastcall **)(__int64, __int64 *))(v19 + 960);
LOWORD(v77[0]) = 0;
BYTE2(v77[0]) = 0;
v22(v20, v77);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v74, (const cocos2d::CCPoint *)&unk_155E418);
v23 = 0xFFFFFFFFLL;
LABEL_4:
v24 = GameManager::sharedState((GameManager *)v23);
v25 = 0;
v26 = *(_DWORD *)(v24 + 716) - *(_DWORD *)(v24 + 720);
LABEL_5:
while ( 1 )
{
v27 = (cocos2d::CCObject *)SimplePlayer::create((SimplePlayer *)v69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v76, (float)((float)v21 * 52.0) + -182.0, 0.0);
cocos2d::CCPoint::operator+(v77, v76);
cocos2d::CCPoint::operator+(&v75, v72);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *, __int64))(*(_QWORD *)*(this + 73) + 464LL))(
*(this + 73),
v27,
10);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v27 + 184LL))(v27, &v75);
cocos2d::CCArray::addObject(*(this + 84), v27);
(*(void (__fastcall **)(cocos2d::CCObject *, float))(*(_QWORD *)v27 + 160LL))(v27, 1.15);
updated = (cocos2d::CCArray *)SimplePlayer::updatePlayerFrame((__int64)v27, v26, v25);
if ( v4 == 8 )
break;
++v4;
while ( 2 )
{
v21 = v4 - 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v74, (const cocos2d::CCPoint *)&unk_155E418);
v23 = (unsigned int)(v4 - 2);
switch ( v4 )
{
case 2:
v52 = GameManager::sharedState((GameManager *)v23);
++v4;
v53 = *(_DWORD *)(v52 + 728) - *(_DWORD *)(v52 + 732);
v54 = (cocos2d::CCObject *)SimplePlayer::create((SimplePlayer *)v69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v76, -130.0, 0.0);
cocos2d::CCPoint::operator+(v77, v76);
cocos2d::CCPoint::operator+(&v75, v72);
v55 = CCMenuItemSpriteExtra::create(
(__int64)v54,
0,
(__int64)this,
(__int64)CharacterColorPage::toggleShip,
0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v55 + 72LL))(v55, 1);
v56 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v55 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v77, 30.0, 30.0);
v56(v55, v77);
v57 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v54 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v77, 15.0, 15.0);
v57(v54, v77);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v55);
v58 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v55 + 184LL);
cocos2d::CCNode::convertToNodeSpace(v77, *(this + 69), (const cocos2d::CCPoint *)&v75);
v58(v55, v77);
cocos2d::CCArray::addObject(*(this + 84), v54);
(*(void (__fastcall **)(cocos2d::CCObject *, float))(*(_QWORD *)v54 + 160LL))(v54, 1.15);
SimplePlayer::updatePlayerFrame((__int64)v54, v53, 1);
continue;
case 3:
v66 = GameManager::sharedState((GameManager *)v23);
v25 = 2;
v26 = *(_DWORD *)(v66 + 740) - *(_DWORD *)(v66 + 744);
goto LABEL_5;
case 4:
v65 = GameManager::sharedState((GameManager *)v23);
v25 = 3;
v26 = *(_DWORD *)(v65 + 752) - *(_DWORD *)(v65 + 756);
goto LABEL_5;
case 5:
v64 = GameManager::sharedState((GameManager *)v23);
v25 = 4;
v26 = *(_DWORD *)(v64 + 764) - *(_DWORD *)(v64 + 768);
goto LABEL_5;
case 6:
v63 = GameManager::sharedState((GameManager *)v23);
v60 = -6.0;
v25 = 5;
v61 = *(_DWORD *)(v63 + 776);
v62 = *(_DWORD *)(v63 + 780);
goto LABEL_20;
case 7:
v59 = GameManager::sharedState((GameManager *)v23);
v60 = -4.0;
v25 = 6;
v61 = *(_DWORD *)(v59 + 788);
v62 = *(_DWORD *)(v59 + 792);
LABEL_20:
v26 = v61 - v62;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v77, v60, 0.0);
cocos2d::CCPoint::operator=(v74, v77);
break;
case 8:
v67 = GameManager::sharedState((GameManager *)v23);
v25 = 7;
v26 = *(_DWORD *)(v67 + 800) - *(_DWORD *)(v67 + 804);
break;
default:
goto LABEL_4;
}
break;
}
}
v29 = (cocos2d::CCObject *)cocos2d::CCArray::create(updated);
*(this + 85) = v29;
v30 = 0;
v31 = 0;
cocos2d::CCObject::retain(v29);
do
{
v78[0] = 0;
v78[1] = 0;
v79 = nullptr;
std::string::__init(v78, &byte_11B8890, 0);
if ( v31 == 1 )
{
std::string::assign(v78, "Col2");
}
else if ( v31 == 2 )
{
std::string::assign(v78, "Glow");
}
else
{
std::string::assign(v78, "Col1");
}
if ( (v78[0] & 1) != 0 )
v33 = (ButtonSprite *)v79;
else
v33 = (ButtonSprite *)((char *)v78 + 1);
v34 = (cocos2d::CCObject *)ButtonSprite::create(
v33,
(const char *)&qword_28,
0,
0,
0.4,
"bigFont.fnt",
"GJ_button_01.png",
v32,
20.0);
(*(void (__fastcall **)(cocos2d::CCObject *, float))(*(_QWORD *)v34 + 160LL))(v34, 0.85);
v35 = CCMenuItemSpriteExtra::create((__int64)v34, 0, (__int64)this, (__int64)CharacterColorPage::onMode, 0);
CCMenuItemSpriteExtra::setSizeMult(v35, 1.1);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v35 + 72LL))(v35, v31);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v35);
v70 = *(this + 69);
v36 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v35 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v76,
(float)((float)((float)(*((float *)this + 167) * 0.5) + (float)(*(float *)&v71 * 0.5)) - 137.0) + (float)v30,
(float)((float)(*((float *)this + 166) * 0.5) + (float)(*((float *)&v71 + 1) * 0.5)) - 17.0);
cocos2d::CCNode::convertToNodeSpace(v77, v70, (const cocos2d::CCPoint *)v76);
v36(v35, v77);
cocos2d::CCArray::addObject(*(this + 85), v34);
if ( (v78[0] & 1) != 0 )
operator delete(v79);
++v31;
v30 += 50;
}
while ( v31 != 3 );
CharacterColorPage::updateIconColors(this);
CharacterColorPage::createColorMenu((CharacterColorPage *)this);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v75,
26.0 - (float)((float)(*((float *)this + 167) * 0.5) - (float)(*(float *)&v71 * 0.5)),
23.0 - (float)((float)(*((float *)this + 166) * 0.5) - (float)(*((float *)&v71 + 1) * 0.5)));
v38 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_checkOn_001.png", v37);
v40 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_checkOff_001.png", v39);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v38 + 160LL))(v38, 0.6);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v40 + 160LL))(v40, 0.6);
v41 = (GameManager *)CCMenuItemToggler::create(v38, v40, (__int64)this, (__int64)CharacterColorPage::toggleGlow, 0);
*(this + 89) = v41;
v42 = v41;
v43 = GameManager::sharedState(v41);
CCMenuItemToggler::toggle(v42, *(_BYTE *)(v43 + 912) ^ 1);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), *(this + 89));
v44 = (__int64)*(this + 89);
v45 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v44 + 184LL);
cocos2d::CCNode::convertToNodeSpace(v77, *(this + 69), (const cocos2d::CCPoint *)&v75);
v45(v44, v77);
CCMenuItemToggler::setSizeMult(*(this + 89), 1.5);
v47 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Glow", "bigFont.fnt", v46);
*(this + 90) = (cocos2d::CCNode *)v47;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v47, 2);
v48 = (__int64)*(this + 90);
v49 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v48 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v77, 0.0, 0.5);
v49(v48, v77);
(*(void (__fastcall **)(_QWORD, float))(*(_QWORD *)*(this + 90) + 160LL))(*(this + 90), 0.45);
v50 = (__int64)*(this + 90);
v51 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v50 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v76, 18.0, 0.0);
cocos2d::CCPoint::operator+(v77, &v75);
v51(v50, v77);
CharacterColorPage::updateColorMode((CharacterColorPage *)this, 0);
}
return v68;
}