//
// HSVWidgetPopup::init from 0x14012f670 to 0x14012f9da (874 bytes)
//
// 2 xrefs:
// > HSVWidgetPopup::create @ 0x14012f617
// > ??> @ 0x140916dc0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:27:02 +0000
//
// Hidden C++ exception states: #wind=1
char __fastcall HSVWidgetPopup::init(__int64 a1, __int128 *a2, __int16 *a3, __int64 a4, void **a5)
{
__int64 v9; // rcx
__int64 v11; // rax
__int64 v12; // rax
__int64 *v13; // rdi
__int64 v14; // rbx
__int64 v15; // rax
__int64 v16; // rbx
__int64 v17; // rax
const char *v18; // rcx
struct cocos2d::CCLabelBMFont *v19; // rdi
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rax
int v23; // eax
cocos2d::CCObject *v24; // rax
__int64 *v25; // rdi
__int64 v26; // rbx
__int64 v27; // rax
__int64 v28; // r8
__int64 v29; // rdx
__int64 v30; // rax
__int64 *v31; // rdi
__int64 v32; // rbx
__int64 v33; // rax
float v34; // [rsp+40h] [rbp-98h] BYREF
float v35; // [rsp+44h] [rbp-94h]
__int16 v36; // [rsp+50h] [rbp-88h] BYREF
char v37; // [rsp+52h] [rbp-86h]
__int128 v38; // [rsp+60h] [rbp-78h] BYREF
_BYTE v39[16]; // [rsp+70h] [rbp-68h] BYREF
void **v40; // [rsp+80h] [rbp-58h]
v40 = a5;
if ( FLAlertLayer::init_1(a1, 200) )
{
*(_QWORD *)(a1 + 672) = a4;
*(_BYTE *)(a1 + 596) = 1;
v11 = cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(v11, &v34);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v39, 0.0, 0.0, 80.0, 80.0);
v13 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v12);
v14 = *v13;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v38, 360.0, 250.0);
(*(void (__fastcall **)(__int64 *, __int64))(v14 + 312))(v13, v15);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v13,
0xFFFFFFFFLL);
v16 = *v13;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, v34 * 0.5, v35 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v16 + 184))(v13, v17);
if ( !a5[2] )
sub_1400405A0(a5, "Setup HSV", 9u);
v18 = (const char *)a5;
if ( (unsigned __int64)a5[3] > 0xF )
v18 = (const char *)*a5;
v19 = cocos2d::CCLabelBMFont::create(v18, "goldFont.fnt");
v20 = *(_QWORD *)v19;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, v34 * 0.5, (float)((float)(v35 * 0.5) + 125.0) - 23.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v20 + 184))(v19, v21);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v19);
v22 = cocos2d::CCMenu::create();
*(_QWORD *)(a1 + 552) = v22;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v22);
v23 = (unsigned int)ButtonSprite::create_1(
(int)"OK",
90,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v24 = CCMenuItemSpriteExtra::create(v23, 0, a1, (__int64)HSVWidgetPopup::onClose);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v24);
v25 = *(__int64 **)(a1 + 552);
v26 = *v25;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, v34 * 0.5, (float)((float)(v35 * 0.5) - 125.0) + 25.0);
(*(void (__fastcall **)(__int64 *, __int64))(v26 + 184))(v25, v27);
v38 = *a2;
LOBYTE(v28) = 1;
v30 = ConfigureHSVWidget::create(&v38, v29, v28);
*(_QWORD *)(a1 + 664) = v30;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v30, 1);
v31 = *(__int64 **)(a1 + 664);
v32 = *v31;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, v34 * 0.5, v35 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v32 + 184))(v31, v33);
v36 = *a3;
v37 = *((_BYTE *)a3 + 2);
ConfigureHSVWidget::setBaseColor(*(_QWORD *)(a1 + 664), &v36);
sub_14003D310((__int64)a5);
return 1;
}
else
{
sub_14003D310((__int64)a5);
return 0;
}
}