//
// CharacterColorPage::onPlayerColor from 0x10073db20 to 0x10073dd67 (583 bytes)
//
// 1 xrefs:
// > CharacterColorPage::createColorMenu @ 0x10073d43a
//
// 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::onPlayerColor(__int64 a1, __int64 a2)
{
unsigned int v2; // r12d
unsigned int v3; // r15d
__int64 v4; // rax
__int64 result; // rax
int v6; // ecx
__int64 v7; // rdi
__int64 v8; // rax
int v9; // eax
_DWORD *v10; // r12
float v11; // xmm0_4
_DWORD *v12; // r12
float v13; // xmm0_4
_DWORD *v14; // r12
float v15; // xmm0_4
__int64 v16; // r15
__int64 v17; // r12
__int64 v18; // r13
unsigned int *v19; // rax
double v20; // [rsp+8h] [rbp-38h] BYREF
double v21[6]; // [rsp+10h] [rbp-30h] BYREF
v2 = ((*(unsigned int *)(a1 + 660) | 0x300000000uLL) - 1) >> 32;
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
v4 = GameManager::sharedState();
result = GameManager::isColorUnlocked(v4, v3, v2);
if ( !(_BYTE)result )
goto LABEL_9;
result = *(unsigned int *)(a1 + 660);
if ( (_DWORD)result == 2 )
{
result = GameManager::sharedState();
if ( *(_DWORD *)(result + 836) - *(_DWORD *)(result + 840) == v3 )
goto LABEL_9;
LABEL_12:
*(_BYTE *)(GameManager::sharedState() + 656) = 0;
v8 = GameManager::sharedState();
GameManager::colorForIdx(v8, v3);
v9 = *(_DWORD *)(a1 + 660);
switch ( v9 )
{
case 2:
v14 = (_DWORD *)GameManager::sharedState();
v14[211] = v3;
v15 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
v14[210] = (int)v15;
v14[209] = (int)v15 + v3;
break;
case 1:
v12 = (_DWORD *)GameManager::sharedState();
v12[208] = v3;
v13 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
v12[207] = (int)v13;
v12[206] = (int)v13 + v3;
break;
case 0:
v10 = (_DWORD *)GameManager::sharedState();
v10[205] = v3;
v11 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
v10[204] = (int)v11;
v10[203] = (int)v11 + v3;
break;
}
v16 = sub_1007FEFE0(*(_QWORD *)(a1 + 696), *(unsigned int *)(a1 + 660));
v17 = *(_QWORD *)(a1 + 584);
v18 = *(_QWORD *)(a1 + 552);
v19 = (unsigned int *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 192LL))(a2);
cocos2d::CCNode::convertToWorldSpace(v21, v18, v19);
cocos2d::CCNode::convertToNodeSpace(&v20, v17, (unsigned int *)v21);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v16 + 184LL))(v16, &v20);
return CharacterColorPage::updateIconColors(a1);
}
if ( (_DWORD)result == 1 )
{
result = GameManager::sharedState();
v6 = *(_DWORD *)(result + 824) - *(_DWORD *)(result + 828);
LABEL_8:
if ( v6 == v3 )
goto LABEL_9;
goto LABEL_12;
}
v6 = 0;
if ( (_DWORD)result )
goto LABEL_8;
result = GameManager::sharedState();
if ( *(_DWORD *)(result + 812) - *(_DWORD *)(result + 816) != v3 )
goto LABEL_12;
LABEL_9:
v7 = *(_QWORD *)(a1 + 704);
if ( v7 )
return (*(__int64 (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)v7 + 8LL))(v7, v3, v2);
return result;
}