//
// CharacterColorPage::onPlayerColor from 0xb51ba0 to 0xb51dd8 (568 bytes)
//
// 3 xrefs:
// > ??> @ 0x46e70
// > CharacterColorPage::createColorMenu @ 0xb521f0
// > ??> @ 0x1541590
//
// 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::onPlayerColor(CharacterColorPage *this, cocos2d::CCObject *a2)
{
unsigned int v4; // w21
unsigned int v5; // w23
GameManager *active; // x0
GameManager *v8; // x0
GameManager *v9; // x0
unsigned __int64 v10; // x0
unsigned int v11; // w1
GameManager *v12; // x0
__int64 v13; // x24
cocos2d::CCObject *v14; // x0
cocos2d::CCNode *v15; // x26
__int64 (__fastcall *v16)(cocos2d::CCObject *); // x1
cocos2d::CCNode *v17; // x25
void (__fastcall *v18)(__int64, __int64 *); // x22
const cocos2d::CCPoint *v19; // x0
__int64 v20; // x0
__int64 v21; // x0
__int64 v22; // x21
float v23; // s0
__int64 v24; // x0
__int64 v25; // x21
float v26; // s0
__int64 v27; // x0
__int64 v28; // x21
float v29; // s0
__int64 v30; // [xsp+58h] [xbp+58h] BYREF
__int64 v31; // [xsp+60h] [xbp+60h] BYREF
if ( *((_DWORD *)this + 165) )
v4 = 3;
else
v4 = 2;
v5 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
if ( (unsigned __int8)CharacterColorPage::checkColor(this, v5, v4) )
{
active = (GameManager *)CharacterColorPage::activeColorForMode(this, *((_DWORD *)this + 165));
if ( v5 == (_DWORD)active )
{
v20 = *((_QWORD *)this + 88);
if ( v20 )
(*(void (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)v20 + 8LL))(v20, v5, v4);
}
else
{
v8 = (GameManager *)GameManager::sharedState(active);
*((_BYTE *)v8 + 656) = 0;
v9 = (GameManager *)GameManager::sharedState(v8);
v10 = GameManager::colorForIdx(v9, v5);
v11 = *((_DWORD *)this + 165);
v12 = (GameManager *)BYTE2(v10);
switch ( v11 )
{
case 1u:
v27 = GameManager::sharedState(v12);
*(_DWORD *)(v27 + 832) = v5;
v28 = v27;
v29 = (float)((float)rand() * 4.6566e-10) * 1000.0;
*(_DWORD *)(v28 + 828) = (int)v29;
*(_DWORD *)(v28 + 824) = v5 + (int)v29;
v11 = *((_DWORD *)this + 165);
break;
case 2u:
v24 = GameManager::sharedState(v12);
*(_DWORD *)(v24 + 844) = v5;
v25 = v24;
v26 = (float)((float)rand() * 4.6566e-10) * 1000.0;
*(_DWORD *)(v25 + 840) = (int)v26;
*(_DWORD *)(v25 + 836) = v5 + (int)v26;
v11 = *((_DWORD *)this + 165);
break;
case 0u:
v21 = GameManager::sharedState(v12);
*(_DWORD *)(v21 + 820) = v5;
v22 = v21;
v23 = (float)((float)rand() * 4.6566e-10) * 1000.0;
*(_DWORD *)(v22 + 816) = (int)v23;
*(_DWORD *)(v22 + 812) = v5 + (int)v23;
v11 = *((_DWORD *)this + 165);
break;
}
v13 = cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)this + 87), v11);
v14 = a2;
v15 = *((cocos2d::CCNode **)this + 69);
v16 = *(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 192LL);
v17 = *((cocos2d::CCNode **)this + 73);
v18 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v13 + 184LL);
v19 = (const cocos2d::CCPoint *)v16(v14);
cocos2d::CCNode::convertToWorldSpace(&v30, v15, v19);
cocos2d::CCNode::convertToNodeSpace(&v31, v17, (const cocos2d::CCPoint *)&v30);
v18(v13, &v31);
CharacterColorPage::updateIconColors((cocos2d::CCArray **)this);
}
}
return _stack_chk_guard;
}