//
// ConfigureHSVWidget::init from 0x4b70b0 to 0x4b76b2 (1538 bytes)
//
// 1 xrefs:
// > ConfigureHSVWidget::create @ 0x4b7750
//
// 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)
{
cocos2d::CCDictionary *v5; // r0
float s; // r1
float v; // r2
cocos2d::CCNode *v8; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r7
cocos2d::CCLabelBMFont *v10; // r0
ConfigureHSVWidget_vtbl *v11; // r3
cocos2d::CCLabelBMFont *m_hueLabel; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
const cocos2d::CCPoint *v14; // r7
cocos2d::CCPoint v15; // r1
int v16; // r3
Slider *v17; // r0
Slider *m_hueSlider; // r8
void (__fastcall *v19)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
const cocos2d::CCPoint *v20; // r11
SliderThumb *Thumb; // r0
cocos2d::CCLabelBMFont *v22; // r0
ConfigureHSVWidget_vtbl *v23; // r3
cocos2d::CCLabelBMFont *m_saturationLabel; // r8
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
const cocos2d::CCPoint *v26; // r0
const cocos2d::CCPoint *v27; // r8
cocos2d::CCPoint v28; // r1
int v29; // r3
Slider *v30; // r0
Slider *m_saturationSlider; // r8
void (__fastcall *v32)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
const cocos2d::CCPoint *v33; // r11
SliderThumb *v34; // r0
cocos2d::CCLabelBMFont *v35; // r0
ConfigureHSVWidget_vtbl *v36; // r3
cocos2d::CCLabelBMFont *m_brightnessLabel; // r8
void (__fastcall *v38)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
const cocos2d::CCPoint *v39; // r0
const cocos2d::CCPoint *v40; // r8
cocos2d::CCPoint v41; // r1
int v42; // r3
Slider *v43; // r0
Slider *m_brightnessSlider; // r7
void (__fastcall *v45)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
const cocos2d::CCPoint *v46; // r9
SliderThumb *v47; // r0
cocos2d::CCMenu *v48; // r8
cocos2d::CCDirector *v49; // r0
cocos2d::CCTouchDispatcher *v50; // r0
void (__fastcall *setTouchPriority)(cocos2d::CCLayer *__hidden, int); // r7
cocos2d::CCDirector *v52; // r0
int v53; // r0
cocos2d::CCLabelBMFont *v54; // r0
bool absoluteSaturation; // r11
int v56; // r0
cocos2d::CCLabelBMFont *v57; // r0
bool absoluteBrightness; // r11
int v59; // r0
cocos2d::CCSprite *v60; // r0
CCMenuItemSpriteExtra *v61; // r6
void (__fastcall *v62)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
float v64; // r2
float v65; // r3
_BOOL4 v66; // [sp+38h] [bp-9Ch]
cocos2d::CCPoint v67; // [sp+44h] [bp-90h] BYREF
cocos2d::CCPoint v68; // [sp+4Ch] [bp-88h] BYREF
cocos2d::CCPoint v69; // [sp+54h] [bp-80h] BYREF
void (*v70)(ConfigureHSVWidget *, cocos2d::CCObject *); // [sp+5Ch] [bp-78h]
int v71; // [sp+60h] [bp-74h]
void (*v72)(ConfigureHSVWidget *, cocos2d::CCObject *); // [sp+64h] [bp-70h]
int v73; // [sp+68h] [bp-6Ch]
void (*v74)(ConfigureHSVWidget *, cocos2d::CCObject *); // [sp+6Ch] [bp-68h]
int v75; // [sp+70h] [bp-64h]
void (*v76)(ConfigureHSVWidget *, cocos2d::CCObject *); // [sp+74h] [bp-60h]
unsigned int v77; // [sp+78h] [bp-5Ch]
cocos2d::CCPoint v78; // [sp+7Ch] [bp-58h] BYREF
cocos2d::CCRect v79; // [sp+84h] [bp-50h] BYREF
cocos2d::CCSize v80; // 0:^0.8
cocos2d::CCRect v81; // 0:kr00_16.16
v66 = cocos2d::CCNode::init(a1);
if ( v66 )
{
a1->m_updating = 1;
v5 = cocos2d::CCDictionary::create();
a1->m_inputs = v5;
cocos2d::CCObject::retain(v5);
s = a2.s;
v = a2.v;
a1->m_hsv.h = a2.h;
a1->m_hsv.s = s;
a1->m_hsv.v = v;
*(_DWORD *)&a1->m_hsv.absoluteSaturation = *(_DWORD *)&a2.absoluteSaturation;
a1->m_addInputs = a4;
if ( !a3 )
{
cocos2d::CCRect::CCRect(&v79, 0.0, 0.0, 80.0, 80.0);
v81.origin.x = v64;
v81.origin.y = v65;
v81.size = v80;
v8 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_001.png",
(const char *)&v79,
v81);
((void (__fastcall *)(cocos2d::CCNode *, int))v8->__vftable[1].~CCNode_0)(v8, 75);
setContentSize = v8->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v79, 270.0, 160.0);
setContentSize(v8, (const cocos2d::CCSize *)&v79);
a1->addChild_0(a1, v8, -1);
}
v10 = cocos2d::CCLabelBMFont::create();
v11 = a1->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_hueLabel = v10;
v11->addChild(a1, v10);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_hueLabel->setScale)(a1->m_hueLabel, 1056964608);
m_hueLabel = a1->m_hueLabel;
setPosition = m_hueLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v79.origin, 0.0, 66.0);
setPosition(m_hueLabel, &v79.origin);
if ( a1->m_addInputs )
{
v14 = a1->m_hueLabel->getPosition(a1->m_hueLabel);
cocos2d::CCPoint::CCPoint(&v78, -10.0, 0.0);
cocos2d::CCPoint::operator+(&v79, v14, &v78);
LODWORD(v15.x) = &v79;
LODWORD(v15.y) = 1;
ConfigureHSVWidget::createTextInputNode(a1, v15, v16);
}
v71 = 0;
v70 = ConfigureHSVWidget::sliderChanged;
v17 = Slider::create(a1, (cocos2d::SEL_MenuHandler)(unsigned int)ConfigureHSVWidget::sliderChanged);
a1->m_hueSlider = v17;
Slider::setBarVisibility(v17, 0);
a1->addChild(a1, a1->m_hueSlider);
m_hueSlider = a1->m_hueSlider;
v19 = m_hueSlider->setPosition;
v20 = a1->m_hueLabel->getPosition(a1->m_hueLabel);
cocos2d::CCPoint::CCPoint(&v78, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v79, v20, &v78);
v19(m_hueSlider, &v79.origin);
Thumb = Slider::getThumb(a1->m_hueSlider);
Thumb->setTag(Thumb, 1);
v22 = cocos2d::CCLabelBMFont::create();
v23 = a1->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_saturationLabel = v22;
v23->addChild(a1, v22);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_saturationLabel->setScale)(
a1->m_saturationLabel,
1056964608);
m_saturationLabel = a1->m_saturationLabel;
v25 = m_saturationLabel->setPosition;
v26 = a1->m_hueLabel->getPosition(a1->m_hueLabel);
cocos2d::CCPoint::CCPoint(&v79.origin, 0.0, v26->y - 50.0);
v25(m_saturationLabel, &v79.origin);
if ( a1->m_addInputs )
{
v27 = a1->m_saturationLabel->getPosition(a1->m_saturationLabel);
cocos2d::CCPoint::CCPoint(&v78, 22.0, 0.0);
cocos2d::CCPoint::operator+(&v79, v27, &v78);
LODWORD(v28.x) = &v79;
LODWORD(v28.y) = 2;
ConfigureHSVWidget::createTextInputNode(a1, v28, v29);
}
v72 = ConfigureHSVWidget::sliderChanged;
v73 = 0;
v30 = Slider::create(a1, (cocos2d::SEL_MenuHandler)(unsigned int)ConfigureHSVWidget::sliderChanged);
a1->m_saturationSlider = v30;
Slider::setBarVisibility(v30, 0);
a1->addChild(a1, a1->m_saturationSlider);
m_saturationSlider = a1->m_saturationSlider;
v32 = m_saturationSlider->setPosition;
v33 = a1->m_saturationLabel->getPosition(a1->m_saturationLabel);
cocos2d::CCPoint::CCPoint(&v78, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v79, v33, &v78);
v32(m_saturationSlider, &v79.origin);
v34 = Slider::getThumb(a1->m_saturationSlider);
v34->setTag(v34, 2);
v35 = cocos2d::CCLabelBMFont::create();
v36 = a1->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_brightnessLabel = v35;
v36->addChild(a1, v35);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_brightnessLabel->setScale)(
a1->m_brightnessLabel,
1056964608);
m_brightnessLabel = a1->m_brightnessLabel;
v38 = m_brightnessLabel->setPosition;
v39 = a1->m_saturationLabel->getPosition(a1->m_saturationLabel);
cocos2d::CCPoint::CCPoint(&v79.origin, 0.0, v39->y - 50.0);
v38(m_brightnessLabel, &v79.origin);
if ( a1->m_addInputs )
{
v40 = a1->m_brightnessLabel->getPosition(a1->m_brightnessLabel);
cocos2d::CCPoint::CCPoint(&v78, 22.0, 0.0);
cocos2d::CCPoint::operator+(&v79, v40, &v78);
LODWORD(v41.x) = &v79;
LODWORD(v41.y) = 3;
ConfigureHSVWidget::createTextInputNode(a1, v41, v42);
}
v74 = ConfigureHSVWidget::sliderChanged;
v75 = 0;
v43 = Slider::create(a1, (cocos2d::SEL_MenuHandler)(unsigned int)ConfigureHSVWidget::sliderChanged);
a1->m_brightnessSlider = v43;
Slider::setBarVisibility(v43, 0);
a1->addChild(a1, a1->m_brightnessSlider);
m_brightnessSlider = a1->m_brightnessSlider;
v45 = m_brightnessSlider->setPosition;
v46 = a1->m_brightnessLabel->getPosition(a1->m_brightnessLabel);
cocos2d::CCPoint::CCPoint(&v78, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v79, v46, &v78);
v45(m_brightnessSlider, &v79.origin);
v47 = Slider::getThumb(a1->m_brightnessSlider);
v47->setTag(v47, 3);
v48 = cocos2d::CCMenu::create();
a1->addChild(a1, v48);
v49 = cocos2d::CCDirector::sharedDirector();
v50 = v49->getTouchDispatcher(v49);
if ( cocos2d::CCTouchDispatcher::isUsingForcePrio(v50) )
{
setTouchPriority = v48->setTouchPriority;
v52 = cocos2d::CCDirector::sharedDirector();
v53 = (int)v52->getTouchDispatcher(v52);
setTouchPriority(v48, *(_DWORD *)(v53 + 96) - 1);
}
cocos2d::CCPoint::CCPoint(&v67, -95.0, 0.0);
sub_776584((int)&v69, " ");
v54 = a1->m_saturationLabel;
absoluteSaturation = a1->m_hsv.absoluteSaturation;
v76 = ConfigureHSVWidget::onToggleSConst;
v77 = 0;
v56 = (int)v54->getPosition(v54);
cocos2d::CCPoint::operator+(&v78, v56, &v67);
cocos2d::CCPoint::CCPoint(&v79.origin, 0.0, 1.0);
GameToolbox::createToggleButton(
(int)&v69,
(unsigned int)v76,
v77,
absoluteSaturation,
v48,
&v78,
a1,
a1,
0.6,
0.4,
150.0,
(int)&v79,
(int)"bigFont.fnt",
1,
0,
nullptr);
sub_774008(&v69);
sub_776584((int)&v68, " ");
v57 = a1->m_brightnessLabel;
absoluteBrightness = a1->m_hsv.absoluteBrightness;
LODWORD(v78.x) = ConfigureHSVWidget::onToggleVConst;
v78.y = 0.0;
v59 = (int)v57->getPosition(v57);
cocos2d::CCPoint::operator+(&v69, v59, &v67);
cocos2d::CCPoint::CCPoint(&v79.origin, 0.0, 1.0);
GameToolbox::createToggleButton(
(int)&v68,
LODWORD(v78.x),
LODWORD(v78.y),
absoluteBrightness,
v48,
&v69,
a1,
a1,
0.6,
0.4,
150.0,
(int)&v79,
(int)"bigFont.fnt",
1,
0,
nullptr);
sub_774008(&v68);
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);
}
v60 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_resetBtn_001.png");
v79.origin.y = 0.0;
LODWORD(v79.origin.x) = ConfigureHSVWidget::onResetHSV;
v61 = CCMenuItemSpriteExtra::create(
v60,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(ConfigureHSVWidget::onResetHSV, (unsigned int)a1));
v48->addChild(v48, v61);
v62 = v61->setPosition;
cocos2d::CCPoint::CCPoint(&v68, 119.0, 64.0);
cocos2d::CCNode::convertToNodeSpace(&v69, v48, &v68);
v62(v61, &v69);
ConfigureHSVWidget::updateSliders(a1);
a1->m_updating = 0;
}
return v66;
}