gb gpu view: oam
This commit is contained in:
parent
1118fded53
commit
ef4bb14d59
|
@ -151,13 +151,15 @@ namespace BizHawk.Emulation.Consoles.GB
|
||||||
IntPtr vram = IntPtr.Zero;
|
IntPtr vram = IntPtr.Zero;
|
||||||
IntPtr bgpal = IntPtr.Zero;
|
IntPtr bgpal = IntPtr.Zero;
|
||||||
IntPtr sppal = IntPtr.Zero;
|
IntPtr sppal = IntPtr.Zero;
|
||||||
|
IntPtr oam = IntPtr.Zero;
|
||||||
int unused = 0;
|
int unused = 0;
|
||||||
if (!LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.vram, ref vram, ref unused)
|
if (!LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.vram, ref vram, ref unused)
|
||||||
|| !LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.bgpal, ref bgpal, ref unused)
|
|| !LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.bgpal, ref bgpal, ref unused)
|
||||||
|| !LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.sppal, ref sppal, ref unused))
|
|| !LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.sppal, ref sppal, ref unused)
|
||||||
|
|| !LibGambatte.gambatte_getmemoryarea(GambatteState, LibGambatte.MemoryAreas.oam, ref oam, ref unused))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
|
|
||||||
scanlinecallback(vram, IsCGBMode(), LibGambatte.gambatte_cpuread(GambatteState, 0xff40), bgpal, sppal);
|
scanlinecallback(vram, IsCGBMode(), LibGambatte.gambatte_cpuread(GambatteState, 0xff40), bgpal, sppal, oam);
|
||||||
}
|
}
|
||||||
|
|
||||||
LibGambatte.gambatte_runfor(GambatteState, VideoBuffer, 160, soundbuff, ref nsamp);
|
LibGambatte.gambatte_runfor(GambatteState, VideoBuffer, 160, soundbuff, ref nsamp);
|
||||||
|
@ -599,7 +601,8 @@ namespace BizHawk.Emulation.Consoles.GB
|
||||||
/// <param name="lcdc"></param>
|
/// <param name="lcdc"></param>
|
||||||
/// <param name="bgpal"></param>
|
/// <param name="bgpal"></param>
|
||||||
/// <param name="sppal"></param>
|
/// <param name="sppal"></param>
|
||||||
public delegate void ScanlineCallback(IntPtr vram, bool cgb, int lcdc, IntPtr bgpal, IntPtr sppal);
|
/// <param name="oam"></param>
|
||||||
|
public delegate void ScanlineCallback(IntPtr vram, bool cgb, int lcdc, IntPtr bgpal, IntPtr sppal, IntPtr oam);
|
||||||
|
|
||||||
ScanlineCallback scanlinecallback;
|
ScanlineCallback scanlinecallback;
|
||||||
|
|
||||||
|
|
|
@ -316,7 +316,7 @@ namespace BizHawk.Emulation.Consoles.GB
|
||||||
cartram = 3,
|
cartram = 3,
|
||||||
oam = 4,
|
oam = 4,
|
||||||
hram = 5,
|
hram = 5,
|
||||||
// these last two aren't returning native memory area data
|
// these last two aren't returning native memory area data, but instead converted RGB32 colors
|
||||||
bgpal = 6,
|
bgpal = 6,
|
||||||
sppal = 7
|
sppal = 7
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,15 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
SetStyle(ControlStyles.Opaque, true);
|
SetStyle(ControlStyles.Opaque, true);
|
||||||
this.BackColor = Color.Transparent;
|
this.BackColor = Color.Transparent;
|
||||||
this.Paint += new PaintEventHandler(BmpView_Paint);
|
this.Paint += new PaintEventHandler(BmpView_Paint);
|
||||||
|
this.SizeChanged += new EventHandler(BmpView_SizeChanged);
|
||||||
ChangeBitmapSize(1, 1);
|
ChangeBitmapSize(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BmpView_SizeChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
scaled = !(bmp.Width == Width && bmp.Height == Height);
|
||||||
|
}
|
||||||
|
|
||||||
void BmpView_Paint(object sender, PaintEventArgs e)
|
void BmpView_Paint(object sender, PaintEventArgs e)
|
||||||
{
|
{
|
||||||
if (scaled)
|
if (scaled)
|
||||||
|
@ -48,9 +54,14 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
public void ChangeBitmapSize(int w, int h)
|
public void ChangeBitmapSize(int w, int h)
|
||||||
{
|
{
|
||||||
if (bmp != null)
|
if (bmp != null)
|
||||||
|
{
|
||||||
|
if (w == bmp.Width && h == bmp.Height)
|
||||||
|
return;
|
||||||
bmp.Dispose();
|
bmp.Dispose();
|
||||||
|
}
|
||||||
bmp = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
bmp = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
scaled = !(w == Width && h == Height);
|
BmpView_SizeChanged(null, null);
|
||||||
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
this.bmpViewTiles1 = new BizHawk.MultiClient.GBtools.BmpView();
|
this.bmpViewTiles1 = new BizHawk.MultiClient.GBtools.BmpView();
|
||||||
this.bmpViewWin = new BizHawk.MultiClient.GBtools.BmpView();
|
this.bmpViewWin = new BizHawk.MultiClient.GBtools.BmpView();
|
||||||
this.bmpViewBG = new BizHawk.MultiClient.GBtools.BmpView();
|
this.bmpViewBG = new BizHawk.MultiClient.GBtools.BmpView();
|
||||||
|
this.bmpViewOAM = new BizHawk.MultiClient.GBtools.BmpView();
|
||||||
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
|
@ -150,11 +152,30 @@
|
||||||
this.bmpViewBG.TabIndex = 4;
|
this.bmpViewBG.TabIndex = 4;
|
||||||
this.bmpViewBG.Text = "bmpView1";
|
this.bmpViewBG.Text = "bmpView1";
|
||||||
//
|
//
|
||||||
|
// bmpViewOAM
|
||||||
|
//
|
||||||
|
this.bmpViewOAM.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.bmpViewOAM.Location = new System.Drawing.Point(12, 300);
|
||||||
|
this.bmpViewOAM.Name = "bmpViewOAM";
|
||||||
|
this.bmpViewOAM.Size = new System.Drawing.Size(320, 16);
|
||||||
|
this.bmpViewOAM.TabIndex = 14;
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
this.label7.AutoSize = true;
|
||||||
|
this.label7.Location = new System.Drawing.Point(9, 284);
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
this.label7.Size = new System.Drawing.Size(31, 13);
|
||||||
|
this.label7.TabIndex = 15;
|
||||||
|
this.label7.Text = "OAM";
|
||||||
|
//
|
||||||
// GBGPUView
|
// GBGPUView
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(951, 414);
|
this.ClientSize = new System.Drawing.Size(951, 414);
|
||||||
|
this.Controls.Add(this.label7);
|
||||||
|
this.Controls.Add(this.bmpViewOAM);
|
||||||
this.Controls.Add(this.label6);
|
this.Controls.Add(this.label6);
|
||||||
this.Controls.Add(this.label5);
|
this.Controls.Add(this.label5);
|
||||||
this.Controls.Add(this.bmpViewSPPal);
|
this.Controls.Add(this.bmpViewSPPal);
|
||||||
|
@ -190,5 +211,7 @@
|
||||||
private BmpView bmpViewSPPal;
|
private BmpView bmpViewSPPal;
|
||||||
private System.Windows.Forms.Label label5;
|
private System.Windows.Forms.Label label5;
|
||||||
private System.Windows.Forms.Label label6;
|
private System.Windows.Forms.Label label6;
|
||||||
|
private BmpView bmpViewOAM;
|
||||||
|
private System.Windows.Forms.Label label7;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,6 +22,7 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
bmpViewTiles2.ChangeBitmapSize(128, 192);
|
bmpViewTiles2.ChangeBitmapSize(128, 192);
|
||||||
bmpViewBGPal.ChangeBitmapSize(8, 4);
|
bmpViewBGPal.ChangeBitmapSize(8, 4);
|
||||||
bmpViewSPPal.ChangeBitmapSize(8, 4);
|
bmpViewSPPal.ChangeBitmapSize(8, 4);
|
||||||
|
bmpViewOAM.ChangeBitmapSize(320, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
|
@ -62,7 +63,14 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
gb.SetScanlineCallback(null, 0);
|
gb.SetScanlineCallback(null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsafe void DrawTileDMG(byte* tile, int* dest, int pitch, int *pal)
|
/// <summary>
|
||||||
|
/// draw a single 2bpp tile
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tile">16 byte 2bpp 8x8 tile (gb format)</param>
|
||||||
|
/// <param name="dest">top left origin on 32bit bitmap</param>
|
||||||
|
/// <param name="pitch">pitch of bitmap in 4 byte units</param>
|
||||||
|
/// <param name="pal">4 palette colors</param>
|
||||||
|
static unsafe void DrawTile(byte* tile, int* dest, int pitch, int *pal)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 8; y++)
|
for (int y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +90,16 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsafe void DrawTileCGB(byte* tile, int* dest, int pitch, int* pal, bool hflip, bool vflip)
|
/// <summary>
|
||||||
|
/// draw a single 2bpp tile, with hflip and vflip
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tile">16 byte 2bpp 8x8 tile (gb format)</param>
|
||||||
|
/// <param name="dest">top left origin on 32bit bitmap</param>
|
||||||
|
/// <param name="pitch">pitch of bitmap in 4 byte units</param>
|
||||||
|
/// <param name="pal">4 palette colors</param>
|
||||||
|
/// <param name="hflip">true to flip horizontally</param>
|
||||||
|
/// <param name="vflip">true to flip vertically</param>
|
||||||
|
static unsafe void DrawTileHV(byte* tile, int* dest, int pitch, int* pal, bool hflip, bool vflip)
|
||||||
{
|
{
|
||||||
if (vflip)
|
if (vflip)
|
||||||
dest += pitch * 7;
|
dest += pitch * 7;
|
||||||
|
@ -115,6 +132,14 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// draw a bg map, cgb format
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="b">bitmap to draw to, should be 256x256</param>
|
||||||
|
/// <param name="_map">tilemap, 32x32 bytes. extended tilemap assumed to be @+8k</param>
|
||||||
|
/// <param name="_tiles">base tiledata location. second bank tiledata assumed to be @+8k</param>
|
||||||
|
/// <param name="wrap">true if tileindexes are s8 (not u8)</param>
|
||||||
|
/// <param name="_pal">8 palettes (4 colors each)</param>
|
||||||
static unsafe void DrawBGCGB(Bitmap b, IntPtr _map, IntPtr _tiles, bool wrap, IntPtr _pal)
|
static unsafe void DrawBGCGB(Bitmap b, IntPtr _map, IntPtr _tiles, bool wrap, IntPtr _pal)
|
||||||
{
|
{
|
||||||
var lockdata = b.LockBits(new Rectangle(0, 0, 256, 256), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
var lockdata = b.LockBits(new Rectangle(0, 0, 256, 256), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
|
@ -137,7 +162,7 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
|
|
||||||
int* thispal = pal + 4 * (tileext & 7);
|
int* thispal = pal + 4 * (tileext & 7);
|
||||||
|
|
||||||
DrawTileCGB(tile, dest, pitch, thispal, tileext.Bit(5), tileext.Bit(6));
|
DrawTileHV(tile, dest, pitch, thispal, tileext.Bit(5), tileext.Bit(6));
|
||||||
map++;
|
map++;
|
||||||
dest += 8;
|
dest += 8;
|
||||||
}
|
}
|
||||||
|
@ -147,6 +172,14 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
b.UnlockBits(lockdata);
|
b.UnlockBits(lockdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// draw a bg map, dmg format
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="b">bitmap to draw to, should be 256x256</param>
|
||||||
|
/// <param name="_map">tilemap, 32x32 bytes</param>
|
||||||
|
/// <param name="_tiles">base tiledata location</param>
|
||||||
|
/// <param name="wrap">true if tileindexes are s8 (not u8)</param>
|
||||||
|
/// <param name="_pal">1 palette (4 colors)</param>
|
||||||
static unsafe void DrawBGDMG(Bitmap b, IntPtr _map, IntPtr _tiles, bool wrap, IntPtr _pal)
|
static unsafe void DrawBGDMG(Bitmap b, IntPtr _map, IntPtr _tiles, bool wrap, IntPtr _pal)
|
||||||
{
|
{
|
||||||
var lockdata = b.LockBits(new Rectangle(0, 0, 256, 256), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
var lockdata = b.LockBits(new Rectangle(0, 0, 256, 256), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
|
@ -163,7 +196,7 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
if (wrap && tileindex >= 128)
|
if (wrap && tileindex >= 128)
|
||||||
tileindex -= 256;
|
tileindex -= 256;
|
||||||
byte* tile = (byte*)(_tiles + tileindex * 16);
|
byte* tile = (byte*)(_tiles + tileindex * 16);
|
||||||
DrawTileDMG(tile, dest, pitch, pal);
|
DrawTile(tile, dest, pitch, pal);
|
||||||
map++;
|
map++;
|
||||||
dest += 8;
|
dest += 8;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +206,12 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
b.UnlockBits(lockdata);
|
b.UnlockBits(lockdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// draw a full bank of 384 tiles
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="b">bitmap to draw to, should be 128x192</param>
|
||||||
|
/// <param name="_tiles">base tile address</param>
|
||||||
|
/// <param name="_pal">single palette to use on all tiles</param>
|
||||||
static unsafe void DrawTiles(Bitmap b, IntPtr _tiles, IntPtr _pal)
|
static unsafe void DrawTiles(Bitmap b, IntPtr _tiles, IntPtr _pal)
|
||||||
{
|
{
|
||||||
var lockdata = b.LockBits(new Rectangle(0, 0, 128, 192), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
var lockdata = b.LockBits(new Rectangle(0, 0, 128, 192), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
|
@ -185,7 +224,7 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
{
|
{
|
||||||
for (int tx = 0; tx < 16; tx++)
|
for (int tx = 0; tx < 16; tx++)
|
||||||
{
|
{
|
||||||
DrawTileDMG(tile, dest, pitch, pal);
|
DrawTile(tile, dest, pitch, pal);
|
||||||
tile += 16;
|
tile += 16;
|
||||||
dest += 8;
|
dest += 8;
|
||||||
}
|
}
|
||||||
|
@ -195,14 +234,62 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
b.UnlockBits(lockdata);
|
b.UnlockBits(lockdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsafe void DrawPal(Bitmap b, IntPtr _pal)
|
/// <summary>
|
||||||
|
/// draw oam data
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="b">bitmap to draw to. should be 320x8 (!tall), 320x16 (tall)</param>
|
||||||
|
/// <param name="_oam">oam data, 4 * 40 bytes</param>
|
||||||
|
/// <param name="_tiles">base tiledata location. cgb: second bank tiledata assumed to be @+8k</param>
|
||||||
|
/// <param name="_pal">2 (dmg) or 8 (cgb) palettes</param>
|
||||||
|
/// <param name="tall">true for 8x16 sprites; else 8x8</param>
|
||||||
|
/// <param name="cgb">true for cgb (more palettes, second bank tiles)</param>
|
||||||
|
static unsafe void DrawOam(Bitmap b, IntPtr _oam, IntPtr _tiles, IntPtr _pal, bool tall, bool cgb)
|
||||||
{
|
{
|
||||||
var lockdata = b.LockBits(new Rectangle(0, 0, 8, 4), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
var lockdata = b.LockBits(new Rectangle(0, 0, 320, tall ? 16 : 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
|
int* dest = (int*)lockdata.Scan0;
|
||||||
|
int pitch = lockdata.Stride / sizeof(int);
|
||||||
|
int* pal = (int*)_pal;
|
||||||
|
byte *oam = (byte*)_oam;
|
||||||
|
|
||||||
|
for (int s = 0; s < 40; s++)
|
||||||
|
{
|
||||||
|
oam += 2; // ypos, xpos
|
||||||
|
int tileindex = *oam++;
|
||||||
|
int flags = *oam++;
|
||||||
|
bool vflip = flags.Bit(6);
|
||||||
|
bool hflip = flags.Bit(5);
|
||||||
|
if (tall)
|
||||||
|
// i assume 8x16 vflip flips the whole thing, not just each tile?
|
||||||
|
if (vflip)
|
||||||
|
tileindex |= 1;
|
||||||
|
else
|
||||||
|
tileindex &= 0xfe;
|
||||||
|
byte* tile = (byte*)(_tiles + tileindex * 16);
|
||||||
|
int* thispal = pal + 4 * (cgb ? flags & 7 : flags >> 4 & 1);
|
||||||
|
if (cgb && flags.Bit(3))
|
||||||
|
tile += 8192;
|
||||||
|
DrawTileHV(tile, dest, pitch, thispal, hflip, vflip);
|
||||||
|
if (tall)
|
||||||
|
DrawTileHV((byte*)((int)tile ^ 16), dest + pitch * 8, pitch, thispal, hflip, vflip);
|
||||||
|
dest += 8;
|
||||||
|
}
|
||||||
|
b.UnlockBits(lockdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// draw a palette directly
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="b">bitmap to draw to. should be numpals x 4</param>
|
||||||
|
/// <param name="_pal">start of palettes</param>
|
||||||
|
/// <param name="numpals">number of palettes (not colors)</param>
|
||||||
|
static unsafe void DrawPal(Bitmap b, IntPtr _pal, int numpals)
|
||||||
|
{
|
||||||
|
var lockdata = b.LockBits(new Rectangle(0, 0, numpals, 4), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
int* dest = (int*)lockdata.Scan0;
|
int* dest = (int*)lockdata.Scan0;
|
||||||
int pitch = lockdata.Stride / sizeof(int);
|
int pitch = lockdata.Stride / sizeof(int);
|
||||||
int* pal = (int*)_pal;
|
int* pal = (int*)_pal;
|
||||||
|
|
||||||
for (int px = 0; px < 8; px++)
|
for (int px = 0; px < numpals; px++)
|
||||||
{
|
{
|
||||||
for (int py = 0; py < 4; py++)
|
for (int py = 0; py < 4; py++)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +302,7 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
b.UnlockBits(lockdata);
|
b.UnlockBits(lockdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScanlineCallback(IntPtr vram, bool cgb, int lcdc, IntPtr bgpal, IntPtr sppal)
|
void ScanlineCallback(IntPtr vram, bool cgb, int lcdc, IntPtr bgpal, IntPtr sppal, IntPtr oam)
|
||||||
{
|
{
|
||||||
// set alpha on all pixels
|
// set alpha on all pixels
|
||||||
unsafe
|
unsafe
|
||||||
|
@ -276,10 +363,47 @@ namespace BizHawk.MultiClient.GBtools
|
||||||
bmpViewTiles2.Refresh();
|
bmpViewTiles2.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPal(bmpViewBGPal.bmp, bgpal);
|
// palettes
|
||||||
DrawPal(bmpViewSPPal.bmp, sppal);
|
if (cgb)
|
||||||
|
{
|
||||||
|
bmpViewBGPal.ChangeBitmapSize(8, 4);
|
||||||
|
if (bmpViewBGPal.Width != 128)
|
||||||
|
bmpViewBGPal.Width = 128;
|
||||||
|
bmpViewSPPal.ChangeBitmapSize(8, 4);
|
||||||
|
if (bmpViewSPPal.Width != 128)
|
||||||
|
bmpViewSPPal.Width = 128;
|
||||||
|
DrawPal(bmpViewBGPal.bmp, bgpal, 8);
|
||||||
|
DrawPal(bmpViewSPPal.bmp, sppal, 8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bmpViewBGPal.ChangeBitmapSize(1, 4);
|
||||||
|
if (bmpViewBGPal.Width != 16)
|
||||||
|
bmpViewBGPal.Width = 16;
|
||||||
|
bmpViewSPPal.ChangeBitmapSize(2, 4);
|
||||||
|
if (bmpViewSPPal.Width != 32)
|
||||||
|
bmpViewSPPal.Width = 32;
|
||||||
|
DrawPal(bmpViewBGPal.bmp, bgpal, 1);
|
||||||
|
DrawPal(bmpViewSPPal.bmp, sppal, 2);
|
||||||
|
}
|
||||||
bmpViewBGPal.Refresh();
|
bmpViewBGPal.Refresh();
|
||||||
bmpViewSPPal.Refresh();
|
bmpViewSPPal.Refresh();
|
||||||
|
|
||||||
|
// oam
|
||||||
|
if (lcdc.Bit(2)) // 8x16
|
||||||
|
{
|
||||||
|
bmpViewOAM.ChangeBitmapSize(320, 16);
|
||||||
|
if (bmpViewOAM.Height != 16)
|
||||||
|
bmpViewOAM.Height = 16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bmpViewOAM.ChangeBitmapSize(320, 8);
|
||||||
|
if (bmpViewOAM.Height != 8)
|
||||||
|
bmpViewOAM.Height = 8;
|
||||||
|
}
|
||||||
|
DrawOam(bmpViewOAM.bmp, oam, vram, sppal, lcdc.Bit(2), cgb);
|
||||||
|
bmpViewOAM.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GBGPUView_FormClosed(object sender, FormClosedEventArgs e)
|
private void GBGPUView_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
|
|
Loading…
Reference in New Issue