//
// CharacterColorPage::onMode from 0x1400a1e30 to 0x1400a20df (687 bytes)
//
// 2 xrefs:
// > CharacterColorPage::init @ 0x1400a1154
// > ??> @ 0x1409130d0
//
// 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::onMode(__int64 a1, __int64 a2)
{
unsigned int v3; // ebx
__int64 v4; // rcx
char *v5; // r14
_QWORD *v6; // rax
int v7; // r9d
__int64 v8; // rax
__int64 DialogLayer; // rsi
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // rdi
__int64 v13; // rbx
__int64 v14; // rax
__int16 v15; // [rsp+30h] [rbp-49h] BYREF
char v16; // [rsp+32h] [rbp-47h]
__int128 *v17; // [rsp+40h] [rbp-39h] BYREF
char v18[16]; // [rsp+48h] [rbp-31h] BYREF
__int64 v19; // [rsp+58h] [rbp-21h]
__int64 v20; // [rsp+60h] [rbp-19h]
__int128 v21; // [rsp+68h] [rbp-11h] BYREF
__int64 v22; // [rsp+78h] [rbp-1h]
__int64 v23; // [rsp+80h] [rbp+7h]
_BYTE v24[8]; // [rsp+88h] [rbp+Fh] BYREF
__int128 v25; // [rsp+90h] [rbp+17h]
__int64 v26; // [rsp+A0h] [rbp+27h]
__int64 v27; // [rsp+A8h] [rbp+2Fh]
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
if ( v3 != 2 )
goto LABEL_6;
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v17 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
if ( (unsigned __int8)GameManager::isIconUnlocked(v4, 2, 99) )
{
LABEL_6:
CharacterColorPage::updateColorMode(a1, v3);
}
else
{
v25 = 0;
v5 = (char *)sub_14003D460(0x40u);
*(_QWORD *)&v25 = v5;
v26 = 61;
v27 = 63;
strcpy(v5, "Complete 10 Map Packs to unlock Glow.");
v17 = &v21;
v15 = -1;
v16 = -1;
v21 = 0;
v22 = 0;
v23 = 0;
v6 = sub_14003D460(0x40u);
*(_QWORD *)&v21 = v6;
v22 = 61;
v23 = 63;
*(_OWORD *)v6 = *(_OWORD *)v5;
*((_OWORD *)v6 + 1) = *((_OWORD *)v5 + 1);
*((_OWORD *)v6 + 2) = *((_OWORD *)v5 + 2);
v6[6] = *((_QWORD *)v5 + 6);
*((_DWORD *)v6 + 14) = *((_DWORD *)v5 + 14);
*((_WORD *)v6 + 30) = *((_WORD *)v5 + 30);
v18[15] = 0;
v19 = 14;
v20 = 15;
strcpy(v18, "The Shopkeeper");
v8 = DialogObject::create((unsigned int)v18, (unsigned int)&v21, 5, v7, 0, (__int64)&v15);
DialogLayer = DialogLayer::createDialogLayer(v8, 0, 2);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
DialogLayer,
100);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v17);
v12 = **(_QWORD **)(DialogLayer + 560);
v13 = *(_QWORD *)(DialogLayer + 560);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, *(float *)&v17 * 0.5, *((float *)&v17 + 1) * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v12 + 184))(v13, v14);
DialogLayer::animateInRandomSide(DialogLayer);
j_j_free(v5);
}
}