Debugger: Added auto-load .mlb file option
This commit is contained in:
parent
daca866957
commit
8c9567bd47
8 changed files with 65 additions and 49 deletions
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Mesen.GUI.Debugger
|
||||
{
|
||||
|
@ -23,7 +24,10 @@ namespace Mesen.GUI.Debugger
|
|||
char[] separator = new char[1] { ':' };
|
||||
foreach(string row in File.ReadAllLines(path, Encoding.UTF8)) {
|
||||
string[] rowData = row.Split(separator, 4);
|
||||
|
||||
if(rowData.Length < 3) {
|
||||
//Invalid row
|
||||
continue;
|
||||
}
|
||||
AddressType type;
|
||||
switch(rowData[0][0]) {
|
||||
case 'G': type = AddressType.Register; break;
|
||||
|
@ -53,8 +57,14 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
}
|
||||
|
||||
int labelCount = 0;
|
||||
foreach(KeyValuePair<AddressType, Dictionary<UInt32, CodeLabel>> kvp in labels) {
|
||||
LabelManager.SetLabels(kvp.Value.Values);
|
||||
labelCount += kvp.Value.Values.Count;
|
||||
}
|
||||
|
||||
if(!silent) {
|
||||
MessageBox.Show($"Import completed with {labelCount} labels imported.", "Mesen", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
76
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
76
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
|
@ -53,6 +53,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuSaveRom = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuSaveAsIps = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuEditHeader = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuWorkspace = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -151,7 +152,6 @@ namespace Mesen.GUI.Debugger
|
|||
this.lblCyclesElapsed = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
|
||||
this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
|
||||
this.mnuSaveAsIps = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
this.splitContainer.Panel2.SuspendLayout();
|
||||
|
@ -196,7 +196,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel10);
|
||||
this.splitContainer.Panel2MinSize = 100;
|
||||
this.splitContainer.Size = new System.Drawing.Size(1172, 573);
|
||||
this.splitContainer.SplitterDistance = 438;
|
||||
this.splitContainer.SplitterDistance = 435;
|
||||
this.splitContainer.SplitterWidth = 7;
|
||||
this.splitContainer.TabIndex = 1;
|
||||
this.splitContainer.TabStop = false;
|
||||
|
@ -219,8 +219,8 @@ namespace Mesen.GUI.Debugger
|
|||
//
|
||||
this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists);
|
||||
this.ctrlSplitContainerTop.Panel2MinSize = 150;
|
||||
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1172, 438);
|
||||
this.ctrlSplitContainerTop.SplitterDistance = 917;
|
||||
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1172, 435);
|
||||
this.ctrlSplitContainerTop.SplitterDistance = 914;
|
||||
this.ctrlSplitContainerTop.SplitterWidth = 7;
|
||||
this.ctrlSplitContainerTop.TabIndex = 3;
|
||||
this.ctrlSplitContainerTop.PanelCollapsed += new System.EventHandler(this.ctrlSplitContainerTop_PanelCollapsed);
|
||||
|
@ -241,7 +241,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.tlpTop.Name = "tlpTop";
|
||||
this.tlpTop.RowCount = 1;
|
||||
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tlpTop.Size = new System.Drawing.Size(917, 438);
|
||||
this.tlpTop.Size = new System.Drawing.Size(914, 435);
|
||||
this.tlpTop.TabIndex = 2;
|
||||
//
|
||||
// ctrlDebuggerCode
|
||||
|
@ -250,7 +250,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3);
|
||||
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
|
||||
this.ctrlDebuggerCode.Size = new System.Drawing.Size(453, 432);
|
||||
this.ctrlDebuggerCode.Size = new System.Drawing.Size(450, 429);
|
||||
this.ctrlDebuggerCode.TabIndex = 2;
|
||||
this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
|
||||
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
|
||||
|
@ -259,10 +259,10 @@ namespace Mesen.GUI.Debugger
|
|||
// ctrlConsoleStatus
|
||||
//
|
||||
this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlConsoleStatus.Location = new System.Drawing.Point(459, 0);
|
||||
this.ctrlConsoleStatus.Location = new System.Drawing.Point(456, 0);
|
||||
this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ctrlConsoleStatus.Name = "ctrlConsoleStatus";
|
||||
this.ctrlConsoleStatus.Size = new System.Drawing.Size(458, 438);
|
||||
this.ctrlConsoleStatus.Size = new System.Drawing.Size(458, 435);
|
||||
this.ctrlConsoleStatus.TabIndex = 3;
|
||||
this.ctrlConsoleStatus.OnGotoLocation += new System.EventHandler(this.ctrlConsoleStatus_OnGotoLocation);
|
||||
//
|
||||
|
@ -270,9 +270,9 @@ namespace Mesen.GUI.Debugger
|
|||
//
|
||||
this.ctrlDebuggerCodeSplit.Code = null;
|
||||
this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(462, 3);
|
||||
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(459, 3);
|
||||
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
|
||||
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 432);
|
||||
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 429);
|
||||
this.ctrlDebuggerCodeSplit.TabIndex = 4;
|
||||
this.ctrlDebuggerCodeSplit.Visible = false;
|
||||
this.ctrlDebuggerCodeSplit.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
|
||||
|
@ -292,16 +292,16 @@ namespace Mesen.GUI.Debugger
|
|||
this.tlpFunctionLabelLists.RowCount = 2;
|
||||
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(248, 438);
|
||||
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(251, 435);
|
||||
this.tlpFunctionLabelLists.TabIndex = 5;
|
||||
//
|
||||
// grpLabels
|
||||
//
|
||||
this.grpLabels.Controls.Add(this.ctrlLabelList);
|
||||
this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpLabels.Location = new System.Drawing.Point(3, 222);
|
||||
this.grpLabels.Location = new System.Drawing.Point(3, 220);
|
||||
this.grpLabels.Name = "grpLabels";
|
||||
this.grpLabels.Size = new System.Drawing.Size(242, 213);
|
||||
this.grpLabels.Size = new System.Drawing.Size(245, 212);
|
||||
this.grpLabels.TabIndex = 6;
|
||||
this.grpLabels.TabStop = false;
|
||||
this.grpLabels.Text = "Labels";
|
||||
|
@ -311,7 +311,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlLabelList.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlLabelList.Name = "ctrlLabelList";
|
||||
this.ctrlLabelList.Size = new System.Drawing.Size(236, 194);
|
||||
this.ctrlLabelList.Size = new System.Drawing.Size(239, 193);
|
||||
this.ctrlLabelList.TabIndex = 0;
|
||||
this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence);
|
||||
this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected);
|
||||
|
@ -322,7 +322,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpFunctions.Location = new System.Drawing.Point(3, 3);
|
||||
this.grpFunctions.Name = "grpFunctions";
|
||||
this.grpFunctions.Size = new System.Drawing.Size(242, 213);
|
||||
this.grpFunctions.Size = new System.Drawing.Size(245, 211);
|
||||
this.grpFunctions.TabIndex = 5;
|
||||
this.grpFunctions.TabStop = false;
|
||||
this.grpFunctions.Text = "Functions";
|
||||
|
@ -332,7 +332,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlFunctionList.Name = "ctrlFunctionList";
|
||||
this.ctrlFunctionList.Size = new System.Drawing.Size(236, 194);
|
||||
this.ctrlFunctionList.Size = new System.Drawing.Size(239, 192);
|
||||
this.ctrlFunctionList.TabIndex = 0;
|
||||
this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence);
|
||||
this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected);
|
||||
|
@ -353,7 +353,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel10.Size = new System.Drawing.Size(1172, 128);
|
||||
this.tableLayoutPanel10.Size = new System.Drawing.Size(1172, 131);
|
||||
this.tableLayoutPanel10.TabIndex = 0;
|
||||
//
|
||||
// grpWatch
|
||||
|
@ -363,7 +363,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.grpWatch.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpWatch.Location = new System.Drawing.Point(3, 3);
|
||||
this.grpWatch.Name = "grpWatch";
|
||||
this.grpWatch.Size = new System.Drawing.Size(384, 122);
|
||||
this.grpWatch.Size = new System.Drawing.Size(384, 125);
|
||||
this.grpWatch.TabIndex = 2;
|
||||
this.grpWatch.TabStop = false;
|
||||
this.grpWatch.Text = "Watch";
|
||||
|
@ -383,7 +383,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlWatch.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlWatch.Name = "ctrlWatch";
|
||||
this.ctrlWatch.Size = new System.Drawing.Size(378, 103);
|
||||
this.ctrlWatch.Size = new System.Drawing.Size(378, 106);
|
||||
this.ctrlWatch.TabIndex = 0;
|
||||
//
|
||||
// grpBreakpoints
|
||||
|
@ -392,7 +392,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.grpBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpBreakpoints.Location = new System.Drawing.Point(393, 3);
|
||||
this.grpBreakpoints.Name = "grpBreakpoints";
|
||||
this.grpBreakpoints.Size = new System.Drawing.Size(384, 122);
|
||||
this.grpBreakpoints.Size = new System.Drawing.Size(384, 125);
|
||||
this.grpBreakpoints.TabIndex = 3;
|
||||
this.grpBreakpoints.TabStop = false;
|
||||
this.grpBreakpoints.Text = "Breakpoints";
|
||||
|
@ -402,7 +402,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlBreakpoints.Name = "ctrlBreakpoints";
|
||||
this.ctrlBreakpoints.Size = new System.Drawing.Size(378, 103);
|
||||
this.ctrlBreakpoints.Size = new System.Drawing.Size(378, 106);
|
||||
this.ctrlBreakpoints.TabIndex = 0;
|
||||
this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation);
|
||||
//
|
||||
|
@ -412,7 +412,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.grpCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.grpCallstack.Location = new System.Drawing.Point(783, 3);
|
||||
this.grpCallstack.Name = "grpCallstack";
|
||||
this.grpCallstack.Size = new System.Drawing.Size(386, 122);
|
||||
this.grpCallstack.Size = new System.Drawing.Size(386, 125);
|
||||
this.grpCallstack.TabIndex = 4;
|
||||
this.grpCallstack.TabStop = false;
|
||||
this.grpCallstack.Text = "Call Stack";
|
||||
|
@ -422,7 +422,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlCallstack.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlCallstack.Name = "ctrlCallstack";
|
||||
this.ctrlCallstack.Size = new System.Drawing.Size(380, 103);
|
||||
this.ctrlCallstack.Size = new System.Drawing.Size(380, 106);
|
||||
this.ctrlCallstack.TabIndex = 0;
|
||||
this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected);
|
||||
//
|
||||
|
@ -463,6 +463,13 @@ namespace Mesen.GUI.Debugger
|
|||
this.mnuSaveRom.Text = "Save ROM as...";
|
||||
this.mnuSaveRom.Click += new System.EventHandler(this.mnuSaveRom_Click);
|
||||
//
|
||||
// mnuSaveAsIps
|
||||
//
|
||||
this.mnuSaveAsIps.Name = "mnuSaveAsIps";
|
||||
this.mnuSaveAsIps.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuSaveAsIps.Text = "Save edits as IPS";
|
||||
this.mnuSaveAsIps.Click += new System.EventHandler(this.mnuSaveAsIps_Click);
|
||||
//
|
||||
// mnuEditHeader
|
||||
//
|
||||
this.mnuEditHeader.Image = global::Mesen.GUI.Properties.Resources.Edit;
|
||||
|
@ -494,7 +501,7 @@ namespace Mesen.GUI.Debugger
|
|||
//
|
||||
this.mnuImportLabels.Image = global::Mesen.GUI.Properties.Resources.Import;
|
||||
this.mnuImportLabels.Name = "mnuImportLabels";
|
||||
this.mnuImportLabels.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuImportLabels.Size = new System.Drawing.Size(207, 22);
|
||||
this.mnuImportLabels.Text = "Import Labels";
|
||||
this.mnuImportLabels.Click += new System.EventHandler(this.mnuImportLabels_Click);
|
||||
//
|
||||
|
@ -502,41 +509,41 @@ namespace Mesen.GUI.Debugger
|
|||
//
|
||||
this.mnuExportLabels.Image = global::Mesen.GUI.Properties.Resources.Export;
|
||||
this.mnuExportLabels.Name = "mnuExportLabels";
|
||||
this.mnuExportLabels.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuExportLabels.Size = new System.Drawing.Size(207, 22);
|
||||
this.mnuExportLabels.Text = "Export Labels";
|
||||
this.mnuExportLabels.Click += new System.EventHandler(this.mnuExportLabels_Click);
|
||||
//
|
||||
// toolStripMenuItem16
|
||||
//
|
||||
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
|
||||
this.toolStripMenuItem16.Size = new System.Drawing.Size(182, 6);
|
||||
this.toolStripMenuItem16.Size = new System.Drawing.Size(204, 6);
|
||||
//
|
||||
// mnuResetWorkspace
|
||||
//
|
||||
this.mnuResetWorkspace.Image = global::Mesen.GUI.Properties.Resources.Reset;
|
||||
this.mnuResetWorkspace.Name = "mnuResetWorkspace";
|
||||
this.mnuResetWorkspace.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuResetWorkspace.Size = new System.Drawing.Size(207, 22);
|
||||
this.mnuResetWorkspace.Text = "Reset Workspace";
|
||||
this.mnuResetWorkspace.Click += new System.EventHandler(this.mnuResetWorkspace_Click);
|
||||
//
|
||||
// toolStripMenuItem10
|
||||
//
|
||||
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(182, 6);
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(204, 6);
|
||||
//
|
||||
// mnuAutoLoadDbgFiles
|
||||
//
|
||||
this.mnuAutoLoadDbgFiles.CheckOnClick = true;
|
||||
this.mnuAutoLoadDbgFiles.Name = "mnuAutoLoadDbgFiles";
|
||||
this.mnuAutoLoadDbgFiles.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuAutoLoadDbgFiles.Text = "Auto-load DBG files";
|
||||
this.mnuAutoLoadDbgFiles.Size = new System.Drawing.Size(207, 22);
|
||||
this.mnuAutoLoadDbgFiles.Text = "Auto-load DBG/MLB files";
|
||||
this.mnuAutoLoadDbgFiles.Click += new System.EventHandler(this.mnuAutoLoadDbgFiles_Click);
|
||||
//
|
||||
// mnuDisableDefaultLabels
|
||||
//
|
||||
this.mnuDisableDefaultLabels.CheckOnClick = true;
|
||||
this.mnuDisableDefaultLabels.Name = "mnuDisableDefaultLabels";
|
||||
this.mnuDisableDefaultLabels.Size = new System.Drawing.Size(185, 22);
|
||||
this.mnuDisableDefaultLabels.Size = new System.Drawing.Size(207, 22);
|
||||
this.mnuDisableDefaultLabels.Text = "Disable default labels";
|
||||
this.mnuDisableDefaultLabels.Click += new System.EventHandler(this.mnuDisableDefaultLabels_Click);
|
||||
//
|
||||
|
@ -1279,13 +1286,6 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlCpuMemoryMapping.Text = "ctrlMemoryMapping1";
|
||||
this.ctrlCpuMemoryMapping.Visible = false;
|
||||
//
|
||||
// mnuSaveAsIps
|
||||
//
|
||||
this.mnuSaveAsIps.Name = "mnuSaveAsIps";
|
||||
this.mnuSaveAsIps.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuSaveAsIps.Text = "Save edits as IPS";
|
||||
this.mnuSaveAsIps.Click += new System.EventHandler(this.mnuSaveAsIps_Click);
|
||||
//
|
||||
// frmDebugger
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
|
@ -149,10 +149,16 @@ namespace Mesen.GUI.Debugger
|
|||
private void AutoLoadDbgFile(bool silent)
|
||||
{
|
||||
if(ConfigManager.Config.DebugInfo.AutoLoadDbgFiles) {
|
||||
string dbgPath = Path.Combine(ConfigManager.Config.RecentFiles[0].RomFile.Folder, Path.GetFileNameWithoutExtension(ConfigManager.Config.RecentFiles[0].RomFile.FileName) + ".dbg");
|
||||
RomInfo info = InteropEmu.GetRomInfo();
|
||||
string dbgPath = Path.Combine(info.RomFile.Folder, info.GetRomName() + ".dbg");
|
||||
if(File.Exists(dbgPath)) {
|
||||
Ld65DbgImporter dbgImporter = new Ld65DbgImporter();
|
||||
dbgImporter.Import(dbgPath, silent);
|
||||
} else {
|
||||
string mlbPath = Path.Combine(info.RomFile.Folder, info.GetRomName() + ".mlb");
|
||||
if(File.Exists(mlbPath)) {
|
||||
MesenLabelFile.Import(mlbPath, silent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace Mesen.GUI.Forms.Cheats
|
|||
RomInfo romInfo = InteropEmu.GetRomInfo(resource);
|
||||
_gameCrc = romInfo.GetPrgCrcString();
|
||||
if(_gameCrc != null) {
|
||||
((CheatInfo)Entity).GameName = Path.GetFileNameWithoutExtension(romInfo.RomName);
|
||||
((CheatInfo)Entity).GameName = romInfo.GetRomName();
|
||||
txtGameName.Text = ((CheatInfo)Entity).GameName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Mesen.GUI.Forms.Cheats
|
|||
UpdateList();
|
||||
|
||||
RomInfo info = InteropEmu.GetRomInfo();
|
||||
if(!string.IsNullOrWhiteSpace(info.RomName)) {
|
||||
if(!string.IsNullOrWhiteSpace(info.GetRomName())) {
|
||||
string loadedGameCrc = info.GetPrgCrcString();
|
||||
for(int i = 0, len = lstGames.Items.Count; i < len; i++) {
|
||||
if(((GameInfo)lstGames.Items[i]).Crc == loadedGameCrc) {
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace Mesen.GUI.Forms.Cheats
|
|||
{
|
||||
RomInfo romInfo = InteropEmu.GetRomInfo();
|
||||
Dictionary<string, string> nameByCrc = new Dictionary<string, string>();
|
||||
if(!string.IsNullOrWhiteSpace(romInfo.RomName)) {
|
||||
if(!string.IsNullOrWhiteSpace(romInfo.GetRomName())) {
|
||||
nameByCrc[romInfo.GetPrgCrcString()] = romInfo.GetRomName();
|
||||
}
|
||||
foreach(CheatInfo cheat in _cheats) {
|
||||
|
@ -88,7 +88,7 @@ namespace Mesen.GUI.Forms.Cheats
|
|||
|
||||
if(lstGameList.Items.Count > 0) {
|
||||
if(gameCrc == null) {
|
||||
if(_selectedItem == null && !string.IsNullOrWhiteSpace(romInfo.RomName)) {
|
||||
if(_selectedItem == null && !string.IsNullOrWhiteSpace(romInfo.GetRomName())) {
|
||||
gameCrc = romInfo.GetPrgCrcString();
|
||||
} else {
|
||||
gameCrc = _selectedItem?.Crc;
|
||||
|
|
|
@ -1136,7 +1136,7 @@ namespace Mesen.GUI
|
|||
|
||||
public class RomInfo
|
||||
{
|
||||
public string RomName;
|
||||
public ResourcePath RomFile;
|
||||
public UInt32 Crc32;
|
||||
public UInt32 PrgCrc32;
|
||||
public RomFormat Format;
|
||||
|
@ -1144,7 +1144,7 @@ namespace Mesen.GUI
|
|||
|
||||
public RomInfo(InteropRomInfo romInfo)
|
||||
{
|
||||
this.RomName = UTF8Marshaler.GetStringFromIntPtr(romInfo.RomNamePointer);
|
||||
this.RomFile = (ResourcePath)UTF8Marshaler.GetStringFromIntPtr(romInfo.RomNamePointer);
|
||||
this.Crc32 = romInfo.Crc32;
|
||||
this.PrgCrc32 = romInfo.PrgCrc32;
|
||||
this.Format = romInfo.Format;
|
||||
|
@ -1153,7 +1153,7 @@ namespace Mesen.GUI
|
|||
|
||||
public string GetRomName()
|
||||
{
|
||||
return Path.GetFileNameWithoutExtension(this.RomName);
|
||||
return Path.GetFileNameWithoutExtension(this.RomFile.FileName);
|
||||
}
|
||||
|
||||
public string GetCrcString()
|
||||
|
|
|
@ -188,7 +188,7 @@ namespace InteropEmu {
|
|||
{
|
||||
string romPath = filename;
|
||||
if(romPath.empty()) {
|
||||
_returnString = Console::GetRomName();
|
||||
_returnString = Console::GetRomPath();
|
||||
romInfo.RomName = _returnString.c_str();
|
||||
romInfo.Crc32 = Console::GetHashInfo().Crc32Hash;
|
||||
romInfo.PrgCrc32 = Console::GetHashInfo().PrgCrc32Hash;
|
||||
|
@ -199,7 +199,7 @@ namespace InteropEmu {
|
|||
if(romLoader.LoadFile(romPath)) {
|
||||
RomData romData = romLoader.GetRomData();
|
||||
|
||||
_returnString = romData.RomName;
|
||||
_returnString = romPath;
|
||||
romInfo.RomName = _returnString.c_str();
|
||||
romInfo.Crc32 = romData.Crc32;
|
||||
romInfo.PrgCrc32 = romData.PrgCrc32;
|
||||
|
|
Loading…
Add table
Reference in a new issue