2016-06-04 14:43:13 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Drawing.Imaging;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2016-11-24 18:30:08 -05:00
|
|
|
|
using System.Xml;
|
2016-11-23 23:46:01 -05:00
|
|
|
|
using System.Xml.Serialization;
|
2016-06-04 14:43:13 -04:00
|
|
|
|
using Mesen.GUI.Debugger;
|
2016-12-18 12:43:20 -05:00
|
|
|
|
using Mesen.GUI.Controls;
|
2016-06-04 14:43:13 -04:00
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Config
|
|
|
|
|
{
|
2016-12-04 14:02:22 -05:00
|
|
|
|
public enum ByteCodePosition
|
|
|
|
|
{
|
|
|
|
|
Hidden,
|
|
|
|
|
Left,
|
|
|
|
|
Below
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum PrgAddressPosition
|
|
|
|
|
{
|
|
|
|
|
Hidden,
|
|
|
|
|
Replace,
|
|
|
|
|
Below
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-04 14:43:13 -04:00
|
|
|
|
public class DebugViewInfo
|
|
|
|
|
{
|
2016-12-04 14:02:22 -05:00
|
|
|
|
public ByteCodePosition ByteCodePosition = ByteCodePosition.Hidden;
|
|
|
|
|
public PrgAddressPosition PrgAddressPosition = PrgAddressPosition.Hidden;
|
2016-12-18 12:43:20 -05:00
|
|
|
|
public float FontSize = BaseControl.DefaultFontSize;
|
2016-06-04 14:43:13 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-23 23:46:01 -05:00
|
|
|
|
public class DebugWorkspace
|
|
|
|
|
{
|
|
|
|
|
public List<Breakpoint> Breakpoints = new List<Breakpoint>();
|
|
|
|
|
public List<string> WatchValues = new List<string>();
|
|
|
|
|
public List<CodeLabel> Labels = new List<CodeLabel>();
|
2017-02-26 19:18:01 -05:00
|
|
|
|
public List<string> TblMappings = null;
|
2016-11-23 23:46:01 -05:00
|
|
|
|
private string _filePath;
|
|
|
|
|
|
|
|
|
|
public static DebugWorkspace GetWorkspace()
|
|
|
|
|
{
|
|
|
|
|
RomInfo info = InteropEmu.GetRomInfo();
|
|
|
|
|
return Deserialize(Path.Combine(ConfigManager.DebuggerFolder, info.GetRomName() + ".Workspace.xml"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static DebugWorkspace Deserialize(string path)
|
|
|
|
|
{
|
|
|
|
|
DebugWorkspace config = config = new DebugWorkspace();
|
|
|
|
|
|
|
|
|
|
if(File.Exists(path)) {
|
|
|
|
|
try {
|
|
|
|
|
XmlSerializer xmlSerializer = new XmlSerializer(typeof(DebugWorkspace));
|
|
|
|
|
using(TextReader textReader = new StreamReader(path)) {
|
|
|
|
|
config = (DebugWorkspace)xmlSerializer.Deserialize(textReader);
|
|
|
|
|
}
|
|
|
|
|
} catch { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
config._filePath = path;
|
|
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Save()
|
|
|
|
|
{
|
|
|
|
|
try {
|
2016-11-24 18:30:08 -05:00
|
|
|
|
XmlWriterSettings ws = new XmlWriterSettings();
|
|
|
|
|
ws.NewLineHandling = NewLineHandling.Entitize;
|
|
|
|
|
|
2016-11-23 23:46:01 -05:00
|
|
|
|
XmlSerializer xmlSerializer = new XmlSerializer(typeof(DebugWorkspace));
|
2016-11-24 18:30:08 -05:00
|
|
|
|
using(XmlWriter xmlWriter = XmlWriter.Create(_filePath, ws)) {
|
|
|
|
|
xmlSerializer.Serialize(xmlWriter, this);
|
2016-11-23 23:46:01 -05:00
|
|
|
|
}
|
|
|
|
|
} catch {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-05 23:35:07 -05:00
|
|
|
|
public enum DisassemblyType
|
|
|
|
|
{
|
|
|
|
|
VerifiedCode,
|
|
|
|
|
Everything,
|
|
|
|
|
EverythingButData
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-04 14:43:13 -04:00
|
|
|
|
public class DebugInfo
|
|
|
|
|
{
|
|
|
|
|
public DebugViewInfo LeftView;
|
|
|
|
|
public DebugViewInfo RightView;
|
2016-11-21 22:34:47 -05:00
|
|
|
|
|
|
|
|
|
public bool ShowOnlyDisassembledCode = true;
|
2016-12-05 23:35:07 -05:00
|
|
|
|
public bool DisplayOpCodesInLowerCase = false;
|
|
|
|
|
public bool ShowEffectiveAddresses = true;
|
|
|
|
|
public DisassemblyType DisassemblyType = DisassemblyType.VerifiedCode;
|
2016-11-21 22:34:47 -05:00
|
|
|
|
|
2016-06-04 14:43:13 -04:00
|
|
|
|
public bool SplitView = false;
|
|
|
|
|
public bool HexDisplay = true;
|
|
|
|
|
|
|
|
|
|
public bool PpuAutoRefresh = true;
|
2016-06-05 10:26:05 -04:00
|
|
|
|
public bool PpuPartialDraw = false;
|
2016-12-02 18:10:37 -05:00
|
|
|
|
public bool ShowPpuScrollOverlay = true;
|
2016-12-04 10:47:48 -05:00
|
|
|
|
public bool ShowTileGrid = false;
|
|
|
|
|
public bool ShowAttributeGrid = false;
|
2016-12-02 18:10:37 -05:00
|
|
|
|
public int PpuDisplayCycle = 0;
|
|
|
|
|
public int PpuDisplayScanline = 241;
|
2016-06-04 14:43:13 -04:00
|
|
|
|
|
2016-09-04 18:08:16 -04:00
|
|
|
|
public bool ShowCpuMemoryMapping = true;
|
|
|
|
|
public bool ShowPpuMemoryMapping = true;
|
2016-12-06 22:50:27 -05:00
|
|
|
|
|
|
|
|
|
public bool ShowRightPanel = true;
|
|
|
|
|
public bool ShowBottomPanel = true;
|
|
|
|
|
public int LeftPanelWidth = 930;
|
|
|
|
|
public int TopPanelHeight = 450;
|
2016-09-04 18:08:16 -04:00
|
|
|
|
|
2016-06-04 14:43:13 -04:00
|
|
|
|
public bool RamAutoRefresh = true;
|
|
|
|
|
public int RamColumnCount = 2;
|
2016-12-18 12:43:20 -05:00
|
|
|
|
public float RamFontSize = BaseControl.DefaultFontSize;
|
2017-02-26 18:58:48 -05:00
|
|
|
|
public bool RamShowCharacters = true;
|
2017-03-01 20:52:15 -05:00
|
|
|
|
public bool RamHighlightExecution = true;
|
|
|
|
|
public bool RamHighlightWrites = true;
|
|
|
|
|
public bool RamHighlightReads = true;
|
|
|
|
|
public int RamFadeSpeed = 300;
|
2017-03-04 23:15:50 -05:00
|
|
|
|
public bool RamHideUnusedBytes;
|
|
|
|
|
public bool RamHideReadBytes;
|
|
|
|
|
public bool RamHideWrittenBytes;
|
|
|
|
|
public bool RamHideExecutedBytes;
|
2016-06-04 14:43:13 -04:00
|
|
|
|
|
2016-11-26 20:58:27 -05:00
|
|
|
|
public int WindowWidth = -1;
|
|
|
|
|
public int WindowHeight = -1;
|
|
|
|
|
|
2016-11-28 20:57:53 -05:00
|
|
|
|
public int BreakInCount = 1;
|
|
|
|
|
public bool BreakInPpuCycles = false;
|
|
|
|
|
|
2016-11-27 19:43:17 -05:00
|
|
|
|
public bool HighlightUnexecutedCode = true;
|
2016-12-01 20:45:13 -05:00
|
|
|
|
|
|
|
|
|
public bool FindOccurrencesMatchCase = false;
|
|
|
|
|
public bool FindOccurrencesMatchWholeWord = false;
|
|
|
|
|
public string FindOccurrencesLastSearch = string.Empty;
|
2016-11-27 19:43:17 -05:00
|
|
|
|
|
2016-12-01 21:43:32 -05:00
|
|
|
|
public bool AutoLoadDbgFiles = false;
|
2016-12-04 09:43:43 -05:00
|
|
|
|
public bool DisableDefaultLabels = false;
|
2016-12-01 21:43:32 -05:00
|
|
|
|
|
2017-06-29 13:47:49 -04:00
|
|
|
|
public bool RefreshWatchWhileRunning = false;
|
|
|
|
|
|
2016-12-04 09:37:01 -05:00
|
|
|
|
public bool BreakOnOpen = true;
|
2016-12-04 09:53:25 -05:00
|
|
|
|
public bool BreakOnReset = true;
|
2017-03-04 16:18:28 -05:00
|
|
|
|
public bool BreakOnUnofficialOpcodes = true;
|
|
|
|
|
public bool BreakOnBrk = false;
|
2016-12-04 09:37:01 -05:00
|
|
|
|
|
2017-03-16 21:34:28 -04:00
|
|
|
|
public TraceLoggerOptions TraceLoggerOptions;
|
2017-03-04 15:18:00 -05:00
|
|
|
|
public bool TraceAutoRefresh = true;
|
|
|
|
|
public int TraceLineCount = 1000;
|
|
|
|
|
public bool TraceIndentCode = false;
|
|
|
|
|
|
2016-06-04 14:43:13 -04:00
|
|
|
|
public DebugInfo()
|
|
|
|
|
{
|
|
|
|
|
LeftView = new DebugViewInfo();
|
|
|
|
|
RightView = new DebugViewInfo();
|
2017-03-16 21:34:28 -04:00
|
|
|
|
TraceLoggerOptions = new TraceLoggerOptions() {
|
|
|
|
|
ShowByteCode = true,
|
|
|
|
|
ShowCpuCycles = false,
|
|
|
|
|
ShowEffectiveAddresses = true,
|
|
|
|
|
ShowExtraInfo = true,
|
|
|
|
|
ShowPpuFrames = false,
|
|
|
|
|
ShowPpuCycles = true,
|
|
|
|
|
ShowPpuScanline = true,
|
|
|
|
|
ShowRegisters = true,
|
|
|
|
|
UseLabels = false,
|
|
|
|
|
StatusFormat = StatusFlagFormat.Hexadecimal
|
|
|
|
|
};
|
2016-06-04 14:43:13 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|