//
// CharacterColorPage::onMode from 0xa24b9c to 0xa24e54 (696 bytes)
//
// 3 xrefs:
// > ??> @ 0xa9380
// > CharacterColorPage::init @ 0xa25cf4
// > ??> @ 0x122ddb8
//
// 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 CharacterColorPage::onMode(CharacterColorPage *a1, cocos2d::CCObject *a2)
{
int v3; // w20
GameManager *v4; // x0
DialogObject *v5; // x0
DialogLayer *v6; // x23
void *v7; // x0
void *v8; // x0
void *v9; // x0
unsigned int *v10; // x1
int v11; // w2
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
__int64 v16; // [xsp+50h] [xbp+50h] BYREF
__int64 v17; // [xsp+58h] [xbp+58h] BYREF
__int64 v18; // [xsp+60h] [xbp+60h] BYREF
v3 = a2->getTag(a2);
if ( v3 != 2 || (v4 = GameManager::sharedState(), GameManager::isIconUnlocked(v4, 2, Special)) )
{
CharacterColorPage::updateColorMode(a1, v3);
}
else
{
sub_D153B8((int)&v16, "Complete 10 Map Packs to unlock Glow.");
sub_D153B8((int)&v17, "The Shopkeeper");
sub_D18D28(&v18);
v5 = (DialogObject *)DialogObject::create(1.0, (__int64)&v17, (__int64)&v18, 5, 0, (int)&unk_FFFFFF);
v6 = DialogLayer::create(v5, (int)&dword_0 + 2);
v7 = (void *)(v18 - 24);
if ( (__int64 *)(v18 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v18 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v7);
}
v8 = (void *)(v17 - 24);
if ( (__int64 *)(v17 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v17 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v8);
}
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v6, 100);
DialogLayer::updateChatPlacement(v6, Center);
DialogLayer::animateInRandomSide(v6);
v9 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v16 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v9);
}
}
}