//
// ColorSelectPopup::colorToHex from 0x10041fd40 to 0x10041fe6c (300 bytes)
//
// 2 xrefs:
// > SetupPulsePopup::updateColorLabels @ 0x1003b76e4
// > ColorSelectPopup::updateColorLabels @ 0x10041fc68
//
// 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 __usercall ColorSelectPopup::colorToHex(unsigned int a1@, __int64 a2@)
{
unsigned __int8 v2; // w20
int v4; // w23
unsigned int v5; // w24
unsigned __int8 v6; // w25
unsigned __int8 v7; // w8
unsigned int v8; // w27
unsigned int v9; // w28
bool v10; // cf
__int128 v11; // [xsp+8h] [xbp-68h] BYREF
__int64 v12; // [xsp+18h] [xbp-58h]
v2 = a1;
v4 = 0;
v5 = a1 >> 8;
v6 = BYTE2(a1);
*(_QWORD *)a2 = 0;
*(_QWORD *)(a2 + 8) = 0;
*(_QWORD *)(a2 + 16) = 0;
do
{
if ( v4 == 1 )
v7 = v5;
else
v7 = v2;
if ( !v4 )
v7 = v6;
v8 = v7;
if ( !v7 )
{
std::operator+(&v11, "00", a2);
goto LABEL_15;
}
v9 = v7;
do
{
sub_100048C00(a0123456789abcd_10[v9 & 0xF], (const void **)a2, (__int64)&v11);
if ( *(char *)(a2 + 23) < 0 )
operator delete(*(void **)a2);
*(_OWORD *)a2 = v11;
*(_QWORD *)(a2 + 16) = v12;
v10 = v9 >= 0x10;
v9 >>= 4;
}
while ( v10 );
if ( v8 <= 0xF )
{
std::operator+(&v11, "0", a2);
LABEL_15:
if ( *(char *)(a2 + 23) < 0 )
operator delete(*(void **)a2);
*(_OWORD *)a2 = v11;
*(_QWORD *)(a2 + 16) = v12;
}
++v4;
}
while ( v4 != 3 );
}