snesgfxdebugger-fix a bunch of bugs and half-baked things. no new features. (part 2 of N)
This commit is contained in:
parent
8834d3dd5c
commit
e960989034
|
@ -83,6 +83,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
Unavailable, Text, Mode7, Mode7Ext, Mode7DC
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// is a BGMode a mode7 type (mode7, mode7ext, mode7DC)
|
||||
/// </summary>
|
||||
public static bool BGModeIsMode7Type(BGMode BGMode) { return BGMode == SNESGraphicsDecoder.BGMode.Mode7 || BGMode == SNESGraphicsDecoder.BGMode.Mode7DC || BGMode == SNESGraphicsDecoder.BGMode.Mode7Ext; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// this class is not 'smart' - it wont recompute values for you. it's meant to be read only (we should find some way to protect write access to make that clear)
|
||||
/// </summary>
|
||||
|
@ -100,7 +107,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
/// <summary>
|
||||
/// is this BGMode a mode7 type (mode7, mode7ext, mode7DC)
|
||||
/// </summary>
|
||||
public bool BGModeIsMode7Type { get { return BGMode == SNESGraphicsDecoder.BGMode.Mode7 || BGMode == SNESGraphicsDecoder.BGMode.Mode7DC || BGMode == SNESGraphicsDecoder.BGMode.Mode7Ext; } }
|
||||
public bool BGModeIsMode7Type { get { return BGModeIsMode7Type(BGMode); } }
|
||||
|
||||
/// <summary>
|
||||
/// Is the layer even enabled?
|
||||
|
|
|
@ -187,6 +187,7 @@
|
|||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtBG1SizeBits = new System.Windows.Forms.TextBox();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
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();
|
||||
|
@ -200,6 +201,13 @@
|
|||
this.lblDetailsOBJOrBG = new System.Windows.Forms.Label();
|
||||
this.pnDetailsPaletteColor = new System.Windows.Forms.Panel();
|
||||
this.tpTile = new System.Windows.Forms.TabPage();
|
||||
this.txtTileMode = new System.Windows.Forms.TextBox();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.txtTileColors = new System.Windows.Forms.TextBox();
|
||||
this.txtTileBpp = new System.Windows.Forms.TextBox();
|
||||
this.label42 = new System.Windows.Forms.Label();
|
||||
this.txtTileAddress = new System.Windows.Forms.TextBox();
|
||||
this.viewerTile = new BizHawk.MultiClient.SNESGraphicsViewer();
|
||||
this.tpMapEntry = new System.Windows.Forms.TabPage();
|
||||
this.checkMapEntryVFlip = new System.Windows.Forms.CheckBox();
|
||||
this.label34 = new System.Windows.Forms.Label();
|
||||
|
@ -213,14 +221,12 @@
|
|||
this.txtMapEntryPrio = new System.Windows.Forms.TextBox();
|
||||
this.txtMapEntryLocation = new System.Windows.Forms.TextBox();
|
||||
this.txtMapEntryTileNum = new System.Windows.Forms.TextBox();
|
||||
this.viewerMapEntryTile = new BizHawk.MultiClient.SNESGraphicsViewer();
|
||||
this.tpOBJ = new System.Windows.Forms.TabPage();
|
||||
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.paletteViewer = new BizHawk.MultiClient.SNESGraphicsViewer();
|
||||
this.viewerTile = new BizHawk.MultiClient.SNESGraphicsViewer();
|
||||
this.viewerMapEntryTile = new BizHawk.MultiClient.SNESGraphicsViewer();
|
||||
this.viewer = new BizHawk.MultiClient.SNESGraphicsViewer();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
|
@ -528,7 +534,7 @@
|
|||
this.groupBox6.Controls.Add(this.labelClipboard);
|
||||
this.groupBox6.Location = new System.Drawing.Point(2, 495);
|
||||
this.groupBox6.Name = "groupBox6";
|
||||
this.groupBox6.Size = new System.Drawing.Size(161, 38);
|
||||
this.groupBox6.Size = new System.Drawing.Size(220, 38);
|
||||
this.groupBox6.TabIndex = 50;
|
||||
this.groupBox6.TabStop = false;
|
||||
this.groupBox6.Text = "Copy to Clipboard";
|
||||
|
@ -833,9 +839,9 @@
|
|||
this.label30.AutoSize = true;
|
||||
this.label30.Location = new System.Drawing.Point(32, 252);
|
||||
this.label30.Name = "label30";
|
||||
this.label30.Size = new System.Drawing.Size(45, 13);
|
||||
this.label30.Size = new System.Drawing.Size(46, 13);
|
||||
this.label30.TabIndex = 53;
|
||||
this.label30.Text = "T1.Addr";
|
||||
this.label30.Text = "@Tiles1";
|
||||
//
|
||||
// checkEN1_BG4
|
||||
//
|
||||
|
@ -892,9 +898,9 @@
|
|||
this.label29.AutoSize = true;
|
||||
this.label29.Location = new System.Drawing.Point(32, 233);
|
||||
this.label29.Name = "label29";
|
||||
this.label29.Size = new System.Drawing.Size(47, 13);
|
||||
this.label29.Size = new System.Drawing.Size(46, 13);
|
||||
this.label29.TabIndex = 50;
|
||||
this.label29.Text = "TD.Addr";
|
||||
this.label29.Text = "@Tiles0";
|
||||
//
|
||||
// checkEN1_BG1
|
||||
//
|
||||
|
@ -1972,6 +1978,18 @@
|
|||
this.groupBox5.TabStop = false;
|
||||
this.groupBox5.Text = "Palette";
|
||||
//
|
||||
// paletteViewer
|
||||
//
|
||||
this.paletteViewer.BackColor = System.Drawing.Color.Transparent;
|
||||
this.paletteViewer.Location = new System.Drawing.Point(6, 14);
|
||||
this.paletteViewer.Name = "paletteViewer";
|
||||
this.paletteViewer.Size = new System.Drawing.Size(307, 307);
|
||||
this.paletteViewer.TabIndex = 18;
|
||||
this.paletteViewer.TabStop = false;
|
||||
this.paletteViewer.MouseClick += new System.Windows.Forms.MouseEventHandler(this.paletteViewer_MouseClick);
|
||||
this.paletteViewer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.paletteViewer_MouseDown);
|
||||
this.paletteViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.paletteViewer_MouseMove);
|
||||
//
|
||||
// tabctrlDetails
|
||||
//
|
||||
this.tabctrlDetails.Controls.Add(this.tpPalette);
|
||||
|
@ -2105,6 +2123,12 @@
|
|||
//
|
||||
// tpTile
|
||||
//
|
||||
this.tpTile.Controls.Add(this.txtTileMode);
|
||||
this.tpTile.Controls.Add(this.label18);
|
||||
this.tpTile.Controls.Add(this.txtTileColors);
|
||||
this.tpTile.Controls.Add(this.txtTileBpp);
|
||||
this.tpTile.Controls.Add(this.label42);
|
||||
this.tpTile.Controls.Add(this.txtTileAddress);
|
||||
this.tpTile.Controls.Add(this.viewerTile);
|
||||
this.tpTile.Location = new System.Drawing.Point(4, 22);
|
||||
this.tpTile.Name = "tpTile";
|
||||
|
@ -2114,6 +2138,73 @@
|
|||
this.tpTile.Text = "Tile";
|
||||
this.tpTile.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// txtTileMode
|
||||
//
|
||||
this.txtTileMode.Location = new System.Drawing.Point(132, 6);
|
||||
this.txtTileMode.Multiline = true;
|
||||
this.txtTileMode.Name = "txtTileMode";
|
||||
this.txtTileMode.ReadOnly = true;
|
||||
this.txtTileMode.Size = new System.Drawing.Size(66, 18);
|
||||
this.txtTileMode.TabIndex = 62;
|
||||
this.txtTileMode.Text = "Text 8bpp";
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Location = new System.Drawing.Point(172, 49);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(36, 13);
|
||||
this.label18.TabIndex = 61;
|
||||
this.label18.Text = "Colors";
|
||||
//
|
||||
// txtTileColors
|
||||
//
|
||||
this.txtTileColors.Location = new System.Drawing.Point(132, 48);
|
||||
this.txtTileColors.Multiline = true;
|
||||
this.txtTileColors.Name = "txtTileColors";
|
||||
this.txtTileColors.ReadOnly = true;
|
||||
this.txtTileColors.Size = new System.Drawing.Size(36, 17);
|
||||
this.txtTileColors.TabIndex = 60;
|
||||
this.txtTileColors.Text = "32768";
|
||||
//
|
||||
// txtTileBpp
|
||||
//
|
||||
this.txtTileBpp.Location = new System.Drawing.Point(132, 29);
|
||||
this.txtTileBpp.Multiline = true;
|
||||
this.txtTileBpp.Name = "txtTileBpp";
|
||||
this.txtTileBpp.ReadOnly = true;
|
||||
this.txtTileBpp.Size = new System.Drawing.Size(24, 17);
|
||||
this.txtTileBpp.TabIndex = 59;
|
||||
this.txtTileBpp.Text = "8";
|
||||
//
|
||||
// label42
|
||||
//
|
||||
this.label42.AutoSize = true;
|
||||
this.label42.Location = new System.Drawing.Point(173, 31);
|
||||
this.label42.Name = "label42";
|
||||
this.label42.Size = new System.Drawing.Size(32, 13);
|
||||
this.label42.TabIndex = 58;
|
||||
this.label42.Text = "Bpp; ";
|
||||
//
|
||||
// txtTileAddress
|
||||
//
|
||||
this.txtTileAddress.Location = new System.Drawing.Point(76, 6);
|
||||
this.txtTileAddress.Multiline = true;
|
||||
this.txtTileAddress.Name = "txtTileAddress";
|
||||
this.txtTileAddress.ReadOnly = true;
|
||||
this.txtTileAddress.Size = new System.Drawing.Size(50, 18);
|
||||
this.txtTileAddress.TabIndex = 57;
|
||||
this.txtTileAddress.Text = "@DDDD";
|
||||
//
|
||||
// viewerTile
|
||||
//
|
||||
this.viewerTile.BackColor = System.Drawing.Color.Transparent;
|
||||
this.viewerTile.Location = new System.Drawing.Point(6, 6);
|
||||
this.viewerTile.Name = "viewerTile";
|
||||
this.viewerTile.Size = new System.Drawing.Size(64, 64);
|
||||
this.viewerTile.TabIndex = 19;
|
||||
this.viewerTile.TabStop = false;
|
||||
//
|
||||
// tpMapEntry
|
||||
//
|
||||
this.tpMapEntry.Controls.Add(this.checkMapEntryVFlip);
|
||||
|
@ -2254,6 +2345,15 @@
|
|||
this.txtMapEntryTileNum.TabIndex = 39;
|
||||
this.txtMapEntryTileNum.Text = "$1024";
|
||||
//
|
||||
// viewerMapEntryTile
|
||||
//
|
||||
this.viewerMapEntryTile.BackColor = System.Drawing.Color.Transparent;
|
||||
this.viewerMapEntryTile.Location = new System.Drawing.Point(6, 6);
|
||||
this.viewerMapEntryTile.Name = "viewerMapEntryTile";
|
||||
this.viewerMapEntryTile.Size = new System.Drawing.Size(64, 64);
|
||||
this.viewerMapEntryTile.TabIndex = 20;
|
||||
this.viewerMapEntryTile.TabStop = false;
|
||||
//
|
||||
// tpOBJ
|
||||
//
|
||||
this.tpOBJ.Location = new System.Drawing.Point(4, 22);
|
||||
|
@ -2275,47 +2375,6 @@
|
|||
this.viewerPanel.Size = new System.Drawing.Size(517, 667);
|
||||
this.viewerPanel.TabIndex = 1;
|
||||
//
|
||||
// toolTip1
|
||||
//
|
||||
this.toolTip1.AutoPopDelay = 5000;
|
||||
this.toolTip1.InitialDelay = 250;
|
||||
this.toolTip1.ReshowDelay = 100;
|
||||
//
|
||||
// messagetimer
|
||||
//
|
||||
this.messagetimer.Interval = 5000;
|
||||
this.messagetimer.Tick += new System.EventHandler(this.messagetimer_Tick);
|
||||
//
|
||||
// paletteViewer
|
||||
//
|
||||
this.paletteViewer.BackColor = System.Drawing.Color.Transparent;
|
||||
this.paletteViewer.Location = new System.Drawing.Point(6, 14);
|
||||
this.paletteViewer.Name = "paletteViewer";
|
||||
this.paletteViewer.Size = new System.Drawing.Size(307, 307);
|
||||
this.paletteViewer.TabIndex = 18;
|
||||
this.paletteViewer.TabStop = false;
|
||||
this.paletteViewer.MouseClick += new System.Windows.Forms.MouseEventHandler(this.paletteViewer_MouseClick);
|
||||
this.paletteViewer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.paletteViewer_MouseDown);
|
||||
this.paletteViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.paletteViewer_MouseMove);
|
||||
//
|
||||
// viewerTile
|
||||
//
|
||||
this.viewerTile.BackColor = System.Drawing.Color.Transparent;
|
||||
this.viewerTile.Location = new System.Drawing.Point(6, 6);
|
||||
this.viewerTile.Name = "viewerTile";
|
||||
this.viewerTile.Size = new System.Drawing.Size(64, 64);
|
||||
this.viewerTile.TabIndex = 19;
|
||||
this.viewerTile.TabStop = false;
|
||||
//
|
||||
// viewerMapEntryTile
|
||||
//
|
||||
this.viewerMapEntryTile.BackColor = System.Drawing.Color.Transparent;
|
||||
this.viewerMapEntryTile.Location = new System.Drawing.Point(6, 6);
|
||||
this.viewerMapEntryTile.Name = "viewerMapEntryTile";
|
||||
this.viewerMapEntryTile.Size = new System.Drawing.Size(64, 64);
|
||||
this.viewerMapEntryTile.TabIndex = 20;
|
||||
this.viewerMapEntryTile.TabStop = false;
|
||||
//
|
||||
// viewer
|
||||
//
|
||||
this.viewer.BackColor = System.Drawing.Color.Transparent;
|
||||
|
@ -2328,6 +2387,17 @@
|
|||
this.viewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.viewer_MouseMove);
|
||||
this.viewer.MouseUp += new System.Windows.Forms.MouseEventHandler(this.viewer_MouseUp);
|
||||
//
|
||||
// toolTip1
|
||||
//
|
||||
this.toolTip1.AutoPopDelay = 5000;
|
||||
this.toolTip1.InitialDelay = 250;
|
||||
this.toolTip1.ReshowDelay = 100;
|
||||
//
|
||||
// messagetimer
|
||||
//
|
||||
this.messagetimer.Interval = 5000;
|
||||
this.messagetimer.Tick += new System.EventHandler(this.messagetimer_Tick);
|
||||
//
|
||||
// SNESGraphicsDebugger
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -2367,6 +2437,7 @@
|
|||
this.tpPalette.ResumeLayout(false);
|
||||
this.tpPalette.PerformLayout();
|
||||
this.tpTile.ResumeLayout(false);
|
||||
this.tpTile.PerformLayout();
|
||||
this.tpMapEntry.ResumeLayout(false);
|
||||
this.tpMapEntry.PerformLayout();
|
||||
this.viewerPanel.ResumeLayout(false);
|
||||
|
@ -2568,5 +2639,11 @@
|
|||
private System.Windows.Forms.Label labelMemory;
|
||||
private System.Windows.Forms.TextBox txtBG1MapSizeBytes;
|
||||
private System.Windows.Forms.TextBox txtBG1SizeInTiles;
|
||||
private System.Windows.Forms.TextBox txtTileMode;
|
||||
private System.Windows.Forms.Label label18;
|
||||
private System.Windows.Forms.TextBox txtTileColors;
|
||||
private System.Windows.Forms.TextBox txtTileBpp;
|
||||
private System.Windows.Forms.Label label42;
|
||||
private System.Windows.Forms.TextBox txtTileAddress;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,11 @@
|
|||
//TODO - add eDisplayType for BG1-Tiles, BG2-Tiles, etc. which show the tiles available to a BG. more concise than viewing all tiles and illustrating the relevant accessible areas
|
||||
// . 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
|
||||
|
||||
//DEFERRED:
|
||||
//. 256bpp modes (difficult to use)
|
||||
//. non-mode7 directcolor (no known examples, perhaps due to difficulty using the requisite 256bpp modes)
|
||||
|
||||
//http://stackoverflow.com/questions/1101149/displaying-thumbnail-icons-128x128-pixels-or-larger-in-a-grid-in-listview
|
||||
|
||||
|
@ -32,6 +37,7 @@ namespace BizHawk.MultiClient
|
|||
int defaultHeight;
|
||||
|
||||
SwappableDisplaySurfaceSet surfaceSet = new SwappableDisplaySurfaceSet();
|
||||
List<DisplayTypeItem> displayTypeItems = new List<DisplayTypeItem>();
|
||||
|
||||
public SNESGraphicsDebugger()
|
||||
{
|
||||
|
@ -41,7 +47,6 @@ namespace BizHawk.MultiClient
|
|||
|
||||
viewer.ScaleImage = false;
|
||||
|
||||
var displayTypeItems = new List<DisplayTypeItem>();
|
||||
displayTypeItems.Add(new DisplayTypeItem("BG1", eDisplayType.BG1));
|
||||
displayTypeItems.Add(new DisplayTypeItem("BG2",eDisplayType.BG2));
|
||||
displayTypeItems.Add(new DisplayTypeItem("BG3",eDisplayType.BG3));
|
||||
|
@ -68,9 +73,11 @@ namespace BizHawk.MultiClient
|
|||
|
||||
comboBGProps.SelectedIndex = 0;
|
||||
|
||||
tabctrlDetails.SelectedIndex = 1;
|
||||
SyncViewerSize();
|
||||
SyncColorSelection();
|
||||
|
||||
//tabctrlDetails.SelectedIndex = 1;
|
||||
SetTab(null);
|
||||
}
|
||||
|
||||
LibsnesCore currentSnesCore;
|
||||
|
@ -432,7 +439,20 @@ namespace BizHawk.MultiClient
|
|||
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 int DisplayTypeBGNum(eDisplayType type) { if(IsDisplayTypeBG(type)) return (int)type; else return -1; }
|
||||
|
||||
static SNESGraphicsDecoder.BGMode BGModeForDisplayType(eDisplayType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case eDisplayType.Tiles2bpp: return SNESGraphicsDecoder.BGMode.Text;
|
||||
case eDisplayType.Tiles4bpp: return SNESGraphicsDecoder.BGMode.Text;
|
||||
case eDisplayType.Tiles8bpp: return SNESGraphicsDecoder.BGMode.Text;
|
||||
case eDisplayType.TilesMode7: return SNESGraphicsDecoder.BGMode.Mode7;
|
||||
case eDisplayType.TilesMode7Ext: return SNESGraphicsDecoder.BGMode.Mode7Ext;
|
||||
case eDisplayType.TilesMode7DC: return SNESGraphicsDecoder.BGMode.Mode7DC;
|
||||
default: throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
class DisplayTypeItem
|
||||
{
|
||||
public eDisplayType type { get; set; }
|
||||
|
@ -540,12 +560,6 @@ namespace BizHawk.MultiClient
|
|||
UpdateValues();
|
||||
}
|
||||
|
||||
void ClearDetails()
|
||||
{
|
||||
//grpDetails.Text = "Details";
|
||||
}
|
||||
|
||||
|
||||
const int paletteCellSize = 16;
|
||||
const int paletteCellSpacing = 3;
|
||||
|
||||
|
@ -673,6 +687,28 @@ namespace BizHawk.MultiClient
|
|||
paletteViewer.SetBitmap(bmp);
|
||||
}
|
||||
|
||||
static string BGModeShortName(SNESGraphicsDecoder.BGMode mode, int bpp)
|
||||
{
|
||||
if (mode == SNESGraphicsDecoder.BGMode.Unavailable) return "Unavailable";
|
||||
if (mode == SNESGraphicsDecoder.BGMode.Text) return string.Format("Text{0}bpp", bpp);
|
||||
if (mode == SNESGraphicsDecoder.BGMode.Mode7) return "Mode7";
|
||||
if (mode == SNESGraphicsDecoder.BGMode.Mode7Ext) return "Mode7Ext";
|
||||
if (mode == SNESGraphicsDecoder.BGMode.Mode7DC) return "Mode7DC";
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
|
||||
void UpdateTileDetails()
|
||||
{
|
||||
if (currTileDataState == null) return;
|
||||
var mode = BGModeForDisplayType(currTileDataState.Type);
|
||||
int bpp = currTileDataState.Bpp;
|
||||
txtTileMode.Text = BGModeShortName(mode, bpp);
|
||||
txtTileBpp.Text = currTileDataState.Bpp.ToString();
|
||||
txtTileColors.Text = (1 << currTileDataState.Bpp).ToString();
|
||||
txtTileAddress.Text = string.Format("@{0:X4}", currTileDataState.Address);
|
||||
}
|
||||
|
||||
void UpdateMapEntryDetails()
|
||||
{
|
||||
if (currMapEntryState == null) return;
|
||||
|
@ -702,6 +738,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
void UpdateColorDetails()
|
||||
{
|
||||
if (lastPalette == null) return;
|
||||
|
||||
int rgb555 = lastPalette[lastColorNum];
|
||||
var gd = NewDecoder();
|
||||
int color = gd.Colorize(rgb555);
|
||||
|
@ -873,8 +911,9 @@ namespace BizHawk.MultiClient
|
|||
public eDisplayType Type;
|
||||
public int Bpp;
|
||||
public int Tile;
|
||||
public int Address;
|
||||
}
|
||||
TileDataState tileDataState;
|
||||
TileDataState currTileDataState;
|
||||
|
||||
void RenderTileView()
|
||||
{
|
||||
|
@ -903,20 +942,20 @@ namespace BizHawk.MultiClient
|
|||
bmp.UnlockBits(bmpdata);
|
||||
viewerMapEntryTile.SetBitmap(bmp);
|
||||
}
|
||||
else if (tileDataState != null)
|
||||
else if (currTileDataState != null)
|
||||
{
|
||||
//view a tileset tile
|
||||
int bpp = tileDataState.Bpp;
|
||||
int bpp = currTileDataState.Bpp;
|
||||
|
||||
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);
|
||||
if (tileDataState.Type == eDisplayType.TilesMode7)
|
||||
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, false, false, 1, tileDataState.Tile, 1);
|
||||
else if (tileDataState.Type == eDisplayType.TilesMode7Ext)
|
||||
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, true, false, 1, tileDataState.Tile, 1);
|
||||
else if (tileDataState.Type == eDisplayType.TilesMode7DC)
|
||||
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, false, true, 1, tileDataState.Tile, 1);
|
||||
else gd.RenderTilesToScreen((int*)bmpdata.Scan0, 1, 1, bmpdata.Stride / 4, bpp, currPaletteSelection.start, tileDataState.Tile, 1);
|
||||
if (currTileDataState.Type == eDisplayType.TilesMode7)
|
||||
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, false, false, 1, currTileDataState.Tile, 1);
|
||||
else if (currTileDataState.Type == eDisplayType.TilesMode7Ext)
|
||||
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 gd.RenderTilesToScreen((int*)bmpdata.Scan0, 1, 1, bmpdata.Stride / 4, bpp, currPaletteSelection.start, currTileDataState.Tile, 1);
|
||||
|
||||
bmp.UnlockBits(bmpdata);
|
||||
viewerTile.SetBitmap(bmp);
|
||||
|
@ -934,17 +973,35 @@ namespace BizHawk.MultiClient
|
|||
int tilesTall = pxtall / 8;
|
||||
if (tx < 0 || ty < 0 || tx >= tilestride || ty >= tilesTall)
|
||||
return;
|
||||
tileDataState = new TileDataState();
|
||||
tileDataState.Bpp = bpp;
|
||||
tileDataState.Type = CurrDisplaySelection;
|
||||
tileDataState.Tile = ty * tilestride + tx;
|
||||
tabctrlDetails.SelectedTab = tpTile;
|
||||
currTileDataState = new TileDataState();
|
||||
currTileDataState.Bpp = bpp;
|
||||
currTileDataState.Type = CurrDisplaySelection;
|
||||
currTileDataState.Tile = ty * tilestride + tx;
|
||||
currTileDataState.Address = (bpp==7?8:bpp) * 8 * currTileDataState.Tile;
|
||||
if (SNESGraphicsDecoder.BGModeIsMode7Type(BGModeForDisplayType(CurrDisplaySelection)))
|
||||
{
|
||||
currTileDataState.Address *= 2;
|
||||
}
|
||||
|
||||
SetTab(tpTile);
|
||||
}
|
||||
|
||||
void SetTab(TabPage tpSet)
|
||||
{
|
||||
//doesnt work well
|
||||
//foreach (var tp in tabctrlDetails.TabPages)
|
||||
// ((TabPage)tp).Visible = tpSet != null;
|
||||
if (tpSet != null)
|
||||
{
|
||||
tpSet.Visible = true;
|
||||
tabctrlDetails.SelectedTab = tpSet;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateViewerMouseover(Point loc)
|
||||
{
|
||||
currMapEntryState = null;
|
||||
tileDataState = null;
|
||||
currTileDataState = null;
|
||||
int tx = loc.X / 8;
|
||||
int ty = loc.Y / 8;
|
||||
switch (CurrDisplaySelection)
|
||||
|
@ -963,10 +1020,12 @@ namespace BizHawk.MultiClient
|
|||
HandleTileViewMouseOver(256, 256, 8, tx, ty);
|
||||
break;
|
||||
case eDisplayType.TilesMode7:
|
||||
case eDisplayType.TilesMode7Ext:
|
||||
case eDisplayType.TilesMode7DC:
|
||||
HandleTileViewMouseOver(128, 128, 8, tx, ty);
|
||||
break;
|
||||
case eDisplayType.TilesMode7Ext:
|
||||
HandleTileViewMouseOver(128, 128, 7, tx, ty);
|
||||
break;
|
||||
case eDisplayType.BG1:
|
||||
case eDisplayType.BG2:
|
||||
case eDisplayType.BG3:
|
||||
|
@ -992,23 +1051,19 @@ namespace BizHawk.MultiClient
|
|||
//gd.DecodeBG(pixelptr, stride / 4, map, bg.TiledataAddr, bg.ScreenSize, bg.Bpp, bg.TileSize, paletteStart);
|
||||
//gd.Paletteize(pixelptr, 0, 0, numPixels);
|
||||
|
||||
tabctrlDetails.SelectedTab = tpMapEntry;
|
||||
SetTab(tpMapEntry);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
RenderTileView();
|
||||
UpdateMapEntryDetails();
|
||||
}
|
||||
|
||||
private void viewer_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
tabctrlDetails.SelectedIndex = 1;
|
||||
UpdateTileDetails();
|
||||
}
|
||||
|
||||
private void viewer_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
ClearDetails();
|
||||
SetTab(null);
|
||||
}
|
||||
|
||||
private void paletteViewer_MouseDown(object sender, MouseEventArgs e)
|
||||
|
@ -1024,7 +1079,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void paletteViewer_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
ClearDetails();
|
||||
SetTab(null);
|
||||
}
|
||||
|
||||
private void paletteViewer_MouseMove(object sender, MouseEventArgs e)
|
||||
|
@ -1034,7 +1089,7 @@ namespace BizHawk.MultiClient
|
|||
if (!valid) return;
|
||||
lastColorNum = pt.Y * 16 + pt.X;
|
||||
UpdateColorDetails();
|
||||
tabctrlDetails.SelectedTab = tpPalette;
|
||||
SetTab(tpPalette);
|
||||
}
|
||||
|
||||
static int DecodeWinformsColorToSNES(Color winforms)
|
||||
|
@ -1100,7 +1155,16 @@ namespace BizHawk.MultiClient
|
|||
var v = found as SNESGraphicsViewer;
|
||||
lock(v)
|
||||
Clipboard.SetImage(v.GetBitmap());
|
||||
labelClipboard.Text = found.Text + " copied to clipboard.";
|
||||
string label = "";
|
||||
if (found.Name == "viewer")
|
||||
label = displayTypeItems.Find((x) => x.type == CurrDisplaySelection).descr;
|
||||
if (found.Name == "viewerTile")
|
||||
label = "Tile";
|
||||
if (found.Name == "viewerMapEntryTile")
|
||||
label = "Map Entry";
|
||||
if(found.Name == "paletteViewer")
|
||||
label = "Palette";
|
||||
labelClipboard.Text = label + " copied to clipboard.";
|
||||
messagetimer.Stop();
|
||||
messagetimer.Start();
|
||||
}
|
||||
|
@ -1183,6 +1247,8 @@ namespace BizHawk.MultiClient
|
|||
Global.MainForm.SyncCoreInputComm();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue