PCE BG Viewer - implement Always on Top and Floating Window, and refactor
This commit is contained in:
parent
5ecc74c435
commit
3497e28f96
|
@ -378,10 +378,8 @@ namespace BizHawk.Client.Common
|
||||||
public int SNESGraphicsUserBackdropColor = -1;
|
public int SNESGraphicsUserBackdropColor = -1;
|
||||||
|
|
||||||
// PCE BG Viewer settings
|
// PCE BG Viewer settings
|
||||||
public bool PCEBGViewerSaveWIndowPosition = true;
|
public ToolDialogSettings PceBgViewerSettings = new ToolDialogSettings();
|
||||||
public bool PCEBGViewerAutoload = false;
|
public bool PCEBGViewerAutoload = false;
|
||||||
public int PCEBGViewerWndx = -1;
|
|
||||||
public int PCEBGViewerWndy = -1;
|
|
||||||
public int PCEBGViewerRefreshRate = 16;
|
public int PCEBGViewerRefreshRate = 16;
|
||||||
|
|
||||||
#region Cheats Dialog
|
#region Cheats Dialog
|
||||||
|
|
|
@ -1254,7 +1254,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void PCEBGViewerMenuItem_Click(object sender, EventArgs e)
|
private void PCEBGViewerMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GlobalWin.Tools.Load<PCEBGViewer>();
|
GlobalWin.Tools.Load<PceBgViewer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PCEAlwaysPerformSpriteLimitMenuItem_Click(object sender, EventArgs e)
|
private void PCEAlwaysPerformSpriteLimitMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -338,7 +338,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Global.Config.PCEBGViewerAutoload && Global.Emulator is PCEngine)
|
if (Global.Config.PCEBGViewerAutoload && Global.Emulator is PCEngine)
|
||||||
{
|
{
|
||||||
GlobalWin.Tools.Load<PCEBGViewer>();
|
GlobalWin.Tools.Load<PceBgViewer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore)
|
if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
partial class PCEBGViewer
|
partial class PceBgViewer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@ -28,15 +28,15 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.menuStrip1 = new MenuStripEx();
|
this.PceBgViewerMenu = new MenuStripEx();
|
||||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ViewerSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.vDC1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.VDC1MenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.vCD2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.VDC2MenuItem = 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.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.canvas = new BizHawk.Client.EmuHawk.PCEBGCanvas();
|
this.canvas = new BizHawk.Client.EmuHawk.PCEBGCanvas();
|
||||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||||
|
@ -51,87 +51,91 @@
|
||||||
this.TileIDLabel = new System.Windows.Forms.Label();
|
this.TileIDLabel = new System.Windows.Forms.Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.PceBgViewerMenu.SuspendLayout();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBox5.SuspendLayout();
|
this.groupBox5.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).BeginInit();
|
||||||
this.groupBox4.SuspendLayout();
|
this.groupBox4.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuStrip1
|
// PceBgViewerMenu
|
||||||
//
|
//
|
||||||
this.menuStrip1.ClickThrough = true;
|
this.PceBgViewerMenu.ClickThrough = true;
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.PceBgViewerMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.fileToolStripMenuItem,
|
this.ViewerSubMenu,
|
||||||
this.optionsToolStripMenuItem});
|
this.OptionsSubMenu});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.PceBgViewerMenu.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.PceBgViewerMenu.Name = "PceBgViewerMenu";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(676, 24);
|
this.PceBgViewerMenu.Size = new System.Drawing.Size(676, 24);
|
||||||
this.menuStrip1.TabIndex = 2;
|
this.PceBgViewerMenu.TabIndex = 2;
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
this.PceBgViewerMenu.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// fileToolStripMenuItem
|
// ViewerSubMenu
|
||||||
//
|
//
|
||||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.ViewerSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.vDC1ToolStripMenuItem,
|
this.VDC1MenuItem,
|
||||||
this.vCD2ToolStripMenuItem,
|
this.VDC2MenuItem,
|
||||||
this.toolStripSeparator1,
|
this.toolStripSeparator1,
|
||||||
this.exitToolStripMenuItem});
|
this.ExitMenuItem});
|
||||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
this.ViewerSubMenu.Name = "ViewerSubMenu";
|
||||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
this.ViewerSubMenu.Size = new System.Drawing.Size(54, 20);
|
||||||
this.fileToolStripMenuItem.Text = "&Viewer";
|
this.ViewerSubMenu.Text = "&Viewer";
|
||||||
this.fileToolStripMenuItem.DropDownOpened += new System.EventHandler(this.fileToolStripMenuItem_DropDownOpened);
|
this.ViewerSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened);
|
||||||
//
|
//
|
||||||
// vDC1ToolStripMenuItem
|
// VDC1MenuItem
|
||||||
//
|
//
|
||||||
this.vDC1ToolStripMenuItem.Name = "vDC1ToolStripMenuItem";
|
this.VDC1MenuItem.Name = "VDC1MenuItem";
|
||||||
this.vDC1ToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
|
this.VDC1MenuItem.Size = new System.Drawing.Size(134, 22);
|
||||||
this.vDC1ToolStripMenuItem.Text = "VDC&1";
|
this.VDC1MenuItem.Text = "VDC&1";
|
||||||
this.vDC1ToolStripMenuItem.Click += new System.EventHandler(this.vDC1ToolStripMenuItem_Click);
|
this.VDC1MenuItem.Click += new System.EventHandler(this.VDC1MenuItem_Click);
|
||||||
//
|
//
|
||||||
// vCD2ToolStripMenuItem
|
// VDC2MenuItem
|
||||||
//
|
//
|
||||||
this.vCD2ToolStripMenuItem.Name = "vCD2ToolStripMenuItem";
|
this.VDC2MenuItem.Name = "VDC2MenuItem";
|
||||||
this.vCD2ToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
|
this.VDC2MenuItem.Size = new System.Drawing.Size(134, 22);
|
||||||
this.vCD2ToolStripMenuItem.Text = "VCD&2";
|
this.VDC2MenuItem.Text = "VCD&2";
|
||||||
this.vCD2ToolStripMenuItem.Click += new System.EventHandler(this.vCD2ToolStripMenuItem_Click);
|
this.VDC2MenuItem.Click += new System.EventHandler(this.VDC2MenuItem_Click);
|
||||||
//
|
//
|
||||||
// toolStripSeparator1
|
// toolStripSeparator1
|
||||||
//
|
//
|
||||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
this.toolStripSeparator1.Size = new System.Drawing.Size(131, 6);
|
this.toolStripSeparator1.Size = new System.Drawing.Size(131, 6);
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem
|
// ExitMenuItem
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
this.ExitMenuItem.Name = "ExitMenuItem";
|
||||||
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
|
this.ExitMenuItem.Size = new System.Drawing.Size(134, 22);
|
||||||
this.exitToolStripMenuItem.Text = "E&xit";
|
this.ExitMenuItem.Text = "E&xit";
|
||||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
||||||
//
|
//
|
||||||
// optionsToolStripMenuItem
|
// OptionsSubMenu
|
||||||
//
|
//
|
||||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.autoloadToolStripMenuItem,
|
this.AutoloadMenuItem,
|
||||||
this.saveWindowPositionToolStripMenuItem});
|
this.SaveWindowPositionMenuItem,
|
||||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
this.AlwaysOnTopMenuItem,
|
||||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
this.FloatingWindowMenuItem});
|
||||||
this.optionsToolStripMenuItem.Text = "&Options";
|
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
||||||
this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened);
|
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
|
||||||
|
this.OptionsSubMenu.Text = "&Options";
|
||||||
|
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
|
||||||
//
|
//
|
||||||
// autoloadToolStripMenuItem
|
// AutoloadMenuItem
|
||||||
//
|
//
|
||||||
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
|
this.AutoloadMenuItem.Name = "AutoloadMenuItem";
|
||||||
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
this.AutoloadMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||||
this.autoloadToolStripMenuItem.Text = "&Autoload";
|
this.AutoloadMenuItem.Text = "&Autoload";
|
||||||
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click);
|
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
|
||||||
//
|
//
|
||||||
// saveWindowPositionToolStripMenuItem
|
// SaveWindowPositionMenuItem
|
||||||
//
|
//
|
||||||
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
|
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
|
||||||
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||||
this.saveWindowPositionToolStripMenuItem.Text = "&Save Window position";
|
this.SaveWindowPositionMenuItem.Text = "&Save Window position";
|
||||||
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
|
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
@ -149,7 +153,7 @@
|
||||||
this.canvas.Name = "canvas";
|
this.canvas.Name = "canvas";
|
||||||
this.canvas.Size = new System.Drawing.Size(512, 513);
|
this.canvas.Size = new System.Drawing.Size(512, 513);
|
||||||
this.canvas.TabIndex = 0;
|
this.canvas.TabIndex = 0;
|
||||||
this.canvas.MouseMove += new System.Windows.Forms.MouseEventHandler(this.canvas_MouseMove);
|
this.canvas.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Canvas_MouseMove);
|
||||||
//
|
//
|
||||||
// groupBox5
|
// groupBox5
|
||||||
//
|
//
|
||||||
|
@ -273,7 +277,21 @@
|
||||||
this.label1.TabIndex = 0;
|
this.label1.TabIndex = 0;
|
||||||
this.label1.Text = "Tile ID:";
|
this.label1.Text = "Tile ID:";
|
||||||
//
|
//
|
||||||
// PCEBGViewer
|
// AlwaysOnTopMenuItem
|
||||||
|
//
|
||||||
|
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
|
||||||
|
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||||
|
this.AlwaysOnTopMenuItem.Text = "Always On Top";
|
||||||
|
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
|
||||||
|
//
|
||||||
|
// FloatingWindowMenuItem
|
||||||
|
//
|
||||||
|
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
|
||||||
|
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||||
|
this.FloatingWindowMenuItem.Text = "Floating Window";
|
||||||
|
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
|
||||||
|
//
|
||||||
|
// PceBgViewer
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
@ -281,15 +299,15 @@
|
||||||
this.Controls.Add(this.groupBox4);
|
this.Controls.Add(this.groupBox4);
|
||||||
this.Controls.Add(this.groupBox5);
|
this.Controls.Add(this.groupBox5);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.groupBox1);
|
||||||
this.Controls.Add(this.menuStrip1);
|
this.Controls.Add(this.PceBgViewerMenu);
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
this.MainMenuStrip = this.PceBgViewerMenu;
|
||||||
this.Name = "PCEBGViewer";
|
this.Name = "PceBgViewer";
|
||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "Background Viewer";
|
this.Text = "Background Viewer";
|
||||||
this.Load += new System.EventHandler(this.PCEBGViewer_Load);
|
this.Load += new System.EventHandler(this.PceBgViewer_Load);
|
||||||
this.menuStrip1.ResumeLayout(false);
|
this.PceBgViewerMenu.ResumeLayout(false);
|
||||||
this.menuStrip1.PerformLayout();
|
this.PceBgViewerMenu.PerformLayout();
|
||||||
this.groupBox1.ResumeLayout(false);
|
this.groupBox1.ResumeLayout(false);
|
||||||
this.groupBox5.ResumeLayout(false);
|
this.groupBox5.ResumeLayout(false);
|
||||||
this.groupBox5.PerformLayout();
|
this.groupBox5.PerformLayout();
|
||||||
|
@ -304,14 +322,14 @@
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private PCEBGCanvas canvas;
|
private PCEBGCanvas canvas;
|
||||||
private MenuStripEx menuStrip1;
|
private MenuStripEx PceBgViewerMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ViewerSubMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem vDC1ToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem VDC1MenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem vCD2ToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem VDC2MenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||||
private System.Windows.Forms.GroupBox groupBox1;
|
private System.Windows.Forms.GroupBox groupBox1;
|
||||||
private System.Windows.Forms.GroupBox groupBox5;
|
private System.Windows.Forms.GroupBox groupBox5;
|
||||||
|
@ -326,5 +344,7 @@
|
||||||
private System.Windows.Forms.Label TileIDLabel;
|
private System.Windows.Forms.Label TileIDLabel;
|
||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label label2;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,43 +1,74 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
using BizHawk.Emulation.Cores.PCEngine;
|
using BizHawk.Emulation.Cores.PCEngine;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class PCEBGViewer : Form, IToolForm
|
public partial class PceBgViewer : Form, IToolForm
|
||||||
{
|
{
|
||||||
private PCEngine _pce;
|
private PCEngine _pce;
|
||||||
private int VDCtype;
|
private int _vdcType;
|
||||||
|
|
||||||
|
public PceBgViewer()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
TopMost = Global.Config.PceBgViewerSettings.TopMost;
|
||||||
|
Activated += (o, e) => Generate();
|
||||||
|
Closing += (o, e) =>
|
||||||
|
{
|
||||||
|
Global.Config.PceBgViewerSettings.Wndx = Location.X;
|
||||||
|
Global.Config.PceBgViewerSettings.Wndy = Location.Y;
|
||||||
|
Global.Config.PCEBGViewerRefreshRate = RefreshRate.Value;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PceBgViewer_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_pce = Global.Emulator as PCEngine;
|
||||||
|
|
||||||
|
if (Global.Config.PceBgViewerSettings.UseWindowPosition)
|
||||||
|
{
|
||||||
|
Location = Global.Config.PceBgViewerSettings.WindowPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.Config.PCEBGViewerRefreshRate >= RefreshRate.Minimum && Global.Config.PCEBGViewerRefreshRate <= RefreshRate.Maximum)
|
||||||
|
{
|
||||||
|
RefreshRate.Value = Global.Config.PCEBGViewerRefreshRate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RefreshRate.Value = RefreshRate.Maximum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshFloatingWindowControl()
|
||||||
|
{
|
||||||
|
Owner = Global.Config.PceBgViewerSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Public API
|
||||||
|
|
||||||
public bool AskSave() { return true; }
|
public bool AskSave() { return true; }
|
||||||
public bool UpdateBefore { get { return true; } }
|
public bool UpdateBefore { get { return true; } }
|
||||||
|
|
||||||
public PCEBGViewer()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
Activated += (o, e) => Generate();
|
|
||||||
Closing += (o, e) => SaveConfigSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe void Generate()
|
public unsafe void Generate()
|
||||||
{
|
{
|
||||||
if (Global.Emulator.Frame % RefreshRate.Value != 0) return;
|
if (Global.Emulator.Frame % RefreshRate.Value != 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VDC vdc = VDCtype == 0 ? _pce.VDC1 : _pce.VDC2;
|
var vdc = _vdcType == 0 ? _pce.VDC1 : _pce.VDC2;
|
||||||
|
|
||||||
int width = 8 * vdc.BatWidth;
|
var width = 8 * vdc.BatWidth;
|
||||||
int height = 8 * vdc.BatHeight;
|
var height = 8 * vdc.BatHeight;
|
||||||
BitmapData buf = canvas.Bat.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, canvas.Bat.PixelFormat);
|
var buf = canvas.Bat.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, canvas.Bat.PixelFormat);
|
||||||
int pitch = buf.Stride / 4;
|
var pitch = buf.Stride / 4;
|
||||||
int* begin = (int*)buf.Scan0.ToPointer();
|
var begin = (int*)buf.Scan0.ToPointer();
|
||||||
|
|
||||||
// TODO: this does not clear background, why?
|
|
||||||
//for (int i = 0; i < pitch * buf.Height; ++i, ++p)
|
|
||||||
// *p = canvas.BackColor.ToArgb();
|
|
||||||
|
|
||||||
int* p = begin;
|
int* p = begin;
|
||||||
for (int y = 0; y < height; ++y)
|
for (int y = 0; y < height; ++y)
|
||||||
|
@ -54,12 +85,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
byte c = vdc.PatternBuffer[(tileNo * 64) + (yOfs * 8) + xOfs];
|
byte c = vdc.PatternBuffer[(tileNo * 64) + (yOfs * 8) + xOfs];
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
|
{
|
||||||
*p = _pce.VCE.Palette[0];
|
*p = _pce.VCE.Palette[0];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*p = _pce.VCE.Palette[paletteBase + c];
|
*p = _pce.VCE.Palette[paletteBase + c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p += pitch - width;
|
p += pitch - width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,95 +125,89 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveConfigSettings()
|
#endregion
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
|
||||||
|
#region Menu
|
||||||
|
|
||||||
|
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.Config.PCEBGViewerWndx = Location.X;
|
VDC2MenuItem.Enabled = _pce.SystemId == "SGX";
|
||||||
Global.Config.PCEBGViewerWndy = Location.Y;
|
|
||||||
Global.Config.PCEBGViewerRefreshRate = RefreshRate.Value;
|
VDC1MenuItem.Checked = _vdcType == 0;
|
||||||
|
VDC2MenuItem.Checked = _vdcType == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadConfigSettings()
|
private void VDC1MenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Global.Config.PCEBGViewerSaveWIndowPosition && Global.Config.PCEBGViewerWndx >= 0 && Global.Config.PCEBGViewerWndy >= 0)
|
_vdcType = 0;
|
||||||
Location = new Point(Global.Config.PCEBGViewerWndx, Global.Config.PCEBGViewerWndy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PCEBGViewer_Load(object sender, EventArgs e)
|
private void VDC2MenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_pce = Global.Emulator as PCEngine;
|
_vdcType = 1;
|
||||||
LoadConfigSettings();
|
|
||||||
if (Global.Config.PCEBGViewerRefreshRate >= RefreshRate.Minimum && Global.Config.PCEBGViewerRefreshRate <= RefreshRate.Maximum)
|
|
||||||
{
|
|
||||||
RefreshRate.Value = Global.Config.PCEBGViewerRefreshRate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RefreshRate.Value = RefreshRate.Maximum;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ExitMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
|
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.Config.PCEBGViewerSaveWIndowPosition ^= true;
|
SaveWindowPositionMenuItem.Checked = Global.Config.PceBgViewerSettings.SaveWindowPosition;
|
||||||
|
AutoloadMenuItem.Checked = Global.Config.PCEBGViewerAutoload;
|
||||||
|
AlwaysOnTopMenuItem.Checked = Global.Config.PceBgViewerSettings.TopMost;
|
||||||
|
FloatingWindowMenuItem.Checked = Global.Config.PceBgViewerSettings.FloatingWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
|
private void AutoloadMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.Config.PCEBGViewerAutoload ^= true;
|
Global.Config.PCEBGViewerAutoload ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
saveWindowPositionToolStripMenuItem.Checked = Global.Config.PCEBGViewerSaveWIndowPosition;
|
Global.Config.PceBgViewerSettings.SaveWindowPosition ^= true;
|
||||||
autoloadToolStripMenuItem.Checked = Global.Config.PCEBGViewerAutoload;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void vDC1ToolStripMenuItem_Click(object sender, EventArgs e)
|
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
VDCtype = 0;
|
Global.Config.PceBgViewerSettings.TopMost ^= true;
|
||||||
|
TopMost = Global.Config.PceBgViewerSettings.TopMost;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void vCD2ToolStripMenuItem_Click(object sender, EventArgs e)
|
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
VDCtype = 1;
|
Global.Config.PceBgViewerSettings.FloatingWindow ^= true;
|
||||||
|
RefreshFloatingWindowControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fileToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
#endregion
|
||||||
{
|
|
||||||
if (_pce.SystemId == "SGX")
|
|
||||||
vCD2ToolStripMenuItem.Enabled = true;
|
|
||||||
else
|
|
||||||
vCD2ToolStripMenuItem.Enabled = false;
|
|
||||||
|
|
||||||
switch (VDCtype)
|
#region Dialog and Controls
|
||||||
{
|
|
||||||
default:
|
|
||||||
case 0:
|
|
||||||
vDC1ToolStripMenuItem.Checked = true;
|
|
||||||
vCD2ToolStripMenuItem.Checked = false;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
vDC1ToolStripMenuItem.Checked = false;
|
|
||||||
vCD2ToolStripMenuItem.Checked = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void canvas_MouseMove(object sender, MouseEventArgs e)
|
private void Canvas_MouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
VDC vdc = VDCtype == 0 ? _pce.VDC1 : _pce.VDC2;
|
var vdc = _vdcType == 0 ? _pce.VDC1 : _pce.VDC2;
|
||||||
int xTile = e.X / 8;
|
int xTile = e.X / 8;
|
||||||
int yTile = e.Y / 8;
|
int yTile = e.Y / 8;
|
||||||
int tileNo = vdc.VRAM[(ushort)(((yTile * vdc.BatWidth) + xTile))] & 0x07FF;
|
int tileNo = vdc.VRAM[(ushort)((yTile * vdc.BatWidth) + xTile)] & 0x07FF;
|
||||||
int paletteNo = vdc.VRAM[(ushort)(((yTile * vdc.BatWidth) + xTile))] >> 12;
|
int paletteNo = vdc.VRAM[(ushort)((yTile * vdc.BatWidth) + xTile)] >> 12;
|
||||||
TileIDLabel.Text = tileNo.ToString();
|
TileIDLabel.Text = tileNo.ToString();
|
||||||
XYLabel.Text = xTile.ToString() + ":" + yTile.ToString();
|
XYLabel.Text = xTile + ":" + yTile;
|
||||||
PaletteLabel.Text = paletteNo.ToString();
|
PaletteLabel.Text = paletteNo.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnShown(EventArgs e)
|
||||||
|
{
|
||||||
|
RefreshFloatingWindowControl();
|
||||||
|
base.OnShown(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="PceBgViewerMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
</root>
|
</root>
|
|
@ -200,7 +200,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void PceBgViewerToolbarItem_Click(object sender, EventArgs e)
|
private void PceBgViewerToolbarItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GlobalWin.Tools.Load<PCEBGViewer>();
|
GlobalWin.Tools.Load<PceBgViewer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GbaGpuViewerToolBarItem_Click(object sender, EventArgs e)
|
private void GbaGpuViewerToolBarItem_Click(object sender, EventArgs e)
|
||||||
|
|
Loading…
Reference in New Issue