diff --git a/UI/Debugger/Config/DebuggerShortcutsConfig.cs b/UI/Debugger/Config/DebuggerShortcutsConfig.cs
index 77a5e38..b792cd7 100644
--- a/UI/Debugger/Config/DebuggerShortcutsConfig.cs
+++ b/UI/Debugger/Config/DebuggerShortcutsConfig.cs
@@ -54,10 +54,10 @@ namespace Mesen.GUI.Config
[ShortcutName("Go to All")]
public XmlKeys GoToAll = Keys.Control | Keys.Oemcomma;
- [ShortcutName("PPU Viewer: Toggle View")]
- public XmlKeys PpuViewer_ToggleView = Keys.Control | Keys.Q;
- [ShortcutName("PPU Viewer: Toggle Zoom")]
- public XmlKeys PpuViewer_ToggleZoom = Keys.Control | Keys.W;
+ [ShortcutName("Zoom In")]
+ public XmlKeys ZoomIn = Keys.Control | Keys.Oemplus;
+ [ShortcutName("Zoom Out")]
+ public XmlKeys ZoomOut = Keys.Control | Keys.OemMinus;
[ShortcutName("Edit in Memory Viewer")]
public XmlKeys CodeWindow_EditInMemoryViewer = Keys.F1;
diff --git a/UI/Debugger/PpuViewer/frmTilemapViewer.Designer.cs b/UI/Debugger/PpuViewer/frmTilemapViewer.Designer.cs
index 18b351d..cd57b3a 100644
--- a/UI/Debugger/PpuViewer/frmTilemapViewer.Designer.cs
+++ b/UI/Debugger/PpuViewer/frmTilemapViewer.Designer.cs
@@ -40,11 +40,22 @@
this.chkShowTileGrid = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.lblLayer = new System.Windows.Forms.Label();
+ this.ctrlMesenMenuStrip1 = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
+ this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuView = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuAutoRefresh = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
+ this.mnuRefresh = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
+ this.mnuZoomIn = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuZoomOut = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.picTilemap)).BeginInit();
this.pnlTilemap.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
+ this.ctrlMesenMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// picTilemap
@@ -56,46 +67,53 @@
this.picTilemap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picTilemap.TabIndex = 0;
this.picTilemap.TabStop = false;
- this.picTilemap.DoubleClick += new System.EventHandler(this.picTilemap_DoubleClick);
//
// btnLayer1
//
+ this.btnLayer1.BackColor = System.Drawing.SystemColors.ControlLight;
+ this.btnLayer1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLayer1.Location = new System.Drawing.Point(45, 3);
this.btnLayer1.Name = "btnLayer1";
this.btnLayer1.Size = new System.Drawing.Size(32, 22);
this.btnLayer1.TabIndex = 1;
this.btnLayer1.Text = "1";
- this.btnLayer1.UseVisualStyleBackColor = true;
+ this.btnLayer1.UseVisualStyleBackColor = false;
this.btnLayer1.Click += new System.EventHandler(this.btnLayer1_Click);
//
// btnLayer2
//
+ this.btnLayer2.BackColor = System.Drawing.SystemColors.ControlLight;
+ this.btnLayer2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLayer2.Location = new System.Drawing.Point(83, 3);
this.btnLayer2.Name = "btnLayer2";
this.btnLayer2.Size = new System.Drawing.Size(32, 22);
this.btnLayer2.TabIndex = 2;
this.btnLayer2.Text = "2";
- this.btnLayer2.UseVisualStyleBackColor = true;
+ this.btnLayer2.UseVisualStyleBackColor = false;
this.btnLayer2.Click += new System.EventHandler(this.btnLayer2_Click);
//
// btnLayer3
//
+ this.btnLayer3.BackColor = System.Drawing.SystemColors.ControlLight;
+ this.btnLayer3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLayer3.Location = new System.Drawing.Point(121, 3);
this.btnLayer3.Name = "btnLayer3";
this.btnLayer3.Size = new System.Drawing.Size(32, 22);
this.btnLayer3.TabIndex = 3;
this.btnLayer3.Text = "3";
- this.btnLayer3.UseVisualStyleBackColor = true;
+ this.btnLayer3.UseVisualStyleBackColor = false;
this.btnLayer3.Click += new System.EventHandler(this.btnLayer3_Click);
//
// btnLayer4
//
+ this.btnLayer4.BackColor = System.Drawing.SystemColors.ControlLight;
+ this.btnLayer4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLayer4.Location = new System.Drawing.Point(159, 3);
this.btnLayer4.Name = "btnLayer4";
this.btnLayer4.Size = new System.Drawing.Size(32, 22);
this.btnLayer4.TabIndex = 4;
this.btnLayer4.Text = "4";
- this.btnLayer4.UseVisualStyleBackColor = true;
+ this.btnLayer4.UseVisualStyleBackColor = false;
this.btnLayer4.Click += new System.EventHandler(this.btnLayer4_Click);
//
// ctrlScanlineCycleSelect
@@ -112,9 +130,8 @@
this.pnlTilemap.Controls.Add(this.picTilemap);
this.pnlTilemap.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlTilemap.Location = new System.Drawing.Point(3, 31);
- this.pnlTilemap.MinimumSize = new System.Drawing.Size(512, 512);
this.pnlTilemap.Name = "pnlTilemap";
- this.pnlTilemap.Size = new System.Drawing.Size(512, 512);
+ this.pnlTilemap.Size = new System.Drawing.Size(512, 488);
this.pnlTilemap.TabIndex = 6;
//
// tableLayoutPanel1
@@ -126,12 +143,12 @@
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.tableLayoutPanel1.Size = new System.Drawing.Size(667, 546);
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(667, 522);
this.tableLayoutPanel1.TabIndex = 7;
//
// tableLayoutPanel2
@@ -204,6 +221,87 @@
this.lblLayer.TabIndex = 5;
this.lblLayer.Text = "Layer:";
//
+ // ctrlMesenMenuStrip1
+ //
+ this.ctrlMesenMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnuFile,
+ this.mnuView});
+ this.ctrlMesenMenuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.ctrlMesenMenuStrip1.Name = "ctrlMesenMenuStrip1";
+ this.ctrlMesenMenuStrip1.Size = new System.Drawing.Size(667, 24);
+ this.ctrlMesenMenuStrip1.TabIndex = 8;
+ this.ctrlMesenMenuStrip1.Text = "ctrlMesenMenuStrip1";
+ //
+ // mnuFile
+ //
+ this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnuClose});
+ this.mnuFile.Name = "mnuFile";
+ this.mnuFile.Size = new System.Drawing.Size(37, 20);
+ this.mnuFile.Text = "File";
+ //
+ // mnuClose
+ //
+ this.mnuClose.Image = global::Mesen.GUI.Properties.Resources.Exit;
+ this.mnuClose.Name = "mnuClose";
+ this.mnuClose.Size = new System.Drawing.Size(152, 22);
+ this.mnuClose.Text = "Close";
+ this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
+ //
+ // mnuView
+ //
+ this.mnuView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnuAutoRefresh,
+ this.toolStripMenuItem2,
+ this.mnuRefresh,
+ this.toolStripMenuItem1,
+ this.mnuZoomIn,
+ this.mnuZoomOut});
+ this.mnuView.Name = "mnuView";
+ this.mnuView.Size = new System.Drawing.Size(44, 20);
+ this.mnuView.Text = "View";
+ //
+ // mnuAutoRefresh
+ //
+ this.mnuAutoRefresh.Checked = true;
+ this.mnuAutoRefresh.CheckOnClick = true;
+ this.mnuAutoRefresh.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.mnuAutoRefresh.Name = "mnuAutoRefresh";
+ this.mnuAutoRefresh.Size = new System.Drawing.Size(152, 22);
+ this.mnuAutoRefresh.Text = "Auto-refresh";
+ //
+ // toolStripMenuItem2
+ //
+ this.toolStripMenuItem2.Name = "toolStripMenuItem2";
+ this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
+ //
+ // mnuRefresh
+ //
+ this.mnuRefresh.Image = global::Mesen.GUI.Properties.Resources.Refresh;
+ this.mnuRefresh.Name = "mnuRefresh";
+ this.mnuRefresh.Size = new System.Drawing.Size(152, 22);
+ this.mnuRefresh.Text = "Refresh";
+ this.mnuRefresh.Click += new System.EventHandler(this.mnuRefresh_Click);
+ //
+ // toolStripMenuItem1
+ //
+ this.toolStripMenuItem1.Name = "toolStripMenuItem1";
+ this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
+ //
+ // mnuZoomIn
+ //
+ this.mnuZoomIn.Name = "mnuZoomIn";
+ this.mnuZoomIn.Size = new System.Drawing.Size(152, 22);
+ this.mnuZoomIn.Text = "Zoom In";
+ this.mnuZoomIn.Click += new System.EventHandler(this.mnuZoomIn_Click);
+ //
+ // mnuZoomOut
+ //
+ this.mnuZoomOut.Name = "mnuZoomOut";
+ this.mnuZoomOut.Size = new System.Drawing.Size(152, 22);
+ this.mnuZoomOut.Text = "Zoom Out";
+ this.mnuZoomOut.Click += new System.EventHandler(this.mnuZoomOut_Click);
+ //
// frmTilemapViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -211,6 +309,8 @@
this.ClientSize = new System.Drawing.Size(667, 574);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.ctrlScanlineCycleSelect);
+ this.Controls.Add(this.ctrlMesenMenuStrip1);
+ this.MainMenuStrip = this.ctrlMesenMenuStrip1;
this.Name = "frmTilemapViewer";
this.Text = "Tilemap Viewer";
((System.ComponentModel.ISupportInitialize)(this.picTilemap)).EndInit();
@@ -220,7 +320,10 @@
this.tableLayoutPanel2.PerformLayout();
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
+ this.ctrlMesenMenuStrip1.ResumeLayout(false);
+ this.ctrlMesenMenuStrip1.PerformLayout();
this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -239,5 +342,15 @@
private System.Windows.Forms.CheckBox chkShowScrollOverlay;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Label lblLayer;
+ private GUI.Controls.ctrlMesenMenuStrip ctrlMesenMenuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem mnuFile;
+ private System.Windows.Forms.ToolStripMenuItem mnuClose;
+ private System.Windows.Forms.ToolStripMenuItem mnuView;
+ private System.Windows.Forms.ToolStripMenuItem mnuAutoRefresh;
+ private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem mnuZoomIn;
+ private System.Windows.Forms.ToolStripMenuItem mnuZoomOut;
+ private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
+ private System.Windows.Forms.ToolStripMenuItem mnuRefresh;
}
}
\ No newline at end of file
diff --git a/UI/Debugger/PpuViewer/frmTilemapViewer.cs b/UI/Debugger/PpuViewer/frmTilemapViewer.cs
index ad47d40..11a4754 100644
--- a/UI/Debugger/PpuViewer/frmTilemapViewer.cs
+++ b/UI/Debugger/PpuViewer/frmTilemapViewer.cs
@@ -1,4 +1,5 @@
-using Mesen.GUI.Forms;
+using Mesen.GUI.Config;
+using Mesen.GUI.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -22,7 +23,7 @@ namespace Mesen.GUI.Debugger
private byte[] _vram;
private byte[] _tilemapData;
private Bitmap _tilemapImage;
- private bool _zoomed;
+ private int _scale = 1;
public frmTilemapViewer()
{
@@ -49,6 +50,15 @@ namespace Mesen.GUI.Debugger
RefreshData();
RefreshViewer();
+
+ InitShortcuts();
+ }
+
+ private void InitShortcuts()
+ {
+ mnuRefresh.InitShortcut(this, nameof(DebuggerShortcutsConfig.Refresh));
+ mnuZoomIn.InitShortcut(this, nameof(DebuggerShortcutsConfig.ZoomIn));
+ mnuZoomOut.InitShortcut(this, nameof(DebuggerShortcutsConfig.ZoomOut));
}
protected override void OnFormClosed(FormClosedEventArgs e)
@@ -78,12 +88,22 @@ namespace Mesen.GUI.Debugger
_cgram = DebugApi.GetMemoryState(SnesMemoryType.CGRam);
}
+ private int GetWidth()
+ {
+ return _state.Ppu.BgMode == 7 ? 1024 : _state.Ppu.Layers[_options.Layer].DoubleWidth ? 512 : 256;
+ }
+
+ private int GetHeight()
+ {
+ return _state.Ppu.BgMode == 7 ? 1024 : _state.Ppu.Layers[_options.Layer].DoubleHeight ? 512 : 256;
+ }
+
private void RefreshViewer()
{
DebugApi.GetTilemap(_options, _vram, _cgram, _tilemapData);
- int mapWidth = _state.Ppu.BgMode == 7 ? 1024 : _state.Ppu.Layers[_options.Layer].DoubleWidth ? 512 : 256;
- int mapHeight = _state.Ppu.BgMode == 7 ? 1024 : _state.Ppu.Layers[_options.Layer].DoubleHeight ? 512 : 256;
+ int mapWidth = GetWidth();
+ int mapHeight = GetHeight();
if(_tilemapImage.Width != mapWidth || _tilemapImage.Height != mapHeight) {
_tilemapImage = new Bitmap(mapWidth, mapHeight, PixelFormat.Format32bppArgb);
picTilemap.Image = _tilemapImage;
@@ -98,44 +118,45 @@ namespace Mesen.GUI.Debugger
}
}
+ btnLayer1.BackColor = _options.Layer == 0 ? SystemColors.GradientActiveCaption : SystemColors.ControlLight;
+ btnLayer2.BackColor = _options.Layer == 1 ? SystemColors.GradientActiveCaption : SystemColors.ControlLight;
+ btnLayer3.BackColor = _options.Layer == 2 ? SystemColors.GradientActiveCaption : SystemColors.ControlLight;
+ btnLayer4.BackColor = _options.Layer == 3 ? SystemColors.GradientActiveCaption : SystemColors.ControlLight;
+
UpdateMapSize();
picTilemap.Invalidate();
}
private void UpdateMapSize()
{
- int mapWidth = _state.Ppu.BgMode == 7 ? 1024 : _state.Ppu.Layers[_options.Layer].DoubleWidth ? 512 : 256;
- int mapHeight = _state.Ppu.BgMode == 7 ? 1024 : _state.Ppu.Layers[_options.Layer].DoubleHeight ? 512 : 256;
- picTilemap.Width = _zoomed ? mapWidth * 2 : mapWidth;
- picTilemap.Height = _zoomed ? mapHeight * 2 : mapHeight;
+ picTilemap.Width = GetWidth() * _scale;
+ picTilemap.Height = GetHeight() * _scale;
}
private void btnLayer1_Click(object sender, EventArgs e)
{
_options.Layer = 0;
+ RefreshViewer();
}
private void btnLayer2_Click(object sender, EventArgs e)
{
_options.Layer = 1;
+ RefreshViewer();
}
private void btnLayer3_Click(object sender, EventArgs e)
{
_options.Layer = 2;
+ RefreshViewer();
}
private void btnLayer4_Click(object sender, EventArgs e)
{
_options.Layer = 3;
+ RefreshViewer();
}
-
- private void picTilemap_DoubleClick(object sender, EventArgs e)
- {
- _zoomed = !_zoomed;
- UpdateMapSize();
- }
-
+
private void chkShowTileGrid_Click(object sender, EventArgs e)
{
_options.ShowTileGrid = chkShowTileGrid.Checked;
@@ -145,5 +166,28 @@ namespace Mesen.GUI.Debugger
{
_options.ShowScrollOverlay = chkShowScrollOverlay.Checked;
}
+
+ private void mnuRefresh_Click(object sender, EventArgs e)
+ {
+ RefreshData();
+ RefreshViewer();
+ }
+
+ private void mnuZoomIn_Click(object sender, EventArgs e)
+ {
+ _scale = Math.Min(8, _scale + 1);
+ UpdateMapSize();
+ }
+
+ private void mnuZoomOut_Click(object sender, EventArgs e)
+ {
+ _scale = Math.Max(1, _scale - 1);
+ UpdateMapSize();
+ }
+
+ private void mnuClose_Click(object sender, EventArgs e)
+ {
+ Close();
+ }
}
}
diff --git a/UI/Debugger/PpuViewer/frmTilemapViewer.resx b/UI/Debugger/PpuViewer/frmTilemapViewer.resx
index 8766f29..914cde3 100644
--- a/UI/Debugger/PpuViewer/frmTilemapViewer.resx
+++ b/UI/Debugger/PpuViewer/frmTilemapViewer.resx
@@ -120,4 +120,7 @@
17, 17
+
+ 107, 17
+
\ No newline at end of file
diff --git a/UI/Debugger/frmDbgPreferences.cs b/UI/Debugger/frmDbgPreferences.cs
index d83ea3c..3928ee2 100644
--- a/UI/Debugger/frmDbgPreferences.cs
+++ b/UI/Debugger/frmDbgPreferences.cs
@@ -23,6 +23,8 @@ namespace Mesen.GUI.Debugger
GetMember(nameof(DebuggerShortcutsConfig.IncreaseFontSize)),
GetMember(nameof(DebuggerShortcutsConfig.DecreaseFontSize)),
GetMember(nameof(DebuggerShortcutsConfig.ResetFontSize)),
+ GetMember(nameof(DebuggerShortcutsConfig.ZoomIn)),
+ GetMember(nameof(DebuggerShortcutsConfig.ZoomOut)),
GetMember(nameof(DebuggerShortcutsConfig.GoTo)),
GetMember(nameof(DebuggerShortcutsConfig.Find)),
GetMember(nameof(DebuggerShortcutsConfig.FindNext)),
@@ -39,8 +41,6 @@ namespace Mesen.GUI.Debugger
GetMember(nameof(DebuggerShortcutsConfig.GoToAll)),
GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_EditInMemoryViewer)),
GetMember(nameof(DebuggerShortcutsConfig.MemoryViewer_ViewInDisassembly)),
- GetMember(nameof(DebuggerShortcutsConfig.PpuViewer_ToggleView)),
- GetMember(nameof(DebuggerShortcutsConfig.PpuViewer_ToggleZoom)),
GetMember(nameof(DebuggerShortcutsConfig.OpenApuViewer)),
GetMember(nameof(DebuggerShortcutsConfig.OpenAssembler)),