Move hex editor into ToolManager
This commit is contained in:
parent
5f1640a3b1
commit
df6af8e158
BizHawk.MultiClient
|
@ -1165,7 +1165,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void HexEditorMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadHexEditor();
|
||||
GlobalWinF.Tools.Load<HexEditor>();
|
||||
}
|
||||
|
||||
private void TraceLoggerMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -85,8 +85,6 @@ namespace BizHawk.MultiClient
|
|||
private Point _windowed_location;
|
||||
|
||||
//tool dialogs
|
||||
|
||||
private HexEditor _hexeditor;
|
||||
private TraceLogger _tracelogger;
|
||||
private SNESGraphicsDebugger _snesgraphicsdebugger;
|
||||
private NESNameTableViewer _nesnametableview;
|
||||
|
@ -107,7 +105,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 HexEditor HexEditor1 { get { if (_hexeditor == null) _hexeditor = new HexEditor(); return _hexeditor; } set { _hexeditor = value; } }
|
||||
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; } }
|
||||
|
@ -354,7 +351,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
if (Global.Config.AutoLoadHexEditor)
|
||||
{
|
||||
LoadHexEditor();
|
||||
GlobalWinF.Tools.Load<HexEditor>();
|
||||
}
|
||||
if (Global.Config.RecentCheats.AutoLoad)
|
||||
{
|
||||
|
@ -1606,8 +1603,6 @@ namespace BizHawk.MultiClient
|
|||
//}
|
||||
|
||||
GlobalWinF.Tools.Restart();
|
||||
|
||||
if (_hexeditor != null) HexEditor1.Restart();
|
||||
if (_nesppu != null) NESPPU1.Restart();
|
||||
if (_nesnametableview != null) NESNameTableViewer1.Restart();
|
||||
if (_nesdebugger != null) NESDebug1.Restart();
|
||||
|
@ -2098,7 +2093,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
case "Ram Watch": LoadRamWatch(true); break;
|
||||
case "Ram Search": GlobalWinF.Tools.Load<RamSearch>(); break;
|
||||
case "Hex Editor": LoadHexEditor(); break;
|
||||
case "Hex Editor": GlobalWinF.Tools.Load<HexEditor>(); break;
|
||||
case "Trace Logger": LoadTraceLogger(); break;
|
||||
case "Lua Console": OpenLuaConsole(); break;
|
||||
case "Cheats": LoadCheatsWindow(); break;
|
||||
|
@ -2364,7 +2359,6 @@ namespace BizHawk.MultiClient
|
|||
|
||||
#endif
|
||||
GlobalWinF.Tools.UpdateAfter();
|
||||
if (_hexeditor != null) HexEditor1.UpdateValues();
|
||||
//The other tool updates are earlier, TAStudio needs to be later so it can display the latest
|
||||
//frame of execution in its list view.
|
||||
|
||||
|
@ -2722,17 +2716,6 @@ namespace BizHawk.MultiClient
|
|||
SNESGraphicsDebugger1.Focus();
|
||||
}
|
||||
|
||||
public void LoadHexEditor()
|
||||
{
|
||||
if (!HexEditor1.IsHandleCreated || HexEditor1.IsDisposed)
|
||||
{
|
||||
HexEditor1 = new HexEditor();
|
||||
HexEditor1.Show();
|
||||
}
|
||||
else
|
||||
HexEditor1.Focus();
|
||||
}
|
||||
|
||||
public void LoadTraceLogger()
|
||||
{
|
||||
if (Global.Emulator.CoreComm.CpuTraceAvailable)
|
||||
|
@ -3190,7 +3173,6 @@ namespace BizHawk.MultiClient
|
|||
|
||||
RewireSound();
|
||||
ResetRewindBuffer();
|
||||
HexEditor1.Restart();
|
||||
NESPPU1.Restart();
|
||||
NESNameTableViewer1.Restart();
|
||||
NESDebug1.Restart();
|
||||
|
@ -3230,7 +3212,6 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void CloseTools()
|
||||
{
|
||||
CloseForm(HexEditor1);
|
||||
CloseForm(NESNameTableViewer1);
|
||||
CloseForm(NESPPU1);
|
||||
CloseForm(NESDebug1);
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace BizHawk.MultiClient
|
|||
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Global.Config.HexBackgrndColor = colorDialog1.Color;
|
||||
GlobalWinF.MainForm.HexEditor1.Header.BackColor = colorDialog1.Color;
|
||||
GlobalWinF.MainForm.HexEditor1.MemoryViewerBox.BackColor = Global.Config.HexBackgrndColor;
|
||||
GlobalWinF.Tools.HexEditor.Header.BackColor = colorDialog1.Color;
|
||||
GlobalWinF.Tools.HexEditor.MemoryViewerBox.BackColor = Global.Config.HexBackgrndColor;
|
||||
HexBackgrnd.BackColor = colorDialog1.Color;
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ namespace BizHawk.MultiClient
|
|||
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Global.Config.HexForegrndColor = colorDialog1.Color;
|
||||
GlobalWinF.MainForm.HexEditor1.Header.ForeColor = colorDialog1.Color;
|
||||
GlobalWinF.MainForm.HexEditor1.MemoryViewerBox.ForeColor = Global.Config.HexForegrndColor;
|
||||
GlobalWinF.Tools.HexEditor.Header.ForeColor = colorDialog1.Color;
|
||||
GlobalWinF.Tools.HexEditor.MemoryViewerBox.ForeColor = Global.Config.HexForegrndColor;
|
||||
HexForegrnd.BackColor = colorDialog1.Color;
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace BizHawk.MultiClient
|
|||
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Global.Config.HexMenubarColor = colorDialog1.Color;
|
||||
GlobalWinF.MainForm.HexEditor1.menuStrip1.BackColor = Global.Config.HexMenubarColor;
|
||||
GlobalWinF.Tools.HexEditor.menuStrip1.BackColor = Global.Config.HexMenubarColor;
|
||||
HexMenubar.BackColor = colorDialog1.Color;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ using BizHawk.Client.Common;
|
|||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public partial class HexEditor : Form
|
||||
public partial class HexEditor : Form, IToolForm
|
||||
{
|
||||
//TODO:
|
||||
//Increment/Decrement wrapping logic for 4 byte values is messed up
|
||||
|
@ -53,7 +53,10 @@ namespace BizHawk.MultiClient
|
|||
private bool BigEndian;
|
||||
private int DataSize;
|
||||
|
||||
HexFind HexFind1 = new HexFind();
|
||||
private HexFind HexFind1 = new HexFind();
|
||||
|
||||
public bool AskSave() { return true; }
|
||||
public bool UpdateBefore { get { return false; } }
|
||||
|
||||
public HexEditor()
|
||||
{
|
||||
|
|
|
@ -60,12 +60,12 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void Find_Prev_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWinF.MainForm.HexEditor1.FindPrev(GetFindBoxChars(), false);
|
||||
GlobalWinF.Tools.HexEditor.FindPrev(GetFindBoxChars(), false);
|
||||
}
|
||||
|
||||
private void Find_Next_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWinF.MainForm.HexEditor1.FindNext(GetFindBoxChars(), false);
|
||||
GlobalWinF.Tools.HexEditor.FindNext(GetFindBoxChars(), false);
|
||||
}
|
||||
|
||||
private void ChangeCasing()
|
||||
|
@ -94,7 +94,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (e.KeyData == Keys.Enter)
|
||||
{
|
||||
GlobalWinF.MainForm.HexEditor1.FindNext(GetFindBoxChars(), false);
|
||||
GlobalWinF.Tools.HexEditor.FindNext(GetFindBoxChars(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public static void client_openhexeditor()
|
||||
{
|
||||
GlobalWinF.MainForm.LoadHexEditor();
|
||||
GlobalWinF.Tools.Load<HexEditor>();
|
||||
}
|
||||
|
||||
public static void client_openramwatch()
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void HexEditor_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWinF.MainForm.LoadHexEditor();
|
||||
GlobalWinF.Tools.Load<HexEditor>();
|
||||
}
|
||||
|
||||
private void toolStripButton5_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
GlobalWinF.Tools.UpdateValues<RamWatch>();
|
||||
GlobalWinF.Tools.UpdateValues<RamSearch>();
|
||||
GlobalWinF.MainForm.HexEditor1.UpdateValues();
|
||||
GlobalWinF.Tools.UpdateValues<HexEditor>();
|
||||
GlobalWinF.MainForm.Cheats_UpdateValues();
|
||||
GlobalWinF.MainForm.UpdateCheatStatus();
|
||||
}
|
||||
|
@ -249,9 +249,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public static void ViewInHexEditor(MemoryDomain domain, IEnumerable<int> addresses)
|
||||
{
|
||||
GlobalWinF.MainForm.LoadHexEditor();
|
||||
GlobalWinF.MainForm.HexEditor1.SetDomain(domain);
|
||||
GlobalWinF.MainForm.HexEditor1.SetToAddresses(addresses.ToList());
|
||||
GlobalWinF.Tools.Load<HexEditor>();
|
||||
GlobalWinF.Tools.HexEditor.SetDomain(domain);
|
||||
GlobalWinF.Tools.HexEditor.SetToAddresses(addresses.ToList());
|
||||
}
|
||||
|
||||
public static MemoryDomain DomainByName(string name)
|
||||
|
|
|
@ -227,6 +227,29 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public HexEditor HexEditor
|
||||
{
|
||||
get
|
||||
{
|
||||
var tool = _tools.FirstOrDefault(x => x is HexEditor);
|
||||
if (tool != null)
|
||||
{
|
||||
if (tool.IsDisposed)
|
||||
{
|
||||
_tools.Remove(tool);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tool as HexEditor;
|
||||
}
|
||||
}
|
||||
|
||||
var ramWatch = new HexEditor();
|
||||
_tools.Add(ramWatch);
|
||||
return ramWatch;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1154,7 +1154,7 @@ namespace BizHawk.MultiClient
|
|||
var selected = SelectedWatches;
|
||||
if (selected.Any())
|
||||
{
|
||||
GlobalWinF.MainForm.LoadHexEditor();
|
||||
GlobalWinF.Tools.Load<HexEditor>();
|
||||
|
||||
if (selected.Select(x => x.Domain).Distinct().Count() > 1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue