//
// cocos2d::extension::CCControlHuePicker::initWithTargetAndPos from 0x180008620 to 0x180008819 (505 bytes)
//
// 5 xrefs:
// > ??> @ 0x180024dd0
// > ??> @ 0x18002dad8
// > ??> @ 0x18002db10
// > ??> @ 0x18002fdf8
// > ??> @ 0x1800498a0
//
// 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
//
char __fastcall cocos2d::extension::CCControlHuePicker::initWithTargetAndPos(
cocos2d::extension::CCControl *a1,
__int64 a2,
float *a3)
{
__int64 v6; // rdx
__int64 v7; // rax
__int64 v8; // r14
__int64 v9; // r15
struct cocos2d::CCSprite *v10; // rax
cocos2d::CCObject *v11; // rbx
cocos2d::CCObject *v12; // rcx
__int64 v13; // rax
__int64 v14; // r14
__int64 v15; // r15
struct cocos2d::CCSprite *v16; // rax
cocos2d::CCObject *v17; // rbx
cocos2d::CCObject *v18; // rax
cocos2d::CCObject *v19; // rcx
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rax
_BYTE v24[40]; // [rsp+20h] [rbp-28h] BYREF
char v25; // [rsp+68h] [rbp+20h] BYREF
if ( !cocos2d::extension::CCControl::init(a1) )
return 0;
LOBYTE(v6) = 1;
(*(void (__fastcall **)(cocos2d::extension::CCControl *, __int64))(*(_QWORD *)a1 + 904LL))(a1, v6);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, 0.0, 0.0);
v8 = v7;
v9 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, (const struct cocos2d::CCPoint *)a3);
v10 = cocos2d::CCSprite::createWithSpriteFrameName("huePickerBackground.png");
v11 = v10;
if ( v10 )
{
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v10 + 184LL))(v10, v9);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v11 + 272LL))(v11, v8);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)a2 + 448LL))(a2, v11);
}
if ( *((cocos2d::CCObject **)a1 + 60) != v11 )
{
if ( v11 )
cocos2d::CCObject::retain(v11);
v12 = *((cocos2d::CCObject **)a1 + 60);
if ( v12 )
cocos2d::CCObject::release(v12);
*((_QWORD *)a1 + 60) = v11;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, 0.5, 0.5);
v14 = v13;
v15 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, (const struct cocos2d::CCPoint *)a3);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("colourPicker.png");
v17 = v16;
if ( v16 )
{
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v16 + 184LL))(v16, v15);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v17 + 272LL))(v17, v14);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)a2 + 448LL))(a2, v17);
}
v18 = *((cocos2d::CCObject **)a1 + 61);
if ( v18 != v17 )
{
if ( v17 )
cocos2d::CCObject::retain(v17);
v19 = *((cocos2d::CCObject **)a1 + 61);
if ( v19 )
cocos2d::CCObject::release(v19);
*((_QWORD *)a1 + 61) = v17;
v18 = v17;
}
v20 = *(_QWORD *)v18;
v21 = cocos2d::CCNode::boundingBox(*((_QWORD *)a1 + 60), v24);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, *a3, (float)(*(float *)(v21 + 12) * 0.5) + a3[1]);
(*(void (__fastcall **)(_QWORD, __int64))(v20 + 184))(*((_QWORD *)a1 + 61), v22);
cocos2d::CCPoint::operator=((char *)a1 + 496, a3);
*((_QWORD *)a1 + 59) = 0;
return 1;
}