snesgfxdebugger-obj properties display

This commit is contained in:
zeromus 2012-12-03 07:50:23 +00:00
parent bb3061baf8
commit 522bcd844c
3 changed files with 396 additions and 163 deletions

View File

@ -229,6 +229,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public int X { private set; get; }
public int Y { private set; get; }
public int Tile { private set; get; }
public int Name { private set; get; }
public int Table { private set; get; }
public int Palette { private set; get; }
public int Priority { private set; get; }
@ -236,14 +237,19 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public bool HFlip { private set; get; }
public int Size { private set; get; }
public OAMInfo(SNESGraphicsDecoder dec, int num)
/// <summary>
/// tiledata address
/// </summary>
public int Address { private set; get; }
public OAMInfo(SNESGraphicsDecoder dec, ScreenInfo si, int num)
{
Index = num;
int lowaddr = num*4;
X = dec.oam[lowaddr++];
Y = dec.oam[lowaddr++];
Tile = dec.oam[lowaddr++];
Name = dec.oam[lowaddr++];
Table = dec.oam[lowaddr] & 1;
Palette = (dec.oam[lowaddr]>>1) & 7;
Priority = (dec.oam[lowaddr] >> 4) & 3;
@ -259,11 +265,25 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
Size = high & 1;
X |= (x << 9);
X = (X << 23) >> 23;
Tile = Table*256 + Name;
Address = 32 * Tile;
if (Tile < 256)
Address += si.OBJTable0Addr;
else
Address += si.OBJTable1Addr - (256 * 32);
Address &= 0xFFFF;
}
}
public class ScreenInfo
{
public Dimensions ObjSizeBounds;
public Dimensions ObjSizeBoundsSquare;
public BGInfos BG = new BGInfos();
public ModeInfo Mode = new ModeInfo();
@ -305,6 +325,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
si.OBSEL_NameSel = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.OBSEL_NAMESEL);
si.OBSEL_NameBase = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.OBSEL_NAMEBASE);
si.ObjSizeBounds = ObjSizes[si.OBSEL_Size,1];
int square = Math.Max(si.ObjSizeBounds.Width, si.ObjSizeBounds.Height);
si.ObjSizeBoundsSquare = new Dimensions(square, square);
si.OBJTable0Addr = si.OBSEL_NameBase << 14;
si.OBJTable1Addr = (si.OBJTable0Addr + ((si.OBSEL_NameSel + 1) << 13)) & 0xFFFF;
@ -875,7 +900,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public void RenderSpriteToScreen(int* screen, int stride, int destx, int desty, ScreenInfo si, int spritenum)
{
var dims = new[] { SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, 0], SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, 1] };
var oam = new OAMInfo(this, spritenum);
var oam = new OAMInfo(this, si, spritenum);
var dim = dims[oam.Size];
int[] tilebuf = _tileCache[4];
@ -886,13 +911,28 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
else
baseaddr = si.OBJTable1Addr;
//TODO - flips of 'undocumented' rectangular oam settings are wrong. probably easy to do right, but we need a test
int bcol = oam.Tile & 0xF;
int brow = (oam.Tile >> 4) & 0xF;
for(int y=0;y<dim.Height;y++)
for (int x = 0; x < dim.Width; x++)
for(int oy=0;oy<dim.Height;oy++)
for (int ox = 0; ox < dim.Width; ox++)
{
int dy = desty + y;
int dx = destx + x;
int x = ox;
int y = oy;
int dy, dx;
if (oam.HFlip)
dx = dim.Width - 1 - x;
else dx = x;
if (oam.VFlip)
dy = dim.Height - 1 - y;
else dy = y;
dx += destx;
dy += desty;
int col = (bcol + (x >> 3)) & 0xF;
int row = (brow + (y >> 3)) & 0xF;
int sx = x & 0x7;
@ -910,6 +950,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public int Colorize(int rgb555)
{
//skip to max luminance in the palette table
return colortable[491520 + rgb555];
}

View File

@ -190,17 +190,19 @@
this.paletteViewer = new BizHawk.MultiClient.SNESGraphicsViewer();
this.tabctrlDetails = new System.Windows.Forms.TabControl();
this.tpPalette = new System.Windows.Forms.TabPage();
this.txtPaletteDetailsIndexSpecific = new System.Windows.Forms.TextBox();
this.txtPaletteDetailsIndexHexSpecific = new System.Windows.Forms.TextBox();
this.label53 = new System.Windows.Forms.Label();
this.label52 = new System.Windows.Forms.Label();
this.label51 = new System.Windows.Forms.Label();
this.txtPaletteDetailsAddress = new System.Windows.Forms.TextBox();
this.txtPaletteDetailsIndex = new System.Windows.Forms.TextBox();
this.txtPaletteDetailsIndexHex = new System.Windows.Forms.TextBox();
this.txtDetailsPaletteColorRGB = new System.Windows.Forms.TextBox();
this.txtDetailsPaletteColorHex = new System.Windows.Forms.TextBox();
this.txtDetailsPaletteColor = new System.Windows.Forms.TextBox();
this.lblDetailsOBJOrBG = new System.Windows.Forms.Label();
this.pnDetailsPaletteColor = new System.Windows.Forms.Panel();
this.tpTile = new System.Windows.Forms.TabPage();
this.label45 = new System.Windows.Forms.Label();
this.txtTilePalette = new System.Windows.Forms.TextBox();
this.txtTileNumber = new System.Windows.Forms.TextBox();
this.txtTileMode = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
@ -210,6 +212,7 @@
this.txtTileAddress = new System.Windows.Forms.TextBox();
this.viewerTile = new BizHawk.MultiClient.SNESGraphicsViewer();
this.tpMapEntry = new System.Windows.Forms.TabPage();
this.textBox2 = new System.Windows.Forms.TextBox();
this.checkMapEntryVFlip = new System.Windows.Forms.CheckBox();
this.label34 = new System.Windows.Forms.Label();
this.checkMapEntryHFlip = new System.Windows.Forms.CheckBox();
@ -224,19 +227,28 @@
this.txtMapEntryTileNum = new System.Windows.Forms.TextBox();
this.viewerMapEntryTile = new BizHawk.MultiClient.SNESGraphicsViewer();
this.tpOBJ = new System.Windows.Forms.TabPage();
this.txtObjPriority = new System.Windows.Forms.TextBox();
this.label50 = new System.Windows.Forms.Label();
this.txtObjPaletteMemo = new System.Windows.Forms.TextBox();
this.label49 = new System.Windows.Forms.Label();
this.txtObjPalette = new System.Windows.Forms.TextBox();
this.label48 = new System.Windows.Forms.Label();
this.txtObjNameAddr = new System.Windows.Forms.TextBox();
this.txtObjName = new System.Windows.Forms.TextBox();
this.txtObjSize = new System.Windows.Forms.TextBox();
this.label46 = new System.Windows.Forms.Label();
this.cbObjLarge = new System.Windows.Forms.CheckBox();
this.txtObjNumber = new System.Windows.Forms.TextBox();
this.txtObjCoord = new System.Windows.Forms.TextBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.cbObjVFlip = new System.Windows.Forms.CheckBox();
this.label43 = new System.Windows.Forms.Label();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.cbObjHFlip = new System.Windows.Forms.CheckBox();
this.label44 = new System.Windows.Forms.Label();
this.viewerObj = new BizHawk.MultiClient.SNESGraphicsViewer();
this.viewerPanel = new System.Windows.Forms.Panel();
this.viewer = new BizHawk.MultiClient.SNESGraphicsViewer();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.messagetimer = new System.Windows.Forms.Timer(this.components);
this.txtTilePalette = new System.Windows.Forms.TextBox();
this.label45 = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
@ -820,11 +832,11 @@
// label41
//
this.label41.AutoSize = true;
this.label41.Location = new System.Drawing.Point(10, 161);
this.label41.Location = new System.Drawing.Point(4, 161);
this.label41.Name = "label41";
this.label41.Size = new System.Drawing.Size(41, 13);
this.label41.Size = new System.Drawing.Size(49, 13);
this.label41.TabIndex = 101;
this.label41.Text = "EN.Pr3";
this.label41.Text = "EN.Prio3";
//
// txtOBSELT1OfsDescr
//
@ -967,11 +979,11 @@
// label40
//
this.label40.AutoSize = true;
this.label40.Location = new System.Drawing.Point(10, 146);
this.label40.Location = new System.Drawing.Point(4, 146);
this.label40.Name = "label40";
this.label40.Size = new System.Drawing.Size(41, 13);
this.label40.Size = new System.Drawing.Size(49, 13);
this.label40.TabIndex = 93;
this.label40.Text = "EN.Pr2";
this.label40.Text = "EN.Prio2";
//
// label28
//
@ -987,9 +999,9 @@
this.label39.AutoSize = true;
this.label39.Location = new System.Drawing.Point(162, 130);
this.label39.Name = "label39";
this.label39.Size = new System.Drawing.Size(41, 13);
this.label39.Size = new System.Drawing.Size(49, 13);
this.label39.TabIndex = 92;
this.label39.Text = "EN.Pr1";
this.label39.Text = "EN.Prio1";
//
// label20
//
@ -1053,9 +1065,9 @@
this.label37.AutoSize = true;
this.label37.Location = new System.Drawing.Point(162, 115);
this.label37.Name = "label37";
this.label37.Size = new System.Drawing.Size(41, 13);
this.label37.Size = new System.Drawing.Size(49, 13);
this.label37.TabIndex = 89;
this.label37.Text = "EN.Pr0";
this.label37.Text = "EN.Prio0";
//
// label18391
//
@ -2015,15 +2027,15 @@
//
// tpPalette
//
this.tpPalette.Controls.Add(this.txtPaletteDetailsIndexSpecific);
this.tpPalette.Controls.Add(this.txtPaletteDetailsIndexHexSpecific);
this.tpPalette.Controls.Add(this.label53);
this.tpPalette.Controls.Add(this.label52);
this.tpPalette.Controls.Add(this.label51);
this.tpPalette.Controls.Add(this.txtPaletteDetailsAddress);
this.tpPalette.Controls.Add(this.txtPaletteDetailsIndex);
this.tpPalette.Controls.Add(this.txtPaletteDetailsIndexHex);
this.tpPalette.Controls.Add(this.txtDetailsPaletteColorRGB);
this.tpPalette.Controls.Add(this.txtDetailsPaletteColorHex);
this.tpPalette.Controls.Add(this.txtDetailsPaletteColor);
this.tpPalette.Controls.Add(this.lblDetailsOBJOrBG);
this.tpPalette.Controls.Add(this.pnDetailsPaletteColor);
this.tpPalette.Location = new System.Drawing.Point(4, 22);
this.tpPalette.Name = "tpPalette";
@ -2033,39 +2045,46 @@
this.tpPalette.Text = "Color";
this.tpPalette.UseVisualStyleBackColor = true;
//
// txtPaletteDetailsIndexSpecific
// label53
//
this.txtPaletteDetailsIndexSpecific.Location = new System.Drawing.Point(69, 42);
this.txtPaletteDetailsIndexSpecific.Multiline = true;
this.txtPaletteDetailsIndexSpecific.Name = "txtPaletteDetailsIndexSpecific";
this.txtPaletteDetailsIndexSpecific.ReadOnly = true;
this.txtPaletteDetailsIndexSpecific.Size = new System.Drawing.Size(31, 18);
this.txtPaletteDetailsIndexSpecific.TabIndex = 44;
this.txtPaletteDetailsIndexSpecific.Text = "127";
this.label53.AutoSize = true;
this.label53.Location = new System.Drawing.Point(73, 76);
this.label53.Name = "label53";
this.label53.Size = new System.Drawing.Size(48, 13);
this.label53.TabIndex = 61;
this.label53.Text = "RGB888";
//
// txtPaletteDetailsIndexHexSpecific
// label52
//
this.txtPaletteDetailsIndexHexSpecific.Location = new System.Drawing.Point(42, 42);
this.txtPaletteDetailsIndexHexSpecific.Multiline = true;
this.txtPaletteDetailsIndexHexSpecific.Name = "txtPaletteDetailsIndexHexSpecific";
this.txtPaletteDetailsIndexHexSpecific.ReadOnly = true;
this.txtPaletteDetailsIndexHexSpecific.Size = new System.Drawing.Size(26, 18);
this.txtPaletteDetailsIndexHexSpecific.TabIndex = 43;
this.txtPaletteDetailsIndexHexSpecific.Text = "$7F";
this.label52.AutoSize = true;
this.label52.Location = new System.Drawing.Point(93, 54);
this.label52.Name = "label52";
this.label52.Size = new System.Drawing.Size(26, 13);
this.label52.TabIndex = 60;
this.label52.Text = "Hex";
//
// label51
//
this.label51.AutoSize = true;
this.label51.Location = new System.Drawing.Point(73, 32);
this.label51.Name = "label51";
this.label51.Size = new System.Drawing.Size(50, 13);
this.label51.TabIndex = 59;
this.label51.Text = "Raw Col.";
//
// txtPaletteDetailsAddress
//
this.txtPaletteDetailsAddress.Location = new System.Drawing.Point(41, 22);
this.txtPaletteDetailsAddress.Location = new System.Drawing.Point(149, 7);
this.txtPaletteDetailsAddress.Multiline = true;
this.txtPaletteDetailsAddress.Name = "txtPaletteDetailsAddress";
this.txtPaletteDetailsAddress.ReadOnly = true;
this.txtPaletteDetailsAddress.Size = new System.Drawing.Size(58, 18);
this.txtPaletteDetailsAddress.Size = new System.Drawing.Size(54, 18);
this.txtPaletteDetailsAddress.TabIndex = 42;
this.txtPaletteDetailsAddress.Text = "@1FE";
this.txtPaletteDetailsAddress.Text = "@DDD";
//
// txtPaletteDetailsIndex
//
this.txtPaletteDetailsIndex.Location = new System.Drawing.Point(68, 3);
this.txtPaletteDetailsIndex.Location = new System.Drawing.Point(112, 7);
this.txtPaletteDetailsIndex.Multiline = true;
this.txtPaletteDetailsIndex.Name = "txtPaletteDetailsIndex";
this.txtPaletteDetailsIndex.ReadOnly = true;
@ -2075,52 +2094,43 @@
//
// txtPaletteDetailsIndexHex
//
this.txtPaletteDetailsIndexHex.Location = new System.Drawing.Point(41, 3);
this.txtPaletteDetailsIndexHex.Location = new System.Drawing.Point(76, 7);
this.txtPaletteDetailsIndexHex.Multiline = true;
this.txtPaletteDetailsIndexHex.Name = "txtPaletteDetailsIndexHex";
this.txtPaletteDetailsIndexHex.ReadOnly = true;
this.txtPaletteDetailsIndexHex.Size = new System.Drawing.Size(26, 18);
this.txtPaletteDetailsIndexHex.Size = new System.Drawing.Size(28, 18);
this.txtPaletteDetailsIndexHex.TabIndex = 39;
this.txtPaletteDetailsIndexHex.Text = "$7F";
this.txtPaletteDetailsIndexHex.Text = "$DD";
//
// txtDetailsPaletteColorRGB
//
this.txtDetailsPaletteColorRGB.Location = new System.Drawing.Point(102, 42);
this.txtDetailsPaletteColorRGB.Location = new System.Drawing.Point(125, 73);
this.txtDetailsPaletteColorRGB.Multiline = true;
this.txtDetailsPaletteColorRGB.Name = "txtDetailsPaletteColorRGB";
this.txtDetailsPaletteColorRGB.ReadOnly = true;
this.txtDetailsPaletteColorRGB.Size = new System.Drawing.Size(96, 18);
this.txtDetailsPaletteColorRGB.Size = new System.Drawing.Size(78, 18);
this.txtDetailsPaletteColorRGB.TabIndex = 38;
this.txtDetailsPaletteColorRGB.Text = "(255, 255, 255)";
//
// txtDetailsPaletteColorHex
//
this.txtDetailsPaletteColorHex.Location = new System.Drawing.Point(102, 22);
this.txtDetailsPaletteColorHex.Location = new System.Drawing.Point(125, 51);
this.txtDetailsPaletteColorHex.Multiline = true;
this.txtDetailsPaletteColorHex.Name = "txtDetailsPaletteColorHex";
this.txtDetailsPaletteColorHex.ReadOnly = true;
this.txtDetailsPaletteColorHex.Size = new System.Drawing.Size(96, 18);
this.txtDetailsPaletteColorHex.Size = new System.Drawing.Size(78, 18);
this.txtDetailsPaletteColorHex.TabIndex = 37;
this.txtDetailsPaletteColorHex.Text = "#FFFFFF";
this.txtDetailsPaletteColorHex.Text = "#DDDDDD";
//
// txtDetailsPaletteColor
//
this.txtDetailsPaletteColor.Location = new System.Drawing.Point(102, 2);
this.txtDetailsPaletteColor.Location = new System.Drawing.Point(125, 29);
this.txtDetailsPaletteColor.Multiline = true;
this.txtDetailsPaletteColor.Name = "txtDetailsPaletteColor";
this.txtDetailsPaletteColor.ReadOnly = true;
this.txtDetailsPaletteColor.Size = new System.Drawing.Size(96, 18);
this.txtDetailsPaletteColor.Size = new System.Drawing.Size(79, 18);
this.txtDetailsPaletteColor.TabIndex = 36;
this.txtDetailsPaletteColor.Text = "$7FFF";
//
// lblDetailsOBJOrBG
//
this.lblDetailsOBJOrBG.Location = new System.Drawing.Point(2, 42);
this.lblDetailsOBJOrBG.Name = "lblDetailsOBJOrBG";
this.lblDetailsOBJOrBG.Size = new System.Drawing.Size(36, 16);
this.lblDetailsOBJOrBG.TabIndex = 40;
this.lblDetailsOBJOrBG.Text = "(OBJ:)";
this.lblDetailsOBJOrBG.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.txtDetailsPaletteColor.Text = "$DDDD";
//
// pnDetailsPaletteColor
//
@ -2128,7 +2138,7 @@
this.pnDetailsPaletteColor.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pnDetailsPaletteColor.Location = new System.Drawing.Point(3, 4);
this.pnDetailsPaletteColor.Name = "pnDetailsPaletteColor";
this.pnDetailsPaletteColor.Size = new System.Drawing.Size(32, 32);
this.pnDetailsPaletteColor.Size = new System.Drawing.Size(69, 68);
this.pnDetailsPaletteColor.TabIndex = 3;
this.pnDetailsPaletteColor.DoubleClick += new System.EventHandler(this.pnDetailsPaletteColor_DoubleClick);
//
@ -2147,11 +2157,30 @@
this.tpTile.Location = new System.Drawing.Point(4, 22);
this.tpTile.Name = "tpTile";
this.tpTile.Padding = new System.Windows.Forms.Padding(3);
this.tpTile.Size = new System.Drawing.Size(206, 94);
this.tpTile.Size = new System.Drawing.Size(206, 92);
this.tpTile.TabIndex = 1;
this.tpTile.Text = "Tile";
this.tpTile.UseVisualStyleBackColor = true;
//
// label45
//
this.label45.AutoSize = true;
this.label45.Location = new System.Drawing.Point(169, 75);
this.label45.Name = "label45";
this.label45.Size = new System.Drawing.Size(22, 13);
this.label45.TabIndex = 65;
this.label45.Text = "Pal";
//
// txtTilePalette
//
this.txtTilePalette.Location = new System.Drawing.Point(139, 73);
this.txtTilePalette.Multiline = true;
this.txtTilePalette.Name = "txtTilePalette";
this.txtTilePalette.ReadOnly = true;
this.txtTilePalette.Size = new System.Drawing.Size(29, 18);
this.txtTilePalette.TabIndex = 64;
this.txtTilePalette.Text = "$FF";
//
// txtTileNumber
//
this.txtTileNumber.Location = new System.Drawing.Point(76, 6);
@ -2175,7 +2204,7 @@
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(169, 49);
this.label18.Location = new System.Drawing.Point(169, 53);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(36, 13);
this.label18.TabIndex = 61;
@ -2183,7 +2212,7 @@
//
// txtTileColors
//
this.txtTileColors.Location = new System.Drawing.Point(139, 48);
this.txtTileColors.Location = new System.Drawing.Point(139, 51);
this.txtTileColors.Multiline = true;
this.txtTileColors.Name = "txtTileColors";
this.txtTileColors.ReadOnly = true;
@ -2193,7 +2222,7 @@
//
// txtTileBpp
//
this.txtTileBpp.Location = new System.Drawing.Point(139, 28);
this.txtTileBpp.Location = new System.Drawing.Point(139, 29);
this.txtTileBpp.Multiline = true;
this.txtTileBpp.Name = "txtTileBpp";
this.txtTileBpp.ReadOnly = true;
@ -2204,7 +2233,7 @@
// label42
//
this.label42.AutoSize = true;
this.label42.Location = new System.Drawing.Point(169, 30);
this.label42.Location = new System.Drawing.Point(169, 31);
this.label42.Name = "label42";
this.label42.Size = new System.Drawing.Size(32, 13);
this.label42.TabIndex = 58;
@ -2212,7 +2241,7 @@
//
// txtTileAddress
//
this.txtTileAddress.Location = new System.Drawing.Point(76, 27);
this.txtTileAddress.Location = new System.Drawing.Point(76, 28);
this.txtTileAddress.Multiline = true;
this.txtTileAddress.Name = "txtTileAddress";
this.txtTileAddress.ReadOnly = true;
@ -2231,6 +2260,7 @@
//
// tpMapEntry
//
this.tpMapEntry.Controls.Add(this.textBox2);
this.tpMapEntry.Controls.Add(this.checkMapEntryVFlip);
this.tpMapEntry.Controls.Add(this.label34);
this.tpMapEntry.Controls.Add(this.checkMapEntryHFlip);
@ -2246,11 +2276,21 @@
this.tpMapEntry.Controls.Add(this.viewerMapEntryTile);
this.tpMapEntry.Location = new System.Drawing.Point(4, 22);
this.tpMapEntry.Name = "tpMapEntry";
this.tpMapEntry.Size = new System.Drawing.Size(206, 94);
this.tpMapEntry.Size = new System.Drawing.Size(206, 92);
this.tpMapEntry.TabIndex = 2;
this.tpMapEntry.Text = "Map Entry";
this.tpMapEntry.UseVisualStyleBackColor = true;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(137, 51);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(34, 18);
this.textBox2.TabIndex = 63;
this.textBox2.Text = "$DD";
//
// checkMapEntryVFlip
//
this.checkMapEntryVFlip.AutoSize = true;
@ -2283,7 +2323,7 @@
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(145, 46);
this.label17.Location = new System.Drawing.Point(93, 53);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(40, 13);
this.label17.TabIndex = 60;
@ -2301,7 +2341,7 @@
// txtMapEntryPalette
//
this.txtMapEntryPalette.BackColor = System.Drawing.Color.LightGreen;
this.txtMapEntryPalette.Location = new System.Drawing.Point(126, 43);
this.txtMapEntryPalette.Location = new System.Drawing.Point(76, 51);
this.txtMapEntryPalette.Multiline = true;
this.txtMapEntryPalette.Name = "txtMapEntryPalette";
this.txtMapEntryPalette.ReadOnly = true;
@ -2312,7 +2352,7 @@
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(95, 46);
this.label14.Location = new System.Drawing.Point(95, 75);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(25, 13);
this.label14.TabIndex = 58;
@ -2321,7 +2361,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(121, 27);
this.label6.Location = new System.Drawing.Point(121, 31);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(31, 13);
this.label6.TabIndex = 56;
@ -2329,7 +2369,7 @@
//
// txtMapEntryTileAddr
//
this.txtMapEntryTileAddr.Location = new System.Drawing.Point(153, 25);
this.txtMapEntryTileAddr.Location = new System.Drawing.Point(153, 29);
this.txtMapEntryTileAddr.Multiline = true;
this.txtMapEntryTileAddr.Name = "txtMapEntryTileAddr";
this.txtMapEntryTileAddr.ReadOnly = true;
@ -2340,7 +2380,7 @@
// txtMapEntryPrio
//
this.txtMapEntryPrio.BackColor = System.Drawing.Color.LightGreen;
this.txtMapEntryPrio.Location = new System.Drawing.Point(76, 43);
this.txtMapEntryPrio.Location = new System.Drawing.Point(76, 73);
this.txtMapEntryPrio.Multiline = true;
this.txtMapEntryPrio.Name = "txtMapEntryPrio";
this.txtMapEntryPrio.ReadOnly = true;
@ -2361,13 +2401,13 @@
// txtMapEntryTileNum
//
this.txtMapEntryTileNum.BackColor = System.Drawing.Color.LightGreen;
this.txtMapEntryTileNum.Location = new System.Drawing.Point(76, 25);
this.txtMapEntryTileNum.Location = new System.Drawing.Point(76, 29);
this.txtMapEntryTileNum.Multiline = true;
this.txtMapEntryTileNum.Name = "txtMapEntryTileNum";
this.txtMapEntryTileNum.ReadOnly = true;
this.txtMapEntryTileNum.Size = new System.Drawing.Size(43, 17);
this.txtMapEntryTileNum.Size = new System.Drawing.Size(44, 17);
this.txtMapEntryTileNum.TabIndex = 39;
this.txtMapEntryTileNum.Text = "$1024";
this.txtMapEntryTileNum.Text = "#$DDD";
//
// viewerMapEntryTile
//
@ -2380,11 +2420,22 @@
//
// tpOBJ
//
this.tpOBJ.Controls.Add(this.txtObjPriority);
this.tpOBJ.Controls.Add(this.label50);
this.tpOBJ.Controls.Add(this.txtObjPaletteMemo);
this.tpOBJ.Controls.Add(this.label49);
this.tpOBJ.Controls.Add(this.txtObjPalette);
this.tpOBJ.Controls.Add(this.label48);
this.tpOBJ.Controls.Add(this.txtObjNameAddr);
this.tpOBJ.Controls.Add(this.txtObjName);
this.tpOBJ.Controls.Add(this.txtObjSize);
this.tpOBJ.Controls.Add(this.label46);
this.tpOBJ.Controls.Add(this.cbObjLarge);
this.tpOBJ.Controls.Add(this.txtObjNumber);
this.tpOBJ.Controls.Add(this.txtObjCoord);
this.tpOBJ.Controls.Add(this.checkBox1);
this.tpOBJ.Controls.Add(this.cbObjVFlip);
this.tpOBJ.Controls.Add(this.label43);
this.tpOBJ.Controls.Add(this.checkBox2);
this.tpOBJ.Controls.Add(this.cbObjHFlip);
this.tpOBJ.Controls.Add(this.label44);
this.tpOBJ.Controls.Add(this.viewerObj);
this.tpOBJ.Location = new System.Drawing.Point(4, 22);
@ -2394,6 +2445,115 @@
this.tpOBJ.Text = "OBJ";
this.tpOBJ.UseVisualStyleBackColor = true;
//
// txtObjPriority
//
this.txtObjPriority.BackColor = System.Drawing.Color.LightGreen;
this.txtObjPriority.Location = new System.Drawing.Point(187, 29);
this.txtObjPriority.Multiline = true;
this.txtObjPriority.Name = "txtObjPriority";
this.txtObjPriority.ReadOnly = true;
this.txtObjPriority.Size = new System.Drawing.Size(18, 17);
this.txtObjPriority.TabIndex = 102;
this.txtObjPriority.Text = "3";
//
// label50
//
this.label50.AutoSize = true;
this.label50.Location = new System.Drawing.Point(160, 31);
this.label50.Name = "label50";
this.label50.Size = new System.Drawing.Size(25, 13);
this.label50.TabIndex = 101;
this.label50.Text = "Prio";
//
// txtObjPaletteMemo
//
this.txtObjPaletteMemo.Location = new System.Drawing.Point(137, 73);
this.txtObjPaletteMemo.Multiline = true;
this.txtObjPaletteMemo.Name = "txtObjPaletteMemo";
this.txtObjPaletteMemo.ReadOnly = true;
this.txtObjPaletteMemo.Size = new System.Drawing.Size(34, 18);
this.txtObjPaletteMemo.TabIndex = 100;
this.txtObjPaletteMemo.Text = "$DD";
//
// label49
//
this.label49.AutoSize = true;
this.label49.Location = new System.Drawing.Point(93, 75);
this.label49.Name = "label49";
this.label49.Size = new System.Drawing.Size(40, 13);
this.label49.TabIndex = 99;
this.label49.Text = "Palette";
//
// txtObjPalette
//
this.txtObjPalette.BackColor = System.Drawing.Color.LightGreen;
this.txtObjPalette.Location = new System.Drawing.Point(76, 73);
this.txtObjPalette.Multiline = true;
this.txtObjPalette.Name = "txtObjPalette";
this.txtObjPalette.ReadOnly = true;
this.txtObjPalette.Size = new System.Drawing.Size(15, 17);
this.txtObjPalette.TabIndex = 98;
this.txtObjPalette.Text = "00";
//
// label48
//
this.label48.AutoSize = true;
this.label48.Location = new System.Drawing.Point(121, 53);
this.label48.Name = "label48";
this.label48.Size = new System.Drawing.Size(31, 13);
this.label48.TabIndex = 96;
this.label48.Text = "Tile#";
//
// txtObjNameAddr
//
this.txtObjNameAddr.Location = new System.Drawing.Point(153, 51);
this.txtObjNameAddr.Multiline = true;
this.txtObjNameAddr.Name = "txtObjNameAddr";
this.txtObjNameAddr.ReadOnly = true;
this.txtObjNameAddr.Size = new System.Drawing.Size(45, 18);
this.txtObjNameAddr.TabIndex = 97;
this.txtObjNameAddr.Text = "@0D00";
//
// txtObjName
//
this.txtObjName.BackColor = System.Drawing.Color.LightGreen;
this.txtObjName.Location = new System.Drawing.Point(76, 51);
this.txtObjName.Multiline = true;
this.txtObjName.Name = "txtObjName";
this.txtObjName.ReadOnly = true;
this.txtObjName.Size = new System.Drawing.Size(43, 17);
this.txtObjName.TabIndex = 95;
this.txtObjName.Text = "#$DDD";
//
// txtObjSize
//
this.txtObjSize.Location = new System.Drawing.Point(122, 29);
this.txtObjSize.Multiline = true;
this.txtObjSize.Name = "txtObjSize";
this.txtObjSize.ReadOnly = true;
this.txtObjSize.Size = new System.Drawing.Size(37, 18);
this.txtObjSize.TabIndex = 93;
this.txtObjSize.Text = "64x64";
//
// label46
//
this.label46.AutoSize = true;
this.label46.Location = new System.Drawing.Point(89, 31);
this.label46.Name = "label46";
this.label46.Size = new System.Drawing.Size(34, 13);
this.label46.TabIndex = 92;
this.label46.Text = "Large";
//
// cbObjLarge
//
this.cbObjLarge.AutoSize = true;
this.cbObjLarge.Enabled = false;
this.cbObjLarge.Location = new System.Drawing.Point(76, 31);
this.cbObjLarge.Name = "cbObjLarge";
this.cbObjLarge.Size = new System.Drawing.Size(15, 14);
this.cbObjLarge.TabIndex = 91;
this.cbObjLarge.UseVisualStyleBackColor = true;
//
// txtObjNumber
//
this.txtObjNumber.Location = new System.Drawing.Point(76, 6);
@ -2414,15 +2574,15 @@
this.txtObjCoord.TabIndex = 67;
this.txtObjCoord.Text = "(-239,-239)";
//
// checkBox1
// cbObjVFlip
//
this.checkBox1.AutoSize = true;
this.checkBox1.Enabled = false;
this.checkBox1.Location = new System.Drawing.Point(42, 76);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(15, 14);
this.checkBox1.TabIndex = 65;
this.checkBox1.UseVisualStyleBackColor = true;
this.cbObjVFlip.AutoSize = true;
this.cbObjVFlip.Enabled = false;
this.cbObjVFlip.Location = new System.Drawing.Point(42, 76);
this.cbObjVFlip.Name = "cbObjVFlip";
this.cbObjVFlip.Size = new System.Drawing.Size(15, 14);
this.cbObjVFlip.TabIndex = 65;
this.cbObjVFlip.UseVisualStyleBackColor = true;
//
// label43
//
@ -2433,15 +2593,15 @@
this.label43.TabIndex = 66;
this.label43.Text = "V";
//
// checkBox2
// cbObjHFlip
//
this.checkBox2.AutoSize = true;
this.checkBox2.Enabled = false;
this.checkBox2.Location = new System.Drawing.Point(8, 76);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(15, 14);
this.checkBox2.TabIndex = 63;
this.checkBox2.UseVisualStyleBackColor = true;
this.cbObjHFlip.AutoSize = true;
this.cbObjHFlip.Enabled = false;
this.cbObjHFlip.Location = new System.Drawing.Point(8, 76);
this.cbObjHFlip.Name = "cbObjHFlip";
this.cbObjHFlip.Size = new System.Drawing.Size(15, 14);
this.cbObjHFlip.TabIndex = 63;
this.cbObjHFlip.UseVisualStyleBackColor = true;
//
// label44
//
@ -2496,25 +2656,6 @@
this.messagetimer.Interval = 5000;
this.messagetimer.Tick += new System.EventHandler(this.messagetimer_Tick);
//
// txtTilePalette
//
this.txtTilePalette.Location = new System.Drawing.Point(139, 68);
this.txtTilePalette.Multiline = true;
this.txtTilePalette.Name = "txtTilePalette";
this.txtTilePalette.ReadOnly = true;
this.txtTilePalette.Size = new System.Drawing.Size(29, 18);
this.txtTilePalette.TabIndex = 64;
this.txtTilePalette.Text = "$FF";
//
// label45
//
this.label45.AutoSize = true;
this.label45.Location = new System.Drawing.Point(169, 70);
this.label45.Name = "label45";
this.label45.Size = new System.Drawing.Size(22, 13);
this.label45.TabIndex = 65;
this.label45.Text = "Pal";
//
// SNESGraphicsDebugger
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -2627,15 +2768,12 @@
private System.Windows.Forms.NumericUpDown nudScanline;
private System.Windows.Forms.TabControl tabctrlDetails;
private System.Windows.Forms.TabPage tpPalette;
private System.Windows.Forms.TextBox txtPaletteDetailsIndexSpecific;
private System.Windows.Forms.TextBox txtPaletteDetailsIndexHexSpecific;
private System.Windows.Forms.TextBox txtPaletteDetailsAddress;
private System.Windows.Forms.TextBox txtPaletteDetailsIndex;
private System.Windows.Forms.TextBox txtPaletteDetailsIndexHex;
private System.Windows.Forms.TextBox txtDetailsPaletteColorRGB;
private System.Windows.Forms.TextBox txtDetailsPaletteColorHex;
private System.Windows.Forms.TextBox txtDetailsPaletteColor;
private System.Windows.Forms.Label lblDetailsOBJOrBG;
private System.Windows.Forms.Panel pnDetailsPaletteColor;
private System.Windows.Forms.TabPage tpTile;
private System.Windows.Forms.Panel viewerPanel;
@ -2767,12 +2905,27 @@
private SNESGraphicsViewer viewerObj;
private System.Windows.Forms.TextBox txtObjNumber;
private System.Windows.Forms.TextBox txtObjCoord;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox cbObjVFlip;
private System.Windows.Forms.Label label43;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox cbObjHFlip;
private System.Windows.Forms.Label label44;
private System.Windows.Forms.TextBox txtTileNumber;
private System.Windows.Forms.Label label45;
private System.Windows.Forms.TextBox txtTilePalette;
private System.Windows.Forms.Label label48;
private System.Windows.Forms.TextBox txtObjNameAddr;
private System.Windows.Forms.TextBox txtObjName;
private System.Windows.Forms.TextBox txtObjSize;
private System.Windows.Forms.Label label46;
private System.Windows.Forms.CheckBox cbObjLarge;
private System.Windows.Forms.Label label53;
private System.Windows.Forms.Label label52;
private System.Windows.Forms.Label label51;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox txtObjPriority;
private System.Windows.Forms.Label label50;
private System.Windows.Forms.TextBox txtObjPaletteMemo;
private System.Windows.Forms.Label label49;
private System.Windows.Forms.TextBox txtObjPalette;
}
}

