//
// ConfigureHSVWidget::init from 0x8e180c to 0x8e217c (2416 bytes)
//
// 2 xrefs:
// > ConfigureHSVWidget::create @ 0x8e2220
// > ??> @ 0xa14d8
//
// 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
//
bool ConfigureHSVWidget::init(ConfigureHSVWidget *a1, cocos2d::ccHSVValue a2, bool a3, bool a4)
{
__int64 v4; // x21
__int64 v5; // x20
_BOOL4 v7; // w23
bool v9; // w24
cocos2d::CCDictionary *v11; // x0
cocos2d::CCLabelBMFont *v12; // x0
cocos2d::CCLabelBMFont *m_hueLabel; // x21
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
Slider *v15; // x0
Slider *m_hueSlider; // x26
void (__fastcall *v17)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
const cocos2d::CCPoint *v18; // x28
SliderThumb *Thumb; // x0
cocos2d::CCLabelBMFont *v20; // x0
cocos2d::CCLabelBMFont *m_saturationLabel; // x26
void (__fastcall *v22)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
const cocos2d::CCPoint *v23; // x0
Slider *v24; // x0
Slider *m_saturationSlider; // x26
void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
const cocos2d::CCPoint *v27; // x28
SliderThumb *v28; // x0
cocos2d::CCLabelBMFont *v29; // x0
cocos2d::CCLabelBMFont *m_brightnessLabel; // x26
void (__fastcall *v31)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
const cocos2d::CCPoint *v32; // x0
Slider *v33; // x0
Slider *m_brightnessSlider; // x25
void (__fastcall *v35)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
const cocos2d::CCPoint *v36; // x27
SliderThumb *v37; // x0
cocos2d::CCMenu *v38; // x25
cocos2d::CCDirector *v39; // x0
cocos2d::CCTouchDispatcher *v40; // x0
const cocos2d::CCPoint *v41; // x0
void *v42; // x0
const cocos2d::CCPoint *v43; // x0
void *v44; // x23
cocos2d::CCSprite *v45; // x0
CCMenuItemSpriteExtra *v46; // x23
void (__fastcall *v47)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *setTouchPriority)(cocos2d::CCLayer *__hidden, int); // x26
cocos2d::CCDirector *v49; // x0
__int64 v50; // x0
const cocos2d::CCPoint *v51; // x26
const cocos2d::CCPoint *v52; // x25
cocos2d::CCNode *v53; // x21
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x23
const cocos2d::CCPoint *v55; // x26
unsigned int *v56; // x28
int v57; // w0
unsigned int *v58; // x1
int v59; // w2
bool absoluteSaturation; // [xsp+BCh] [xbp+8Ch]
bool absoluteBrightness; // [xsp+BCh] [xbp+8Ch]
cocos2d::CCPoint v62; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v63; // [xsp+D8h] [xbp+A8h] BYREF
cocos2d::CCPoint v64; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCRect v65; // [xsp+E8h] [xbp+B8h] BYREF
cocos2d::CCPoint v66; // 0:kr00_8.8
cocos2d::SEL_MenuHandler v67; // 0:x1.16
cocos2d::SEL_MenuHandler v68; // 0:x1.16
cocos2d::SEL_MenuHandler v69; // 0:x1.16
cocos2d::SEL_MenuHandler v70; // 0:x2.16
cocos2d::CCPoint v71; // 0:s0.4,4:s1.4
cocos2d::CCPoint v72; // 0:s0.4,4:s1.4
cocos2d::CCPoint v73; // 0:s0.4,4:s1.4
cocos2d::CCRect v74; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v4 = *(_QWORD *)&a2.v;
v5 = *(_QWORD *)&a2.h;
v7 = a3;
v9 = cocos2d::CCNode::init(a1);
if ( v9 )
{
a1->m_updating = (unsigned __int8)&dword_0 + 1;
v11 = cocos2d::CCDictionary::create();
a1->m_inputs = v11;
cocos2d::CCObject::retain(v11);
*(_QWORD *)&a1->m_hsv.h = v5;
*(_QWORD *)&a1->m_hsv.v = v4;
a1->m_addInputs = a4;
if ( !v7 )
{
cocos2d::CCRect::CCRect(&v65, 0.0, 0.0, 80.0, 80.0);
v53 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_001.png",
(const char *)&v65,
v74);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v53->__vftable[1].~CCNode_0)(v53, 75);
setContentSize = v53->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v65, 270.0, 160.0);
setContentSize(v53, (const cocos2d::CCSize *)&v65);
a1->addChild_0(a1, v53, -1);
}
v12 = cocos2d::CCLabelBMFont::create();
a1->m_hueLabel = v12;
a1->addChild(a1, v12);
a1->m_hueLabel->setScale(a1->m_hueLabel, 0.5);
m_hueLabel = a1->m_hueLabel;
setPosition = m_hueLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v65.origin, 0.0, 66.0);
setPosition(m_hueLabel, &v65.origin);
if ( a1->m_addInputs )
{
v52 = a1->m_hueLabel->getPosition(a1->m_hueLabel);
cocos2d::CCPoint::CCPoint(&v64, -10.0, 0.0);
cocos2d::CCPoint::operator+(&v65, v52, &v64);
ConfigureHSVWidget::createTextInputNode(a1, v72, (int)&v65);
}
v67.adj = 0;
v67.ptr = (void (__cdecl *)(cocos2d::CCObject *))ConfigureHSVWidget::sliderChanged;
v15 = Slider::create(a1, v67);
a1->m_hueSlider = v15;
Slider::setBarVisibility(v15, 0);
a1->addChild(a1, a1->m_hueSlider);
m_hueSlider = a1->m_hueSlider;
v17 = m_hueSlider->setPosition;
v18 = a1->m_hueLabel->getPosition(a1->m_hueLabel);
cocos2d::CCPoint::CCPoint(&v64, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v65, v18, &v64);
v17(m_hueSlider, &v65.origin);
Thumb = Slider::getThumb(a1->m_hueSlider);
Thumb->setTag(Thumb, 1);
v20 = cocos2d::CCLabelBMFont::create();
a1->m_saturationLabel = v20;
a1->addChild(a1, v20);
a1->m_saturationLabel->setScale(a1->m_saturationLabel, 0.5);
m_saturationLabel = a1->m_saturationLabel;
v22 = m_saturationLabel->setPosition;
v23 = a1->m_hueLabel->getPosition(a1->m_hueLabel);
cocos2d::CCPoint::CCPoint(&v65.origin, 0.0, v23->y - 50.0);
v22(m_saturationLabel, &v65.origin);
if ( a1->m_addInputs )
{
v51 = a1->m_saturationLabel->getPosition(a1->m_saturationLabel);
cocos2d::CCPoint::CCPoint(&v64, 22.0, 0.0);
cocos2d::CCPoint::operator+(&v65, v51, &v64);
ConfigureHSVWidget::createTextInputNode(a1, v71, (int)&v65);
}
v68.ptr = (void (__cdecl *)(cocos2d::CCObject *))ConfigureHSVWidget::sliderChanged;
v68.adj = 0;
v24 = Slider::create(a1, v68);
a1->m_saturationSlider = v24;
Slider::setBarVisibility(v24, 0);
a1->addChild(a1, a1->m_saturationSlider);
m_saturationSlider = a1->m_saturationSlider;
v26 = m_saturationSlider->setPosition;
v27 = a1->m_saturationLabel->getPosition(a1->m_saturationLabel);
cocos2d::CCPoint::CCPoint(&v64, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v65, v27, &v64);
v26(m_saturationSlider, &v65.origin);
v28 = Slider::getThumb(a1->m_saturationSlider);
v28->setTag(v28, 2);
v29 = cocos2d::CCLabelBMFont::create();
a1->m_brightnessLabel = v29;
a1->addChild(a1, v29);
a1->m_brightnessLabel->setScale(a1->m_brightnessLabel, 0.5);
m_brightnessLabel = a1->m_brightnessLabel;
v31 = m_brightnessLabel->setPosition;
v32 = a1->m_saturationLabel->getPosition(a1->m_saturationLabel);
cocos2d::CCPoint::CCPoint(&v65.origin, 0.0, v32->y - 50.0);
v31(m_brightnessLabel, &v65.origin);
if ( a1->m_addInputs )
{
v55 = a1->m_brightnessLabel->getPosition(a1->m_brightnessLabel);
cocos2d::CCPoint::CCPoint(&v64, 22.0, 0.0);
cocos2d::CCPoint::operator+(&v65, v55, &v64);
ConfigureHSVWidget::createTextInputNode(a1, v73, (int)&v65);
}
v69.ptr = (void (__cdecl *)(cocos2d::CCObject *))ConfigureHSVWidget::sliderChanged;
v69.adj = 0;
v33 = Slider::create(a1, v69);
a1->m_brightnessSlider = v33;
Slider::setBarVisibility(v33, 0);
a1->addChild(a1, a1->m_brightnessSlider);
m_brightnessSlider = a1->m_brightnessSlider;
v35 = m_brightnessSlider->setPosition;
v36 = a1->m_brightnessLabel->getPosition(a1->m_brightnessLabel);
cocos2d::CCPoint::CCPoint(&v64, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v65, v36, &v64);
v35(m_brightnessSlider, &v65.origin);
v37 = Slider::getThumb(a1->m_brightnessSlider);
v37->setTag(v37, 3);
v38 = cocos2d::CCMenu::create();
a1->addChild(a1, v38);
v39 = cocos2d::CCDirector::sharedDirector();
v40 = v39->getTouchDispatcher(v39);
if ( cocos2d::CCTouchDispatcher::isUsingForcePrio(v40) )
{
setTouchPriority = v38->setTouchPriority;
v49 = cocos2d::CCDirector::sharedDirector();
v50 = (__int64)v49->getTouchDispatcher(v49);
setTouchPriority(v38, *(_DWORD *)(v50 + 124) - 1);
}
cocos2d::CCPoint::CCPoint(&v62, -95.0, 0.0);
sub_D153B8((int)&v65, " ");
absoluteSaturation = a1->m_hsv.absoluteSaturation;
v41 = a1->m_saturationLabel->getPosition(a1->m_saturationLabel);
cocos2d::CCPoint::operator+(&v63, v41, &v62);
cocos2d::CCPoint::CCPoint(&v64, 0.0, 1.0);
GameToolbox::createToggleButton(
0.6,
0.4,
150.0,
(__int64)&v65,
(void (__cdecl *)(cocos2d::CCObject *))ConfigureHSVWidget::onToggleSConst,
0,
absoluteSaturation,
v38,
&v63,
a1,
a1,
(float *)&v64,
(__int64)"bigFont.fnt",
1,
0,
nullptr);
v42 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v42);
}
sub_D153B8((int)&v65, " ");
absoluteBrightness = a1->m_hsv.absoluteBrightness;
v43 = a1->m_brightnessLabel->getPosition(a1->m_brightnessLabel);
cocos2d::CCPoint::operator+(&v63, v43, &v62);
cocos2d::CCPoint::CCPoint(&v64, 0.0, 1.0);
GameToolbox::createToggleButton(
0.6,
0.4,
150.0,
(__int64)&v65,
(void (__cdecl *)(cocos2d::CCObject *))ConfigureHSVWidget::onToggleVConst,
0,
absoluteBrightness,
v38,
&v63,
a1,
a1,
(float *)&v64,
(__int64)"bigFont.fnt",
1,
0,
nullptr);
v44 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v44);
}
if ( a1->m_hsv.h == -0.001 )
{
ConfigureHSVWidget::onResetHSV(a1, nullptr);
if ( !a1->m_addInputs )
{
a1->m_hueLabel->setString(a1->m_hueLabel, "Hue: Mixed");
a1->m_saturationLabel->setString(a1->m_saturationLabel, "Saturation: Mixed");
a1->m_brightnessLabel->setString(a1->m_brightnessLabel, "Brightness: Mixed");
}
a1->m_mixed = 1;
}
else
{
ConfigureHSVWidget::updateLabels(a1);
}
v45 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_resetBtn_001.png");
v70.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v70.adj = (size_t)ConfigureHSVWidget::onResetHSV;
v46 = CCMenuItemSpriteExtra::create(v45, nullptr, v70);
v38->addChild(v38, v46);
v47 = v46->setPosition;
cocos2d::CCPoint::CCPoint(&v64, 119.0, 64.0);
v66 = cocos2d::CCNode::convertToNodeSpace(v38, &v64);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v47)(v46, &v65, v66.x, v66.y);
ConfigureHSVWidget::updateSliders(a1);
a1->m_updating = 0;
}
return v9;
}