//
// ConfigureHSVWidget::getHSV from 0x1001003dc to 0x100100590 (436 bytes)
//
// 5 xrefs:
// > CustomizeObjectLayer::onHSV @ 0x10004f77c
// > CustomizeObjectLayer::onHSV @ 0x10004f7b0
// > CustomizeObjectLayer::updateHSVButtons @ 0x10004f8fc
// > CustomizeObjectLayer::updateHSVButtons @ 0x10004f92c
// > HSVLiveOverlay::createHSVWidget @ 0x1001a0008
//
// 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
//
cocos2d::ccHSVValue __fastcall ConfigureHSVWidget::getHSV(GameObject *a1, cocos2d::CCArray *a2, int a3)
{
cocos2d::CCArray *v4; // x20
__int64 v5; // x23
float v6; // w24
float v7; // w22
__int64 v8; // x25
__int64 v9; // x27
unsigned __int64 v10; // x26
__int64 v11; // x21
char v12; // w28
__int64 v13; // x0
int v14; // w8
unsigned __int64 v15; // x8
__int64 absoluteSaturation; // x9
__int64 s_low; // x11
float h; // w12
__int64 absoluteBrightness; // x10
unsigned __int64 v20; // x13
GJSpriteColor *RelativeSpriteColor; // x0
bool v22; // zf
int v24; // w8
cocos2d::ccHSVValue result; // 0:x0.16
v4 = a2;
if ( a1 )
v4 = (cocos2d::CCArray *)sub_10024A1B8(a1, a2);
if ( !v4 )
{
*(_QWORD *)&result.v = *((_QWORD *)&xmmword_10086B0A0 + 1);
*(_QWORD *)&result.h = xmmword_10086B0A0;
return result;
}
v6 = *(float *)&xmmword_10086B0A0;
v5 = DWORD1(xmmword_10086B0A0);
v7 = *((float *)&xmmword_10086B0A0 + 2);
v8 = BYTE12(xmmword_10086B0A0);
v9 = BYTE13(xmmword_10086B0A0);
v10 = HIWORD(xmmword_10086B0A0);
if ( !(unsigned int)sub_10024A36C(v4) )
{
LABEL_27:
v24 = 0;
goto LABEL_30;
}
v11 = 0;
v12 = 1;
while ( 1 )
{
v13 = sub_10024A388(v4, v11);
v14 = *(_DWORD *)(v13 + 1028);
if ( v14 != 1006 && v14 != 899 )
break;
if ( a3 == 1 )
{
v15 = *(_QWORD *)(v13 + 1620);
absoluteSaturation = BYTE4(v15);
h = *(float *)(v13 + 1612);
s_low = *(unsigned int *)(v13 + 1616);
absoluteBrightness = BYTE5(v15);
v20 = HIWORD(v15);
goto LABEL_12;
}
LABEL_26:
v11 = (unsigned int)(v11 + 1);
if ( (unsigned int)v11 >= (unsigned int)sub_10024A36C(v4) )
goto LABEL_27;
}
RelativeSpriteColor = GameObject::getRelativeSpriteColor((GameObject *)v13, a3);
if ( !RelativeSpriteColor )
goto LABEL_26;
h = RelativeSpriteColor->m_hsv.h;
s_low = LODWORD(RelativeSpriteColor->m_hsv.s);
*(float *)&v15 = RelativeSpriteColor->m_hsv.v;
absoluteSaturation = RelativeSpriteColor->m_hsv.absoluteSaturation;
absoluteBrightness = RelativeSpriteColor->m_hsv.absoluteBrightness;
v20 = *(unsigned __int16 *)RelativeSpriteColor->m_hsv.__pad;
LABEL_12:
if ( h == -0.001 )
goto LABEL_26;
if ( (v12 & 1) != 0 )
{
v12 = 0;
v5 = s_low;
v6 = h;
v10 = v20;
v9 = absoluteBrightness;
v8 = absoluteSaturation;
v7 = *(float *)&v15;
goto LABEL_26;
}
if ( v6 == h && *(float *)&v5 == *(float *)&s_low )
{
v22 = v7 == *(float *)&v15 && (_DWORD)v8 == (_DWORD)absoluteSaturation;
if ( v22 && (_DWORD)v9 == (_DWORD)absoluteBrightness )
{
v12 = 0;
goto LABEL_26;
}
}
v24 = 1;
LABEL_30:
if ( v24 )
*(_QWORD *)&result.h = 3129152111LL;
else
*(_QWORD *)&result.h = LODWORD(v6) | (unsigned __int64)(v5 << 32);
if ( v24 )
*(_QWORD *)&result.v = 0;
else
*(_QWORD *)&result.v = (v9 << 40) | (v10 << 48) | (v8 << 32) | LODWORD(v7);
return result;
}