mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
Debugger: Event Viewer - Added event color in list
This commit is contained in:
parent
a2d5593b9e
commit
66cc6d005c
6 changed files with 41 additions and 15 deletions
|
@ -64,6 +64,9 @@ void BaseEventManager::GetEvents(DebugEventInfo* eventArray, uint32_t& maxEventC
|
|||
auto lock = _lock.AcquireSafe();
|
||||
uint32_t eventCount = std::min(maxEventCount, (uint32_t)_sentEvents.size());
|
||||
memcpy(eventArray, _sentEvents.data(), eventCount * sizeof(DebugEventInfo));
|
||||
for(uint32_t i = 0; i < eventCount; i++) {
|
||||
eventArray[i].Color = GetEventConfig(eventArray[i]).Color;
|
||||
}
|
||||
maxEventCount = eventCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ struct DebugEventInfo
|
|||
uint32_t Flags;
|
||||
int32_t RegisterId = -1;
|
||||
MemoryOperationInfo TargetMemory;
|
||||
uint32_t Color = 0;
|
||||
};
|
||||
|
||||
struct EventViewerCategoryCfg
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace Mesen.Debugger.ViewModels
|
|||
}
|
||||
|
||||
private Dictionary<string, Func<DebugEventInfo, DebugEventInfo, int>> _comparers = new() {
|
||||
{ "Color", (a, b) => a.Color.CompareTo(b.Color) },
|
||||
{ "ProgramCounter", (a, b) => a.ProgramCounter.CompareTo(b.ProgramCounter) },
|
||||
{ "Scanline", (a, b) => a.Scanline.CompareTo(b.Scanline) },
|
||||
{ "Cycle", (a, b) => a.Cycle.CompareTo(b.Cycle) },
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace Mesen.Debugger.ViewModels
|
|||
new ContextMenuAction() {
|
||||
ActionType = ActionType.ViewInDebugger,
|
||||
IsEnabled = () => SelectedEvent != null,
|
||||
HintText = () => "PC - " + (SelectedEvent != null ? $"${SelectedEvent.Value.ProgramCounter:X4}" : ""),
|
||||
HintText = () => SelectedEvent != null ? $"PC -${SelectedEvent.Value.ProgramCounter:X4}" : "",
|
||||
OnClick = () => {
|
||||
if(SelectedEvent != null) {
|
||||
DebuggerWindow.OpenWindowAtAddress(CpuType, (int)SelectedEvent.Value.ProgramCounter);
|
||||
|
@ -184,7 +184,7 @@ namespace Mesen.Debugger.ViewModels
|
|||
new ContextMenuAction() {
|
||||
ActionType = ActionType.ToggleBreakpoint,
|
||||
IsEnabled = () => SelectedEvent != null,
|
||||
HintText = () => "PC - " + (SelectedEvent != null ? $"${SelectedEvent.Value.ProgramCounter:X4}" : ""),
|
||||
HintText = () => SelectedEvent != null ? $"PC - ${SelectedEvent.Value.ProgramCounter:X4}" : "",
|
||||
OnClick = () => {
|
||||
if(SelectedEvent != null) {
|
||||
int addr = (int)SelectedEvent.Value.Operation.Address;
|
||||
|
@ -195,7 +195,7 @@ namespace Mesen.Debugger.ViewModels
|
|||
new ContextMenuAction() {
|
||||
ActionType = ActionType.ToggleBreakpoint,
|
||||
IsEnabled = () => SelectedEvent != null && SelectedEvent?.Type == DebugEventType.Register,
|
||||
HintText = () => "Address - " + (SelectedEvent != null && SelectedEvent?.Type == DebugEventType.Register ? $"${SelectedEvent.Value.Operation.Address:X4}" : ""),
|
||||
HintText = () => (SelectedEvent != null && SelectedEvent?.Type == DebugEventType.Register ? $"Address - ${SelectedEvent.Value.Operation.Address:X4}" : ""),
|
||||
OnClick = () => {
|
||||
if(SelectedEvent != null && SelectedEvent?.Type == DebugEventType.Register) {
|
||||
int addr = (int)SelectedEvent.Value.Operation.Address;
|
||||
|
@ -458,16 +458,7 @@ namespace Mesen.Debugger.ViewModels
|
|||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
private string _programCounter = "";
|
||||
public string ProgramCounter
|
||||
{
|
||||
get
|
||||
{
|
||||
UpdateFields();
|
||||
return _programCounter;
|
||||
}
|
||||
}
|
||||
|
||||
public string ProgramCounter { get; set; } = "";
|
||||
public string Scanline { get; set; } = "";
|
||||
public string Cycle { get; set; } = "";
|
||||
public string Type { get; set; } = "";
|
||||
|
@ -475,6 +466,16 @@ namespace Mesen.Debugger.ViewModels
|
|||
public string Value { get; set; } = "";
|
||||
public string Details { get; set; } = "";
|
||||
|
||||
private UInt32 _color = 0;
|
||||
public UInt32 Color
|
||||
{
|
||||
get
|
||||
{
|
||||
UpdateFields();
|
||||
return _color;
|
||||
}
|
||||
}
|
||||
|
||||
public DebugEventInfo RawEvent => _events[_index];
|
||||
|
||||
public DebugEventViewModel(DebugEventInfo[] events, int index)
|
||||
|
@ -494,12 +495,14 @@ namespace Mesen.Debugger.ViewModels
|
|||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Address"));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Value"));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Details"));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Color"));
|
||||
}
|
||||
|
||||
private void UpdateFields()
|
||||
{
|
||||
DebugEventInfo evt = _events[_index];
|
||||
_programCounter = "$" + evt.ProgramCounter.ToString("X4");
|
||||
_color = evt.Color;
|
||||
ProgramCounter = "$" + evt.ProgramCounter.ToString("X4");
|
||||
Scanline = evt.Scanline.ToString();
|
||||
Cycle = evt.Cycle.ToString();
|
||||
string address = "";
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
xmlns:c="using:Mesen.Controls"
|
||||
xmlns:dc="using:Mesen.Debugger.Controls"
|
||||
xmlns:du="using:Mesen.Debugger.Utilities"
|
||||
xmlns:u="using:Mesen.Utilities"
|
||||
xmlns:v="using:Mesen.Debugger.Views"
|
||||
xmlns:i="using:Mesen.Interop"
|
||||
xmlns:l="using:Mesen.Localization"
|
||||
|
@ -27,6 +28,7 @@
|
|||
|
||||
<Window.Resources>
|
||||
<du:GridLengthConverter x:Key="GridLengthConverter" />
|
||||
<u:ArgbColorToBrushConverter x:Key="ArgbColorToBrushConverter"/>
|
||||
</Window.Resources>
|
||||
|
||||
<Window.DataTemplates>
|
||||
|
@ -122,9 +124,24 @@
|
|||
</DataBox.Styles>
|
||||
|
||||
<DataBox.Columns>
|
||||
<DataBoxTextColumn Header="{l:Translate colPc}" ColumnName="ProgramCounter" InitialWidth="62" Binding="{Binding ProgramCounter}" />
|
||||
<DataBoxTemplateColumn
|
||||
Header=""
|
||||
ColumnName="Color"
|
||||
InitialWidth="16"
|
||||
>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
BorderBrush="{DynamicResource MesenBlackBorderColor}"
|
||||
BorderThickness="1"
|
||||
Background="{Binding Color, Converter={StaticResource ArgbColorToBrushConverter}}"
|
||||
Width="12"
|
||||
Height="12"
|
||||
/>
|
||||
</DataTemplate>
|
||||
</DataBoxTemplateColumn>
|
||||
<DataBoxTextColumn Header="{l:Translate colScanline}" ColumnName="Scanline" InitialWidth="88" Binding="{Binding Scanline}" />
|
||||
<DataBoxTextColumn Header="{l:Translate colCycle}" ColumnName="Cycle" InitialWidth="77" Binding="{Binding Cycle}" />
|
||||
<DataBoxTextColumn Header="{l:Translate colPc}" ColumnName="ProgramCounter" InitialWidth="62" Binding="{Binding ProgramCounter}" />
|
||||
<DataBoxTextColumn Header="{l:Translate colType}" ColumnName="Type" InitialWidth="77" Binding="{Binding Type}" />
|
||||
<DataBoxTextColumn Header="{l:Translate colAddress}" ColumnName="Address" InitialWidth="68" Binding="{Binding Address}" />
|
||||
<DataBoxTextColumn Header="{l:Translate colValue}" ColumnName="Value" InitialWidth="50" Binding="{Binding Value}" />
|
||||
|
|
|
@ -713,6 +713,7 @@ namespace Mesen.Interop
|
|||
public EventFlags Flags;
|
||||
public Int32 RegisterId;
|
||||
public MemoryOperationInfo TargetMemory;
|
||||
public UInt32 Color;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
|
Loading…
Add table
Reference in a new issue