//
// HSVLiveOverlay::init from 0x1403c0b10 to 0x1403c0fec (1244 bytes)
//
// 2 xrefs:
// > EditorUI::editHSV @ 0x1401be629
// > ??> @ 0x140924038
//
// 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:31:28 +0000
//
// Hidden C++ exception states: #wind=2
bool __fastcall HSVLiveOverlay::init(__int64 a1, cocos2d::CCObject *a2, cocos2d::CCObject *a3, __int64 a4, __int64 a5)
{
bool result; // al
__int64 v10; // rcx
cocos2d::CCObject *v11; // rcx
__int64 v12; // rax
__int64 v13; // rcx
cocos2d::CCObject *v14; // rax
struct cocos2d::CCSprite *v15; // rax
int v16; // ebx
cocos2d::CCObject *v17; // rax
struct cocos2d::CCMenu *v18; // rax
__int64 v19; // rax
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rcx
cocos2d::CCObject *v23; // rax
cocos2d::CCObject *v24; // rbx
cocos2d::CCObject *v25; // r15
cocos2d::CCObject *v26; // rbx
cocos2d::CCObject *v27; // rsi
__int64 v28; // rax
__int64 v29; // rbx
__int64 v30; // rax
__int64 v31; // rdi
__int64 v32; // rbx
__int64 v33; // rax
__int64 v34; // rax
__int64 v35; // rax
__int64 v36; // rbx
__int64 v37; // rax
_BYTE v38[8]; // [rsp+50h] [rbp-58h] BYREF
_BYTE v39[8]; // [rsp+58h] [rbp-50h] BYREF
_BYTE v40[8]; // [rsp+60h] [rbp-48h] BYREF
void *v41; // [rsp+68h] [rbp-40h] BYREF
_BYTE v42[8]; // [rsp+70h] [rbp-38h] BYREF
_BYTE v43[40]; // [rsp+78h] [rbp-30h] BYREF
result = FLAlertLayer::init_1(a1, 0);
if ( !result )
return result;
*(_WORD *)(a1 + 731) = *(_WORD *)a4;
*(_BYTE *)(a1 + 733) = *(_BYTE *)(a4 + 2);
v10 = a5;
*(_WORD *)(a1 + 734) = *(_WORD *)a5;
*(_BYTE *)(a1 + 736) = *(_BYTE *)(a5 + 2);
if ( a2 )
{
*(_QWORD *)(a1 + 672) = a2;
v11 = a2;
}
else
{
if ( !a3 )
goto LABEL_7;
*(_QWORD *)(a1 + 680) = a3;
v11 = a3;
}
cocos2d::CCObject::retain(v11);
LABEL_7:
*(_BYTE *)(a1 + 596) = 1;
v12 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v12, v39);
v14 = (cocos2d::CCObject *)cocos2d::CCArray::create(v13);
*(_QWORD *)(a1 + 688) = v14;
cocos2d::CCObject::retain(v14);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 920LL))(a1, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 992LL))(a1, 0);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v16 = (int)v15;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v15 + 160LL))(v15);
v17 = CCMenuItemSpriteExtra::create(v16, 0, a1, (__int64)HSVLiveOverlay::closeColorSelect);
v18 = cocos2d::CCMenu::create(v17, 0);
*(_QWORD *)(a1 + 552) = v18;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCMenu *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v18,
10);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v40, -81.0, 48.0);
v20 = v19;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v41, 157.0, 163.0);
cocos2d::CCPoint::operator+(v21, v38, v20);
(*(void (__fastcall **)(_QWORD, _BYTE *))(**(_QWORD **)(a1 + 552) + 184LL))(*(_QWORD *)(a1 + 552), v38);
HSVLiveOverlay::determineStartValues(a1);
if ( *(_BYTE *)(a1 + 728) && *(_BYTE *)(a1 + 729) )
{
v23 = (cocos2d::CCObject *)cocos2d::CCArray::create(v22);
*(_QWORD *)(a1 + 696) = v23;
cocos2d::CCObject::retain(v23);
v41 = operator new(0x2C8u);
v24 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v41);
if ( v24 )
{
if ( ButtonSprite::init_1(
(__int64)v24,
(__int64)&word_14070D060,
20,
0,
1056964608,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v24);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v24 + 8LL))(v24, 1);
v24 = nullptr;
}
}
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v24 + 160LL))(v24);
v25 = CCMenuItemSpriteExtra::create((int)v24, 0, a1, (__int64)HSVLiveOverlay::onSelectTab);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v25);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v25 + 64LL))(v25, 1);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v24 + 64LL))(v24, 1);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 696), v24);
v41 = operator new(0x2C8u);
v26 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v41);
if ( v26 )
{
if ( ButtonSprite::init_1(
(__int64)v26,
(__int64)&word_14070D058,
20,
0,
1056964608,
1,
&qword_140704F78,
(__int64)"GJ_button_04.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v26);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v26 + 8LL))(v26, 1);
v26 = nullptr;
}
}
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v26 + 160LL))(v26);
v27 = CCMenuItemSpriteExtra::create((int)v26, 0, a1, (__int64)HSVLiveOverlay::onSelectTab);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v27);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v27 + 64LL))(v27, 2);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v26 + 64LL))(v26, 2);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 696), v26);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v41, 97.0, 36.0);
v29 = v28;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v40, 157.0, 163.0);
cocos2d::CCPoint::operator+(v30, v38, v29);
v31 = *(_QWORD *)v25;
v32 = *(_QWORD *)(a1 + 552);
cocos2d::CCNode::convertToWorldSpace(*(_QWORD *)(a1 + 584), v42, v38);
cocos2d::CCNode::convertToNodeSpace(v32, v43, v33);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v31 + 184))(v25, v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, 0.0, -24.0);
v36 = v35;
v37 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v25 + 200LL))(v25);
cocos2d::CCPoint::operator+(v37, v38, v36);
(*(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_QWORD *)v27 + 184LL))(v27, v38);
}
HSVLiveOverlay::createHSVWidget(a1, 2 - (unsigned int)(*(_BYTE *)(a1 + 728) != 0));
return 1;
}