//
// cocos2d::extension::CCControlSaturationBrightnessPicker::updateSliderPosition from 0x1001be0dc to 0x1001be270 (404 bytes)
//
// 2 xrefs:
// > cocos2d::extension::CCControlSaturationBrightnessPicker::updateDraggerWithHSV @ 0x1001be0c8
// > cocos2d::extension::CCControlSaturationBrightnessPicker::checkSliderPosition @ 0x1001be31c
//
// 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::CCControlSaturationBrightnessPicker::updateSliderPosition(
cocos2d::extension::CCControlSaturationBrightnessPicker *a1,
cocos2d::CCPoint a2)
{
float *v2; // x1
float *v3; // x20
float x; // s8
float v6; // s10
float y; // s8
float v8; // s11
float v9; // s8
float v10; // s9
float v11; // s12
float v12; // s0
float v13; // s1
float boxPos; // s0
float v15; // s2
float v16; // s4
float v17; // s2
float boxSize; // s3
float v19; // [xsp+8h] [xbp-48h]
float v20; // [xsp+Ch] [xbp-44h]
__float2 v21; // 0:kr30_8.8
v3 = v2;
x = a1->m_startPos.x;
cocos2d::CCNode::boundingBox(a1->m_background);
v6 = x + (float)(v19 * 0.5);
y = a1->m_startPos.y;
cocos2d::CCNode::boundingBox(a1->m_background);
v8 = y + (float)(v20 * 0.5);
v9 = *v3 - v6;
v10 = v3[1] - v8;
cocos2d::CCNode::boundingBox(a1->m_background);
v11 = v19 * 0.5;
if ( sqrtf((float)(v10 * v10) + (float)(v9 * v9)) > (float)(v19 * 0.5) )
{
v12 = atan2f(v10, v9);
v21 = __sincosf_stret(v12);
*v3 = v6 + (float)(v11 * v21.__cosval);
v3[1] = v8 + (float)(v11 * v21.__sinval);
}
((void (__fastcall *)(cocos2d::CCSprite *, float *))a1->m_slider->setPosition)(a1->m_slider, v3);
v13 = *v3;
boxPos = (float)a1->boxPos;
v15 = a1->m_startPos.x + boxPos;
if ( *v3 < v15 || (v15 = (float)(v15 + (float)a1->boxSize) + -1.0, v13 > v15) )
{
*v3 = v15;
v13 = v15;
}
v16 = v3[1];
v17 = a1->m_startPos.y + boxPos;
if ( v16 >= v17 )
{
boxSize = (float)a1->boxSize;
v17 = v17 + boxSize;
if ( v16 <= v17 )
v17 = v3[1];
else
v3[1] = v17;
}
else
{
v3[1] = v17;
boxSize = (float)a1->boxSize;
}
a1->m_saturation = 1.0 - fabsf((float)((float)(a1->m_startPos.x + boxPos) - v13) / boxSize);
a1->m_brightness = fabsf((float)((float)(a1->m_startPos.y + boxPos) - v17) / boxSize);
}