Debugger: Added TBL support
This commit is contained in:
parent
3261f8bcfa
commit
ac4b5345f7
12 changed files with 274 additions and 66 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include "../Core/EmuSettings.h"
|
#include "../Core/EmuSettings.h"
|
||||||
#include "../Core/VideoDecoder.h"
|
#include "../Core/VideoDecoder.h"
|
||||||
#include "../Core/ControlManager.h"
|
#include "../Core/ControlManager.h"
|
||||||
|
#include "../Core/BaseCartridge.h"
|
||||||
#include "../Core/SystemActionManager.h"
|
#include "../Core/SystemActionManager.h"
|
||||||
#include "../Core/MessageManager.h"
|
#include "../Core/MessageManager.h"
|
||||||
#include "../Core/SaveStateManager.h"
|
#include "../Core/SaveStateManager.h"
|
||||||
|
@ -34,6 +35,16 @@ string _logString;
|
||||||
shared_ptr<Console> _console;
|
shared_ptr<Console> _console;
|
||||||
InteropNotificationListeners _listeners;
|
InteropNotificationListeners _listeners;
|
||||||
|
|
||||||
|
struct InteropRomInfo
|
||||||
|
{
|
||||||
|
const char* RomPath;
|
||||||
|
const char* PatchPath;
|
||||||
|
SnesCartInformation Header;
|
||||||
|
};
|
||||||
|
|
||||||
|
string _romPath;
|
||||||
|
string _patchPath;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
DllExport bool __stdcall TestDll()
|
DllExport bool __stdcall TestDll()
|
||||||
{
|
{
|
||||||
|
@ -95,6 +106,17 @@ extern "C" {
|
||||||
DllExport void __stdcall LoadRom(char* filename, char* patchFile) { _console->LoadRom((VirtualFile)filename, patchFile ? (VirtualFile)patchFile : VirtualFile()); }
|
DllExport void __stdcall LoadRom(char* filename, char* patchFile) { _console->LoadRom((VirtualFile)filename, patchFile ? (VirtualFile)patchFile : VirtualFile()); }
|
||||||
//DllExport void __stdcall AddKnownGameFolder(char* folder) { FolderUtilities::AddKnownGameFolder(folder); }
|
//DllExport void __stdcall AddKnownGameFolder(char* folder) { FolderUtilities::AddKnownGameFolder(folder); }
|
||||||
|
|
||||||
|
DllExport void __stdcall GetRomInfo(InteropRomInfo &info)
|
||||||
|
{
|
||||||
|
RomInfo romInfo = _console->GetCartridge()->GetRomInfo();
|
||||||
|
_romPath = romInfo.RomFile;
|
||||||
|
_patchPath = romInfo.PatchFile;
|
||||||
|
|
||||||
|
info.Header = romInfo.Header;
|
||||||
|
info.RomPath = _romPath.c_str();
|
||||||
|
info.PatchPath = _patchPath.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
DllExport void __stdcall TakeScreenshot() { _console->GetVideoDecoder()->TakeScreenshot(); }
|
DllExport void __stdcall TakeScreenshot() { _console->GetVideoDecoder()->TakeScreenshot(); }
|
||||||
|
|
||||||
DllExport const char* __stdcall GetArchiveRomList(char* filename) {
|
DllExport const char* __stdcall GetArchiveRomList(char* filename) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Mesen.GUI.Forms;
|
using Mesen.GUI.Debugger.Workspace;
|
||||||
|
using Mesen.GUI.Forms;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -101,9 +102,8 @@ namespace Mesen.GUI.Debugger
|
||||||
{
|
{
|
||||||
if(_openedWindows.Count == 0) {
|
if(_openedWindows.Count == 0) {
|
||||||
//All windows have been closed, disable debugger
|
//All windows have been closed, disable debugger
|
||||||
//TODO
|
DebugWorkspaceManager.SaveWorkspace();
|
||||||
//DebugWorkspaceManager.SaveWorkspace();
|
DebugWorkspaceManager.Clear();
|
||||||
//DebugWorkspaceManager.Clear();
|
|
||||||
DebugApi.ReleaseDebugger();
|
DebugApi.ReleaseDebugger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
using System;
|
using Be.Windows.Forms;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static Mesen.GUI.Debugger.TblLoader;
|
|
||||||
|
|
||||||
namespace Be.Windows.Forms
|
namespace Mesen.GUI.Debugger
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default <see cref="IByteCharConverter"/> implementation.
|
/// The default <see cref="IByteCharConverter"/> implementation.
|
||||||
|
@ -72,7 +72,7 @@ namespace Be.Windows.Forms
|
||||||
public virtual byte[] GetBytes(string text)
|
public virtual byte[] GetBytes(string text)
|
||||||
{
|
{
|
||||||
List<byte> bytes = new List<byte>();
|
List<byte> bytes = new List<byte>();
|
||||||
|
|
||||||
bool match = false;
|
bool match = false;
|
||||||
while(text.Length > 0) {
|
while(text.Length > 0) {
|
||||||
do {
|
do {
|
|
@ -10,23 +10,6 @@ namespace Mesen.GUI.Debugger
|
||||||
{
|
{
|
||||||
public class TblLoader
|
public class TblLoader
|
||||||
{
|
{
|
||||||
public struct TblKey
|
|
||||||
{
|
|
||||||
public UInt64 Key;
|
|
||||||
public int Length;
|
|
||||||
|
|
||||||
public byte[] GetBytes()
|
|
||||||
{
|
|
||||||
byte[] bytes = new byte[this.Length];
|
|
||||||
UInt64 value = this.Key;
|
|
||||||
for(int i = 0; i < this.Length; i++) {
|
|
||||||
bytes[i] = (byte)value;
|
|
||||||
value >>= 8;
|
|
||||||
}
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dictionary<TblKey, string> ToDictionary(string[] fileContents)
|
public static Dictionary<TblKey, string> ToDictionary(string[] fileContents)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -58,4 +41,21 @@ namespace Mesen.GUI.Debugger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct TblKey
|
||||||
|
{
|
||||||
|
public UInt64 Key;
|
||||||
|
public int Length;
|
||||||
|
|
||||||
|
public byte[] GetBytes()
|
||||||
|
{
|
||||||
|
byte[] bytes = new byte[this.Length];
|
||||||
|
UInt64 value = this.Key;
|
||||||
|
for(int i = 0; i < this.Length; i++) {
|
||||||
|
bytes[i] = (byte)value;
|
||||||
|
value >>= 8;
|
||||||
|
}
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ using System.Windows.Forms;
|
||||||
using Mesen.GUI.Config;
|
using Mesen.GUI.Config;
|
||||||
using Mesen.GUI.Forms;
|
using Mesen.GUI.Forms;
|
||||||
using Mesen.GUI.Debugger.Controls;
|
using Mesen.GUI.Debugger.Controls;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Mesen.GUI.Debugger.Workspace;
|
||||||
|
|
||||||
namespace Mesen.GUI.Debugger
|
namespace Mesen.GUI.Debugger
|
||||||
{
|
{
|
||||||
|
@ -67,8 +69,7 @@ namespace Mesen.GUI.Debugger
|
||||||
|
|
||||||
this.UpdateFadeOptions();
|
this.UpdateFadeOptions();
|
||||||
|
|
||||||
//TODO
|
this.InitTblMappings();
|
||||||
//this.InitTblMappings();
|
|
||||||
|
|
||||||
this.ctrlHexViewer.StringViewVisible = mnuShowCharacters.Checked;
|
this.ctrlHexViewer.StringViewVisible = mnuShowCharacters.Checked;
|
||||||
//TODO
|
//TODO
|
||||||
|
@ -215,7 +216,7 @@ namespace Mesen.GUI.Debugger
|
||||||
GoToDestination(frm.Destination);
|
GoToDestination(frm.Destination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private void InitTblMappings()
|
private void InitTblMappings()
|
||||||
{
|
{
|
||||||
|
@ -228,7 +229,7 @@ namespace Mesen.GUI.Debugger
|
||||||
} else {
|
} else {
|
||||||
this.ctrlHexViewer.ByteCharConverter = null;
|
this.ctrlHexViewer.ByteCharConverter = null;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
private void OnNotificationReceived(NotificationEventArgs e)
|
private void OnNotificationReceived(NotificationEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -243,6 +244,7 @@ namespace Mesen.GUI.Debugger
|
||||||
if(_formClosed) {
|
if(_formClosed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.InitTblMappings();
|
||||||
this.InitMemoryTypeDropdown(false);
|
this.InitMemoryTypeDropdown(false);
|
||||||
//TODO ctrlMemoryAccessCounters.InitMemoryTypeDropdown();
|
//TODO ctrlMemoryAccessCounters.InitMemoryTypeDropdown();
|
||||||
}));
|
}));
|
||||||
|
@ -312,14 +314,6 @@ namespace Mesen.GUI.Debugger
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
|
||||||
/*
|
|
||||||
if(DebugWorkspaceManager.GetWorkspace() != this._previousWorkspace) {
|
|
||||||
this.InitTblMappings();
|
|
||||||
_previousWorkspace = DebugWorkspaceManager.GetWorkspace();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(this.tabMain.SelectedTab == this.tpgAccessCounters) {
|
if(this.tabMain.SelectedTab == this.tpgAccessCounters) {
|
||||||
//TODO this.ctrlMemoryAccessCounters.RefreshData();
|
//TODO this.ctrlMemoryAccessCounters.RefreshData();
|
||||||
} else if(this.tabMain.SelectedTab == this.tpgMemoryViewer) {
|
} else if(this.tabMain.SelectedTab == this.tpgMemoryViewer) {
|
||||||
|
@ -416,7 +410,7 @@ namespace Mesen.GUI.Debugger
|
||||||
using(SaveFileDialog sfd = new SaveFileDialog()) {
|
using(SaveFileDialog sfd = new SaveFileDialog()) {
|
||||||
sfd.SetFilter("Memory dump files (*.dmp)|*.dmp|All files (*.*)|*.*");
|
sfd.SetFilter("Memory dump files (*.dmp)|*.dmp|All files (*.*)|*.*");
|
||||||
sfd.InitialDirectory = ConfigManager.DebuggerFolder;
|
sfd.InitialDirectory = ConfigManager.DebuggerFolder;
|
||||||
//TODO sfd.FileName = InteropEmu.GetRomInfo().GetRomName() + " - " + cboMemoryType.SelectedItem.ToString() + ".dmp";
|
sfd.FileName = EmuApi.GetRomInfo().GetRomName() + " - " + cboMemoryType.SelectedItem.ToString() + ".dmp";
|
||||||
sfd.FileName = cboMemoryType.SelectedItem.ToString() + ".dmp";
|
sfd.FileName = cboMemoryType.SelectedItem.ToString() + ".dmp";
|
||||||
if(sfd.ShowDialog() == DialogResult.OK) {
|
if(sfd.ShowDialog() == DialogResult.OK) {
|
||||||
File.WriteAllBytes(sfd.FileName, this.ctrlHexViewer.GetData());
|
File.WriteAllBytes(sfd.FileName, this.ctrlHexViewer.GetData());
|
||||||
|
@ -437,27 +431,27 @@ namespace Mesen.GUI.Debugger
|
||||||
|
|
||||||
private void mnuLoadTblFile_Click(object sender, EventArgs e)
|
private void mnuLoadTblFile_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//TODO
|
using(OpenFileDialog ofd = new OpenFileDialog()) {
|
||||||
/*OpenFileDialog ofd = new OpenFileDialog();
|
ofd.SetFilter("TBL files (*.tbl)|*.tbl");
|
||||||
ofd.SetFilter("TBL files (*.tbl)|*.tbl");
|
if(ofd.ShowDialog() == DialogResult.OK) {
|
||||||
if(ofd.ShowDialog() == DialogResult.OK) {
|
string[] fileContents = File.ReadAllLines(ofd.FileName);
|
||||||
string[] fileContents = File.ReadAllLines(ofd.FileName);
|
var tblDict = TblLoader.ToDictionary(fileContents);
|
||||||
var tblDict = TblLoader.ToDictionary(fileContents);
|
if(tblDict == null) {
|
||||||
if(tblDict == null) {
|
MessageBox.Show("Could not load TBL file. The file selected file appears to be invalid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
MessageBox.Show("Could not load TBL file. The file selected file appears to be invalid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
} else {
|
||||||
} else {
|
DebugWorkspaceManager.GetWorkspace().TblMappings = new List<string>(fileContents);
|
||||||
DebugWorkspaceManager.GetWorkspace().TblMappings = new List<string>(fileContents);
|
this.ctrlHexViewer.ByteCharConverter = new TblByteCharConverter(tblDict);
|
||||||
this.ctrlHexViewer.ByteCharConverter = new TblByteCharConverter(tblDict);
|
this.mnuShowCharacters.Checked = true;
|
||||||
this.mnuShowCharacters.Checked = true;
|
InitTblMappings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mnuResetTblMappings_Click(object sender, EventArgs e)
|
private void mnuResetTblMappings_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//TODO
|
DebugWorkspaceManager.GetWorkspace().TblMappings = null;
|
||||||
//DebugWorkspaceManager.GetWorkspace().TblMappings = null;
|
this.ctrlHexViewer.ByteCharConverter = null;
|
||||||
//this.ctrlHexViewer.ByteCharConverter = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mnuShowCharacters_CheckedChanged(object sender, EventArgs e)
|
private void mnuShowCharacters_CheckedChanged(object sender, EventArgs e)
|
||||||
|
|
60
UI/Debugger/Workspace/DebugWorkspace.cs
Normal file
60
UI/Debugger/Workspace/DebugWorkspace.cs
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
using Mesen.GUI.Config;
|
||||||
|
using Mesen.GUI.Debugger;
|
||||||
|
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>();
|
||||||
|
//public List<CodeLabel> Labels = new List<CodeLabel>();
|
||||||
|
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;
|
||||||
|
|
||||||
|
XmlSerializer xmlSerializer = new XmlSerializer(typeof(DebugWorkspace));
|
||||||
|
using(XmlWriter xmlWriter = XmlWriter.Create(_filePath, ws)) {
|
||||||
|
xmlSerializer.Serialize(xmlWriter, this);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
61
UI/Debugger/Workspace/DebugWorkspaceManager.cs
Normal file
61
UI/Debugger/Workspace/DebugWorkspaceManager.cs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Mesen.GUI.Debugger.Workspace
|
||||||
|
{
|
||||||
|
public class DebugWorkspaceManager
|
||||||
|
{
|
||||||
|
private static DebugWorkspace _workspace;
|
||||||
|
private static string _romName;
|
||||||
|
private static object _lock = new object();
|
||||||
|
|
||||||
|
public static void SaveWorkspace()
|
||||||
|
{
|
||||||
|
if(_workspace != null) {
|
||||||
|
_workspace.WatchValues = new List<string>(WatchManager.WatchEntries);
|
||||||
|
_workspace.Breakpoints = new List<Breakpoint>(BreakpointManager.Breakpoints);
|
||||||
|
_workspace.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Clear()
|
||||||
|
{
|
||||||
|
_workspace = null;
|
||||||
|
_romName = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResetWorkspace()
|
||||||
|
{
|
||||||
|
if(_workspace != null) {
|
||||||
|
_workspace.Breakpoints = new List<Breakpoint>();
|
||||||
|
_workspace.WatchValues = new List<string>();
|
||||||
|
WatchManager.WatchEntries = _workspace.WatchValues;
|
||||||
|
BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
|
||||||
|
_workspace.Save();
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DebugWorkspace GetWorkspace()
|
||||||
|
{
|
||||||
|
string romName = EmuApi.GetRomInfo().GetRomName();
|
||||||
|
if(_workspace == null || _romName != romName) {
|
||||||
|
if(_workspace != null) {
|
||||||
|
SaveWorkspace();
|
||||||
|
}
|
||||||
|
_romName = romName;
|
||||||
|
_workspace = DebugWorkspace.GetWorkspace();
|
||||||
|
|
||||||
|
//Load watch entries
|
||||||
|
WatchManager.WatchEntries = _workspace.WatchValues;
|
||||||
|
|
||||||
|
//Load breakpoints
|
||||||
|
BreakpointManager.SetBreakpoints(_workspace.Breakpoints);
|
||||||
|
}
|
||||||
|
return _workspace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -103,8 +103,7 @@ namespace Mesen.GUI.Emulation
|
||||||
if(EmuRunner.IsRunning()) {
|
if(EmuRunner.IsRunning()) {
|
||||||
using(SaveFileDialog sfd = new SaveFileDialog()) {
|
using(SaveFileDialog sfd = new SaveFileDialog()) {
|
||||||
sfd.InitialDirectory = ConfigManager.SaveStateFolder;
|
sfd.InitialDirectory = ConfigManager.SaveStateFolder;
|
||||||
//TODO
|
sfd.FileName = EmuApi.GetRomInfo().GetRomName() + ".mst";
|
||||||
//sfd.FileName = EmuApi.GetRomInfo().GetRomName() + ".mst";
|
|
||||||
sfd.SetFilter(ResourceHelper.GetMessage("FilterSavestate"));
|
sfd.SetFilter(ResourceHelper.GetMessage("FilterSavestate"));
|
||||||
if(sfd.ShowDialog(Application.OpenForms[0]) == DialogResult.OK) {
|
if(sfd.ShowDialog(Application.OpenForms[0]) == DialogResult.OK) {
|
||||||
EmuApi.SaveStateFile(sfd.FileName);
|
EmuApi.SaveStateFile(sfd.FileName);
|
||||||
|
|
|
@ -38,13 +38,13 @@ namespace Mesen.GUI.Forms
|
||||||
|
|
||||||
private void btnBrowse_Click(object sender, EventArgs e)
|
private void btnBrowse_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SaveFileDialog sfd = new SaveFileDialog();
|
using(SaveFileDialog sfd = new SaveFileDialog()) {
|
||||||
sfd.SetFilter(ResourceHelper.GetMessage("FilterAvi"));
|
sfd.SetFilter(ResourceHelper.GetMessage("FilterAvi"));
|
||||||
sfd.InitialDirectory = ConfigManager.AviFolder;
|
sfd.InitialDirectory = ConfigManager.AviFolder;
|
||||||
//TODO
|
sfd.FileName = EmuApi.GetRomInfo().GetRomName() + ".avi";
|
||||||
//sfd.FileName = InteropEmu.GetRomInfo().GetRomName() + ".avi";
|
if(sfd.ShowDialog() == DialogResult.OK) {
|
||||||
if(sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
txtFilename.Text = sfd.FileName;
|
||||||
txtFilename.Text = sfd.FileName;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,9 @@ namespace Mesen.GUI.Forms
|
||||||
ctrlRecentGames.Visible = false;
|
ctrlRecentGames.Visible = false;
|
||||||
SaveStateManager.UpdateStateMenu(mnuLoadState, false);
|
SaveStateManager.UpdateStateMenu(mnuLoadState, false);
|
||||||
SaveStateManager.UpdateStateMenu(mnuSaveState, true);
|
SaveStateManager.UpdateStateMenu(mnuSaveState, true);
|
||||||
|
|
||||||
|
RomInfo romInfo = EmuApi.GetRomInfo();
|
||||||
|
this.Text = "Mesen-S - " + romInfo.GetRomName();
|
||||||
}));
|
}));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -472,8 +475,7 @@ namespace Mesen.GUI.Forms
|
||||||
using(SaveFileDialog sfd = new SaveFileDialog()) {
|
using(SaveFileDialog sfd = new SaveFileDialog()) {
|
||||||
sfd.SetFilter(ResourceHelper.GetMessage("FilterWave"));
|
sfd.SetFilter(ResourceHelper.GetMessage("FilterWave"));
|
||||||
sfd.InitialDirectory = ConfigManager.WaveFolder;
|
sfd.InitialDirectory = ConfigManager.WaveFolder;
|
||||||
//TODO
|
sfd.FileName = EmuApi.GetRomInfo().GetRomName() + ".wav";
|
||||||
//sfd.FileName = InteropEmu.GetRomInfo().GetRomName() + ".wav";
|
|
||||||
if(sfd.ShowDialog(this) == DialogResult.OK) {
|
if(sfd.ShowDialog(this) == DialogResult.OK) {
|
||||||
RecordApi.WaveRecord(sfd.FileName);
|
RecordApi.WaveRecord(sfd.FileName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,14 @@ namespace Mesen.GUI
|
||||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string patchFile = ""
|
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string patchFile = ""
|
||||||
);
|
);
|
||||||
|
|
||||||
|
[DllImport(DllPath, EntryPoint = "GetRomInfo")] private static extern void GetRomInfoWrapper(out InteropRomInfo romInfo);
|
||||||
|
public static RomInfo GetRomInfo()
|
||||||
|
{
|
||||||
|
InteropRomInfo info;
|
||||||
|
EmuApi.GetRomInfoWrapper(out info);
|
||||||
|
return new RomInfo(info);
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport(DllPath)] public static extern void LoadRecentGame([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string filepath, [MarshalAs(UnmanagedType.I1)]bool resetGame);
|
[DllImport(DllPath)] public static extern void LoadRecentGame([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string filepath, [MarshalAs(UnmanagedType.I1)]bool resetGame);
|
||||||
|
|
||||||
[DllImport(DllPath)] public static extern void AddKnownGameFolder([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string folder);
|
[DllImport(DllPath)] public static extern void AddKnownGameFolder([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string folder);
|
||||||
|
@ -86,4 +94,64 @@ namespace Mesen.GUI
|
||||||
public Int32 Height;
|
public Int32 Height;
|
||||||
public double Scale;
|
public double Scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct InteropRomInfo
|
||||||
|
{
|
||||||
|
public IntPtr RomPath;
|
||||||
|
public IntPtr PatchPath;
|
||||||
|
public SnesCartInformation Header;
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct RomInfo
|
||||||
|
{
|
||||||
|
public string RomPath;
|
||||||
|
public string PatchPath;
|
||||||
|
public SnesCartInformation Header;
|
||||||
|
|
||||||
|
public RomInfo(InteropRomInfo romInfo)
|
||||||
|
{
|
||||||
|
RomPath = (ResourcePath)Utf8Marshaler.GetStringFromIntPtr(romInfo.RomPath);
|
||||||
|
PatchPath = (ResourcePath)Utf8Marshaler.GetStringFromIntPtr(romInfo.PatchPath);
|
||||||
|
Header = romInfo.Header;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetRomName()
|
||||||
|
{
|
||||||
|
return Path.GetFileNameWithoutExtension(((ResourcePath)RomPath).FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct SnesCartInformation
|
||||||
|
{
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||||
|
public byte[] MakerCode;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||||
|
public byte[] GameCode;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
|
||||||
|
public byte[] Reserved;
|
||||||
|
|
||||||
|
public byte ExpansionRamSize;
|
||||||
|
public byte SpecialVersion;
|
||||||
|
public byte CartridgeType;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)]
|
||||||
|
public byte[] CartName;
|
||||||
|
|
||||||
|
public byte MapMode;
|
||||||
|
public byte RomType;
|
||||||
|
public byte RomSize;
|
||||||
|
public byte SramSize;
|
||||||
|
|
||||||
|
public byte DestinationCode;
|
||||||
|
public byte Reserved2;
|
||||||
|
public byte Version;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||||
|
public byte[] ChecksumComplement;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||||
|
public byte[] Checksum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,6 +248,7 @@
|
||||||
<Compile Include="Debugger\Code\CpuLineStyleProvider.cs" />
|
<Compile Include="Debugger\Code\CpuLineStyleProvider.cs" />
|
||||||
<Compile Include="Debugger\Code\IDisassemblyManager.cs" />
|
<Compile Include="Debugger\Code\IDisassemblyManager.cs" />
|
||||||
<Compile Include="Debugger\Config\DebuggerShortcutsConfig.cs" />
|
<Compile Include="Debugger\Config\DebuggerShortcutsConfig.cs" />
|
||||||
|
<Compile Include="Debugger\Workspace\DebugWorkspace.cs" />
|
||||||
<Compile Include="Debugger\Config\EventViewerInfo.cs" />
|
<Compile Include="Debugger\Config\EventViewerInfo.cs" />
|
||||||
<Compile Include="Debugger\Config\HexEditorInfo.cs" />
|
<Compile Include="Debugger\Config\HexEditorInfo.cs" />
|
||||||
<Compile Include="Config\RecentItems.cs" />
|
<Compile Include="Config\RecentItems.cs" />
|
||||||
|
@ -431,6 +432,7 @@
|
||||||
<Compile Include="Debugger\MemoryTools\frmMemoryViewerColors.designer.cs">
|
<Compile Include="Debugger\MemoryTools\frmMemoryViewerColors.designer.cs">
|
||||||
<DependentUpon>frmMemoryViewerColors.cs</DependentUpon>
|
<DependentUpon>frmMemoryViewerColors.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Debugger\MemoryTools\TblByteCharConverter.cs" />
|
||||||
<Compile Include="Debugger\PpuViewer\ctrlPaletteViewer.cs">
|
<Compile Include="Debugger\PpuViewer\ctrlPaletteViewer.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -488,7 +490,6 @@
|
||||||
<Compile Include="Debugger\HexBox\MemoryDataBlock.cs" />
|
<Compile Include="Debugger\HexBox\MemoryDataBlock.cs" />
|
||||||
<Compile Include="Debugger\HexBox\NativeMethods.cs" />
|
<Compile Include="Debugger\HexBox\NativeMethods.cs" />
|
||||||
<Compile Include="Debugger\HexBox\StaticByteProvider.cs" />
|
<Compile Include="Debugger\HexBox\StaticByteProvider.cs" />
|
||||||
<Compile Include="Debugger\HexBox\TblByteCharConverter.cs" />
|
|
||||||
<Compile Include="Debugger\HexBox\Util.cs" />
|
<Compile Include="Debugger\HexBox\Util.cs" />
|
||||||
<Compile Include="Debugger\MemoryTools\TblLoader.cs" />
|
<Compile Include="Debugger\MemoryTools\TblLoader.cs" />
|
||||||
<Compile Include="Debugger\DebugWindowManager.cs" />
|
<Compile Include="Debugger\DebugWindowManager.cs" />
|
||||||
|
@ -502,6 +503,7 @@
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Debugger\WatchManager.cs" />
|
<Compile Include="Debugger\WatchManager.cs" />
|
||||||
|
<Compile Include="Debugger\Workspace\DebugWorkspaceManager.cs" />
|
||||||
<Compile Include="Emulation\CursorManager.cs" />
|
<Compile Include="Emulation\CursorManager.cs" />
|
||||||
<Compile Include="Emulation\DisplayManager.cs" />
|
<Compile Include="Emulation\DisplayManager.cs" />
|
||||||
<Compile Include="Emulation\SaveStateManager.cs" />
|
<Compile Include="Emulation\SaveStateManager.cs" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue