snes gfx debugger: fix crashes and malfunction in 16x16 tilemaps
This commit is contained in:
parent
5a9bdca459
commit
195197fb70
|
@ -2143,10 +2143,9 @@
|
|||
// pnDetailsPaletteColor
|
||||
//
|
||||
this.pnDetailsPaletteColor.BackColor = System.Drawing.Color.Red;
|
||||
this.pnDetailsPaletteColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.pnDetailsPaletteColor.Location = new System.Drawing.Point(3, 4);
|
||||
this.pnDetailsPaletteColor.Location = new System.Drawing.Point(6, 6);
|
||||
this.pnDetailsPaletteColor.Name = "pnDetailsPaletteColor";
|
||||
this.pnDetailsPaletteColor.Size = new System.Drawing.Size(69, 68);
|
||||
this.pnDetailsPaletteColor.Size = new System.Drawing.Size(64, 64);
|
||||
this.pnDetailsPaletteColor.TabIndex = 3;
|
||||
this.pnDetailsPaletteColor.DoubleClick += new System.EventHandler(this.pnDetailsPaletteColor_DoubleClick);
|
||||
//
|
||||
|
|
|
@ -978,10 +978,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
//view a BG tile
|
||||
int paletteStart = 0;
|
||||
var bmp = new Bitmap(8, 8, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
var bmpdata = bmp.LockBits(new Rectangle(0, 0, 8, 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
var bgs = currMapEntryState;
|
||||
var oneTileEntry = new SNESGraphicsDecoder.TileEntry[] { bgs.entry };
|
||||
int tileSize = si.BG[bgs.bgnum].TileSize;
|
||||
int pixels = tileSize * tileSize;
|
||||
|
||||
var bmp = new Bitmap(tileSize, tileSize, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
var bmpdata = bmp.LockBits(new Rectangle(0, 0, tileSize, tileSize), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
|
||||
if (viewBgMode == SNESGraphicsDecoder.BGMode.Mode7)
|
||||
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, false, false, 1, currMapEntryState.entry.tilenum, 1);
|
||||
|
@ -991,9 +994,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, false, true, 1, currMapEntryState.entry.tilenum, 1);
|
||||
else
|
||||
{
|
||||
gd.DecodeBG((int*)bmpdata.Scan0, bmpdata.Stride / 4, oneTileEntry, si.BG[bgs.bgnum].TiledataAddr, SNESGraphicsDecoder.ScreenSize.Hacky_1x1, si.BG[bgs.bgnum].Bpp, 8, paletteStart);
|
||||
gd.Paletteize((int*)bmpdata.Scan0, 0, 0, 64);
|
||||
gd.Colorize((int*)bmpdata.Scan0, 0, 64);
|
||||
gd.DecodeBG((int*)bmpdata.Scan0, bmpdata.Stride / 4, oneTileEntry, si.BG[bgs.bgnum].TiledataAddr, SNESGraphicsDecoder.ScreenSize.Hacky_1x1, si.BG[bgs.bgnum].Bpp, tileSize, paletteStart);
|
||||
gd.Paletteize((int*)bmpdata.Scan0, 0, 0, pixels);
|
||||
gd.Colorize((int*)bmpdata.Scan0, 0, pixels);
|
||||
}
|
||||
|
||||
bmp.UnlockBits(bmpdata);
|
||||
|
|
|
@ -663,7 +663,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
{
|
||||
int mapIndex = mty * dims.Width + mtx;
|
||||
var te = map[mapIndex];
|
||||
int tileNum = te.tilenum + tx + ty * 16 + baseTileNum;
|
||||
|
||||
//apply metatile flipping
|
||||
int tnx = tx, tny = ty;
|
||||
if (tilesize == 16)
|
||||
{
|
||||
if ((te.flags & TileEntryFlags.Horz) != 0) tnx = 1 - tnx;
|
||||
if ((te.flags & TileEntryFlags.Vert) != 0) tny = 1 - tny;
|
||||
}
|
||||
|
||||
int tileNum = te.tilenum + tnx + tny * 16 + baseTileNum;
|
||||
int srcOfs = tileNum * 64;
|
||||
for (int i = 0, y = 0; y < 8; y++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue