diff --git a/UI/Debugger/StatusViews/BaseConsoleStatusViewModel.cs b/UI/Debugger/StatusViews/BaseConsoleStatusViewModel.cs index 7eb3ca1d..2e0e0276 100644 --- a/UI/Debugger/StatusViews/BaseConsoleStatusViewModel.cs +++ b/UI/Debugger/StatusViews/BaseConsoleStatusViewModel.cs @@ -14,6 +14,9 @@ public abstract class BaseConsoleStatusViewModel : ViewModelBase private bool _isUpdatingUi = false; private bool _needUpdate = false; + private UInt64 _lastBreakCycleCount = 0; + private bool _isRunning = false; + public BaseConsoleStatusViewModel() { PropertyChanged += BaseConsoleStatusViewModel_PropertyChanged; @@ -34,19 +37,29 @@ private void BaseConsoleStatusViewModel_PropertyChanged(object? sender, Property public void UpdateCycleCount(UInt64 newCycleCount) { - if(newCycleCount > CycleCount) { - ElapsedCycles = newCycleCount - CycleCount; + CycleCount = newCycleCount; + + if(_isRunning) { + //Don't reset elapsed value if refresh done because "refresh while running" is enabled + return; + } + + if(newCycleCount > _lastBreakCycleCount) { + ElapsedCycles = newCycleCount - _lastBreakCycleCount; } else { ElapsedCycles = 0; } - CycleCount = newCycleCount; + + _lastBreakCycleCount = newCycleCount; } - public void UpdateUiState() + public void UpdateUiState(bool isRunning = false) { _isUpdatingUi = true; _needUpdate = false; + _isRunning = isRunning; InternalUpdateUiState(); + _isRunning = false; _isUpdatingUi = false; _needUpdate = false; } diff --git a/UI/Debugger/ViewModels/DebuggerWindowViewModel.cs b/UI/Debugger/ViewModels/DebuggerWindowViewModel.cs index a9f5105a..033252ee 100644 --- a/UI/Debugger/ViewModels/DebuggerWindowViewModel.cs +++ b/UI/Debugger/ViewModels/DebuggerWindowViewModel.cs @@ -286,7 +286,7 @@ public void UpdateDebugger(bool forBreak = false, BreakEvent? evt = null) public void PartialRefresh(bool refreshWatch) { - ConsoleStatus?.UpdateUiState(); + ConsoleStatus?.UpdateUiState(true); MemoryMappings?.Refresh(); if(refreshWatch) { WatchList.UpdateWatch();