//
// CharacterColorPage::updateColorMode from 0x10065dfa0 to 0x10065e453 (1203 bytes)
//
// 2 xrefs:
// > CharacterColorPage::init @ 0x10065d703
// > CharacterColorPage::onMode @ 0x10065d8b2
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall CharacterColorPage::updateColorMode(CharacterColorPage *a1, int a2)
{
CharacterColorPage *v2; // r15
GameManager *v3; // rax
GameManager *v4; // rax
GameManager *v5; // rax
cocos2d::CCDictionary *m_colorButtons; // rcx
cocos2d::CCDictElement *m_pElements; // rdx
cocos2d::CCObject *m_pObject; // r13
__int64 v9; // rax
int v10; // r12d
cocos2d::CCLayer *m_mainLayer; // r15
const cocos2d::CCPoint *m_buttonMenu; // r14
__int64 v13; // rax
const cocos2d::CCPoint *v14; // rsi
__int64 v15; // rax
GameManager *v16; // rax
bool isColorUnlocked; // r14
__int64 v18; // r13
GameStatsManager *v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // r14
__int64 v23; // rax
CharacterColorPage *v24; // rcx
ButtonSprite *v25; // r15
const char *v26; // r12
unsigned int v27; // r13d
__int64 v28; // rax
CharacterColorPage *v29; // rbx
unsigned int v30; // r12d
__int64 v31; // r14
ButtonSprite *v32; // r15
const char *v33; // r13
__int64 v34; // rax
CharacterColorPage *v35; // rbx
__int64 v36; // r14
ButtonSprite *v37; // r15
const char *v38; // r12
unsigned int v39; // r13d
__int64 v40; // rax
CharacterColorPage *v41; // rbx
_BOOL4 v42; // r14d
cocos2d::CCDictElement *next; // [rsp+8h] [rbp-58h]
int v44; // [rsp+14h] [rbp-4Ch]
int v45; // [rsp+18h] [rbp-48h]
int v46; // [rsp+1Ch] [rbp-44h]
__int16 v47; // [rsp+20h] [rbp-40h] BYREF
char v48; // [rsp+22h] [rbp-3Eh]
CharacterColorPage *v49; // [rsp+28h] [rbp-38h]
_WORD v50[24]; // [rsp+30h] [rbp-30h] BYREF
double v51; // 0:xmm0_8.8
v2 = a1;
a1->m_colorMode = a2;
v3 = GameManager::sharedState();
v44 = v3->m_playerColor.random - v3->m_playerColor.seed;
v4 = GameManager::sharedState();
v45 = v4->m_playerColor2.random - v4->m_playerColor2.seed;
v5 = GameManager::sharedState();
m_colorButtons = a1->m_colorButtons;
v49 = a1;
if ( m_colorButtons )
{
m_pElements = m_colorButtons->m_pElements;
if ( m_pElements )
{
v46 = v5->m_playerGlowColor.random - v5->m_playerGlowColor.seed;
do
{
m_pObject = m_pElements->m_pObject;
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
v9 = ((__int64 (__fastcall *)(cocos2d::CCObject *))m_pObject->__vftable[6].~CCObject_0)(m_pObject);
v10 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 64LL))(v9);
m_mainLayer = v49->m_mainLayer;
m_buttonMenu = (const cocos2d::CCPoint *)v49->m_buttonMenu;
v13 = ((__int64 (__fastcall *)(cocos2d::CCObject *))m_pObject->__vftable[6].~CCObject_0)(m_pObject);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 192LL))(v13);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v47, m_buttonMenu);
v14 = (const cocos2d::CCPoint *)m_mainLayer;
v2 = v49;
*(cocos2d::CCPoint *)&v51 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v50, v14);
if ( v10 == v44 )
{
v20 = sub_1007200C0(v2->m_cursors, 0);
(*(void (__fastcall **)(__int64, _WORD *, double))(*(_QWORD *)v20 + 184LL))(v20, v50, v51);
if ( v10 != v45 )
{
LABEL_8:
if ( v10 != v46 )
goto LABEL_10;
LABEL_9:
v15 = sub_1007200C0(v2->m_cursors, 2);
(*(void (__fastcall **)(__int64, _WORD *, double))(*(_QWORD *)v15 + 184LL))(v15, v50, v51);
goto LABEL_10;
}
}
else if ( v10 != v45 )
{
goto LABEL_8;
}
v21 = sub_1007200C0(v2->m_cursors, 1);
(*(void (__fastcall **)(__int64, _WORD *, double))(*(_QWORD *)v21 + 184LL))(v21, v50, v51);
if ( v10 == v46 )
goto LABEL_9;
LABEL_10:
v16 = GameManager::sharedState();
isColorUnlocked = GameManager::isColorUnlocked(
v16,
v10,
(UnlockType)((((unsigned int)v2->m_colorMode | 0x300000000uLL) - 1) >> 32));
v18 = ((__int64 (__fastcall *)(cocos2d::CCObject *, __int64, double))m_pObject->__vftable[5].getTag)(
m_pObject,
100,
v51);
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v18 + 328LL))(v18, !isColorUnlocked);
if ( isColorUnlocked
|| (v19 = GameStatsManager::sharedState(),
GameStatsManager::getItemUnlockState(
v19,
v10,
(UnlockType)((((unsigned int)v2->m_colorMode | 0x300000000uLL) - 1) >> 32))) )
{
v48 = -1;
v47 = -1;
}
else
{
v48 = 0;
v47 = -256;
}
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v18 + 944LL))(v18, &v47);
m_pElements = next;
}
while ( next );
}
}
v22 = sub_1007200C0(v2->m_cursors, 0);
v23 = sub_1007200C0(v2->m_modeButtons, 0);
v24 = v2;
v25 = (ButtonSprite *)v23;
if ( v24->m_colorMode )
{
memset(v50, 50, 3);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v22 + 944LL))(v22, v50);
v26 = "GJ_button_04.png";
v27 = 1;
}
else
{
LOBYTE(v50[1]) = -1;
v50[0] = -1;
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v22 + 944LL))(v22, v50);
v26 = "GJ_button_01.png";
v27 = 11;
}
v28 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v22 + 496LL))(v22);
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v28 + 576LL))(v28, v22, v27);
ButtonSprite::updateBGImage(v25, v26);
v29 = v49;
v30 = 1;
v31 = sub_1007200C0(v49->m_cursors, 1);
v32 = (ButtonSprite *)sub_1007200C0(v29->m_modeButtons, 1);
if ( v29->m_colorMode == 1 )
{
LOBYTE(v50[1]) = -1;
v50[0] = -1;
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v31 + 944LL))(v31, v50);
v33 = "GJ_button_01.png";
v30 = 11;
}
else
{
memset(v50, 50, 3);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v31 + 944LL))(v31, v50);
v33 = "GJ_button_04.png";
}
v34 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v31 + 496LL))(v31);
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v34 + 576LL))(v34, v31, v30);
ButtonSprite::updateBGImage(v32, v33);
v35 = v49;
v36 = sub_1007200C0(v49->m_cursors, 2);
v37 = (ButtonSprite *)sub_1007200C0(v35->m_modeButtons, 2);
if ( v35->m_colorMode == 2 )
{
LOBYTE(v50[1]) = -1;
v50[0] = -1;
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v36 + 944LL))(v36, v50);
v38 = "GJ_button_01.png";
v39 = 11;
}
else
{
memset(v50, 50, 3);
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v36 + 944LL))(v36, v50);
v38 = "GJ_button_04.png";
v39 = 1;
}
v40 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v36 + 496LL))(v36);
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v40 + 576LL))(v40, v36, v39);
ButtonSprite::updateBGImage(v37, v38);
v41 = v49;
v42 = v49->m_colorMode == 2;
((void (__fastcall *)(CCMenuItemToggler *, bool))v49->m_glowToggler->setEnabled)(
v49->m_glowToggler,
v49->m_colorMode == 2);
((void (__fastcall *)(CCMenuItemToggler *, _BOOL4))v41->m_glowToggler->setVisible)(v41->m_glowToggler, v42);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _BOOL4))v41->m_glowLabel->setVisible)(v41->m_glowLabel, v42);
}