Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyPlatPkg / Platform / Pei / EarlyVideoPei / BitmapDecodeFull.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Full restructure
/*
 * BitmapDecodeFull at 0xffe73168.
 * Top-level bitmap decode path combining header, palette, and pixel handling.
 */
int __fastcall BitmapDecodeFull(char *i, int *Pool, int a3, int a4)
{
  char *i_1; // ebp
  int v5; // eax
  int v6; // ecx
  int v7; // esi
  char *j; // edi
  char n57; // cl
  int v10; // esi
  int v11; // esi
  char v12; // al
  void *count; // esi
  int DataOffset; // eax
  int v15; // ecx
  int v16; // ecx
  int v20; // [esp+14h] [ebp-8h]
  int v21; // [esp+18h] [ebp-4h]

  i_1 = i;
  v5 = 0;
  if ( *Pool > 9 )
    v6 = (*Pool > 26) + 1;
  else
    v6 = 0;
  v21 = *(_DWORD *)(a4 + 4 * v6 + 140);
  if ( *Pool > 9 )
    v5 = (*Pool > 26) + 1;
  v7 = *(_DWORD *)(a4 + 4 * v5 + 128);
  v20 = v7;
LABEL_7:
  for ( j = i_1; ; ++j )
  {
    n57 = *j;
    if ( *j < 0 || *(char *)(n57 + a4) < 0 )
      break;
    if ( n57 >= 48 && n57 <= 57 )
    {
      i_1 = j;
      do
      {
        if ( n57 > 57 )
          break;
        n57 = *++i_1;
      }
      while ( *i_1 >= 48 );
      v10 = v7 - BitmapGetDataOffset(i_1 - i);
      v11 = BitmapGetImageSize(i_1 - j) + v10;
      if ( v11 + BitmapGetDataOffset(j - i) + 4 >= 0 )
      {
        v7 = v20;
        goto LABEL_7;
      }
      break;
    }
  }
  v12 = *j;
  count = (void *)(j - i);
  if ( *j && (v12 < 0 || *(char *)(v12 + a4) < 0) )
  {
    DataOffset = BitmapGetDataOffset((int)count);
    v16 = 8 * v15;
    if ( v21 - v16 + DataOffset + 4 > 0 )
      return BitmapDecodePixels(i, Pool, v16, a4);
  }
  if ( BitmapDecodePalette((int)Pool, 1, count, i, a4) >= 0 )
    return j - i;
  return -1;
}