Debugger: Event Viewer - Fixed rare crash when opening window (esp. on Linux)

This commit is contained in:
Sour 2020-01-24 22:37:34 -05:00
parent ffe2c480cb
commit d44da4f9b6
4 changed files with 13 additions and 12 deletions

View file

@ -23,11 +23,11 @@ private:
vector<DebugEventInfo> _sentEvents;
vector<DebugEventInfo> _snapshot;
uint16_t _snapshotScanline;
uint16_t _snapshotScanline = 0;
SimpleLock _lock;
uint32_t _scanlineCount = 262;
uint16_t *_ppuBuffer;
uint16_t *_ppuBuffer = nullptr;
void DrawEvent(DebugEventInfo &evt, bool drawBackground, uint32_t *buffer, EventViewerDisplayOptions &options);
void DrawNtscBorders(uint32_t *buffer);

View file

@ -26,7 +26,7 @@ namespace Mesen.GUI.Debugger.Controls
private Bitmap _screenBitmap = null;
private Bitmap _overlayBitmap = null;
private Bitmap _displayBitmap = null;
private byte[] _pictureData = null;
private UInt32[] _pictureData = null;
private Font _overlayFont;
public ctrlEventViewerPpuView()

View file

@ -85,12 +85,6 @@ namespace Mesen.GUI.Debugger
RestoreLocation(_config.EventViewerLocation, _config.EventViewerSize);
this._notifListener = new InteropEmu.NotificationListener(_config.DebugConsoleId);
this._notifListener.OnNotification += this._notifListener_OnNotification;
_refreshManager = new WindowRefreshManager(this);
_refreshManager.AutoRefresh = _config.EventViewerAutoRefresh;
_refreshManager.AutoRefreshSpeed = _config.EventViewerAutoRefreshSpeed;
mnuAutoRefresh.Checked = _config.EventViewerAutoRefresh;
mnuAutoRefreshLow.Click += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.Low;
mnuAutoRefreshNormal.Click += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.Normal;
@ -101,6 +95,13 @@ namespace Mesen.GUI.Debugger
_binder.UpdateUI();
this.RefreshViewer();
_refreshManager = new WindowRefreshManager(this);
_refreshManager.AutoRefresh = _config.EventViewerAutoRefresh;
_refreshManager.AutoRefreshSpeed = _config.EventViewerAutoRefreshSpeed;
this._notifListener = new InteropEmu.NotificationListener(_config.DebugConsoleId);
this._notifListener.OnNotification += this._notifListener_OnNotification;
InitShortcuts();
}
}

View file

@ -511,10 +511,10 @@ namespace Mesen.GUI
[DllImport(DLLPath)] public static extern void GetEventViewerEvent(ref DebugEventInfo evtInfo, Int16 scanline, UInt16 cycle, EventViewerDisplayOptions options);
[DllImport(DLLPath)] public static extern UInt32 TakeEventSnapshot(EventViewerDisplayOptions options);
[DllImport(DLLPath, EntryPoint = "GetEventViewerOutput")] private static extern void GetEventViewerOutputWrapper([In, Out]byte[] buffer, EventViewerDisplayOptions options);
public static byte[] GetEventViewerOutput(UInt32 scanlineCount, EventViewerDisplayOptions options)
[DllImport(DLLPath, EntryPoint = "GetEventViewerOutput")] private static extern void GetEventViewerOutputWrapper([In, Out]UInt32[] buffer, EventViewerDisplayOptions options);
public static UInt32[] GetEventViewerOutput(UInt32 scanlineCount, EventViewerDisplayOptions options)
{
byte[] buffer = new byte[341 * 2 * scanlineCount * 2 * 4];
UInt32[] buffer = new UInt32[341 * 2 * scanlineCount * 2];
InteropEmu.GetEventViewerOutputWrapper(buffer, options);
return buffer;
}