2019-03-28 21:20:18 -04:00
|
|
|
|
using Mesen.GUI.Config;
|
|
|
|
|
using Mesen.GUI.Debugger;
|
2019-04-28 22:19:52 -04:00
|
|
|
|
using Mesen.GUI.Debugger.Labels;
|
2019-03-28 21:20:18 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Debugger.Workspace
|
|
|
|
|
{
|
|
|
|
|
public class DebugWorkspace
|
|
|
|
|
{
|
|
|
|
|
public List<Breakpoint> Breakpoints = new List<Breakpoint>();
|
|
|
|
|
public List<string> WatchValues = new List<string>();
|
2019-04-07 15:03:41 -04:00
|
|
|
|
public List<string> SpcWatchValues = new List<string>();
|
2019-07-25 22:22:09 -04:00
|
|
|
|
public List<string> Sa1WatchValues = new List<string>();
|
2019-07-30 22:34:52 -04:00
|
|
|
|
public List<string> GsuWatchValues = new List<string>();
|
2019-04-28 22:19:52 -04:00
|
|
|
|
public List<CodeLabel> CpuLabels = new List<CodeLabel>();
|
|
|
|
|
public List<CodeLabel> SpcLabels = new List<CodeLabel>();
|
2019-03-28 21:20:18 -04:00
|
|
|
|
public List<string> TblMappings = null;
|
|
|
|
|
private string _filePath;
|
|
|
|
|
|
|
|
|
|
public static DebugWorkspace GetWorkspace()
|
|
|
|
|
{
|
|
|
|
|
RomInfo info = EmuApi.GetRomInfo();
|
|
|
|
|
return Deserialize(Path.Combine(ConfigManager.DebuggerFolder, info.GetRomName() + ".Workspace.xml"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static DebugWorkspace Deserialize(string path)
|
|
|
|
|
{
|
|
|
|
|
DebugWorkspace 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 {
|
|
|
|
|
XmlWriterSettings ws = new XmlWriterSettings();
|
|
|
|
|
ws.NewLineHandling = NewLineHandling.Entitize;
|
2019-10-12 22:40:25 -04:00
|
|
|
|
ws.Indent = true;
|
2019-03-28 21:20:18 -04:00
|
|
|
|
|
|
|
|
|
XmlSerializer xmlSerializer = new XmlSerializer(typeof(DebugWorkspace));
|
|
|
|
|
using(XmlWriter xmlWriter = XmlWriter.Create(_filePath, ws)) {
|
|
|
|
|
xmlSerializer.Serialize(xmlWriter, this);
|
|
|
|
|
}
|
|
|
|
|
} catch {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|