move some more tools

This commit is contained in:
adelikat 2013-11-02 21:31:04 +00:00
parent 9a349ba309
commit 28d6e20e6e
11 changed files with 126 additions and 132 deletions

View File

@ -1180,7 +1180,7 @@ namespace BizHawk.MultiClient
private void VirtualPadMenuItem_Click(object sender, EventArgs e)
{
LoadVirtualPads();
GlobalWinF.Tools.Load<VirtualPadForm>();
}
private void CheatsMenuItem_Click(object sender, EventArgs e)
@ -1209,17 +1209,17 @@ namespace BizHawk.MultiClient
private void NESDebuggerMenuItem_Click(object sender, EventArgs e)
{
LoadNESDebugger();
GlobalWinF.Tools.Load<NESDebugger>();
}
private void NESPPUViewerMenuItem_Click(object sender, EventArgs e)
{
LoadNESPPU();
GlobalWinF.Tools.Load<NESPPU>();
}
private void NESNametableViewerMenuItem_Click(object sender, EventArgs e)
{
LoadNESNameTable();
GlobalWinF.Tools.Load<NESNameTableViewer>();
}
private void NESGameGenieCodesMenuItem_Click(object sender, EventArgs e)

View File

@ -53,7 +53,7 @@ namespace BizHawk.MultiClient
}
SetMainformMovieInfo();
TAStudio1.Restart();
VirtualPadForm1.Restart();
GlobalWinF.Tools.Restart<VirtualPadForm>();
GlobalWinF.DisplayManager.NeedsToPaint = true;
}

View File

@ -85,18 +85,13 @@ namespace BizHawk.MultiClient
private Point _windowed_location;
//tool dialogs
private TraceLogger _tracelogger;
private SNESGraphicsDebugger _snesgraphicsdebugger;
private NESNameTableViewer _nesnametableview;
private NESPPU _nesppu;
private NESDebugger _nesdebugger;
private GBtools.GBGPUView _gbgpuview;
private GBAtools.GBAGPUView _gbagpuview;
private PCEBGViewer _pcebgviewer;
private ToolBox _toolbox;
private TI83KeyPad _ti83pad;
private TAStudio _tastudio;
private VirtualPadForm _vpad;
private NESGameGenie _ngg;
private SNESGameGenie _sgg;
private GBGameGenie _gbgg;
@ -104,18 +99,13 @@ 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 TraceLogger TraceLogger1 { get { if (_tracelogger == null) _tracelogger = new TraceLogger(); return _tracelogger; } set { _tracelogger = value; } }
public SNESGraphicsDebugger SNESGraphicsDebugger1 { get { if (_snesgraphicsdebugger == null) _snesgraphicsdebugger = new SNESGraphicsDebugger(); return _snesgraphicsdebugger; } set { _snesgraphicsdebugger = value; } }
public NESNameTableViewer NESNameTableViewer1 { get { return _nesnametableview ?? (_nesnametableview = new NESNameTableViewer()); } set { _nesnametableview = value; } }
public NESPPU NESPPU1 { get { return _nesppu ?? (_nesppu = new NESPPU()); } set { _nesppu = value; } }
public NESDebugger NESDebug1 { get { if (_nesdebugger == null) _nesdebugger = new NESDebugger(); return _nesdebugger; } set { _nesdebugger = 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; } }
public ToolBox ToolBox1 { get { if (_toolbox == null) _toolbox = new ToolBox(); return _toolbox; } set { _toolbox = value; } }
public TI83KeyPad TI83KeyPad1 { get { if (_ti83pad == null) _ti83pad = new TI83KeyPad(); return _ti83pad; } set { _ti83pad = value; } }
public TAStudio TAStudio1 { get { if (_tastudio == null) _tastudio = new TAStudio(); return _tastudio; } set { _tastudio = value; } }
public VirtualPadForm VirtualPadForm1 { get { if (_vpad == null) _vpad = new VirtualPadForm(); return _vpad; } set { _vpad = value; } }
public NESGameGenie NESgg { get { if (_ngg == null) _ngg = new NESGameGenie(); return _ngg; } set { _ngg = value; } }
public SNESGameGenie SNESgg { get { if (_sgg == null) _sgg = new SNESGameGenie(); return _sgg; } set { _sgg = value; } }
public GBGameGenie GBgg { get { if (_gbgg == null) _gbgg = new GBGameGenie(); return _gbgg; } set { _gbgg = value; } }
@ -363,15 +353,15 @@ namespace BizHawk.MultiClient
}
if (Global.Config.AutoLoadNESPPU && Global.Emulator is NES)
{
LoadNESPPU();
GlobalWinF.Tools.Load<NESPPU>();
}
if (Global.Config.AutoLoadNESNameTable && Global.Emulator is NES)
{
LoadNESNameTable();
GlobalWinF.Tools.Load<NESNameTableViewer>();
}
if (Global.Config.AutoLoadNESDebugger && Global.Emulator is NES)
{
LoadNESDebugger();
GlobalWinF.Tools.Load<NESDebugger>();
}
if (Global.Config.NESGGAutoload && Global.Emulator is NES)
{
@ -387,7 +377,7 @@ namespace BizHawk.MultiClient
}
if (Global.Config.AutoloadVirtualPad)
{
LoadVirtualPads();
GlobalWinF.Tools.Load<VirtualPadForm>();
}
if (Global.Config.AutoLoadLuaConsole)
{
@ -1607,18 +1597,13 @@ namespace BizHawk.MultiClient
//}
GlobalWinF.Tools.Restart();
if (_nesppu != null) NESPPU1.Restart();
if (_nesnametableview != null) NESNameTableViewer1.Restart();
if (_nesdebugger != null) NESDebug1.Restart();
if (_gbgpuview != null) GBGPUView1.Restart();
if (_gbagpuview != null) GBAGPUView1.Restart();
if (_pcebgviewer != null) PCEBGViewer1.Restart();
if (_ti83pad != null) TI83KeyPad1.Restart();
if (_tastudio != null) TAStudio1.Restart();
if (_vpad != null) VirtualPadForm1.Restart();
Cheats_Restart();
if (_toolbox != null) ToolBox1.Restart();
if (_tracelogger != null) TraceLogger1.Restart();
if (Global.Config.LoadCheatFileByGame)
{
@ -1935,7 +1920,12 @@ namespace BizHawk.MultiClient
{
Global.StickyXORAdapter.ClearStickies();
GlobalWinF.AutofireStickyXORAdapter.ClearStickies();
VirtualPadForm1.ClearVirtualPadHolds();
if (GlobalWinF.Tools.Has<VirtualPadForm>())
{
GlobalWinF.Tools.VirtualPad.ClearVirtualPadHolds();
}
GlobalWinF.OSD.AddMessage("Autohold keys cleared");
}
@ -2101,7 +2091,7 @@ namespace BizHawk.MultiClient
case "Cheats": GlobalWinF.Tools.Load<Cheats>(); break;
case "TAStudio": LoadTAStudio(); break;
case "ToolBox": LoadToolBox(); break;
case "Virtual Pad": LoadVirtualPads(); break;
case "Virtual Pad": GlobalWinF.Tools.Load<VirtualPadForm>(); break;
case "Do Search": GlobalWinF.Tools.RamSearch.DoSearch(); break;
case "New Search": GlobalWinF.Tools.RamSearch.NewSearch(); break;
@ -2120,15 +2110,15 @@ namespace BizHawk.MultiClient
case "Toggle OBJ 4": SNES_ToggleOBJ4(); break;
case "Y Up Small": VirtualPadForm1.BumpAnalogValue(null, Global.Config.Analog_SmallChange); break;
case "Y Up Large": VirtualPadForm1.BumpAnalogValue(null, Global.Config.Analog_LargeChange); break;
case "Y Down Small": VirtualPadForm1.BumpAnalogValue(null, -(Global.Config.Analog_SmallChange)); break;
case "Y Down Large": VirtualPadForm1.BumpAnalogValue(null, -(Global.Config.Analog_LargeChange)); break;
case "Y Up Small": GlobalWinF.Tools.VirtualPad.BumpAnalogValue(null, Global.Config.Analog_SmallChange); break;
case "Y Up Large": GlobalWinF.Tools.VirtualPad.BumpAnalogValue(null, Global.Config.Analog_LargeChange); break;
case "Y Down Small": GlobalWinF.Tools.VirtualPad.BumpAnalogValue(null, -(Global.Config.Analog_SmallChange)); break;
case "Y Down Large": GlobalWinF.Tools.VirtualPad.BumpAnalogValue(null, -(Global.Config.Analog_LargeChange)); break;
case "X Up Small": VirtualPadForm1.BumpAnalogValue(Global.Config.Analog_SmallChange, null); break;
case "X Up Large": VirtualPadForm1.BumpAnalogValue(Global.Config.Analog_LargeChange, null); break;
case "X Down Small": VirtualPadForm1.BumpAnalogValue(-(Global.Config.Analog_SmallChange), null); break;
case "X Down Large": VirtualPadForm1.BumpAnalogValue(-(Global.Config.Analog_LargeChange), null); break;
case "X Up Small": GlobalWinF.Tools.VirtualPad.BumpAnalogValue(Global.Config.Analog_SmallChange, null); break;
case "X Up Large": GlobalWinF.Tools.VirtualPad.BumpAnalogValue(Global.Config.Analog_LargeChange, null); break;
case "X Down Small": GlobalWinF.Tools.VirtualPad.BumpAnalogValue(-(Global.Config.Analog_SmallChange), null); break;
case "X Down Large": GlobalWinF.Tools.VirtualPad.BumpAnalogValue(-(Global.Config.Analog_LargeChange), null); break;
}
return true;
@ -2339,8 +2329,6 @@ namespace BizHawk.MultiClient
GlobalWinF.Tools.UpdateBefore();
if (_nesnametableview != null) NESNameTableViewer1.UpdateValues();
if (_nesppu != null) NESPPU1.UpdateValues();
if (_pcebgviewer != null) PCEBGViewer1.UpdateValues();
if (_gbgpuview != null) GBGPUView1.UpdateValues();
if (_gbagpuview != null) GBAGPUView1.UpdateValues();
@ -2365,9 +2353,7 @@ namespace BizHawk.MultiClient
//frame of execution in its list view.
if (_tastudio != null) TAStudio1.UpdateValues();
if (_vpad != null) VirtualPadForm1.UpdateValues();
if (_snesgraphicsdebugger != null) SNESGraphicsDebugger1.UpdateToolsAfter();
if (_tracelogger != null) TraceLogger1.UpdateValues();
HandleToggleLight();
#if WINDOWS
if (_luaconsole != null)
@ -2722,15 +2708,7 @@ namespace BizHawk.MultiClient
{
if (Global.Emulator.CoreComm.CpuTraceAvailable)
{
if (!TraceLogger1.IsHandleCreated || TraceLogger1.IsDisposed)
{
TraceLogger1 = new TraceLogger();
TraceLogger1.Show();
}
else
{
TraceLogger1.Focus();
}
GlobalWinF.Tools.Load<TraceLogger>();
}
}
@ -2745,39 +2723,6 @@ namespace BizHawk.MultiClient
ToolBox1.Close();
}
public void LoadNESPPU()
{
if (!NESPPU1.IsHandleCreated || NESPPU1.IsDisposed)
{
NESPPU1 = new NESPPU();
NESPPU1.Show();
}
else
NESPPU1.Focus();
}
public void LoadNESNameTable()
{
if (!NESNameTableViewer1.IsHandleCreated || NESNameTableViewer1.IsDisposed)
{
NESNameTableViewer1 = new NESNameTableViewer();
NESNameTableViewer1.Show();
}
else
NESNameTableViewer1.Focus();
}
public void LoadNESDebugger()
{
if (!NESDebug1.IsHandleCreated || NESDebug1.IsDisposed)
{
NESDebug1 = new NESDebugger();
NESDebug1.Show();
}
else
NESDebug1.Focus();
}
public void LoadPCEBGViewer()
{
if (!PCEBGViewer1.IsHandleCreated || PCEBGViewer1.IsDisposed)
@ -3157,9 +3102,6 @@ namespace BizHawk.MultiClient
RewireSound();
ResetRewindBuffer();
NESPPU1.Restart();
NESNameTableViewer1.Restart();
NESDebug1.Restart();
GBGPUView1.Restart();
GBAGPUView1.Restart();
PCEBGViewer1.Restart();
@ -3196,16 +3138,11 @@ namespace BizHawk.MultiClient
public void CloseTools()
{
CloseForm(NESNameTableViewer1);
CloseForm(NESPPU1);
CloseForm(NESDebug1);
CloseForm(GBGPUView1);
CloseForm(GBAGPUView1);
CloseForm(PCEBGViewer1);
CloseForm(TI83KeyPad1);
CloseForm(TAStudio1); Global.MovieSession.EditorMode = false;
CloseForm(TraceLogger1);
CloseForm(VirtualPadForm1);
#if WINDOWS
CloseForm(LuaConsole1);
#endif
@ -3293,17 +3230,6 @@ namespace BizHawk.MultiClient
}
}
public void LoadVirtualPads()
{
if (!VirtualPadForm1.IsHandleCreated || VirtualPadForm1.IsDisposed)
{
VirtualPadForm1 = new VirtualPadForm();
VirtualPadForm1.Show();
}
else
VirtualPadForm1.Focus();
}
private void VolumeUp()
{
Global.Config.SoundVolume += 10;

View File

@ -8,7 +8,7 @@ using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class NESDebugger : Form
public partial class NESDebugger : Form, IToolForm
{
private const int ADDR_MAX = 0xFFFF;
private const int DISASM_LINE_COUNT = 100;
@ -25,7 +25,9 @@ namespace BizHawk.MultiClient
public readonly string mnemonic;
public DisasmOp(int s, string m) { size = s; mnemonic = m; }
}
public bool AskSave() { return true; }
public bool UpdateBefore { get { return true; } }
public NESDebugger()
{
@ -40,17 +42,27 @@ namespace BizHawk.MultiClient
public void Restart()
{
if (!(Global.Emulator is NES)) Close();
if (!IsHandleCreated || IsDisposed) return;
_nes = Global.Emulator as NES;
if (Global.Emulator is NES)
{
_nes = Global.Emulator as NES;
}
else
{
Close();
}
}
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed) return;
addr = pc = _nes.cpu.PC;
UpdateDebugView();
if (Global.Emulator is NES)
{
addr = pc = _nes.cpu.PC;
UpdateDebugView();
}
else
{
Close();
}
}
private void UpdateDebugView()

View File

@ -8,7 +8,7 @@ using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class NESNameTableViewer : Form
public partial class NESNameTableViewer : Form, IToolForm
{
//TODO:
//Show Scroll Lines + UI Toggle
@ -16,6 +16,9 @@ namespace BizHawk.MultiClient
private NES _nes;
private readonly NES.PPU.DebugCallback Callback = new NES.PPU.DebugCallback();
public bool AskSave() { return true; }
public bool UpdateBefore { get { return true; } }
public NESNameTableViewer()
{
InitializeComponent();
@ -106,17 +109,28 @@ namespace BizHawk.MultiClient
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed) return;
if (!(Global.Emulator is NES)) return;
NES.PPU ppu = (Global.Emulator as NES).ppu;
ppu.NTViewCallback = Callback;
if (Global.Emulator is NES)
{
NES.PPU ppu = (Global.Emulator as NES).ppu;
ppu.NTViewCallback = Callback;
}
else
{
Close();
}
}
public void Restart()
{
if (!(Global.Emulator is NES)) Close();
_nes = Global.Emulator as NES;
Generate(true);
if (Global.Emulator is NES)
{
_nes = Global.Emulator as NES;
Generate(true);
}
else
{
Close();
}
}
private void NESNameTableViewer_Load(object sender, EventArgs e)

