Newer
Older
AMI-Aptio-BIOS-Reversed / EarlyVideoPei / BitmapDecodePalette.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Init
int __fastcall BitmapDecodePalette(int a1, int n2, void *count, char *i, int a5)
{
  int v7; // ecx
  char v8; // al
  int v9; // eax
  int v10; // eax
  char n48; // cl
  _DWORD *v12; // eax
  int v13; // ecx

  if ( !n2 )
  {
    v10 = 0;
    if ( (int)count <= 0 )
    {
LABEL_15:
      v9 = 0;
    }
    else
    {
      while ( 1 )
      {
        n48 = i[v10];
        if ( n48 < 48 || n48 > 57 )
          break;
        if ( ++v10 >= (int)count )
          goto LABEL_15;
      }
      v9 = -1;
    }
LABEL_16:
    if ( v9 )
      return -1;
    goto LABEL_17;
  }
  if ( n2 == 1 )
  {
    v7 = 0;
    if ( (int)count <= 0 )
    {
LABEL_9:
      v9 = 0;
    }
    else
    {
      while ( 1 )
      {
        v8 = i[v7];
        if ( v8 < 0 || *(char *)(v8 + a5) < 0 )
          break;
        if ( ++v7 >= (int)count )
          goto LABEL_9;
      }
      v9 = -1;
    }
    goto LABEL_16;
  }
  if ( n2 != 2 )
    return -1;
LABEL_17:
  v12 = BitmapDecodeHeader(n2, count, i);
  if ( !v12 )
    return -1;
  v13 = *(_DWORD *)(a1 + 12);
  if ( v13 )
    *(_DWORD *)(v13 + 16) = v12;
  else
    *(_DWORD *)(a1 + 8) = v12;
  *(_DWORD *)(a1 + 12) = v12;
  v12[4] = 0;
  return 0;
}