diff src/gb/GB.cpp @ 496:a6d060a64246

pixel introspection. but entire image is upside down.
author Robert McIntyre <rlm@mit.edu>
date Mon, 11 Jun 2012 06:04:25 -0500
parents 893c753f8088
children 690811e54b51
line wrap: on
line diff
     1.1 --- a/src/gb/GB.cpp	Mon Jun 11 00:55:51 2012 -0500
     1.2 +++ b/src/gb/GB.cpp	Mon Jun 11 06:04:25 2012 -0500
     1.3 @@ -3878,6 +3878,39 @@
     1.4  
     1.5  
     1.6  //RLM: 
     1.7 +/**
     1.8 +void getPixels32(int32* store){
     1.9 +  utilWriteBMP((u8*)store, 144, 160, 32, pix);
    1.10 +}
    1.11 +**/
    1.12 +
    1.13 +void getPixels32(int32* store){
    1.14 +  int w = 160;
    1.15 +  int h = 144;
    1.16 +
    1.17 +  int sizeX = w;
    1.18 +  int sizeY = h;
    1.19 +
    1.20 +  u32 *pixU32 = (u32 *)(pix + 4 * (w + 1) * (h));
    1.21 +  for (int y = 0; y < sizeY; y++)
    1.22 +    {
    1.23 +      for (int x = 0; x < sizeX; x++)
    1.24 +	{
    1.25 +	  u32 v = *pixU32++;
    1.26 +
    1.27 +	  u8 b = ((v >> systemBlueShift) & 0x001f) << 3; // B
    1.28 +	  u8 g = ((v >> systemGreenShift) & 0x001f) << 3; // G
    1.29 +	  u8 r = ((v >> systemRedShift) & 0x001f) << 3; // R
    1.30 +
    1.31 +	  int32 rgb = (r << 16 ) + (g << 8) + b;
    1.32 +	  *store++ = rgb;
    1.33 +	}
    1.34 +      pixU32++;
    1.35 +      pixU32 -= 2 * (w + 1);
    1.36 +    }
    1.37 +}
    1.38 +
    1.39 +
    1.40  int getRamSize(){
    1.41    return gbRamSize;
    1.42  }