//
// CharacterColorPage::createColorMenu from 0x1400a1710 to 0x1400a1d1b (1547 bytes)
//
// 2 xrefs:
// > CharacterColorPage::init @ 0x1400a1299
// > ??> @ 0x1409130b8
//
// 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:26:07 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall CharacterColorPage::createColorMenu(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rcx
cocos2d::CCObject *v4; // rax
__int64 v5; // rdi
struct cocos2d::CCObject *v6; // rbx
cocos2d::CCObject *v7; // rax
int i; // esi
__int64 v9; // rcx
int v10; // eax
__int64 v11; // r15
__int64 v12; // r13
const char *v13; // rcx
struct cocos2d::CCSprite *v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
__int64 *v17; // rdi
float v18; // xmm1_4
float v19; // xmm2_4
__int64 v20; // rax
__int64 v21; // rbx
__int64 v22; // rax
__int64 v23; // rcx
void (__fastcall **v24)(__int64, __int64); // rbx
__int64 v25; // rax
void *v26; // rcx
int v27; // [rsp+30h] [rbp-D0h]
float v28[2]; // [rsp+38h] [rbp-C8h] BYREF
float v29[2]; // [rsp+40h] [rbp-C0h] BYREF
char v30[4]; // [rsp+48h] [rbp-B8h] BYREF
_BYTE v31[12]; // [rsp+4Ch] [rbp-B4h] BYREF
char v32[8]; // [rsp+58h] [rbp-A8h] BYREF
char v33[8]; // [rsp+60h] [rbp-A0h] BYREF
char v34[8]; // [rsp+68h] [rbp-98h] BYREF
void *v35; // [rsp+70h] [rbp-90h]
char v36[8]; // [rsp+78h] [rbp-88h] BYREF
char v37[8]; // [rsp+80h] [rbp-80h] BYREF
void *v38; // [rsp+88h] [rbp-78h]
__int128 v39; // [rsp+90h] [rbp-70h] BYREF
__int64 v40; // [rsp+A0h] [rbp-60h]
unsigned __int64 v41; // [rsp+A8h] [rbp-58h]
v2 = cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2, v28);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v32, v28[0] * 0.5, (float)(v28[1] * 0.5) - 59.0);
v4 = (cocos2d::CCObject *)cocos2d::CCArray::create(v3);
*(_QWORD *)(a1 + 704) = v4;
cocos2d::CCObject::retain(v4);
v5 = 3;
do
{
v6 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_select_001.png");
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v6 + 160LL))(v6);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v6,
11);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 704), v6);
--v5;
}
while ( v5 );
v7 = (cocos2d::CCObject *)cocos2d::CCDictionary::create();
*(_QWORD *)(a1 + 696) = v7;
cocos2d::CCObject::retain(v7);
for ( i = 0; i < 144; ++i )
{
v27 = (int)floorf((float)(i / 18));
v10 = CharacterColorPage::colorForIndex(v9, (unsigned int)i);
v11 = v10;
if ( v10 < 0 )
continue;
v12 = ColorChannelSprite::create();
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 696), (struct cocos2d::CCObject *)v12, v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 160LL))(v12);
v39 = 0;
v40 = 0;
v41 = 0;
*(_QWORD *)&v39 = sub_14003D460(0x20u);
v40 = 19;
v41 = 31;
strcpy((char *)v39, "GJ_lockGray_001.png");
v13 = (const char *)&v39;
if ( v41 > 0xF )
v13 = (const char *)v39;
v14 = cocos2d::CCSprite::createWithSpriteFrameName(v13);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v14 + 160LL))(v14);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v14 + 64LL))(v14, 100);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *))(*(_QWORD *)v12 + 464LL))(v12, v14);
v15 = *(_QWORD *)v14;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v34, *(float *)(v12 + 432) * 0.5, *(float *)(v12 + 436) * 0.5);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v15 + 184))(v14, v16);
v35 = operator new(0x208u);
v17 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v35);
if ( !v17 )
goto LABEL_11;
if ( !CCMenuItemSpriteExtra::init(v17, (__int64 *)v12, 0, a1, (__int64)CharacterColorPage::onPlayerColor) )
{
(*(void (__fastcall **)(__int64 *, __int64))(*v17 + 8))(v17, 1);
LABEL_11:
v17 = nullptr;
goto LABEL_12;
}
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v17);
LABEL_12:
(*(void (__fastcall **)(__int64 *, _QWORD))(*v17 + 64))(v17, (unsigned int)v11);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v17);
v18 = 0.0;
if ( (unsigned int)(i - 54) > 0x51 )
v19 = 0.0;
else
v19 = -0.80000001;
if ( i >= 136 )
v19 = 0.40000001;
if ( (unsigned int)(i - 4) <= 0x8A )
{
switch ( byte_1400A1C90[i - 4] )
{
case 0:
v18 = 1.0;
break;
case 1:
break;
}
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v31, v18, v19);
cocos2d::CCPoint::operator*(v31, v29);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v36,
(float)((float)((float)((float)(i % 18) * 24.0) - 204.0) + v29[0]) + 6.0,
(float)(96.0 - (float)((float)v27 * 24.0)) + v29[1]);
cocos2d::CCPoint::operator+(v32, v33, v20);
v21 = *v17;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v37, v33);
(*(void (__fastcall **)(__int64 *, __int64))(v21 + 184))(v17, v22);
v23 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v38 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v23 = qword_14090BFD0;
}
v24 = *(void (__fastcall ***)(__int64, __int64))(v12 + 320);
v25 = GameManager::colorForIdx(v23, v30, (unsigned int)v11);
(*v24)(v12 + 320, v25);
if ( v41 > 0xF )
{
v26 = (void *)v39;
if ( v41 + 1 >= 0x1000 )
{
v26 = *(void **)(v39 - 8);
if ( (unsigned __int64)(v39 - (_QWORD)v26 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v26);
}
}
}