//
// HSVWidgetPopup::init from 0x10042f620 to 0x10042f962 (834 bytes)
//
// 1 xrefs:
// > HSVWidgetPopup::create @ 0x10042f5af
//
// 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 __fastcall HSVWidgetPopup::init(__int64 a1, cocos2d::ccHSVValue a2, __int64 a3, std::string *a4)
{
bool result; // al
cocos2d::extension::CCScale9Sprite *v7; // r12
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v8; // al
const char *data; // r15
cocos2d::CCLabelBMFont *v10; // r15
cocos2d::CCMenu *v11; // rax
ButtonSprite *v12; // rax
CCMenuItemSpriteExtra *v13; // rax
__int64 v14; // r15
ConfigureHSVWidget *v15; // r15
__int64 v16; // rbx
__int64 v17; // [rsp+0h] [rbp-60h]
float v18[4]; // [rsp+1Ch] [rbp-44h] BYREF
float v19; // [rsp+2Ch] [rbp-34h] BYREF
float v20; // [rsp+30h] [rbp-30h]
bool v21; // [rsp+37h] [rbp-29h]
cocos2d::CCRect v22; // 0:xmm0_8.8,8:xmm1_8.8
v17 = *(_QWORD *)&a2.h;
result = FLAlertLayer::init_1((FLAlertLayer *)a1, 200);
if ( !result )
return result;
v21 = result;
*(_QWORD *)(a1 + 640) = a3;
*(_BYTE *)(a1 + 588) = 1;
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v19);
v22.origin = 0;
v22.size = 0;
sub_10028CC00((__int64)v18, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v7 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v22);
sub_10028CBF0(v18, 360.0, 250.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float *))v7->setContentSize)(v7, v18);
(*(void (__fastcall **)(_QWORD, cocos2d::extension::CCScale9Sprite *, __int64))(**(_QWORD **)(a1 + 576) + 448LL))(
*(_QWORD *)(a1 + 576),
v7,
0xFFFFFFFFLL);
sub_10028CBE0(v18, v19 * 0.5, v20 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float *))v7->setPosition)(v7, v18);
v8 = a4->__r_.__value_.__s.0;
if ( (*(_BYTE *)&a4->__r_.__value_.__s.0 & 1) != 0 )
{
if ( !a4->__r_.__value_.__l.__size_ )
goto LABEL_8;
}
else if ( !(*(unsigned __int8 *)&v8 >> 1) )
{
LABEL_8:
std::string::assign(a4, "Setup HSV");
if ( (*(_BYTE *)&a4->__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_9;
goto LABEL_7;
}
if ( (*(_BYTE *)&v8 & 1) != 0 )
{
LABEL_9:
data = a4->__r_.__value_.__l.__data_;
goto LABEL_10;
}
LABEL_7:
data = a4->__r_.__value_.__s.__data_;
LABEL_10:
v10 = cocos2d::CCLabelBMFont::create_3(data, "goldFont.fnt");
sub_10028CBE0(v18, v19 * 0.5, (float)((float)(v20 * 0.5) + 125.0) + -23.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float *))v10->setPosition)(v10, v18);
(*(void (__fastcall **)(_QWORD, cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 576) + 440LL))(
*(_QWORD *)(a1 + 576),
v10);
v11 = cocos2d::CCMenu::create();
*(_QWORD *)(a1 + 544) = v11;
(*(void (__fastcall **)(_QWORD, cocos2d::CCMenu *))(**(_QWORD **)(a1 + 576) + 440LL))(*(_QWORD *)(a1 + 576), v11);
v12 = sub_100092A60("OK", 90, 0, 0, 1.0);
v13 = CCMenuItemSpriteExtra::create(
v12,
nullptr,
(cocos2d::CCObject *)a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)HSVWidgetPopup::onClose);
(*(void (__fastcall **)(_QWORD, CCMenuItemSpriteExtra *))(**(_QWORD **)(a1 + 544) + 440LL))(
*(_QWORD *)(a1 + 544),
v13);
v14 = *(_QWORD *)(a1 + 544);
sub_10028CBE0(v18, v19 * 0.5, (float)((float)(v20 * 0.5) + -125.0) + 25.0);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v14 + 184LL))(v14, v18);
v15 = (ConfigureHSVWidget *)operator new(0x1A8u);
cocos2d::CCNode::CCNode((__int64)v15);
v15->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (ConfigureHSVWidget_vtbl *)off_1009361C8;
v15->TextInputDelegate::__vftable = (TextInputDelegate_vtbl *)off_100936560;
v15->m_mixed = 0;
v15->m_delegate = nullptr;
*(_WORD *)&v15->m_addInputs = 0;
v15->m_inputs = nullptr;
*(_QWORD *)&a2.h = v17;
if ( ConfigureHSVWidget::init(v15, a2, 0, 1) )
{
cocos2d::CCObject::autorelease(v15);
}
else
{
((void (__fastcall *)(ConfigureHSVWidget *))v15->~ConfigureHSVWidget_0)(v15);
v15 = nullptr;
}
*(_QWORD *)(a1 + 632) = v15;
(*(void (__fastcall **)(_QWORD, ConfigureHSVWidget *, __int64))(**(_QWORD **)(a1 + 576) + 448LL))(
*(_QWORD *)(a1 + 576),
v15,
1);
v16 = *(_QWORD *)(a1 + 632);
sub_10028CBE0(v18, v19 * 0.5, 0.5 * v20);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v16 + 184LL))(v16, v18);
return v21;
}