Debugger: Fixed "refresh on pause/break" logic when debugger window is not opened

This commit is contained in:
Sour 2018-03-15 20:24:08 -04:00
parent ed2cef21c0
commit 22300854f5
2 changed files with 39 additions and 20 deletions

View File

@ -63,16 +63,23 @@ namespace Mesen.GUI.Debugger
private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
{
if(e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak && ConfigManager.Config.DebugInfo.EventViewerRefreshOnBreak) {
this.GetData();
this.BeginInvoke((MethodInvoker)(() => this.RefreshViewer()));
} else if(e.NotificationType == InteropEmu.ConsoleNotificationType.EventViewerDisplayFrame) {
if(!_refreshing && (DateTime.Now - _lastUpdate).Milliseconds >= 32) {
//Update at ~30 fps at most
this.GetData();
this.BeginInvoke((MethodInvoker)(() => this.RefreshViewer()));
_lastUpdate = DateTime.Now;
}
switch(e.NotificationType) {
case InteropEmu.ConsoleNotificationType.CodeBreak:
case InteropEmu.ConsoleNotificationType.GamePaused:
if(ConfigManager.Config.DebugInfo.EventViewerRefreshOnBreak) {
this.GetData();
this.BeginInvoke((MethodInvoker)(() => this.RefreshViewer()));
}
break;
case InteropEmu.ConsoleNotificationType.EventViewerDisplayFrame:
if(!_refreshing && (DateTime.Now - _lastUpdate).Milliseconds >= 32) {
//Update at ~30 fps at most
this.GetData();
this.BeginInvoke((MethodInvoker)(() => this.RefreshViewer()));
_lastUpdate = DateTime.Now;
}
break;
}
}

View File

@ -71,16 +71,28 @@ namespace Mesen.GUI.Debugger
private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
{
if(e.NotificationType == InteropEmu.ConsoleNotificationType.CodeBreak && ConfigManager.Config.DebugInfo.PpuRefreshOnBreak) {
this.GetData();
this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
} else if(e.NotificationType == InteropEmu.ConsoleNotificationType.PpuViewerDisplayFrame) {
if(ConfigManager.Config.DebugInfo.PpuAutoRefresh && !_refreshing && (DateTime.Now - _lastUpdate).Milliseconds > 66) {
//Update at 15 fps most
this.GetData();
this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
_lastUpdate = DateTime.Now;
}
switch(e.NotificationType) {
case InteropEmu.ConsoleNotificationType.CodeBreak:
case InteropEmu.ConsoleNotificationType.GamePaused:
if(ConfigManager.Config.DebugInfo.PpuRefreshOnBreak) {
this.GetData();
this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
}
break;
case InteropEmu.ConsoleNotificationType.PpuViewerDisplayFrame:
if(ConfigManager.Config.DebugInfo.PpuAutoRefresh && !_refreshing && (DateTime.Now - _lastUpdate).Milliseconds > 66) {
//Update at 15 fps most
this.GetData();
this.BeginInvoke((MethodInvoker)(() => this.RefreshViewers()));
_lastUpdate = DateTime.Now;
}
break;
case InteropEmu.ConsoleNotificationType.GameLoaded:
//Configuration is lost when debugger is restarted (when switching game or power cycling)
InteropEmu.DebugSetPpuViewerScanlineCycle(ConfigManager.Config.DebugInfo.PpuDisplayScanline, ConfigManager.Config.DebugInfo.PpuDisplayCycle);
break;
}
}