From 44b7190ad406067901fd1b6c367b093778a24df0 Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 23 Feb 2020 13:00:39 -0500 Subject: [PATCH] Debugger: Disable break on bus conflicts option when the current board does not have bus conflicts --- Core/BaseMapper.cpp | 8 +++++++- GUI.NET/Debugger/frmDebugger.cs | 1 + GUI.NET/InteropEmu.cs | 5 +++++ InteropDLL/ConsoleWrapper.cpp | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Core/BaseMapper.cpp b/Core/BaseMapper.cpp index 9cc586a9..ed037e3a 100644 --- a/Core/BaseMapper.cpp +++ b/Core/BaseMapper.cpp @@ -581,6 +581,10 @@ void BaseMapper::Initialize(RomData &romData) case BusConflictType::No: _hasBusConflicts = false; break; } + if(_hasBusConflicts) { + MessageManager::Log("[iNes] Bus conflicts enabled"); + } + _saveRam = new uint8_t[_saveRamSize]; _workRam = new uint8_t[_workRamSize]; @@ -728,7 +732,9 @@ shared_ptr BaseMapper::GetMapperControlDevice() RomInfo BaseMapper::GetRomInfo() { - return _romInfo; + RomInfo romInfo = _romInfo; + romInfo.BusConflicts = _hasBusConflicts ? BusConflictType::Yes : BusConflictType::No; + return romInfo; } uint32_t BaseMapper::GetMapperDipSwitchCount() diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index 56c866af..3aec9950 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -1724,6 +1724,7 @@ namespace Mesen.GUI.Debugger private void mnuBreakOptions_DropDownOpening(object sender, EventArgs e) { this.mnuBreakOnDecayedOamRead.Enabled = ConfigManager.Config.EmulationInfo.EnableOamDecay; + this.mnuBreakOnBusConflict.Enabled = InteropEmu.GetRomInfo().HasBusConflicts; bool isNsf = InteropEmu.IsNsf(); mnuBreakOnInit.Visible = isNsf; diff --git a/GUI.NET/InteropEmu.cs b/GUI.NET/InteropEmu.cs index e23c6d4b..832f699c 100644 --- a/GUI.NET/InteropEmu.cs +++ b/GUI.NET/InteropEmu.cs @@ -1731,6 +1731,9 @@ namespace Mesen.GUI [MarshalAs(UnmanagedType.I1)] public bool IsChrRam; + [MarshalAs(UnmanagedType.I1)] + public bool HasBusConflicts; + public UInt16 MapperId; public UInt32 FilePrgOffset; @@ -1755,6 +1758,7 @@ namespace Mesen.GUI public UInt32 PrgCrc32; public RomFormat Format; public bool IsChrRam; + public bool HasBusConflicts; public UInt16 MapperId; public UInt32 FilePrgOffset; public string Sha1; @@ -1766,6 +1770,7 @@ namespace Mesen.GUI this.PrgCrc32 = romInfo.PrgCrc32; this.Format = romInfo.Format; this.IsChrRam = romInfo.IsChrRam; + this.HasBusConflicts = romInfo.HasBusConflicts; this.MapperId = romInfo.MapperId; this.FilePrgOffset = romInfo.FilePrgOffset; this.Sha1 = Encoding.UTF8.GetString(romInfo.Sha1); diff --git a/InteropDLL/ConsoleWrapper.cpp b/InteropDLL/ConsoleWrapper.cpp index 3a5ed78a..b415d5f5 100644 --- a/InteropDLL/ConsoleWrapper.cpp +++ b/InteropDLL/ConsoleWrapper.cpp @@ -111,6 +111,7 @@ namespace InteropEmu { uint32_t PrgCrc32; RomFormat Format; bool IsChrRam; + bool HasBusConflicts; uint16_t MapperId; uint32_t FilePrgOffset; char Sha1[40]; @@ -405,6 +406,7 @@ namespace InteropEmu { interopRomInfo.PrgCrc32 = romInfo.Hash.PrgCrc32; interopRomInfo.Format = romInfo.Format; interopRomInfo.IsChrRam = romInfo.HasChrRam; + interopRomInfo.HasBusConflicts = romInfo.BusConflicts == BusConflictType::Yes; interopRomInfo.MapperId = romInfo.MapperID; interopRomInfo.FilePrgOffset = romInfo.FilePrgOffset; if(romInfo.Hash.Sha1.size() == 40) {