Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I'm lost again

Name: Anonymous 2011-11-16 4:15

Any idea what does the following code do? (The PalA and PalB tables are used for some scary 16-bit lookup. Never understood such crap.)


void __cdecl initPalsAB()
{
  unsigned __int32 I; // [sp+4Ch] [bp-18h]@4
  unsigned __int32 J; // [sp+4Ch] [bp-18h]@17
  unsigned __int32 K; // [sp+50h] [bp-14h]@2
  unsigned __int32 L; // [sp+50h] [bp-14h]@15
  unsigned __int32 A; // [sp+5Ch] [bp-8h]@7
  unsigned __int32 B; // [sp+5Ch] [bp-8h]@20

  if ( SprFlags == 1 )
  {
    for ( K = 0; K < 0x20; ++K )
    {
      for ( I = 0; I < 0x100; ++I )
      {
        if ( ((0x1F - K) * 8 * (I & 3) >> 4) & 1 )
          A = ((0x1F - K) * 8 * (I & 3) >> 5) + 1;
        else
          A = (0x1F - K) * 8 * (I & 3) >> 5;
        if ( A > 0x1F )
          A = 31;
        *(_DWORD *)&PalB[2 * (I + (K << 8))] = 0x20 * A + ((31 - K) * ((I & 0x7C) >> 2) >> 5 << 10);
        *(_DWORD *)&PalA[2 * (I + (K << 8))] = ((31 - K) * (I & 0x1F) >> 5)
                                             + 0x20 * ((0x1F - K) * ((I & 0xE0) >> 5) >> 5);
      }
    }
    GlbFormat = 0x7BDEu;
  }
  else
  {
    if ( SprFlags )
    {
      GlbFormat = 0xFEFEFEu;
    }
    else
    {
      for ( L = 0; L < 0x20; ++L )
      {
        for ( J = 0; J < 0x100; ++J )
        {
          if ( ((31 - L) * 8 * (J & 7) >> 4) & 1 )
            B = ((31 - L) * 8 * (J & 7) >> 5) + 1;
          else
            B = (31 - L) * 8 * (J & 7) >> 5;
          if ( B > 0x3F )
            B = 63;
          *(_DWORD *)&PalB[2 * (J + (L << 8))] = 0x20 * B + ((0x1F - L) * ((J & 0xF8) >> 3) >> 5 << 11);
          *(_DWORD *)&PalA[2 * (J + (L << 8))] = ((0x1F - L) * (J & 0x1F) >> 5)
                                               + 0x20 * ((0x1F - L) * ((J & 0xE0) >> 5) >> 5);
        }
      }
      GlbFormat = 0xF7DEu;
    }
  }
}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-16 4:32

>>6
I can read their code actually, if it was really obsfucated it would be filled with casts, redefined function pointers and exchanged variables through global arrays decided by functions. Its just "lets minify it to 500 bytes"

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List