Debugger: Minor event viewer fixes

This commit is contained in:
Sour 2019-03-07 20:28:48 -05:00
parent 9f5be3f97c
commit 8c39c03311
5 changed files with 11 additions and 5 deletions

View file

@ -190,7 +190,10 @@ void Debugger::ProcessEvent(EventType type)
switch(type) { switch(type) {
case EventType::Nmi: _eventManager->AddEvent(DebugEventType::Nmi); break; case EventType::Nmi: _eventManager->AddEvent(DebugEventType::Nmi); break;
case EventType::Irq: _eventManager->AddEvent(DebugEventType::Irq); break; case EventType::Irq: _eventManager->AddEvent(DebugEventType::Irq); break;
case EventType::StartFrame: _eventManager->ClearFrameEvents(); break; case EventType::StartFrame:
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::EventViewerRefresh);
_eventManager->ClearFrameEvents();
break;
} }
} }

View file

@ -141,7 +141,7 @@ void EventManager::TakeEventSnapshot(EventViewerDisplayOptions options)
_snapshot = _debugEvents; _snapshot = _debugEvents;
_snapshotScanline = scanline; _snapshotScanline = scanline;
if(options.ShowPreviousFrameEvents) { if(options.ShowPreviousFrameEvents && scanline != 0) {
for(DebugEventInfo &evt : _prevDebugEvents) { for(DebugEventInfo &evt : _prevDebugEvents) {
uint32_t evtKey = (evt.Scanline << 9) + evt.Cycle; uint32_t evtKey = (evt.Scanline << 9) + evt.Cycle;
if(evtKey > key) { if(evtKey > key) {
@ -174,13 +174,14 @@ void EventManager::GetDisplayBuffer(uint32_t *buffer, EventViewerDisplayOptions
} }
constexpr uint32_t nmiColor = 0xFF55FFFF; constexpr uint32_t nmiColor = 0xFF55FFFF;
constexpr uint32_t currentScanlineColor = 0xFFFFFF55;
int nmiScanline = (overscanMode ? 240 : 225) * 2 * 340 * 2; int nmiScanline = (overscanMode ? 240 : 225) * 2 * 340 * 2;
uint32_t scanlineOffset = _snapshotScanline * 2 * 340 * 2; uint32_t scanlineOffset = _snapshotScanline * 2 * 340 * 2;
for(int i = 0; i < 340 * 2; i++) { for(int i = 0; i < 340 * 2; i++) {
buffer[nmiScanline + i] = nmiColor; buffer[nmiScanline + i] = nmiColor;
buffer[nmiScanline + 340 * 2 + i] = nmiColor; buffer[nmiScanline + 340 * 2 + i] = nmiColor;
buffer[scanlineOffset + i] = nmiColor; buffer[scanlineOffset + i] = currentScanlineColor;
buffer[scanlineOffset + 340 * 2 + i] = nmiColor; buffer[scanlineOffset + 340 * 2 + i] = currentScanlineColor;
} }
for(DebugEventInfo &evt : _snapshot) { for(DebugEventInfo &evt : _snapshot) {

View file

@ -17,6 +17,7 @@ enum class ConsoleNotificationType
EmulationStopped = 11, EmulationStopped = 11,
BeforeEmulationStop = 12, BeforeEmulationStop = 12,
ViewerRefresh = 13, ViewerRefresh = 13,
EventViewerRefresh = 14
}; };
class INotificationListener class INotificationListener

View file

@ -40,7 +40,7 @@ namespace Mesen.GUI.Debugger
{ {
switch(e.NotificationType) { switch(e.NotificationType) {
case ConsoleNotificationType.CodeBreak: case ConsoleNotificationType.CodeBreak:
case ConsoleNotificationType.PpuFrameDone: case ConsoleNotificationType.EventViewerRefresh:
ctrlPpuView.RefreshData(); ctrlPpuView.RefreshData();
this.BeginInvoke((Action)(() => { this.BeginInvoke((Action)(() => {
ctrlPpuView.RefreshViewer(); ctrlPpuView.RefreshViewer();

View file

@ -61,5 +61,6 @@ namespace Mesen.GUI
EmulationStopped = 11, EmulationStopped = 11,
BeforeEmulationStop = 12, BeforeEmulationStop = 12,
ViewerRefresh = 13, ViewerRefresh = 13,
EventViewerRefresh = 14,
} }
} }