View File

@ -8,7 +8,7 @@ using BizHawk.Emulation.Consoles.Nintendo;
namespace BizHawk.MultiClient
{
public partial class NESPPU : Form
public partial class NESPPU : Form, IToolForm
{
//TODO:
//If 8/16 sprite mode, mouse over should put 32x64 version of prite
@ -25,6 +25,9 @@ namespace BizHawk.MultiClient
private readonly NES.PPU.DebugCallback Callback = new NES.PPU.DebugCallback();
private bool ForceChange;
public bool AskSave() { return true; }
public bool UpdateBefore { get { return true; } }
public NESPPU()
{
InitializeComponent();
@ -52,10 +55,15 @@ namespace BizHawk.MultiClient
public void Restart()
{
if (!(Global.Emulator is NES)) Close();
if (!IsHandleCreated || IsDisposed) return;
_nes = Global.Emulator as NES;
Generate(true);
if (Global.Emulator is NES)
{
_nes = Global.Emulator as NES;
Generate(true);
}
else
{
Close();
}
}
private void LoadConfigSettings()
@ -232,9 +240,14 @@ namespace BizHawk.MultiClient
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed) return;
if (!(Global.Emulator is NES)) return;
_nes.ppu.PPUViewCallback = Callback;
if (Global.Emulator is NES)
{
_nes.ppu.PPUViewCallback = Callback;
}
else
{
Close();
}
}
private void NESPPU_Load(object sender, EventArgs e)

View File

@ -141,7 +141,7 @@
this.TAStudioButton.Name = "TAStudioButton";
this.TAStudioButton.Size = new System.Drawing.Size(86, 20);
this.TAStudioButton.Text = "VirtualPads";
this.TAStudioButton.Click += new System.EventHandler(this.TAStudioButton_Click_1);
this.TAStudioButton.Click += new System.EventHandler(this.VirtualPadButton_Click);
//
// NESDebugger
//

View File

@ -113,12 +113,12 @@ namespace BizHawk.MultiClient
private void NESPPU_Click(object sender, EventArgs e)
{
GlobalWinF.MainForm.LoadNESPPU();
GlobalWinF.Tools.Load<NESPPU>();
}
private void NESDebugger_Click(object sender, EventArgs e)
{
GlobalWinF.MainForm.LoadNESDebugger();
GlobalWinF.Tools.Load<NESDebugger>();
}
private void NESGameGenie_Click(object sender, EventArgs e)
@ -128,7 +128,7 @@ namespace BizHawk.MultiClient
private void NESNameTable_Click(object sender, EventArgs e)
{
GlobalWinF.MainForm.LoadNESNameTable();
GlobalWinF.Tools.Load<NESNameTableViewer>();
}
private void KeyPadTool_Click(object sender, EventArgs e)
@ -152,9 +152,9 @@ namespace BizHawk.MultiClient
}
}
private void TAStudioButton_Click_1(object sender, EventArgs e)
private void VirtualPadButton_Click(object sender, EventArgs e)
{
GlobalWinF.MainForm.LoadVirtualPads();
GlobalWinF.Tools.Load<VirtualPadForm>();
}
private void SNESGameGenie_Click(object sender, EventArgs e)

