Debugger: Added option to select which CPU to debug (VS DualSystem) (hidden from menu because issues exist)
This commit is contained in:
parent
0fefccb869
commit
7a62b2af80
17 changed files with 147 additions and 46 deletions
|
@ -49,10 +49,6 @@ Console::Console(shared_ptr<Console> master)
|
|||
{
|
||||
_master = master;
|
||||
_model = NesModel::NTSC;
|
||||
|
||||
if(_master) {
|
||||
_master->_notificationManager->SendNotification(ConsoleNotificationType::VsDualSystemStarted);
|
||||
}
|
||||
}
|
||||
|
||||
Console::~Console()
|
||||
|
@ -73,6 +69,10 @@ void Console::Init()
|
|||
|
||||
_soundMixer.reset(new SoundMixer(shared_from_this()));
|
||||
_soundMixer->SetNesModel(_model);
|
||||
|
||||
if(_master) {
|
||||
_emulationThreadId = _master->_emulationThreadId;
|
||||
}
|
||||
}
|
||||
|
||||
void Console::Release(bool forShutdown)
|
||||
|
@ -385,6 +385,10 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
|
|||
MessageManager::DisplayMessage("ClockRate", std::to_string(EmulationSettings::GetOverclockRate()) + "%");
|
||||
}
|
||||
EmulationSettings::ClearFlags(EmulationFlags::ForceMaxSpeed);
|
||||
|
||||
if(_slave) {
|
||||
_notificationManager->SendNotification(ConsoleNotificationType::VsDualSystemStarted);
|
||||
}
|
||||
}
|
||||
Resume();
|
||||
return true;
|
||||
|
@ -667,6 +671,9 @@ void Console::Run()
|
|||
_stopLock.Acquire();
|
||||
|
||||
_emulationThreadId = std::this_thread::get_id();
|
||||
if(_slave) {
|
||||
_slave->_emulationThreadId = std::this_thread::get_id();
|
||||
}
|
||||
|
||||
targetTime = GetFrameDelay();
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#include <atomic>
|
||||
#include "../Utilities/SimpleLock.h"
|
||||
#include "VirtualFile.h"
|
||||
#include "RomData.h"
|
||||
#include "Debugger.h"
|
||||
|
||||
class BaseMapper;
|
||||
class RewindManager;
|
||||
|
@ -26,8 +24,13 @@ class VideoRenderer;
|
|||
class DebugHud;
|
||||
class SoundMixer;
|
||||
class NotificationManager;
|
||||
class Debugger;
|
||||
|
||||
struct HdPackData;
|
||||
struct HashInfo;
|
||||
struct MapperInfo;
|
||||
|
||||
enum class MemoryOperationType;
|
||||
enum class NesModel;
|
||||
enum class ScaleFilterType;
|
||||
enum class ConsoleFeatures;
|
||||
|
|
|
@ -119,6 +119,8 @@ namespace Mesen.GUI.Config
|
|||
public DebugViewInfo LeftView;
|
||||
public DebugViewInfo RightView;
|
||||
|
||||
public InteropEmu.ConsoleId DebugConsoleId = InteropEmu.ConsoleId.Master;
|
||||
|
||||
public string FontFamily = BaseControl.MonospaceFontFamily;
|
||||
public FontStyle FontStyle = FontStyle.Regular;
|
||||
public float FontSize = BaseControl.DefaultFontSize;
|
||||
|
|
|
@ -77,6 +77,14 @@ namespace Mesen.GUI.Debugger
|
|||
return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmMemoryViewer)) as frmMemoryViewer;
|
||||
}
|
||||
|
||||
public static bool HasOpenedWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
return _openedWindows.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CloseAll()
|
||||
{
|
||||
List<Form> openedWindows = new List<Form>(_openedWindows);
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace Mesen.GUI.Debugger
|
|||
"[MyLabel, 4]: Display 4 bytes starting from the address the specified label (MyLabel) refers to"
|
||||
);
|
||||
|
||||
_notifListener = new InteropEmu.NotificationListener();
|
||||
_notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
|
||||
_notifListener.OnNotification += _notifListener_OnNotification;
|
||||
|
||||
InteropEmu.DebugInitialize();
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.Location = ConfigManager.Config.DebugInfo.EventViewerLocation;
|
||||
}
|
||||
|
||||
this._notifListener = new InteropEmu.NotificationListener();
|
||||
this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
|
||||
this._notifListener.OnNotification += this._notifListener_OnNotification;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Mesen.GUI.Debugger
|
|||
UpdateImportButton();
|
||||
InitMemoryTypeDropdown(true);
|
||||
|
||||
_notifListener = new InteropEmu.NotificationListener();
|
||||
_notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
|
||||
_notifListener.OnNotification += _notifListener_OnNotification;
|
||||
|
||||
this.mnuShowCharacters.CheckedChanged += this.mnuShowCharacters_CheckedChanged;
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace Mesen.GUI.Debugger
|
|||
base.OnLoad(e);
|
||||
|
||||
if(!this.DesignMode) {
|
||||
this._notifListener = new InteropEmu.NotificationListener();
|
||||
this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
|
||||
this._notifListener.OnNotification += this._notifListener_OnNotification;
|
||||
|
||||
this.ctrlScanlineCycle.Initialize(_ppuViewerId, ConfigManager.Config.DebugInfo.PpuDisplayScanline, ConfigManager.Config.DebugInfo.PpuDisplayCycle);
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace Mesen.GUI.Debugger
|
|||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
this._notifListener = new InteropEmu.NotificationListener();
|
||||
this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
|
||||
this._notifListener.OnNotification += this._notifListener_OnNotification;
|
||||
|
||||
this.InitShortcuts();
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace Mesen.GUI.Debugger
|
|||
this.ctrlTextHooker.SetCharacterMappings(_charMappings);
|
||||
this.ctrlCharacterMappings.SetCharacterMappings(_charMappings);
|
||||
|
||||
this._notifListener = new InteropEmu.NotificationListener();
|
||||
this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
|
||||
this._notifListener.OnNotification += this._notifListener_OnNotification;
|
||||
|
||||
this.ctrlTextHooker.GetData();
|
||||
|
|
62
GUI.NET/Forms/frmMain.Designer.cs
generated
62
GUI.NET/Forms/frmMain.Designer.cs
generated
|
@ -33,6 +33,7 @@ namespace Mesen.GUI.Forms
|
|||
this.components = new System.ComponentModel.Container();
|
||||
this.menuTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.panelRenderer = new System.Windows.Forms.Panel();
|
||||
this.ctrlRendererDualSystem = new Mesen.GUI.Controls.ctrlRenderer();
|
||||
this.ctrlLoading = new Mesen.GUI.Controls.ctrlLoadingRom();
|
||||
this.panelInfo = new System.Windows.Forms.Panel();
|
||||
this.picIcon = new System.Windows.Forms.PictureBox();
|
||||
|
@ -197,6 +198,8 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuScriptWindow = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuTextHooker = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuTraceLogger = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.sepDebugDualSystemSecondaryCpu = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuDebugDualSystemSecondaryCpu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem25 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuEditHeader = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -208,7 +211,6 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuReportBug = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ctrlRendererDualSystem = new Mesen.GUI.Controls.ctrlRenderer();
|
||||
this.panelRenderer.SuspendLayout();
|
||||
this.panelInfo.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit();
|
||||
|
@ -238,6 +240,16 @@ namespace Mesen.GUI.Forms
|
|||
this.panelRenderer.MouseLeave += new System.EventHandler(this.panelRenderer_MouseLeave);
|
||||
this.panelRenderer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrlRenderer_MouseMove);
|
||||
//
|
||||
// ctrlRendererDualSystem
|
||||
//
|
||||
this.ctrlRendererDualSystem.BackColor = System.Drawing.Color.Black;
|
||||
this.ctrlRendererDualSystem.Location = new System.Drawing.Point(275, 0);
|
||||
this.ctrlRendererDualSystem.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ctrlRendererDualSystem.Name = "ctrlRendererDualSystem";
|
||||
this.ctrlRendererDualSystem.Size = new System.Drawing.Size(150, 90);
|
||||
this.ctrlRendererDualSystem.TabIndex = 8;
|
||||
this.ctrlRendererDualSystem.Visible = false;
|
||||
//
|
||||
// ctrlLoading
|
||||
//
|
||||
this.ctrlLoading.BackColor = System.Drawing.Color.Black;
|
||||
|
@ -1498,6 +1510,8 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuScriptWindow,
|
||||
this.mnuTextHooker,
|
||||
this.mnuTraceLogger,
|
||||
this.sepDebugDualSystemSecondaryCpu,
|
||||
this.mnuDebugDualSystemSecondaryCpu,
|
||||
this.toolStripMenuItem25,
|
||||
this.mnuEditHeader});
|
||||
this.mnuDebug.Name = "mnuDebug";
|
||||
|
@ -1511,7 +1525,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuApuViewer.Image = global::Mesen.GUI.Properties.Resources.Audio;
|
||||
this.mnuApuViewer.Name = "mnuApuViewer";
|
||||
this.mnuApuViewer.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuApuViewer.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuApuViewer.Text = "APU Viewer";
|
||||
this.mnuApuViewer.Click += new System.EventHandler(this.mnuApuViewer_Click);
|
||||
//
|
||||
|
@ -1519,7 +1533,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuAssembler.Image = global::Mesen.GUI.Properties.Resources.Chip;
|
||||
this.mnuAssembler.Name = "mnuAssembler";
|
||||
this.mnuAssembler.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuAssembler.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuAssembler.Text = "Assembler";
|
||||
this.mnuAssembler.Click += new System.EventHandler(this.mnuAssembler_Click);
|
||||
//
|
||||
|
@ -1527,7 +1541,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuDebugDebugger.Image = global::Mesen.GUI.Properties.Resources.Bug;
|
||||
this.mnuDebugDebugger.Name = "mnuDebugDebugger";
|
||||
this.mnuDebugDebugger.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuDebugDebugger.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuDebugDebugger.Text = "Debugger";
|
||||
this.mnuDebugDebugger.Click += new System.EventHandler(this.mnuDebugDebugger_Click);
|
||||
//
|
||||
|
@ -1535,7 +1549,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuEventViewer.Image = global::Mesen.GUI.Properties.Resources.NesEventViewer;
|
||||
this.mnuEventViewer.Name = "mnuEventViewer";
|
||||
this.mnuEventViewer.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuEventViewer.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuEventViewer.Text = "Event Viewer";
|
||||
this.mnuEventViewer.Click += new System.EventHandler(this.mnuEventViewer_Click);
|
||||
//
|
||||
|
@ -1543,7 +1557,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuMemoryViewer.Image = global::Mesen.GUI.Properties.Resources.CheatCode;
|
||||
this.mnuMemoryViewer.Name = "mnuMemoryViewer";
|
||||
this.mnuMemoryViewer.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuMemoryViewer.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuMemoryViewer.Text = "Memory Tools";
|
||||
this.mnuMemoryViewer.Click += new System.EventHandler(this.mnuMemoryViewer_Click);
|
||||
//
|
||||
|
@ -1551,7 +1565,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuPpuViewer.Image = global::Mesen.GUI.Properties.Resources.Video;
|
||||
this.mnuPpuViewer.Name = "mnuPpuViewer";
|
||||
this.mnuPpuViewer.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuPpuViewer.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuPpuViewer.Text = "PPU Viewer";
|
||||
this.mnuPpuViewer.Click += new System.EventHandler(this.mnuPpuViewer_Click);
|
||||
//
|
||||
|
@ -1559,7 +1573,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuScriptWindow.Image = global::Mesen.GUI.Properties.Resources.Script;
|
||||
this.mnuScriptWindow.Name = "mnuScriptWindow";
|
||||
this.mnuScriptWindow.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuScriptWindow.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuScriptWindow.Text = "Script Window";
|
||||
this.mnuScriptWindow.Click += new System.EventHandler(this.mnuScriptWindow_Click);
|
||||
//
|
||||
|
@ -1567,7 +1581,7 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuTextHooker.Image = global::Mesen.GUI.Properties.Resources.Font;
|
||||
this.mnuTextHooker.Name = "mnuTextHooker";
|
||||
this.mnuTextHooker.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuTextHooker.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuTextHooker.Text = "Text Hooker";
|
||||
this.mnuTextHooker.Click += new System.EventHandler(this.mnuTextHooker_Click);
|
||||
//
|
||||
|
@ -1575,20 +1589,32 @@ namespace Mesen.GUI.Forms
|
|||
//
|
||||
this.mnuTraceLogger.Image = global::Mesen.GUI.Properties.Resources.LogWindow;
|
||||
this.mnuTraceLogger.Name = "mnuTraceLogger";
|
||||
this.mnuTraceLogger.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuTraceLogger.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuTraceLogger.Text = "Trace Logger";
|
||||
this.mnuTraceLogger.Click += new System.EventHandler(this.mnuTraceLogger_Click);
|
||||
//
|
||||
// sepDebugDualSystemSecondaryCpu
|
||||
//
|
||||
this.sepDebugDualSystemSecondaryCpu.Name = "sepDebugDualSystemSecondaryCpu";
|
||||
this.sepDebugDualSystemSecondaryCpu.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// mnuDebugDualSystemSecondaryCpu
|
||||
//
|
||||
this.mnuDebugDualSystemSecondaryCpu.Name = "mnuDebugDualSystemSecondaryCpu";
|
||||
this.mnuDebugDualSystemSecondaryCpu.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuDebugDualSystemSecondaryCpu.Text = "Debug DualSystem Secondary CPU";
|
||||
this.mnuDebugDualSystemSecondaryCpu.Click += new System.EventHandler(this.mnuDebugDualSystemSecondaryCpu_Click);
|
||||
//
|
||||
// toolStripMenuItem25
|
||||
//
|
||||
this.toolStripMenuItem25.Name = "toolStripMenuItem25";
|
||||
this.toolStripMenuItem25.Size = new System.Drawing.Size(159, 6);
|
||||
this.toolStripMenuItem25.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// mnuEditHeader
|
||||
//
|
||||
this.mnuEditHeader.Image = global::Mesen.GUI.Properties.Resources.Edit;
|
||||
this.mnuEditHeader.Name = "mnuEditHeader";
|
||||
this.mnuEditHeader.Size = new System.Drawing.Size(162, 22);
|
||||
this.mnuEditHeader.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuEditHeader.Text = "Edit iNES Header";
|
||||
this.mnuEditHeader.Click += new System.EventHandler(this.mnuEditHeader_Click);
|
||||
//
|
||||
|
@ -1664,16 +1690,6 @@ namespace Mesen.GUI.Forms
|
|||
this.mnuAbout.Text = "About";
|
||||
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
|
||||
//
|
||||
// ctrlRendererDualSystem
|
||||
//
|
||||
this.ctrlRendererDualSystem.BackColor = System.Drawing.Color.Black;
|
||||
this.ctrlRendererDualSystem.Location = new System.Drawing.Point(275, 0);
|
||||
this.ctrlRendererDualSystem.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ctrlRendererDualSystem.Name = "ctrlRendererDualSystem";
|
||||
this.ctrlRendererDualSystem.Size = new System.Drawing.Size(150, 90);
|
||||
this.ctrlRendererDualSystem.TabIndex = 8;
|
||||
this.ctrlRendererDualSystem.Visible = false;
|
||||
//
|
||||
// frmMain
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -1881,6 +1897,8 @@ namespace Mesen.GUI.Forms
|
|||
private System.Windows.Forms.ToolStripMenuItem mnuInstallHdPack;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuTextHooker;
|
||||
private Controls.ctrlRenderer ctrlRendererDualSystem;
|
||||
private System.Windows.Forms.ToolStripSeparator sepDebugDualSystemSecondaryCpu;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuDebugDualSystemSecondaryCpu;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -346,5 +346,28 @@ namespace Mesen.GUI.Forms
|
|||
{
|
||||
DebugWindowManager.OpenDebugWindow(DebugWindow.TextHooker);
|
||||
}
|
||||
|
||||
private void mnuDebugDualSystemSecondaryCpu_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool switchCpu = false;
|
||||
|
||||
if(!DebugWindowManager.HasOpenedWindow) {
|
||||
switchCpu = true;
|
||||
} else {
|
||||
if(MessageBox.Show("Warning: Changing this setting will close all currently opened debug tools!", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) {
|
||||
DebugWindowManager.CloseAll();
|
||||
if(!DebugWindowManager.HasOpenedWindow) {
|
||||
switchCpu = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(switchCpu) {
|
||||
mnuDebugDualSystemSecondaryCpu.Checked = !mnuDebugDualSystemSecondaryCpu.Checked;
|
||||
ConfigManager.Config.DebugInfo.DebugConsoleId = mnuDebugDualSystemSecondaryCpu.Checked ? InteropEmu.ConsoleId.Slave : InteropEmu.ConsoleId.Master;
|
||||
ConfigManager.ApplyChanges();
|
||||
InteropEmu.DebugSetDebuggerConsole(ConfigManager.Config.DebugInfo.DebugConsoleId == InteropEmu.ConsoleId.Slave ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace Mesen.GUI.Forms
|
|||
#endif
|
||||
InitializeCore();
|
||||
|
||||
_notifListener = new InteropEmu.NotificationListener();
|
||||
_notifListener = new InteropEmu.NotificationListener(InteropEmu.ConsoleId.Master);
|
||||
_notifListener.OnNotification += _notifListener_OnNotification;
|
||||
|
||||
menuTimer.Start();
|
||||
|
@ -204,6 +204,9 @@ namespace Mesen.GUI.Forms
|
|||
if(ConfigManager.Config.PreferenceInfo.DisableMouseResize) {
|
||||
this.FormBorderStyle = FormBorderStyle.Fixed3D;
|
||||
}
|
||||
|
||||
mnuDebugDualSystemSecondaryCpu.Checked = ConfigManager.Config.DebugInfo.DebugConsoleId == InteropEmu.ConsoleId.Slave;
|
||||
InteropEmu.DebugSetDebuggerConsole(ConfigManager.Config.DebugInfo.DebugConsoleId == InteropEmu.ConsoleId.Slave ? 1 : 0);
|
||||
}
|
||||
|
||||
private void ProcessFullscreenSwitch(List<string> switches)
|
||||
|
@ -1114,6 +1117,15 @@ namespace Mesen.GUI.Forms
|
|||
mnuTextHooker.Enabled = running;
|
||||
mnuTraceLogger.Enabled = running;
|
||||
|
||||
#if !HIDETESTMENU
|
||||
//Keep this option hidden for now, until some remaining issues are fixed.
|
||||
mnuDebugDualSystemSecondaryCpu.Visible = _isDualSystem;
|
||||
sepDebugDualSystemSecondaryCpu.Visible = _isDualSystem;
|
||||
#else
|
||||
mnuDebugDualSystemSecondaryCpu.Visible = false;
|
||||
sepDebugDualSystemSecondaryCpu.Visible = false;
|
||||
#endif
|
||||
|
||||
mnuInstallHdPack.Enabled = running;
|
||||
mnuHdPackEditor.Enabled = !netPlay && running;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace Mesen.GUI
|
|||
|
||||
[DllImport(DLLPath)] public static extern void TakeScreenshot();
|
||||
|
||||
[DllImport(DLLPath)] public static extern IntPtr RegisterNotificationCallback(NotificationListener.NotificationCallback callback);
|
||||
[DllImport(DLLPath)] public static extern IntPtr RegisterNotificationCallback(Int32 consoleId, NotificationListener.NotificationCallback callback);
|
||||
[DllImport(DLLPath)] public static extern void UnregisterNotificationCallback(IntPtr notificationListener);
|
||||
|
||||
[DllImport(DLLPath)] public static extern void DisplayMessage([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string title, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string message, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string param1 = null);
|
||||
|
@ -203,6 +203,7 @@ namespace Mesen.GUI
|
|||
[DllImport(DLLPath, EntryPoint = "GetAudioDevices")] private static extern IntPtr GetAudioDevicesWrapper();
|
||||
[DllImport(DLLPath)] public static extern void SetAudioDevice(string audioDevice);
|
||||
|
||||
[DllImport(DLLPath)] public static extern void DebugSetDebuggerConsole(Int32 consoleId);
|
||||
[DllImport(DLLPath)] public static extern void DebugInitialize();
|
||||
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool DebugIsDebuggerRunning();
|
||||
[DllImport(DLLPath)] public static extern void DebugRelease();
|
||||
|
@ -1041,6 +1042,12 @@ namespace Mesen.GUI
|
|||
public IntPtr Parameter;
|
||||
}
|
||||
|
||||
public enum ConsoleId
|
||||
{
|
||||
Master = 0,
|
||||
Slave = 1
|
||||
}
|
||||
|
||||
public class NotificationListener : IDisposable
|
||||
{
|
||||
public delegate void NotificationCallback(int type, IntPtr parameter);
|
||||
|
@ -1051,12 +1058,12 @@ namespace Mesen.GUI
|
|||
NotificationCallback _callback;
|
||||
IntPtr _notificationListener;
|
||||
|
||||
public NotificationListener()
|
||||
public NotificationListener(ConsoleId consoleId)
|
||||
{
|
||||
_callback = (int type, IntPtr parameter) => {
|
||||
this.ProcessNotification(type, parameter);
|
||||
};
|
||||
_notificationListener = InteropEmu.RegisterNotificationCallback(_callback);
|
||||
_notificationListener = InteropEmu.RegisterNotificationCallback(consoleId == ConsoleId.Slave ? 1 : 0, _callback);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -60,6 +60,21 @@ vector<shared_ptr<INotificationListener>> _externalNotificationListeners;
|
|||
|
||||
typedef void (__stdcall *NotificationListenerCallback)(int, void*);
|
||||
|
||||
shared_ptr<Console> GetConsoleById(int32_t consoleId)
|
||||
{
|
||||
shared_ptr<Console> console;
|
||||
if(consoleId == 1) {
|
||||
//Get the VS Dualsystem's 2nd CPU, only if it's available (and requested)
|
||||
console = _console->GetDualConsole();
|
||||
}
|
||||
|
||||
if(!console) {
|
||||
//Otherwise return the main CPU
|
||||
console = _console;
|
||||
}
|
||||
return console;
|
||||
}
|
||||
|
||||
namespace InteropEmu {
|
||||
class InteropNotificationListener : public INotificationListener
|
||||
{
|
||||
|
@ -379,12 +394,12 @@ namespace InteropEmu {
|
|||
|
||||
DllExport void __stdcall TakeScreenshot() { _console->GetVideoDecoder()->TakeScreenshot(); }
|
||||
|
||||
DllExport INotificationListener* __stdcall RegisterNotificationCallback(NotificationListenerCallback callback)
|
||||
DllExport INotificationListener* __stdcall RegisterNotificationCallback(int32_t consoleId, NotificationListenerCallback callback)
|
||||
{
|
||||
auto lock = _externalNotificationListenerLock.AcquireSafe();
|
||||
auto listener = shared_ptr<INotificationListener>(new InteropNotificationListener(callback));
|
||||
_externalNotificationListeners.push_back(listener);
|
||||
_console->GetNotificationManager()->RegisterNotificationListener(listener);
|
||||
GetConsoleById(consoleId)->GetNotificationManager()->RegisterNotificationListener(listener);
|
||||
return listener.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,12 @@
|
|||
#include "../Core/TraceLogger.h"
|
||||
|
||||
extern shared_ptr<Console> _console;
|
||||
static int32_t _debugConsoleId = 0;
|
||||
extern shared_ptr<Console> GetConsoleById(int32_t consoleId);
|
||||
|
||||
shared_ptr<Debugger> GetDebugger()
|
||||
{
|
||||
return _console->GetDebugger();
|
||||
return GetConsoleById(_debugConsoleId)->GetDebugger();
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
@ -26,12 +28,17 @@ extern "C"
|
|||
|
||||
DllExport void __stdcall DebugRelease()
|
||||
{
|
||||
_console->StopDebugger();
|
||||
GetConsoleById(_debugConsoleId)->StopDebugger();
|
||||
}
|
||||
|
||||
DllExport bool __stdcall DebugIsDebuggerRunning()
|
||||
{
|
||||
return _console->GetDebugger(false).get() != nullptr;
|
||||
return GetConsoleById(_debugConsoleId)->GetDebugger(false).get() != nullptr;
|
||||
}
|
||||
|
||||
DllExport void __stdcall DebugSetDebuggerConsole(int32_t consoleId)
|
||||
{
|
||||
_debugConsoleId = consoleId;
|
||||
}
|
||||
|
||||
DllExport void __stdcall DebugSetFlags(uint32_t flags) { GetDebugger()->SetFlags(flags); }
|
||||
|
|
|
@ -37,7 +37,7 @@ extern "C" {
|
|||
int __stdcall RunRecordedTest(char* filename);
|
||||
void __stdcall Run();
|
||||
void __stdcall Stop();
|
||||
INotificationListener* __stdcall RegisterNotificationCallback(NotificationListenerCallback callback);
|
||||
INotificationListener* __stdcall RegisterNotificationCallback(int32_t consoleId, NotificationListenerCallback callback);
|
||||
}
|
||||
|
||||
std::thread *runThread = nullptr;
|
||||
|
@ -189,10 +189,9 @@ int main(int argc, char* argv[])
|
|||
std::getchar();
|
||||
} else if(argc == 3) {
|
||||
char* testFilename = argv[2];
|
||||
RegisterNotificationCallback((NotificationListenerCallback)OnNotificationReceived);
|
||||
|
||||
SetFlags(0x8000000000000000); //EmulationFlags::ConsoleMode
|
||||
InitializeEmu(mesenFolder.c_str(), nullptr, nullptr, false, false, false);
|
||||
RegisterNotificationCallback(0, (NotificationListenerCallback)OnNotificationReceived);
|
||||
SetControllerType(0, ControllerType::StandardController);
|
||||
SetControllerType(1, ControllerType::StandardController);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue