//
// cocos2d::extension::CCControlColourPicker::setColorValue from 0x100355e30 to 0x100355f77 (327 bytes)
//
// 1 xrefs:
// > ??> @ 0x100916980
//
// 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
//
void __fastcall cocos2d::extension::CCControlColourPicker::setColorValue(
cocos2d::extension::CCControlColourPicker *a1,
const cocos2d::ccColor3B *a2)
{
__int64 v2; // rdx
__int64 v3; // rcx
__int64 v4; // r8
cocos2d::ccColor3B *p_m_rgb; // r14
double v7; // xmm0_8
__int64 v8; // rdx
__int64 v9; // rcx
__int64 v10; // r8
__int64 v11; // r9
__int64 v12; // rdx
__int64 v13; // r8
__int64 v14; // r9
__int64 v15; // rdx
__int64 v16; // r8
__int64 v17; // r9
cocos2d::CCSprite *m_colorTarget; // rdi
cocos2d::extension::ColorPickerDelegate *m_delegate; // rdi
__m128d v20; // [rsp+0h] [rbp-70h]
__int128 v21; // [rsp+10h] [rbp-60h]
cocos2d::HSV v22; // [rsp+28h] [rbp-48h] BYREF
__m128d v23; // [rsp+40h] [rbp-30h]
double v24[4]; // [rsp+50h] [rbp-20h]
a1->m_rgb = *a2;
p_m_rgb = &a1->m_rgb;
v7 = (float)((float)a2->b / 255.0);
v23 = _mm_cvtps_pd(
_mm_div_ps(
_mm_cvtepi32_ps(_mm_cvtepu8_epi32(_mm_cvtsi32_si128(*(unsigned __int16 *)&a2->r))),
(__m128)xmmword_100815DB0));
v24[0] = v7;
v24[1] = 1.0;
v21 = *(_OWORD *)v24;
v20 = v23;
cocos2d::extension::CCControlUtils::HSVfromRGB((unsigned int)&v22, (_DWORD)a2, v2, v3, v4);
a1->m_hsv = v22;
*(float *)&v7 = a1->m_hsv.h;
((void (__fastcall *)(cocos2d::extension::CCControlHuePicker *, const cocos2d::ccColor3B *, __int64, __int64, __int64, __int64, float, _QWORD, _QWORD, _QWORD, _QWORD))a1->m_huePicker->getHue)(
a1->m_huePicker,
a2,
v8,
v9,
v10,
v11,
*(float *)&v7,
*(_QWORD *)&v20.f64[0],
*(_QWORD *)&v20.f64[1],
v21,
*((_QWORD *)&v21 + 1));
((void (__fastcall *)(cocos2d::extension::CCControlSaturationBrightnessPicker *, const cocos2d::ccColor3B *, __int64, _QWORD, __int64, __int64, _QWORD, _QWORD, _QWORD))a1->m_colourPicker->getBrightness)(
a1->m_colourPicker,
a2,
v12,
*(_QWORD *)&a1->m_hsv.v,
v13,
v14,
*(_QWORD *)&a1->m_hsv.h,
*(_QWORD *)&a1->m_hsv.s,
*(_QWORD *)&a1->m_hsv.v);
((void (__fastcall *)(cocos2d::extension::CCControlSaturationBrightnessPicker *, const cocos2d::ccColor3B *, __int64, _QWORD, __int64, __int64, _QWORD, _QWORD, _QWORD))a1->m_colourPicker->getBackground)(
a1->m_colourPicker,
a2,
v15,
*(_QWORD *)&a1->m_hsv.v,
v16,
v17,
*(_QWORD *)&a1->m_hsv.h,
*(_QWORD *)&a1->m_hsv.s,
*(_QWORD *)&a1->m_hsv.v);
m_colorTarget = a1->m_colorTarget;
if ( m_colorTarget )
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::ccColor3B *))m_colorTarget->setColor)(m_colorTarget, p_m_rgb);
m_delegate = a1->m_delegate;
if ( m_delegate )
((void (__fastcall *)(cocos2d::extension::ColorPickerDelegate *, _QWORD))m_delegate->colorValueChanged)(
m_delegate,
*(unsigned __int16 *)&p_m_rgb->r | (p_m_rgb->b << 16));
}