View File

@ -250,6 +250,29 @@ namespace BizHawk.MultiClient
}
}
public VirtualPadForm VirtualPad
{
get
{
var tool = _tools.FirstOrDefault(x => x is VirtualPadForm);
if (tool != null)
{
if (tool.IsDisposed)
{
_tools.Remove(tool);
}
else
{
return tool as VirtualPadForm;
}
}
var ramWatch = new VirtualPadForm();
_tools.Add(ramWatch);
return ramWatch;
}
}
#endregion
}
}

View File

@ -9,7 +9,7 @@ using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class TraceLogger : Form
public partial class TraceLogger : Form, IToolForm
{
//Refresh rate slider
//Make faster, such as not saving to disk until the logging is stopped, dont' add to Instructions list every frame, etc
@ -18,6 +18,9 @@ namespace BizHawk.MultiClient
private readonly List<string> Instructions = new List<string>();
private FileInfo LogFile;
public bool AskSave() { return true; }
public bool UpdateBefore { get { return false; } }
public TraceLogger()
{
InitializeComponent();

View File

@ -8,12 +8,15 @@ using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class VirtualPadForm : Form
public partial class VirtualPadForm : Form, IToolForm
{
private int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
private int defaultHeight;
private readonly List<IVirtualPad> Pads = new List<IVirtualPad>();
public bool AskSave() { return true; }
public bool UpdateBefore { get { return false; } }
public VirtualPadForm()
{
InitializeComponent();