NES Nametable viewer - Screenshot menu item (to png or bmp format)
This commit is contained in:
parent
665c9c5fbd
commit
36055f2644
|
@ -29,13 +29,11 @@
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.NameTableView = new BizHawk.MultiClient.NameTableViewer();
|
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||||
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.txtScanline = new System.Windows.Forms.TextBox();
|
this.txtScanline = new System.Windows.Forms.TextBox();
|
||||||
this.rbNametableNW = new System.Windows.Forms.RadioButton();
|
this.rbNametableNW = new System.Windows.Forms.RadioButton();
|
||||||
this.rbNametableNE = new System.Windows.Forms.RadioButton();
|
this.rbNametableNE = new System.Windows.Forms.RadioButton();
|
||||||
|
@ -59,6 +57,11 @@
|
||||||
this.label7 = new System.Windows.Forms.Label();
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
this.RefreshRate = new System.Windows.Forms.TrackBar();
|
this.RefreshRate = new System.Windows.Forms.TrackBar();
|
||||||
|
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.screenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.NameTableView = new BizHawk.MultiClient.NameTableViewer();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
|
@ -77,19 +80,10 @@
|
||||||
this.groupBox1.TabIndex = 0;
|
this.groupBox1.TabIndex = 0;
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
//
|
//
|
||||||
// NameTableView
|
|
||||||
//
|
|
||||||
this.NameTableView.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.NameTableView.Location = new System.Drawing.Point(17, 19);
|
|
||||||
this.NameTableView.Name = "NameTableView";
|
|
||||||
this.NameTableView.Size = new System.Drawing.Size(512, 480);
|
|
||||||
this.NameTableView.TabIndex = 0;
|
|
||||||
this.NameTableView.MouseLeave += new System.EventHandler(this.NameTableView_MouseLeave);
|
|
||||||
this.NameTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.NameTableView_MouseMove);
|
|
||||||
//
|
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
//
|
//
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.fileToolStripMenuItem,
|
||||||
this.optionsToolStripMenuItem});
|
this.optionsToolStripMenuItem});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
|
@ -102,8 +96,7 @@
|
||||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.autoloadToolStripMenuItem,
|
this.autoloadToolStripMenuItem,
|
||||||
this.saveWindowPositionToolStripMenuItem,
|
this.saveWindowPositionToolStripMenuItem,
|
||||||
this.toolStripSeparator1,
|
this.toolStripSeparator1});
|
||||||
this.exitToolStripMenuItem});
|
|
||||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
|
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
|
||||||
this.optionsToolStripMenuItem.Text = "&Options";
|
this.optionsToolStripMenuItem.Text = "&Options";
|
||||||
|
@ -128,14 +121,6 @@
|
||||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
this.toolStripSeparator1.Size = new System.Drawing.Size(187, 6);
|
this.toolStripSeparator1.Size = new System.Drawing.Size(187, 6);
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
|
||||||
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
|
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(190, 22);
|
|
||||||
this.exitToolStripMenuItem.Text = "E&xit";
|
|
||||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// txtScanline
|
// txtScanline
|
||||||
//
|
//
|
||||||
this.txtScanline.Location = new System.Drawing.Point(4, 19);
|
this.txtScanline.Location = new System.Drawing.Point(4, 19);
|
||||||
|
@ -373,6 +358,46 @@
|
||||||
this.RefreshRate.TickFrequency = 4;
|
this.RefreshRate.TickFrequency = 4;
|
||||||
this.RefreshRate.Value = 1;
|
this.RefreshRate.Value = 1;
|
||||||
//
|
//
|
||||||
|
// fileToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.screenshotToolStripMenuItem,
|
||||||
|
this.toolStripSeparator2,
|
||||||
|
this.exitToolStripMenuItem});
|
||||||
|
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
|
this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
|
||||||
|
this.fileToolStripMenuItem.Text = "&File";
|
||||||
|
//
|
||||||
|
// screenshotToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.screenshotToolStripMenuItem.Name = "screenshotToolStripMenuItem";
|
||||||
|
this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(193, 22);
|
||||||
|
this.screenshotToolStripMenuItem.Text = "Save Screenshot As...";
|
||||||
|
this.screenshotToolStripMenuItem.Click += new System.EventHandler(this.screenshotToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// exitToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
|
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
|
||||||
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(193, 22);
|
||||||
|
this.exitToolStripMenuItem.Text = "E&xit";
|
||||||
|
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// toolStripSeparator2
|
||||||
|
//
|
||||||
|
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||||
|
this.toolStripSeparator2.Size = new System.Drawing.Size(190, 6);
|
||||||
|
//
|
||||||
|
// NameTableView
|
||||||
|
//
|
||||||
|
this.NameTableView.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.NameTableView.Location = new System.Drawing.Point(17, 19);
|
||||||
|
this.NameTableView.Name = "NameTableView";
|
||||||
|
this.NameTableView.Size = new System.Drawing.Size(512, 480);
|
||||||
|
this.NameTableView.TabIndex = 0;
|
||||||
|
this.NameTableView.MouseLeave += new System.EventHandler(this.NameTableView_MouseLeave);
|
||||||
|
this.NameTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.NameTableView_MouseMove);
|
||||||
|
//
|
||||||
// NESNameTableViewer
|
// NESNameTableViewer
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -417,7 +442,6 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.TextBox txtScanline;
|
private System.Windows.Forms.TextBox txtScanline;
|
||||||
private System.Windows.Forms.RadioButton rbNametableNW;
|
private System.Windows.Forms.RadioButton rbNametableNW;
|
||||||
private System.Windows.Forms.RadioButton rbNametableNE;
|
private System.Windows.Forms.RadioButton rbNametableNE;
|
||||||
|
@ -441,5 +465,9 @@
|
||||||
private System.Windows.Forms.Label label6;
|
private System.Windows.Forms.Label label6;
|
||||||
private System.Windows.Forms.TrackBar RefreshRate;
|
private System.Windows.Forms.TrackBar RefreshRate;
|
||||||
private System.Windows.Forms.Label label7;
|
private System.Windows.Forms.Label label7;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem screenshotToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,6 +8,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using BizHawk.Emulation.Consoles.Nintendo;
|
using BizHawk.Emulation.Consoles.Nintendo;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace BizHawk.MultiClient
|
namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
|
@ -252,5 +253,40 @@ namespace BizHawk.MultiClient
|
||||||
TableLabel.Text = "";
|
TableLabel.Text = "";
|
||||||
PaletteLabel.Text = "";
|
PaletteLabel.Text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void screenshotToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var sfd = new SaveFileDialog();
|
||||||
|
sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + "-nametable";
|
||||||
|
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathNESScreenshots, "NES");
|
||||||
|
sfd.Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*";
|
||||||
|
|
||||||
|
sfd.RestoreDirectory = true;
|
||||||
|
Global.Sound.StopSound();
|
||||||
|
var result = sfd.ShowDialog();
|
||||||
|
Global.Sound.StartSound();
|
||||||
|
if (result != DialogResult.OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var file = new FileInfo(sfd.FileName);
|
||||||
|
Bitmap b = new Bitmap(NameTableView.Width, NameTableView.Height);
|
||||||
|
Rectangle rect = new Rectangle(new Point(0, 0), NameTableView.Size);
|
||||||
|
NameTableView.DrawToBitmap(b, rect);
|
||||||
|
|
||||||
|
ImageFormat i;
|
||||||
|
string extension = file.Extension.ToUpper();
|
||||||
|
switch (extension)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case ".PNG":
|
||||||
|
i = ImageFormat.Png;
|
||||||
|
break;
|
||||||
|
case ".BMP":
|
||||||
|
i = ImageFormat.Bmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.Save(file.FullName, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue