//
// HSVLiveOverlay::init from 0x1402b99c0 to 0x1402b9e58 (1176 bytes)
//
// 2 xrefs:
// > EditorUI::editHSV @ 0x14011f182
// > ??> @ 0x1406d2714
//
// 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
//
// Hidden C++ exception states: #wind=2
bool HSVLiveOverlay::init(HSVLiveOverlay *a1, GameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
__int64 v7; // rcx
cocos2d::CCObject *v8; // rcx
cocos2d::CCDirector *v9; // rax
__int64 v10; // rcx
cocos2d::CCArray *v11; // rax
struct cocos2d::CCSprite *v12; // rbx
CCMenuItemSpriteExtra *v13; // rax
cocos2d::CCMenu *v14; // rax
float v15; // xmm0_4
double v16; // xmm0_8
__int64 v17; // rax
double v18; // xmm0_8
__int64 v19; // rcx
cocos2d::CCArray *v20; // rax
ButtonSprite *v21; // rbx
CCMenuItemSpriteExtra *v22; // r14
ButtonSprite *v23; // rbx
CCMenuItemSpriteExtra *v24; // rdi
double v25; // xmm0_8
__int64 v26; // rax
CCMenuItemSpriteExtra_vtbl *v27; // rbx
struct cocos2d::CCPoint v28; // rax
float v29; // xmm0_4
__int64 v30; // rax
struct cocos2d::CCPoint v31; // [rsp+68h] [rbp-40h] BYREF
struct cocos2d::CCPoint v32; // [rsp+70h] [rbp-38h] BYREF
ButtonSprite *v33; // [rsp+C8h] [rbp+20h] BYREF
result = FLAlertLayer::init_1(a1, 0);
if ( !result )
return result;
if ( a2 )
{
a1->m_object = a2;
v8 = a2;
}
else
{
if ( !a3 )
goto LABEL_7;
a1->m_objects = a3;
v8 = a3;
}
cocos2d::CCObject::retain(v8);
LABEL_7:
a1->m_noElasticity = 1;
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v9);
v11 = (cocos2d::CCArray *)cocos2d::CCArray::create(v10);
a1->m_controls = v11;
cocos2d::CCObject::retain(v11);
a1->setTouchEnabled(a1, 0);
a1->setKeypadEnabled(a1, 0);
v12 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v12->setScale_0)(v12);
v13 = CCMenuItemSpriteExtra::create(v12, nullptr, a1, (cocos2d::SEL_MenuHandler *)HSVLiveOverlay::closeColorSelect);
v14 = cocos2d::CCMenu::create(v13, 0);
a1->m_buttonMenu = v14;
v15 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v14,
10);
v16 = cocos2d::CCPoint::CCPoint(v15, -81.0);
cocos2d::CCPoint::CCPoint(*(float *)&v16, 157.0);
v18 = cocos2d::CCPoint::operator+(v17, &v33);
a1->m_buttonMenu->setPosition_0(a1->m_buttonMenu, (const cocos2d::CCPoint *)&v33);
HSVLiveOverlay::determineStartValues(a1);
if ( a1->m_unkBool1 && a1->m_unkBool2 )
{
v20 = (cocos2d::CCArray *)cocos2d::CCArray::create(v19);
a1->m_unkArray = v20;
cocos2d::CCObject::retain(v20);
v33 = (ButtonSprite *)operator new(0x2C0u);
v21 = ButtonSprite::ButtonSprite(v33);
if ( v21 )
{
if ( ButtonSprite::init_1(
v21,
(const char *)&word_140531EA4,
20,
0,
0.5,
1,
(const char *)&qword_14052A4D8,
"GJ_button_01.png",
30.0) )
{
cocos2d::CCObject::autorelease(v21);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v21->~ButtonSprite)(v21, 1);
v21 = nullptr;
}
}
((void (__fastcall *)(ButtonSprite *))v21->setScale_0)(v21);
v22 = CCMenuItemSpriteExtra::create(v21, nullptr, a1, (cocos2d::SEL_MenuHandler *)HSVLiveOverlay::onSelectTab);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v22);
v22->setTag(v22, 1);
v21->setTag(v21, 1);
cocos2d::CCArray::addObject(a1->m_unkArray, v21);
v33 = (ButtonSprite *)operator new(0x2C0u);
v23 = ButtonSprite::ButtonSprite(v33);
if ( v23 )
{
if ( ButtonSprite::init_1(
v23,
(const char *)&word_140531EA0,
20,
0,
0.5,
1,
(const char *)&qword_14052A4D8,
"GJ_button_04.png",
30.0) )
{
cocos2d::CCObject::autorelease(v23);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v23->~ButtonSprite)(v23, 1);
v23 = nullptr;
}
}
((void (__fastcall *)(ButtonSprite *))v23->setScale_0)(v23);
v24 = CCMenuItemSpriteExtra::create(v23, nullptr, a1, (cocos2d::SEL_MenuHandler *)HSVLiveOverlay::onSelectTab);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v24);
v24->setTag(v24, 2);
v23->setTag(v23, 2);
cocos2d::CCArray::addObject(a1->m_unkArray, v23);
v25 = cocos2d::CCPoint::CCPoint(*(float *)&v18, 97.0);
cocos2d::CCPoint::CCPoint(*(float *)&v25, 157.0);
cocos2d::CCPoint::operator+(v26, &v33);
v27 = v22->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, &v31);
v28 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v32);
v29 = ((float (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v27->setPosition_0)(v22, v28);
cocos2d::CCPoint::CCPoint(v29, 0.0);
v30 = (__int64)v22->getPosition_0(v22);
cocos2d::CCPoint::operator+(v30, &v33);
v24->setPosition_0(v24, (const cocos2d::CCPoint *)&v33);
}
HSVLiveOverlay::createHSVWidget(a1, 2 - a1->m_unkBool1);
return 1;
}