//
// ColorSelectPopup::hexToColor from 0x3dcd94 to 0x3dcff2 (606 bytes)
//
// 2 xrefs:
// > ColorSelectPopup::textChanged @ 0x3dd196
// > SetupPulsePopup::textChanged @ 0x4bdf60
//
// 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
//
int __fastcall ColorSelectPopup::hexToColor(const char **a1)
{
unsigned int i; // r4
const char *v3; // r5
int v4; // r6
int v5; // r2
int v6; // r2
int v7; // r2
int v8; // r2
int v9; // r2
int v10; // r2
int v11; // r2
int v12; // r2
int v13; // r2
int v14; // r2
int v15; // r2
int v16; // r2
int v17; // r2
int v18; // r2
int v19; // r2
int v20; // r10
int v21; // r9
int j; // r11
int v23; // r2
char v25; // [sp+0h] [bp-24h] BYREF
unsigned __int8 v26; // [sp+1h] [bp-23h]
unsigned __int8 v27; // [sp+2h] [bp-22h]
int v28; // [sp+4h] [bp-20h] BYREF
_DWORD *v29[5]; // [sp+8h] [bp-1Ch] BYREF
for ( i = 0; i < *((_DWORD *)*a1 - 3); ++i )
{
sub_775170(a1);
v3 = *a1;
sub_775170(a1);
v3[i] = toupper((unsigned __int8)(*a1)[i]);
}
memset(v29, 0, sizeof(v29));
v29[2] = v29;
v29[3] = v29;
v25 = 48;
v4 = 0;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, 48) = 0;
v25 = 49;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v5) = 1;
v25 = 50;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v6) = 2;
v25 = 51;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v7) = 3;
v25 = 52;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v8) = 4;
v25 = 53;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v9) = 5;
v25 = 54;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v10) = 6;
v25 = 55;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v11) = 7;
v25 = 56;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v12) = 8;
v25 = 57;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v13) = 9;
v25 = 65;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v14) = 10;
v25 = 66;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v15) = 11;
v25 = 67;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v16) = 12;
v25 = 68;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v17) = 13;
v25 = 69;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v18) = 14;
v25 = 70;
*(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v19) = 15;
if ( strlen(*a1) == 6 )
{
v20 = 0;
v21 = 0;
for ( j = 0; j != 6; ++j )
{
sub_775170(a1);
v25 = (*a1)[j];
switch ( j )
{
case 1:
v4 += *(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v23);
goto LABEL_10;
case 2:
v20 += 16 * *(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v23);
goto LABEL_13;
case 3:
v20 += *(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v23);
LABEL_13:
v20 = (unsigned __int8)v20;
continue;
case 4:
v21 += 16 * *(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v23);
goto LABEL_16;
case 5:
v21 += *(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v23);
LABEL_16:
v21 = (unsigned __int8)v21;
break;
default:
v4 += 16 * *(_DWORD *)std::map::operator[](&v28, (unsigned __int8 *)&v25, v23);
LABEL_10:
v4 = (unsigned __int8)v4;
break;
}
}
v25 = v4;
v26 = v20;
v27 = v21;
}
else
{
v25 = 0;
v26 = 0;
v27 = 0;
}
std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_erase(
(int)&v28,
v29[1]);
return (unsigned __int8)v25 | (unsigned __int16)(v26 << 8) | (v27 << 16);
}