Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 7a62b2a

Browse files
committed
Debugger: Added option to select which CPU to debug (VS DualSystem) (hidden from menu because issues exist)
1 parent 0fefccb commit 7a62b2a

17 files changed

+147
-46
lines changed

Core/Console.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ Console::Console(shared_ptr<Console> master)
4949
{
5050
_master = master;
5151
_model = NesModel::NTSC;
52-
53-
if(_master) {
54-
_master->_notificationManager->SendNotification(ConsoleNotificationType::VsDualSystemStarted);
55-
}
5652
}
5753

5854
Console::~Console()
@@ -73,6 +69,10 @@ void Console::Init()
7369

7470
_soundMixer.reset(new SoundMixer(shared_from_this()));
7571
_soundMixer->SetNesModel(_model);
72+
73+
if(_master) {
74+
_emulationThreadId = _master->_emulationThreadId;
75+
}
7676
}
7777

7878
void Console::Release(bool forShutdown)
@@ -385,6 +385,10 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
385385
MessageManager::DisplayMessage("ClockRate", std::to_string(EmulationSettings::GetOverclockRate()) + "%");
386386
}
387387
EmulationSettings::ClearFlags(EmulationFlags::ForceMaxSpeed);
388+
389+
if(_slave) {
390+
_notificationManager->SendNotification(ConsoleNotificationType::VsDualSystemStarted);
391+
}
388392
}
389393
Resume();
390394
return true;
@@ -667,6 +671,9 @@ void Console::Run()
667671
_stopLock.Acquire();
668672

669673
_emulationThreadId = std::this_thread::get_id();
674+
if(_slave) {
675+
_slave->_emulationThreadId = std::this_thread::get_id();
676+
}
670677

671678
targetTime = GetFrameDelay();
672679

Core/Console.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include <atomic>
55
#include "../Utilities/SimpleLock.h"
66
#include "VirtualFile.h"
7-
#include "RomData.h"
8-
#include "Debugger.h"
97

108
class BaseMapper;
119
class RewindManager;
@@ -26,8 +24,13 @@ class VideoRenderer;
2624
class DebugHud;
2725
class SoundMixer;
2826
class NotificationManager;
27+
class Debugger;
2928

3029
struct HdPackData;
30+
struct HashInfo;
31+
struct MapperInfo;
32+
33+
enum class MemoryOperationType;
3134
enum class NesModel;
3235
enum class ScaleFilterType;
3336
enum class ConsoleFeatures;

GUI.NET/Config/DebugInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public class DebugInfo
119119
public DebugViewInfo LeftView;
120120
public DebugViewInfo RightView;
121121

122+
public InteropEmu.ConsoleId DebugConsoleId = InteropEmu.ConsoleId.Master;
123+
122124
public string FontFamily = BaseControl.MonospaceFontFamily;
123125
public FontStyle FontStyle = FontStyle.Regular;
124126
public float FontSize = BaseControl.DefaultFontSize;

GUI.NET/Debugger/DebugWindowManager.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ public static frmMemoryViewer GetMemoryViewer()
7777
return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmMemoryViewer)) as frmMemoryViewer;
7878
}
7979

80+
public static bool HasOpenedWindow
81+
{
82+
get
83+
{
84+
return _openedWindows.Count > 0;
85+
}
86+
}
87+
8088
public static void CloseAll()
8189
{
8290
List<Form> openedWindows = new List<Form>(_openedWindows);

GUI.NET/Debugger/frmDebugger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ protected override void OnLoad(EventArgs e)
158158
"[MyLabel, 4]: Display 4 bytes starting from the address the specified label (MyLabel) refers to"
159159
);
160160

161-
_notifListener = new InteropEmu.NotificationListener();
161+
_notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
162162
_notifListener.OnNotification += _notifListener_OnNotification;
163163

164164
InteropEmu.DebugInitialize();

GUI.NET/Debugger/frmEventViewer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected override void OnLoad(EventArgs e)
5050
this.Location = ConfigManager.Config.DebugInfo.EventViewerLocation;
5151
}
5252

53-
this._notifListener = new InteropEmu.NotificationListener();
53+
this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
5454
this._notifListener.OnNotification += this._notifListener_OnNotification;
5555
}
5656
}

GUI.NET/Debugger/frmMemoryViewer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected override void OnLoad(EventArgs e)
8181
UpdateImportButton();
8282
InitMemoryTypeDropdown(true);
8383

84-
_notifListener = new InteropEmu.NotificationListener();
84+
_notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
8585
_notifListener.OnNotification += _notifListener_OnNotification;
8686

8787
this.mnuShowCharacters.CheckedChanged += this.mnuShowCharacters_CheckedChanged;

GUI.NET/Debugger/frmPpuViewer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected override void OnLoad(EventArgs e)
5656
base.OnLoad(e);
5757

5858
if(!this.DesignMode) {
59-
this._notifListener = new InteropEmu.NotificationListener();
59+
this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
6060
this._notifListener.OnNotification += this._notifListener_OnNotification;
6161

6262
this.ctrlScanlineCycle.Initialize(_ppuViewerId, ConfigManager.Config.DebugInfo.PpuDisplayScanline, ConfigManager.Config.DebugInfo.PpuDisplayCycle);

GUI.NET/Debugger/frmScript.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public frmScript(bool forceBlank = false)
120120
protected override void OnLoad(EventArgs e)
121121
{
122122
base.OnLoad(e);
123-
this._notifListener = new InteropEmu.NotificationListener();
123+
this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
124124
this._notifListener.OnNotification += this._notifListener_OnNotification;
125125

126126
this.InitShortcuts();

GUI.NET/Debugger/frmTextHooker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected override void OnLoad(EventArgs e)
7777
this.ctrlTextHooker.SetCharacterMappings(_charMappings);
7878
this.ctrlCharacterMappings.SetCharacterMappings(_charMappings);
7979

80-
this._notifListener = new InteropEmu.NotificationListener();
80+
this._notifListener = new InteropEmu.NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId);
8181
this._notifListener.OnNotification += this._notifListener_OnNotification;
8282

8383
this.ctrlTextHooker.GetData();

0 commit comments

Comments
 (0)