//
// ColorSelectPopup::colorToHex from 0x3dc8b8 to 0x3dc9e2 (298 bytes)
//
// 2 xrefs:
// > ColorSelectPopup::updateColorLabels @ 0x3dcaa6
// > SetupPulsePopup::updateColorLabels @ 0x4bda9e
//
// 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
//
_DWORD *__fastcall ColorSelectPopup::colorToHex(_DWORD *a1, int a2)
{
_DWORD *v2; // lr
const char *v4; // r5
int v5; // r0
int v6; // r1
int i; // r6
int v8; // r7
int v9; // r9
int v10; // r11
int *v11; // r0
void *v14; // [sp+18h] [bp-24h] BYREF
int v15; // [sp+1Ch] [bp-20h] BYREF
int v16; // [sp+20h] [bp-1Ch] BYREF
_BYTE v17[24]; // [sp+24h] [bp-18h] BYREF
v2 = v17;
v4 = "0123456789ABCDEF";
*a1 = &unk_ACDDA8;
do
{
v5 = *(_DWORD *)v4;
v4 += 8;
v6 = *((_DWORD *)v4 - 1);
*v2 = v5;
v2[1] = v6;
v2 += 2;
}
while ( v4 != "" );
for ( i = 0; i != 3; ++i )
{
if ( i )
{
if ( i == 1 )
v8 = BYTE1(a2);
else
v8 = (unsigned __int8)a2;
}
else
{
v8 = BYTE2(a2);
}
if ( !v8 )
{
sub_2EDF90(&v16, "00", a1);
sub_774794(a1, &v16);
v11 = &v16;
goto LABEL_15;
}
v9 = v8;
do
{
v10 = (unsigned __int8)v17[v9 & 0xF];
v14 = &unk_ACDDA8;
sub_7740F8(&v14, *(_DWORD *)(*a1 - 12) + 1);
sub_774560(&v14, 1, v10);
sub_77441C(&v14, a1);
sub_774794(a1, &v14);
sub_774008(&v14);
v9 >>= 4;
}
while ( v9 );
if ( v8 <= 15 )
{
sub_2EDF90(&v15, "0", a1);
sub_774794(a1, &v15);
v11 = &v15;
LABEL_15:
sub_774008(v11);
continue;
}
}
return a1;
}