//
// CharacterColorPage::updateColorMode from 0x10073d5f0 to 0x10073daa3 (1203 bytes)
//
// 2 xrefs:
// > CharacterColorPage::init @ 0x10073cd53
// > CharacterColorPage::onMode @ 0x10073cf02
//
// 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 12:36:27 +0000
//
__int64 __fastcall CharacterColorPage::updateColorMode(__int64 a1, int a2)
{
__int64 v2; // r15
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rcx
__int64 v7; // rdx
__int64 v8; // r13
__int64 v9; // rax
unsigned int v10; // r12d
__int64 v11; // r15
__int64 v12; // r14
__int64 v13; // rax
unsigned int *v14; // rax
__int64 v15; // rsi
__int64 v16; // rax
__int64 v17; // rax
unsigned __int8 isColorUnlocked; // r14
__int64 v19; // r13
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // r14
__int64 v24; // rax
__int64 v25; // rcx
__int64 v26; // r15
const char *v27; // r12
unsigned int v28; // r13d
__int64 v29; // rax
__int64 v30; // rbx
unsigned int v31; // r12d
__int64 v32; // r14
__int64 v33; // r15
const char *v34; // r13
__int64 v35; // rax
__int64 v36; // rbx
__int64 v37; // r14
__int64 v38; // r15
const char *v39; // r12
unsigned int v40; // r13d
__int64 v41; // rax
__int64 v42; // rbx
_BOOL4 v43; // r14d
__int64 v45; // [rsp+8h] [rbp-58h]
int v46; // [rsp+14h] [rbp-4Ch]
int v47; // [rsp+18h] [rbp-48h]
int v48; // [rsp+1Ch] [rbp-44h]
double v49; // [rsp+20h] [rbp-40h] BYREF
__int64 v50; // [rsp+28h] [rbp-38h]
double v51[6]; // [rsp+30h] [rbp-30h] BYREF
v2 = a1;
*(_DWORD *)(a1 + 660) = a2;
v3 = GameManager::sharedState();
v46 = *(_DWORD *)(v3 + 812) - *(_DWORD *)(v3 + 816);
v4 = GameManager::sharedState();
v47 = *(_DWORD *)(v4 + 824) - *(_DWORD *)(v4 + 828);
v5 = GameManager::sharedState();
v6 = *(_QWORD *)(a1 + 688);
v50 = a1;
if ( v6 )
{
v7 = *(_QWORD *)(v6 + 56);
if ( v7 )
{
v48 = *(_DWORD *)(v5 + 836) - *(_DWORD *)(v5 + 840);
do
{
v8 = *(_QWORD *)(v7 + 264);
v45 = *(_QWORD *)(v7 + 288);
v9 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 512LL))(v8);
v10 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 64LL))(v9);
v11 = *(_QWORD *)(v50 + 584);
v12 = *(_QWORD *)(v50 + 552);
v13 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 512LL))(v8);
v14 = (unsigned int *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 192LL))(v13);
cocos2d::CCNode::convertToWorldSpace(&v49, v12, v14);
v15 = v11;
v2 = v50;
cocos2d::CCNode::convertToNodeSpace(v51, v15, (unsigned int *)&v49);
if ( v10 == v46 )
{
v21 = sub_1007FEFE0(*(_QWORD *)(v2 + 696), 0);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v21 + 184LL))(v21, v51);
if ( v10 != v47 )
{
LABEL_8:
if ( v10 != v48 )
goto LABEL_10;
LABEL_9:
v16 = sub_1007FEFE0(*(_QWORD *)(v2 + 696), 2);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v16 + 184LL))(v16, v51);
goto LABEL_10;
}
}
else if ( v10 != v47 )
{
goto LABEL_8;
}
v22 = sub_1007FEFE0(*(_QWORD *)(v2 + 696), 1);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v22 + 184LL))(v22, v51);
if ( v10 == v48 )
goto LABEL_9;
LABEL_10:
v17 = GameManager::sharedState();
isColorUnlocked = GameManager::isColorUnlocked(
v17,
v10,
((*(unsigned int *)(v2 + 660) | 0x300000000uLL) - 1) >> 32);
v19 = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 480LL))(v8, 100);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v19 + 344LL))(v19, isColorUnlocked ^ 1u);
if ( isColorUnlocked
|| (v20 = GameStatsManager::sharedState(),
(unsigned int)GameStatsManager::getItemUnlockState(
v20,
v10,
((*(unsigned int *)(v2 + 660) | 0x300000000uLL) - 1) >> 32)) )
{
BYTE2(v49) = -1;
LOWORD(v49) = -1;
}
else
{
BYTE2(v49) = 0;
LOWORD(v49) = -256;
}
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v19 + 960LL))(v19, &v49);
v7 = v45;
}
while ( v45 );
}
}
v23 = sub_1007FEFE0(*(_QWORD *)(v2 + 696), 0);
v24 = sub_1007FEFE0(*(_QWORD *)(v2 + 680), 0);
v25 = v2;
v26 = v24;
if ( *(_DWORD *)(v25 + 660) )
{
memset(v51, 50, 3);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v23 + 960LL))(v23, v51);
v27 = "GJ_button_04.png";
v28 = 1;
}
else
{
BYTE2(v51[0]) = -1;
LOWORD(v51[0]) = -1;
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v23 + 960LL))(v23, v51);
v27 = "GJ_button_01.png";
v28 = 11;
}
v29 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v23 + 512LL))(v23);
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v29 + 592LL))(v29, v23, v28);
ButtonSprite::updateBGImage(v26, (__int64)v27);
v30 = v50;
v31 = 1;
v32 = sub_1007FEFE0(*(_QWORD *)(v50 + 696), 1);
v33 = sub_1007FEFE0(*(_QWORD *)(v30 + 680), 1);
if ( *(_DWORD *)(v30 + 660) == 1 )
{
BYTE2(v51[0]) = -1;
LOWORD(v51[0]) = -1;
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v32 + 960LL))(v32, v51);
v34 = "GJ_button_01.png";
v31 = 11;
}
else
{
memset(v51, 50, 3);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v32 + 960LL))(v32, v51);
v34 = "GJ_button_04.png";
}
v35 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v32 + 512LL))(v32);
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v35 + 592LL))(v35, v32, v31);
ButtonSprite::updateBGImage(v33, (__int64)v34);
v36 = v50;
v37 = sub_1007FEFE0(*(_QWORD *)(v50 + 696), 2);
v38 = sub_1007FEFE0(*(_QWORD *)(v36 + 680), 2);
if ( *(_DWORD *)(v36 + 660) == 2 )
{
BYTE2(v51[0]) = -1;
LOWORD(v51[0]) = -1;
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v37 + 960LL))(v37, v51);
v39 = "GJ_button_01.png";
v40 = 11;
}
else
{
memset(v51, 50, 3);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v37 + 960LL))(v37, v51);
v39 = "GJ_button_04.png";
v40 = 1;
}
v41 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v37 + 512LL))(v37);
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v41 + 592LL))(v41, v37, v40);
ButtonSprite::updateBGImage(v38, (__int64)v39);
v42 = v50;
v43 = *(_DWORD *)(v50 + 660) == 2;
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(v50 + 712) + 1056LL))(
*(_QWORD *)(v50 + 712),
*(_DWORD *)(v50 + 660) == 2);
(*(void (__fastcall **)(_QWORD, _BOOL4))(**(_QWORD **)(v42 + 712) + 344LL))(*(_QWORD *)(v42 + 712), v43);
return (*(__int64 (__fastcall **)(_QWORD, _BOOL4))(**(_QWORD **)(v42 + 720) + 344LL))(*(_QWORD *)(v42 + 720), v43);
}