//
// ColorSelectPopup::textChanged from 0x100420508 to 0x10042083c (820 bytes)
//
// 2 xrefs:
// > sub_10042090C @ 0x100420910
// > ??> @ 0x1008241e8
//
// 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 __fastcall ColorSelectPopup::textChanged(ColorSelectPopup *a1, CCTextInputNode *a2)
{
int v4; // w0
int v5; // w21
double v6; // d8
char *v7; // x22
GLubyte v8; // w21
int v9; // w0
int m_colorID; // w0
int m_copyColorID; // w0
__int16 v12; // w8
char *v13; // x20
int v14; // w8
size_t v15; // x21
int v16; // w0
char *v17; // x20
float v18; // s0
cocos2d::CCString *v19; // x0
float v20; // s0
float v21; // s1
_BOOL4 v22; // w8
_BOOL4 v23; // w9
char *v24; // x20
int v25; // w8
void *__p[2]; // [xsp+10h] [xbp-60h] BYREF
char v27; // [xsp+27h] [xbp-49h]
char __s[8]; // [xsp+28h] [xbp-48h] BYREF
char v29; // [xsp+3Fh] [xbp-31h]
if ( !a1->m_disableTextDelegate )
{
v4 = ((__int64 (__fastcall *)(CCTextInputNode *))a2->getTag)(a2);
if ( v4 > 7 )
{
if ( (unsigned int)(v4 - 8) < 3 )
{
CCTextInputNode::getString((__int64)a2, __s);
if ( v29 < 0 )
{
v7 = *(char **)__s;
v5 = atoi(*(const char **)__s);
operator delete(v7);
}
else
{
v5 = atoi(__s);
}
if ( (v5 & ~(v5 >> 31)) >= 255 )
v8 = -1;
else
v8 = v5 & ~(v5 >> 31);
v9 = ((__int64 (__fastcall *)(CCTextInputNode *))a2->getTag)(a2);
switch ( v9 )
{
case 10:
a1->m_currentColor.b = v8;
break;
case 9:
a1->m_currentColor.g = v8;
break;
case 8:
a1->m_currentColor.r = v8;
break;
}
v12 = *(_WORD *)&a1->m_currentColor.r;
__s[2] = a1->m_currentColor.b;
*(_WORD *)__s = v12;
LABEL_30:
((void (__fastcall *)(cocos2d::extension::CCControlColourPicker *, char *))a1->m_colorPicker->setColorValue)(
a1->m_colorPicker,
__s);
return;
}
if ( v4 != 11 )
return;
CCTextInputNode::getString((__int64)a1->m_hexInput, __s);
if ( v29 < 0 )
{
v15 = strlen(*(const char **)__s);
operator delete(*(void **)__s);
if ( v15 != 6 )
return;
}
else if ( strlen(__s) != 6 )
{
return;
}
CCTextInputNode::getString((__int64)a1->m_hexInput, __p);
v16 = ColorSelectPopup::hexToColor((const char *)__p);
*(_WORD *)&a1->m_currentColor.r = v16;
a1->m_currentColor.b = BYTE2(v16);
if ( v27 < 0 )
{
operator delete(__p[0]);
v16 = *(unsigned __int16 *)&a1->m_currentColor.r | (a1->m_currentColor.b << 16);
}
*(_WORD *)__s = v16;
__s[2] = BYTE2(v16);
goto LABEL_30;
}
switch ( v4 )
{
case 3:
CCTextInputNode::getString((__int64)a2, __s);
if ( v29 < 0 )
{
v13 = *(char **)__s;
a1->m_colorID = atoi(*(const char **)__s);
operator delete(v13);
m_colorID = a1->m_colorID;
}
else
{
m_colorID = atoi(__s);
a1->m_colorID = m_colorID;
}
v14 = m_colorID & ~(m_colorID >> 31);
if ( v14 >= 999 )
v14 = 999;
a1->m_colorID = v14;
ColorSelectPopup::updateCustomColorIdx(a1);
SetupTriggerPopup::updateEditorLabel(a1);
break;
case 4:
CCTextInputNode::getString((__int64)a2, __s);
if ( v29 < 0 )
{
v24 = *(char **)__s;
a1->m_copyColorID = atoi(*(const char **)__s);
operator delete(v24);
m_copyColorID = a1->m_copyColorID;
}
else
{
m_copyColorID = atoi(__s);
a1->m_copyColorID = m_copyColorID;
}
v25 = m_copyColorID & ~(m_copyColorID >> 31);
if ( v25 >= 999 )
v25 = 999;
a1->m_copyColorID = v25;
ColorSelectPopup::updateCopyColor(a1);
break;
case 5:
CCTextInputNode::getString((__int64)a2, __s);
if ( v29 < 0 )
{
v17 = *(char **)__s;
v6 = atof(*(const char **)__s);
operator delete(v17);
}
else
{
v6 = atof(__s);
}
v18 = v6;
v19 = (cocos2d::CCString *)sub_100268F4C("%.02f", v18);
a1->m_fadeTime = cocos2d::CCString::floatValue(v19);
ColorSelectPopup::updateDuration(a1);
v20 = a1->m_fadeTime / 10.0;
v21 = 1.0;
v22 = v20 >= 1.0;
v23 = v20 > 0.0 || v20 >= 1.0;
if ( v20 <= 0.0 )
v22 = 1;
if ( !v23 )
v21 = 0.0;
if ( v22 )
v20 = v21;
Slider::setValue(a1->m_fadeTimeSlider, v20);
break;
}
}
}