View File

@ -6,6 +6,7 @@
// . could this apply to the palette too?
//TODO - show the priority list for the current mode. make the priority list have checkboxes, and use that to control whether that item displays (does bsnes have that granularity? maybe)
//TODO - use custom checkboxes for register-viewing checkboxes to make them green and checked
//TODO - make freeze actually save the info caches, and re-render in realtime, so that you can pick something you want to see animate without having to hover your mouse just right. also add a checkbox to do the literal freeze (stop it from updating)
//DEFERRED:
//. 256bpp modes (difficult to use)
@ -47,12 +48,12 @@ namespace BizHawk.MultiClient
viewer.ScaleImage = false;
displayTypeItems.Add(new DisplayTypeItem("OBJ", eDisplayType.OBJ));
displayTypeItems.Add(new DisplayTypeItem("BG1", eDisplayType.BG1));
displayTypeItems.Add(new DisplayTypeItem("BG2",eDisplayType.BG2));
displayTypeItems.Add(new DisplayTypeItem("BG3",eDisplayType.BG3));
displayTypeItems.Add(new DisplayTypeItem("BG4",eDisplayType.BG4));
displayTypeItems.Add(new DisplayTypeItem("OBJ Tiles",eDisplayType.OBJ0));
displayTypeItems.Add(new DisplayTypeItem("Sprites", eDisplayType.Sprites));
displayTypeItems.Add(new DisplayTypeItem("OBJ Tiles",eDisplayType.OBJTiles0));
displayTypeItems.Add(new DisplayTypeItem("2bpp tiles",eDisplayType.Tiles2bpp));
displayTypeItems.Add(new DisplayTypeItem("4bpp tiles",eDisplayType.Tiles4bpp));
displayTypeItems.Add(new DisplayTypeItem("8bpp tiles",eDisplayType.Tiles8bpp));
@ -60,7 +61,7 @@ namespace BizHawk.MultiClient
displayTypeItems.Add(new DisplayTypeItem("Mode7Ext tiles",eDisplayType.TilesMode7Ext));
displayTypeItems.Add(new DisplayTypeItem("Mode7 tiles (DC)", eDisplayType.TilesMode7DC));
comboDisplayType.DataSource = displayTypeItems;
comboDisplayType.SelectedIndex = 0;
comboDisplayType.SelectedIndex = 1;
var paletteTypeItems = new List<PaletteTypeItem>();
paletteTypeItems.Add(new PaletteTypeItem("BizHawk", SnesColors.ColorType.BizHawk));
@ -202,7 +203,7 @@ namespace BizHawk.MultiClient
txtOBSELSizeBits.Text = si.OBSEL_Size.ToString();
txtOBSELBaseBits.Text = si.OBSEL_NameBase.ToString();
txtOBSELT1OfsBits.Text = si.OBSEL_NameSel.ToString();
txtOBSELSizeDescr.Text = string.Format("{0}, {1}", SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size,0], SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size,1]);
txtOBSELSizeDescr.Text = string.Format("{0}, {1}", SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, 0], SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, 1]);
txtOBSELBaseDescr.Text = FormatVramAddress(si.OBJTable0Addr);
txtOBSELT1OfsDescr.Text = FormatVramAddress(si.OBJTable1Addr);
@ -278,7 +279,7 @@ namespace BizHawk.MultiClient
if (si.Mode.MODE == 1 && si.Mode1_BG3_Priority)
{
lblBG3.ForeColor = Color.Red;
if(toolTip1.GetToolTip(lblBG3) != "Mode 1 BG3 priority toggle bit of $2105 is SET")
if (toolTip1.GetToolTip(lblBG3) != "Mode 1 BG3 priority toggle bit of $2105 is SET")
toolTip1.SetToolTip(lblBG3, "Mode 1 BG3 priority toggle bit of $2105 is SET");
}
else
@ -292,7 +293,12 @@ namespace BizHawk.MultiClient
RenderView();
RenderPalette();
RenderTileView();
//these are likely to be changing all the time
UpdateColorDetails();
UpdateOBJDetails();
//maybe bg settings changed, or something
UpdateMapEntryDetails();
UpdateTileDetails();
}
eDisplayType CurrDisplaySelection { get { return (comboDisplayType.SelectedValue as eDisplayType?).Value; } }
@ -314,24 +320,22 @@ namespace BizHawk.MultiClient
};
var selection = CurrDisplaySelection;
if (selection == eDisplayType.Sprites)
if (selection == eDisplayType.OBJ)
{
var dims = new[] { SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size,0], SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size,1] };
int largestWidth = Math.Max(dims[0].Width, dims[1].Width);
int largestHeight = Math.Max(dims[0].Height, dims[1].Height);
int width = largestWidth * 16;
int height = largestHeight * 8;
var objBounds = si.ObjSizeBounds;
int width = objBounds.Width * 8;
int height = objBounds.Height * 16;
allocate(width, height);
for (int i = 0; i < 128; i++)
{
int tx = i % 16;
int ty = i / 16;
int x = tx * largestWidth;
int y = ty * largestHeight;
int tx = i % 8;
int ty = i / 8;
int x = tx * objBounds.Width;
int y = ty * objBounds.Height;
gd.RenderSpriteToScreen(pixelptr, stride / 4, x,y, si, i);
}
}
if (selection == eDisplayType.OBJ0 || selection == eDisplayType.OBJ1)
if (selection == eDisplayType.OBJTiles0 || selection == eDisplayType.OBJTiles1)
{
allocate(128, 256);
int startTile;
@ -376,7 +380,6 @@ namespace BizHawk.MultiClient
if (IsDisplayTypeBG(selection))
{
int bgnum = (int)selection;
var si = gd.ScanScreenInfo();
var bg = si.BG[bgnum];
map = new SNESGraphicsDecoder.TileEntry[0];
@ -434,10 +437,10 @@ namespace BizHawk.MultiClient
enum eDisplayType
{
BG1=1, BG2=2, BG3=3, BG4=4, Sprites, OBJ0, OBJ1, Tiles2bpp, Tiles4bpp, Tiles8bpp, TilesMode7, TilesMode7Ext, TilesMode7DC
OBJ, BG1 = 1, BG2 = 2, BG3 = 3, BG4 = 4, OBJTiles0, OBJTiles1, Tiles2bpp, Tiles4bpp, Tiles8bpp, TilesMode7, TilesMode7Ext, TilesMode7DC
}
static bool IsDisplayTypeBG(eDisplayType type) { return type == eDisplayType.BG1 || type == eDisplayType.BG2 || type == eDisplayType.BG3 || type == eDisplayType.BG4; }
static bool IsDisplayTypeOBJ(eDisplayType type) { return type == eDisplayType.OBJ0 || type == eDisplayType.OBJ1; }
static bool IsDisplayTypeOBJ(eDisplayType type) { return type == eDisplayType.OBJTiles0 || type == eDisplayType.OBJTiles1; }
static int DisplayTypeBGNum(eDisplayType type) { if(IsDisplayTypeBG(type)) return (int)type; else return -1; }
static SNESGraphicsDecoder.BGMode BGModeForDisplayType(eDisplayType type)
{
@ -449,8 +452,8 @@ namespace BizHawk.MultiClient
case eDisplayType.TilesMode7: return SNESGraphicsDecoder.BGMode.Mode7;
case eDisplayType.TilesMode7Ext: return SNESGraphicsDecoder.BGMode.Mode7Ext;
case eDisplayType.TilesMode7DC: return SNESGraphicsDecoder.BGMode.Mode7DC;
case eDisplayType.OBJ0: return SNESGraphicsDecoder.BGMode.OBJ;
case eDisplayType.OBJ1: return SNESGraphicsDecoder.BGMode.OBJ;
case eDisplayType.OBJTiles0: return SNESGraphicsDecoder.BGMode.OBJ;
case eDisplayType.OBJTiles1: return SNESGraphicsDecoder.BGMode.OBJ;
default: throw new InvalidOperationException();
}
}
@ -612,8 +615,8 @@ namespace BizHawk.MultiClient
if (selection == eDisplayType.Tiles8bpp) bpp = 8;
if (selection == eDisplayType.TilesMode7) bpp = 8;
if (selection == eDisplayType.TilesMode7Ext) bpp = 7;
if (selection == eDisplayType.OBJ0) bpp = 4;
if (selection == eDisplayType.OBJ1) bpp = 4;
if (selection == eDisplayType.OBJTiles0) bpp = 4;
if (selection == eDisplayType.OBJTiles1) bpp = 4;
SNESGraphicsDecoder.PaletteSelection ret = new SNESGraphicsDecoder.PaletteSelection();
if(bpp == 0) return ret;
@ -700,6 +703,22 @@ namespace BizHawk.MultiClient
throw new InvalidOperationException();
}
void UpdateOBJDetails()
{
if (currObjDataState == null) return;
var oam = new SNESGraphicsDecoder.OAMInfo(gd, si, currObjDataState.Number);
txtObjNumber.Text = string.Format("#${0:X2}", currObjDataState.Number);
txtObjCoord.Text = string.Format("({0}, {1})",oam.X,oam.Y);
cbObjHFlip.Checked = oam.HFlip;
cbObjVFlip.Checked = oam.VFlip;
cbObjLarge.Checked = oam.Size == 1;
txtObjSize.Text = SNESGraphicsDecoder.ObjSizes[si.OBSEL_Size, oam.Size].ToString();
txtObjPriority.Text = oam.Priority.ToString();
txtObjPalette.Text = oam.Palette.ToString();
txtObjPaletteMemo.Text = string.Format("${0:X2}", oam.Palette * 16 + 128);
txtObjName.Text = string.Format("#${0:X3}", oam.Tile);
txtObjNameAddr.Text = string.Format("@{0:X4}", oam.Address);
}
void UpdateTileDetails()
{
@ -754,11 +773,13 @@ namespace BizHawk.MultiClient
txtDetailsPaletteColorHex.Text = string.Format("#{0:X6}", color & 0xFFFFFF);
txtDetailsPaletteColorRGB.Text = string.Format("({0},{1},{2})", (color >> 16) & 0xFF, (color >> 8) & 0xFF, (color & 0xFF));
if (lastColorNum < 128) lblDetailsOBJOrBG.Text = "(BG:)"; else lblDetailsOBJOrBG.Text = "(OBJ:)";
txtPaletteDetailsIndexHex.Text = string.Format("${0:X2}", lastColorNum);
txtPaletteDetailsIndexHexSpecific.Text = string.Format("${0:X2}", lastColorNum & 0x7F);
txtPaletteDetailsIndex.Text = string.Format("{0}", lastColorNum);
txtPaletteDetailsIndexSpecific.Text = string.Format("{0}", lastColorNum & 0x7F);
//not being used anymore
//if (lastColorNum < 128) lblDetailsOBJOrBG.Text = "(BG:)"; else lblDetailsOBJOrBG.Text = "(OBJ:)";
//txtPaletteDetailsIndexHexSpecific.Text = string.Format("${0:X2}", lastColorNum & 0x7F);
//txtPaletteDetailsIndexSpecific.Text = string.Format("{0}", lastColorNum & 0x7F);
txtPaletteDetailsAddress.Text = string.Format("${0:X3}", lastColorNum * 2);
@ -929,7 +950,6 @@ namespace BizHawk.MultiClient
class ObjDataState
{
public int Number;
public SNESGraphicsDecoder.OAMInfo OAMInfo;
}
ObjDataState currObjDataState;
@ -973,7 +993,7 @@ namespace BizHawk.MultiClient
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, true, false, 1, currTileDataState.Tile, 1);
else if (currTileDataState.Type == eDisplayType.TilesMode7DC)
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, false, true, 1, currTileDataState.Tile, 1);
else if (currTileDataState.Type == eDisplayType.OBJ0 || currTileDataState.Type == eDisplayType.OBJ1)
else if (currTileDataState.Type == eDisplayType.OBJTiles0 || currTileDataState.Type == eDisplayType.OBJTiles1)
{
//render an obj tile
int tile = currTileDataState.Address / 32;
@ -984,6 +1004,17 @@ namespace BizHawk.MultiClient
bmp.UnlockBits(bmpdata);
viewerTile.SetBitmap(bmp);
}
else if (currObjDataState != null)
{
var bounds = si.ObjSizeBoundsSquare;
int width = bounds.Width;
int height = bounds.Height;
var bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var bmpdata = bmp.LockBits(new Rectangle(0, 0, width, height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
gd.RenderSpriteToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, 0, 0, si, currObjDataState.Number);
bmp.UnlockBits(bmpdata);
viewerObj.SetBitmap(bmp);
}
else
{
var bmp = new Bitmap(8, 8, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
@ -1004,9 +1035,8 @@ namespace BizHawk.MultiClient
currTileDataState.Tile = tilenum;
currTileDataState.Address = (bpp==7?8:bpp) * 8 * currTileDataState.Tile;
currTileDataState.Palette = currPaletteSelection.start;
if (CurrDisplaySelection == eDisplayType.OBJ0 || CurrDisplaySelection == eDisplayType.OBJ1)
if (CurrDisplaySelection == eDisplayType.OBJTiles0 || CurrDisplaySelection == eDisplayType.OBJTiles1)
{
//adjust address according to
if (tilenum < 256)
currTileDataState.Address += si.OBJTable0Addr;
else
@ -1024,11 +1054,19 @@ namespace BizHawk.MultiClient
void HandleSpriteMouseOver(int px, int py)
{
//currViewingSprite = tx + ty * 16;
int ox = px / si.ObjSizeBounds.Width;
int oy = py / si.ObjSizeBounds.Height;
if (ox < 0 || oy < 0 || ox >= 8 || oy >= 16)
return;
int objNum = oy * 8 + ox;
currObjDataState = new ObjDataState();
currObjDataState.Number = objNum;
//RenderView(); //remember, we were going to highlight the selected sprite somehow as we hover over it
int ox = px / 64;
int oy = py / 64;
//if(ox<0 || oy<0 || ox>
SetTab(tpOBJ);
}
void SetTab(TabPage tpSet)
@ -1054,11 +1092,11 @@ namespace BizHawk.MultiClient
switch (CurrDisplaySelection)
{
case eDisplayType.OBJ0:
case eDisplayType.OBJ1:
case eDisplayType.OBJTiles0:
case eDisplayType.OBJTiles1:
HandleTileViewMouseOver(128, 256, 4, tx, ty);
break;
case eDisplayType.Sprites:
case eDisplayType.OBJ:
HandleSpriteMouseOver(loc.X, loc.Y);
break;
case eDisplayType.Tiles2bpp:
@ -1110,6 +1148,7 @@ namespace BizHawk.MultiClient
RenderTileView();
UpdateMapEntryDetails();
UpdateTileDetails();
UpdateOBJDetails();
}
private void viewer_MouseLeave(object sender, EventArgs e)