mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
Debugger: Fixed new breakpoints always being associated to the SNES CPU (+ filtered dropdown)
This commit is contained in:
parent
c63c99f82b
commit
997dbb00c9
6 changed files with 21 additions and 8 deletions
|
@ -310,6 +310,8 @@ bool DisassemblyInfo::IsJump()
|
|||
opCode == 0xF0 //BEQ
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DisassemblyInfo::UpdateCpuFlags(uint8_t& cpuFlags)
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace Mesen.Debugger.ViewModels
|
|||
[ObservableAsProperty] public bool IsConditionValid { get; }
|
||||
[ObservableAsProperty] public bool OkEnabled { get; }
|
||||
[ObservableAsProperty] public string MaxAddress { get; } = "";
|
||||
|
||||
public Enum[] AvailableMemoryTypes { get; private set; } = Array.Empty<Enum>();
|
||||
|
||||
//For designer
|
||||
public BreakpointEditViewModel() : this(null!) { }
|
||||
|
@ -30,6 +32,8 @@ namespace Mesen.Debugger.ViewModels
|
|||
{
|
||||
Breakpoint = bp;
|
||||
|
||||
AvailableMemoryTypes = Enum.GetValues<SnesMemoryType>().Where(t => DebugApi.GetMemorySize(t) > 0).Cast<Enum>().ToArray();
|
||||
|
||||
this.WhenAnyValue(x => x.Breakpoint.StartAddress)
|
||||
.Buffer(2, 1)
|
||||
.Select(b => (Previous: b[0], Current: b[1]))
|
||||
|
|
|
@ -5,18 +5,24 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Reactive.Linq;
|
||||
using System.Linq;
|
||||
using Mesen.Interop;
|
||||
|
||||
namespace Mesen.Debugger.ViewModels
|
||||
{
|
||||
public class BreakpointListViewModel : Tool
|
||||
{
|
||||
[Reactive] public List<Breakpoint> Breakpoints { get; private set; } = new List<Breakpoint>();
|
||||
public CpuType CpuType { get; }
|
||||
|
||||
public BreakpointListViewModel()
|
||||
[Obsolete("For designer only")]
|
||||
public BreakpointListViewModel() : this(CpuType.Cpu) { }
|
||||
|
||||
public BreakpointListViewModel(CpuType cpuType)
|
||||
{
|
||||
Id = "BreakpointList";
|
||||
Title = "Breakpoints";
|
||||
CanPin = false;
|
||||
CpuType = cpuType;
|
||||
BreakpointManager.BreakpointsChanged += BreakpointManager_BreakpointsChanged;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,12 +45,9 @@ namespace Mesen.Debugger.ViewModels
|
|||
public DebuggerWindowViewModel(CpuType? cpuType = null)
|
||||
{
|
||||
Config = ConfigManager.Config.Debug.Debugger;
|
||||
|
||||
Options = new DebuggerOptionsViewModel(Config, CpuType);
|
||||
|
||||
Disassembly = new DisassemblyViewModel(ConfigManager.Config.Debug);
|
||||
BreakpointList = new BreakpointListViewModel();
|
||||
|
||||
Options = new DebuggerOptionsViewModel(Config, CpuType);
|
||||
Disassembly = new DisassemblyViewModel(ConfigManager.Config.Debug);
|
||||
DockFactory = new DebuggerDockFactory(this);
|
||||
|
||||
if(Design.IsDesignMode) {
|
||||
|
@ -78,6 +75,7 @@ namespace Mesen.Debugger.ViewModels
|
|||
}
|
||||
|
||||
DefaultLabelHelper.SetDefaultLabels();
|
||||
BreakpointList = new BreakpointListViewModel(CpuType);
|
||||
LabelList = new LabelListViewModel(CpuType);
|
||||
CallStack = new CallStackViewModel(CpuType);
|
||||
WatchList = new WatchListViewModel(CpuType);
|
||||
|
|
|
@ -40,8 +40,10 @@ namespace Mesen.Debugger.Views
|
|||
ActionType = ActionType.Add,
|
||||
Shortcut = () => ConfigManager.Config.Debug.Shortcuts.Get(DebuggerShortcut.BreakpointList_Add),
|
||||
OnClick = () => {
|
||||
Breakpoint bp = new Breakpoint() { BreakOnRead = true, BreakOnWrite = true, BreakOnExec = true };
|
||||
BreakpointEditWindow.EditBreakpoint(bp, this);
|
||||
if(DataContext is BreakpointListViewModel model) {
|
||||
Breakpoint bp = new Breakpoint() { BreakOnRead = true, BreakOnWrite = true, BreakOnExec = true, CpuType = model.CpuType };
|
||||
BreakpointEditWindow.EditBreakpoint(bp, this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
<StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="0">
|
||||
<c:EnumComboBox
|
||||
SelectedItem="{CompiledBinding Breakpoint.MemoryType}"
|
||||
AvailableValues="{CompiledBinding AvailableMemoryTypes}"
|
||||
Width="150"
|
||||
/>
|
||||
<TextBlock Margin="3 0 0 0" Text="{CompiledBinding MaxAddress}" Foreground="Gray" />
|
||||
|
|
Loading…
Add table
Reference in a new issue