//
// ColorSelectPopup::hexToColor from 0x4e1eb8 to 0x4e2122 (618 bytes)
//
// 2 xrefs:
// > ColorSelectPopup::textChanged @ 0x4e230a
// > SetupPulsePopup::textChanged @ 0x5ec8ca
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:51:02 +0000
//
int __fastcall ColorSelectPopup::hexToColor(unsigned __int8 *a1)
{
unsigned int i; // r4
unsigned int v3; // r3
int v4; // r2
unsigned __int8 *v5; // r3
unsigned __int8 *v6; // r5
unsigned __int8 *v7; // r3
int v8; // r0
int v9; // r6
const char *v10; // r0
int v11; // r10
int v12; // r9
int j; // r11
unsigned __int8 *v14; // r3
unsigned __int8 v16; // [sp+4h] [bp-18h] BYREF
unsigned __int8 v17; // [sp+5h] [bp-17h]
unsigned __int8 v18; // [sp+6h] [bp-16h]
int *v19; // [sp+8h] [bp-14h] BYREF
_DWORD *v20[2]; // [sp+Ch] [bp-10h] BYREF
for ( i = 0; ; ++i )
{
v3 = *a1;
v4 = v3 & 1;
if ( (v3 & 1) == 0 )
break;
if ( i >= *((_DWORD *)a1 + 1) )
goto LABEL_11;
v5 = *((unsigned __int8 **)a1 + 2);
LABEL_7:
v6 = &v5[i];
if ( v4 )
v7 = *((unsigned __int8 **)a1 + 2);
else
v7 = a1 + 1;
v8 = v7[i];
*v6 = toupper(v8);
}
if ( i < v3 >> 1 )
{
v5 = a1 + 1;
goto LABEL_7;
}
LABEL_11:
v19 = (int *)v20;
v16 = 48;
v20[0] = nullptr;
v20[1] = nullptr;
*std::map::operator[](&v19, &v16) = 0;
v16 = 49;
*std::map::operator[](&v19, &v16) = 1;
v16 = 50;
*std::map::operator[](&v19, &v16) = 2;
v16 = 51;
*std::map::operator[](&v19, &v16) = 3;
v16 = 52;
*std::map::operator[](&v19, &v16) = 4;
v16 = 53;
*std::map::operator[](&v19, &v16) = 5;
v16 = 54;
*std::map::operator[](&v19, &v16) = 6;
v16 = 55;
*std::map::operator[](&v19, &v16) = 7;
v16 = 56;
*std::map::operator[](&v19, &v16) = 8;
v16 = 57;
*std::map::operator[](&v19, &v16) = 9;
v16 = 65;
*std::map::operator[](&v19, &v16) = 10;
v16 = 66;
*std::map::operator[](&v19, &v16) = 11;
v16 = 67;
*std::map::operator[](&v19, &v16) = 12;
v16 = 68;
*std::map::operator[](&v19, &v16) = 13;
v16 = 69;
*std::map::operator[](&v19, &v16) = 14;
v16 = 70;
*std::map::operator[](&v19, &v16) = 15;
v9 = 0;
if ( (*a1 & 1) != 0 )
v10 = *((const char **)a1 + 2);
else
v10 = (const char *)(a1 + 1);
if ( strlen(v10) == 6 )
{
v11 = 0;
v12 = 0;
for ( j = 0; j != 6; ++j )
{
if ( (*a1 & 1) != 0 )
v14 = *((unsigned __int8 **)a1 + 2);
else
v14 = a1 + 1;
v16 = v14[j];
switch ( j )
{
case 1:
v9 += *std::map::operator[](&v19, &v16);
goto LABEL_23;
case 2:
v11 += 16 * *std::map::operator[](&v19, &v16);
goto LABEL_26;
case 3:
v11 += *std::map::operator[](&v19, &v16);
LABEL_26:
v11 = (unsigned __int8)v11;
continue;
case 4:
v12 += 16 * *std::map::operator[](&v19, &v16);
goto LABEL_29;
case 5:
v12 += *std::map::operator[](&v19, &v16);
LABEL_29:
v12 = (unsigned __int8)v12;
break;
default:
v9 += 16 * *std::map::operator[](&v19, &v16);
LABEL_23:
v9 = (unsigned __int8)v9;
break;
}
}
v16 = v9;
v17 = v11;
v18 = v12;
}
else
{
v16 = 0;
v17 = 0;
v18 = 0;
}
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
(int)&v19,
v20[0]);
return v16 | (unsigned __int16)(v17 << 8) | (v18 << 16);
}