Explorar o código

Bpp = 2 support

myst6re %!s(int64=11) %!d(string=hai) anos
pai
achega
994cb9b3a2
Modificáronse 1 ficheiros con 31 adicións e 0 borrados
  1. 31 0
      utilities/ffvii_field_dat_dumper/src/MimFile.cpp

+ 31 - 0
utilities/ffvii_field_dat_dumper/src/MimFile.cpp

@@ -180,6 +180,37 @@ MimFile::GetSurface( const u16 page_x, const u16 page_y, const u16 clut_x, const
         }
     }
 
+
+
+    else if ( bpp == 2 )
+    {
+        for( int y = 0; y < 256; ++y )
+        {
+            for( int x = 0; x < 256; ++x )
+            {
+                u16 real_x = mImageVramPositionX + page_x * 128 + x * 2;
+                u16 real_y = mImageVramPositionY + page_y * 256 + y;
+
+                u16 col = m_Vram->GetU16(real_x, real_y);
+
+                color.r = ( ( col       ) & 31 ) * 255 / 31;
+                color.g = ( ( col >>  5 ) & 31 ) * 255 / 31;
+                color.b = ( ( col >> 10 ) & 31 ) * 255 / 31;
+
+                if( col == 0x0000 )
+                {
+                    color.a = 0;
+                }
+                else
+                {
+                    color.a = 255;
+                }
+
+                memcpy( ret->pixels.data() + x * 4 + ret->width * 4 * y, &color, sizeof( ClutColor ) );
+            }
+        }
+    }
+
     return ret;
 }