move snes graphics debugger to ToolManager
This commit is contained in:
parent
385245bfea
commit
1fdfd1f627
|
@ -1666,7 +1666,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void SnesGfxDebuggerMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadSNESGraphicsDebugger();
|
||||
GlobalWinF.Tools.Load<SNESGraphicsDebugger>();
|
||||
}
|
||||
|
||||
private void SnesGBInSGBMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -85,7 +85,6 @@ namespace BizHawk.MultiClient
|
|||
private Point _windowed_location;
|
||||
|
||||
//tool dialogs
|
||||
private SNESGraphicsDebugger _snesgraphicsdebugger;
|
||||
private GBtools.GBGPUView _gbgpuview;
|
||||
private GBAtools.GBAGPUView _gbagpuview;
|
||||
private PCEBGViewer _pcebgviewer;
|
||||
|
@ -95,7 +94,6 @@ namespace BizHawk.MultiClient
|
|||
private NESSoundConfig _nessound;
|
||||
|
||||
//TODO: this is a lazy way to refactor things, but works for now. The point is to not have these objects created until needed, without refactoring a lot of code
|
||||
public SNESGraphicsDebugger SNESGraphicsDebugger1 { get { if (_snesgraphicsdebugger == null) _snesgraphicsdebugger = new SNESGraphicsDebugger(); return _snesgraphicsdebugger; } set { _snesgraphicsdebugger = value; } }
|
||||
public GBtools.GBGPUView GBGPUView1 { get { if (_gbgpuview == null) _gbgpuview = new GBtools.GBGPUView(); return _gbgpuview; } set { _gbgpuview = value; } }
|
||||
public GBAtools.GBAGPUView GBAGPUView1 { get { if (_gbagpuview == null) _gbagpuview = new GBAtools.GBAGPUView(); return _gbagpuview; } set { _gbagpuview = value; } }
|
||||
public PCEBGViewer PCEBGViewer1 { get { if (_pcebgviewer == null) _pcebgviewer = new PCEBGViewer(); return _pcebgviewer; } set { _pcebgviewer = value; } }
|
||||
|
@ -381,7 +379,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore)
|
||||
{
|
||||
LoadSNESGraphicsDebugger();
|
||||
GlobalWinF.Tools.Load<SNESGraphicsDebugger>();
|
||||
}
|
||||
if (Global.Config.TraceLoggerAutoLoad)
|
||||
{
|
||||
|
@ -2328,7 +2326,10 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void UpdateToolsLoadstate()
|
||||
{
|
||||
if (_snesgraphicsdebugger != null) SNESGraphicsDebugger1.UpdateToolsLoadstate();
|
||||
if (GlobalWinF.Tools.Has<SNESGraphicsDebugger>())
|
||||
{
|
||||
GlobalWinF.Tools.SNESGraphicsDebugger.UpdateToolsLoadstate();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateToolsAfter(bool fromLua = false)
|
||||
|
@ -2345,7 +2346,6 @@ namespace BizHawk.MultiClient
|
|||
//frame of execution in its list view.
|
||||
|
||||
if (_tastudio != null) TAStudio1.UpdateValues();
|
||||
if (_snesgraphicsdebugger != null) SNESGraphicsDebugger1.UpdateToolsAfter();
|
||||
HandleToggleLight();
|
||||
#if WINDOWS
|
||||
if (_luaconsole != null)
|
||||
|
@ -2659,18 +2659,6 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadSNESGraphicsDebugger()
|
||||
{
|
||||
if (!SNESGraphicsDebugger1.IsHandleCreated || SNESGraphicsDebugger1.IsDisposed)
|
||||
{
|
||||
SNESGraphicsDebugger1 = new SNESGraphicsDebugger();
|
||||
SNESGraphicsDebugger1.UpdateToolsLoadstate();
|
||||
SNESGraphicsDebugger1.Show();
|
||||
}
|
||||
else
|
||||
SNESGraphicsDebugger1.Focus();
|
||||
}
|
||||
|
||||
public void LoadTraceLogger()
|
||||
{
|
||||
if (Global.Emulator.CoreComm.CpuTraceAvailable)
|
||||
|
|
|
@ -274,6 +274,7 @@
|
|||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.ClickThrough = true;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.optionsToolStripMenuItem});
|
||||
|
@ -291,14 +292,14 @@
|
|||
this.toolStripSeparator1,
|
||||
this.exitToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "&File";
|
||||
//
|
||||
// saveScreenshotAsToolStripMenuItem
|
||||
//
|
||||
this.saveScreenshotAsToolStripMenuItem.Enabled = false;
|
||||
this.saveScreenshotAsToolStripMenuItem.Name = "saveScreenshotAsToolStripMenuItem";
|
||||
this.saveScreenshotAsToolStripMenuItem.Size = new System.Drawing.Size(266, 22);
|
||||
this.saveScreenshotAsToolStripMenuItem.Size = new System.Drawing.Size(270, 22);
|
||||
this.saveScreenshotAsToolStripMenuItem.Text = "Save Screenshot &As...";
|
||||
//
|
||||
// saveScreenshotToClipboardToolStripMenuItem
|
||||
|
@ -306,19 +307,19 @@
|
|||
this.saveScreenshotToClipboardToolStripMenuItem.Enabled = false;
|
||||
this.saveScreenshotToClipboardToolStripMenuItem.Name = "saveScreenshotToClipboardToolStripMenuItem";
|
||||
this.saveScreenshotToClipboardToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||
this.saveScreenshotToClipboardToolStripMenuItem.Size = new System.Drawing.Size(266, 22);
|
||||
this.saveScreenshotToClipboardToolStripMenuItem.Size = new System.Drawing.Size(270, 22);
|
||||
this.saveScreenshotToClipboardToolStripMenuItem.Text = "Save Screenshot to Clipboard";
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(263, 6);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(267, 6);
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(266, 22);
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(270, 22);
|
||||
this.exitToolStripMenuItem.Text = "E&xit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
|
@ -328,21 +329,21 @@
|
|||
this.autoloadToolStripMenuItem,
|
||||
this.saveWindowPositionToolStripMenuItem});
|
||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
|
||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||
this.optionsToolStripMenuItem.Text = "&Options";
|
||||
this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
// autoloadToolStripMenuItem
|
||||
//
|
||||
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
|
||||
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(190, 22);
|
||||
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.autoloadToolStripMenuItem.Text = "Auto-load";
|
||||
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click);
|
||||
//
|
||||
// saveWindowPositionToolStripMenuItem
|
||||
//
|
||||
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
|
||||
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(190, 22);
|
||||
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.saveWindowPositionToolStripMenuItem.Text = "&Save Window Position";
|
||||
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
|
||||
//
|
||||
|
@ -2701,7 +2702,8 @@
|
|||
this.KeyPreview = true;
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "SNESGraphicsDebugger";
|
||||
this.Text = "SNES Graphics Debugger";
|
||||
this.ShowIcon = false;
|
||||
this.Text = "Graphics Debugger";
|
||||
this.Load += new System.EventHandler(this.SNESGraphicsDebugger_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
|
|
|
@ -36,7 +36,7 @@ using BizHawk.Core;
|
|||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public unsafe partial class SNESGraphicsDebugger : Form
|
||||
public unsafe partial class SNESGraphicsDebugger : Form, IToolForm
|
||||
{
|
||||
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
||||
int defaultHeight;
|
||||
|
@ -44,6 +44,21 @@ namespace BizHawk.MultiClient
|
|||
SwappableDisplaySurfaceSet surfaceSet = new SwappableDisplaySurfaceSet();
|
||||
List<DisplayTypeItem> displayTypeItems = new List<DisplayTypeItem>();
|
||||
|
||||
public bool UpdateBefore { get { return false; } }
|
||||
public bool AskSave() { return true; }
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
//TODO: shouldn't something be done here?
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public SNESGraphicsDebugger()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -114,13 +129,20 @@ namespace BizHawk.MultiClient
|
|||
else return string.Format("@{0} ({1}K)", address.ToHexString(4), address / 1024);
|
||||
}
|
||||
|
||||
public void UpdateToolsAfter()
|
||||
public void UpdateValues()
|
||||
{
|
||||
SyncCore();
|
||||
if (Visible && !checkScanlineControl.Checked)
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
RegenerateData();
|
||||
UpdateValues();
|
||||
SyncCore();
|
||||
if (Visible && !checkScanlineControl.Checked)
|
||||
{
|
||||
RegenerateData();
|
||||
InternalUpdateValues();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +152,7 @@ namespace BizHawk.MultiClient
|
|||
if (Visible)
|
||||
{
|
||||
RegenerateData();
|
||||
UpdateValues();
|
||||
InternalUpdateValues();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +208,7 @@ namespace BizHawk.MultiClient
|
|||
if (target == line)
|
||||
{
|
||||
RegenerateData();
|
||||
UpdateValues();
|
||||
InternalUpdateValues();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,9 +230,8 @@ namespace BizHawk.MultiClient
|
|||
si = gd.ScanScreenInfo();
|
||||
}
|
||||
|
||||
void UpdateValues()
|
||||
private void InternalUpdateValues()
|
||||
{
|
||||
if (!IsHandleCreated || IsDisposed) return;
|
||||
if (currentSnesCore == null) return;
|
||||
|
||||
txtOBSELSizeBits.Text = si.OBSEL_Size.ToString();
|
||||
|
@ -509,7 +530,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void comboDisplayType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateValues();
|
||||
InternalUpdateValues();
|
||||
|
||||
//change the bg props viewer to match
|
||||
if (IsDisplayTypeBG(CurrDisplaySelection))
|
||||
|
@ -556,6 +577,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
SyncBackdropColor();
|
||||
}
|
||||
|
||||
UpdateToolsLoadstate();
|
||||
}
|
||||
|
||||
private void SaveConfigSettings()
|
||||
|
@ -575,7 +598,7 @@ namespace BizHawk.MultiClient
|
|||
if (rbBG3.Checked) comboBGProps.SelectedIndex = 2;
|
||||
if (rbBG4.Checked) comboBGProps.SelectedIndex = 3;
|
||||
suppression = false;
|
||||
UpdateValues();
|
||||
InternalUpdateValues();
|
||||
}
|
||||
|
||||
private void comboBGProps_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
@ -589,7 +612,7 @@ namespace BizHawk.MultiClient
|
|||
if (comboBGProps.SelectedIndex == 2) rbBG3.Checked = true;
|
||||
if (comboBGProps.SelectedIndex == 3) rbBG4.Checked = true;
|
||||
suppression = false;
|
||||
UpdateValues();
|
||||
InternalUpdateValues();
|
||||
}
|
||||
|
||||
const int paletteCellSize = 16;
|
||||
|
@ -839,7 +862,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
SyncColorSelection();
|
||||
UpdateValues();
|
||||
InternalUpdateValues();
|
||||
}
|
||||
|
||||
void SyncColorSelection()
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
GlobalWinF.MainForm.LoadSNESGraphicsDebugger();
|
||||
GlobalWinF.Tools.Load<SNESGraphicsDebugger>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -198,9 +198,9 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
var ramWatch = new RamWatch();
|
||||
_tools.Add(ramWatch);
|
||||
return ramWatch;
|
||||
var newTool = new RamWatch();
|
||||
_tools.Add(newTool);
|
||||
return newTool;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,9 +221,9 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
var ramWatch = new RamSearch();
|
||||
_tools.Add(ramWatch);
|
||||
return ramWatch;
|
||||
var newTool = new RamSearch();
|
||||
_tools.Add(newTool);
|
||||
return newTool;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,9 +244,9 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
var ramWatch = new HexEditor();
|
||||
_tools.Add(ramWatch);
|
||||
return ramWatch;
|
||||
var newTool = new HexEditor();
|
||||
_tools.Add(newTool);
|
||||
return newTool;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,9 +267,32 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
var ramWatch = new VirtualPadForm();
|
||||
_tools.Add(ramWatch);
|
||||
return ramWatch;
|
||||
var newTool = new VirtualPadForm();
|
||||
_tools.Add(newTool);
|
||||
return newTool;
|
||||
}
|
||||
}
|
||||
|
||||
public SNESGraphicsDebugger SNESGraphicsDebugger
|
||||
{
|
||||
get
|
||||
{
|
||||
var tool = _tools.FirstOrDefault(x => x is SNESGraphicsDebugger);
|
||||
if (tool != null)
|
||||
{
|
||||
if (tool.IsDisposed)
|
||||
{
|
||||
_tools.Remove(tool);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tool as SNESGraphicsDebugger;
|
||||
}
|
||||
}
|
||||
|
||||
var newTool = new SNESGraphicsDebugger();
|
||||
_tools.Add(newTool);
|
||||
return newTool;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue