//
// ConfigureHSVWidget::getHSV from 0x8e2778 to 0x8e297c (516 bytes)
//
// 3 xrefs:
// > CustomizeObjectLayer::getHSV @ 0x8407ac
// > HSVLiveOverlay::createHSVWidget @ 0xa23c40
// > ??> @ 0x3efd0
//
// 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 ConfigureHSVWidget::getHSV(GameObject *a1, cocos2d::CCArray *a2, int a3)
{
unsigned __int64 v3; // x23
cocos2d::CCArray *v4; // x20
unsigned int v6; // w19
int v7; // w22
unsigned __int64 v8; // kr00_8
float v9; // s10
unsigned __int64 v10; // x26
unsigned __int8 v11; // w25
unsigned __int8 i; // w24
__int64 v13; // x0
int v14; // w2
__int64 v15; // x1
GJSpriteColor *RelativeSpriteColor; // x0
float h; // s0
float s; // s1
unsigned __int8 absoluteSaturation; // w2
float v; // s2
unsigned __int8 absoluteBrightness; // w0
cocos2d::ccHSVValue result; // 0:x0.16
v4 = a2;
if ( a1 )
v4 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject((cocos2d::CCArray *)a1, a2);
if ( v4 )
{
v6 = 0;
v7 = 1;
v8 = qword_1242EA0;
v9 = *(float *)&qword_1242EA8;
v10 = qword_1242EA8;
v11 = BYTE4(qword_1242EA8);
for ( i = BYTE5(qword_1242EA8); v6 < (unsigned int)cocos2d::CCArray::count(v4); ++v6 )
{
v13 = cocos2d::CCArray::objectAtIndex(v4, v6);
v14 = *(_DWORD *)(v13 + 1012);
v15 = v13;
if ( v14 == 1006 || v14 == 899 )
{
if ( a3 != 1 )
continue;
h = *(float *)(v13 + 1596);
absoluteSaturation = *(_BYTE *)(v13 + 1608);
s = *(float *)(v13 + 1600);
absoluteBrightness = *(_BYTE *)(v13 + 1609);
v = *(float *)(v15 + 1604);
}
else
{
RelativeSpriteColor = GameObject::getRelativeSpriteColor((GameObject *)v13, a3);
if ( !RelativeSpriteColor )
continue;
h = RelativeSpriteColor->m_hsv.h;
v3 = *(_QWORD *)&RelativeSpriteColor->m_hsv.v;
s = RelativeSpriteColor->m_hsv.s;
absoluteSaturation = RelativeSpriteColor->m_hsv.absoluteSaturation;
v = RelativeSpriteColor->m_hsv.v;
absoluteBrightness = RelativeSpriteColor->m_hsv.absoluteBrightness;
}
if ( h != -0.001 )
{
if ( v7 )
{
v9 = v;
i = absoluteBrightness;
v11 = absoluteSaturation;
v7 = 0;
v8 = __PAIR64__(LODWORD(s), LODWORD(h));
}
else if ( h != *(float *)&v8
|| s != *((float *)&v8 + 1)
|| v != v9
|| (v3 = v3 & 0xFFFF0000FFFFFFFFLL
| ((unsigned __int64)absoluteSaturation << 32) & 0xFFFF00FFFFFFFFFFLL
| ((unsigned __int64)absoluteBrightness << 40),
v10 = v10 & 0xFFFF0000FFFFFFFFLL
| ((unsigned __int64)v11 << 32) & 0xFFFF00FFFFFFFFFFLL
| ((unsigned __int64)i << 40),
WORD2(v3) != WORD2(v10)) )
{
*(_QWORD *)&result.v = 0;
*(_QWORD *)&result.h = 3129152111LL;
return result;
}
}
}
*(_QWORD *)&result.v = LODWORD(v9)
| ((unsigned __int64)v11 << 32) & 0xFFFF00FFFFFFFFFFLL
| ((unsigned __int64)i << 40);
*(_QWORD *)&result.h = v8;
}
else
{
*(_QWORD *)&result.h = qword_1242EA0;
*(_QWORD *)&result.v = qword_1242EA8;
}
return result;
}