//
// cocos2d::extension::CCControlSaturationBrightnessPicker::initWithTargetAndPos from 0x1800099c0 to 0x180009c3b (635 bytes)
//
// 5 xrefs:
// > ??> @ 0x180025958
// > ??> @ 0x18002dc84
// > ??> @ 0x18002dc94
// > ??> @ 0x18002fdf8
// > ??> @ 0x180049a38
//
// 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::CCControlSaturationBrightnessPicker::initWithTargetAndPos(
__int64 a1,
__int64 a2,
const struct cocos2d::CCPoint *a3)
{
__int64 v6; // rdx
__int64 v7; // rax
__int64 v8; // r15
__int64 v9; // r12
struct cocos2d::CCSprite *v10; // rax
struct cocos2d::CCSprite *v11; // rsi
struct cocos2d::CCSprite *v12; // rdi
__int64 v13; // rax
__int64 v14; // r15
__int64 v15; // r12
struct cocos2d::CCSprite *v16; // rax
struct cocos2d::CCSprite *v17; // rdi
__int64 v18; // rax
__int64 v19; // r15
__int64 v20; // r12
struct cocos2d::CCSprite *v21; // rax
struct cocos2d::CCSprite *v22; // rdi
__int64 v23; // rax
__int64 v24; // r15
__int64 v25; // r12
struct cocos2d::CCSprite *v26; // rax
struct cocos2d::CCSprite *v27; // rdi
__int64 v28; // rcx
_BYTE v30[16]; // [rsp+20h] [rbp-38h] BYREF
char v31; // [rsp+78h] [rbp+20h] BYREF
if ( !cocos2d::extension::CCControl::init((cocos2d::extension::CCControl *)a1) )
return 0;
LOBYTE(v6) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 904LL))(a1, v6);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, 0.0);
v8 = v7;
v9 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, a3);
v10 = cocos2d::CCSprite::createWithSpriteFrameName("colourPickerBackground.png");
v11 = nullptr;
v12 = v10;
if ( v10 )
{
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v10 + 184LL))(v10, v9);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v12 + 272LL))(v12, v8);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 448LL))(a2, v12);
}
else
{
v12 = nullptr;
}
*(_QWORD *)(a1 + 480) = v12;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, 0.0);
v14 = v13;
v15 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, a3);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("colourPickerOverlay.png");
v17 = v16;
if ( v16 )
{
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v16 + 184LL))(v16, v15);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v17 + 272LL))(v17, v14);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 448LL))(a2, v17);
}
else
{
v17 = nullptr;
}
*(_QWORD *)(a1 + 488) = v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.0, 0.0);
v19 = v18;
v20 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, a3);
v21 = cocos2d::CCSprite::createWithSpriteFrameName("colourPickerShadow.png");
v22 = v21;
if ( v21 )
{
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v21 + 184LL))(v21, v20);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v22 + 272LL))(v22, v19);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 448LL))(a2, v22);
}
else
{
v22 = nullptr;
}
*(_QWORD *)(a1 + 496) = v22;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v31, 0.5, 0.5);
v24 = v23;
v25 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, a3);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("colourPicker.png");
v27 = v26;
if ( v26 )
{
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v26 + 184LL))(v26, v25);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v27 + 272LL))(v27, v24);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *))(*(_QWORD *)a2 + 448LL))(a2, v27);
v11 = v27;
}
*(_QWORD *)(a1 + 504) = v11;
cocos2d::CCPoint::operator=(a1 + 512, a3);
v28 = *(_QWORD *)(a1 + 480);
*(_DWORD *)(a1 + 520) = 35;
*(_DWORD *)(a1 + 524) = (int)(float)(*(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 304LL))(v28) * 0.5);
return 1;
}