diff --git a/src/Ryujinx.Gtk3/UI/MainWindow.cs b/src/Ryujinx.Gtk3/UI/MainWindow.cs
index 66c0afae0..fe3414fa1 100644
--- a/src/Ryujinx.Gtk3/UI/MainWindow.cs
+++ b/src/Ryujinx.Gtk3/UI/MainWindow.cs
@@ -677,7 +677,9 @@ namespace Ryujinx.UI
ConfigurationState.Instance.System.AudioVolume,
ConfigurationState.Instance.System.UseHypervisor,
ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value,
- ConfigurationState.Instance.Multiplayer.Mode);
+ ConfigurationState.Instance.Multiplayer.Mode,
+ ConfigurationState.Instance.Debug.EnableGdbStub,
+ ConfigurationState.Instance.Debug.GdbStubPort);
_emulationContext = new HLE.Switch(configuration);
}
@@ -790,6 +792,24 @@ namespace Ryujinx.UI
shadersDumpWarningDialog.Dispose();
}
+
+ if (ConfigurationState.Instance.Debug.EnableGdbStub.Value)
+ {
+ MessageDialog gdbStubWarningDialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo, null)
+ {
+ Title = "Ryujinx - Warning",
+ Text = "You have the GDB stub enabled, which is designed to be used by developers only.",
+ SecondaryText = "For optimal performance, it's recommended to disable the GDB stub. Would you like to disable the GDB stub now?"
+ };
+
+ if (gdbStubWarningDialog.Run() == (int)ResponseType.Yes)
+ {
+ ConfigurationState.Instance.Debug.EnableGdbStub.Value = false;
+ SaveConfig();
+ }
+
+ gdbStubWarningDialog.Dispose();
+ }
}
private bool LoadApplication(string path, ulong applicationId, bool isFirmwareTitle)
diff --git a/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs b/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs
index dc467c0f2..a71d1428e 100644
--- a/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs
+++ b/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.cs
@@ -117,7 +117,8 @@ namespace Ryujinx.UI.Windows
[GUI] ToggleButton _configureController7;
[GUI] ToggleButton _configureController8;
[GUI] ToggleButton _configureControllerH;
-
+ [GUI] ToggleButton _gdbStubToggle;
+ [GUI] Adjustment _gdbStubPortSpinAdjustment;
#pragma warning restore CS0649, IDE0044
public SettingsWindow(MainWindow parent, VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this(parent, new Builder("Ryujinx.Gtk3.UI.Windows.SettingsWindow.glade"), virtualFileSystem, contentManager) { }
@@ -316,6 +317,11 @@ namespace Ryujinx.UI.Windows
_custThemeToggle.Click();
}
+ if (ConfigurationState.Instance.Debug.EnableGdbStub)
+ {
+ _gdbStubToggle.Click();
+ }
+
// Custom EntryCompletion Columns. If added to glade, need to override more signals
ListStore tzList = new(typeof(string), typeof(string), typeof(string));
_systemTimeZoneCompletion.Model = tzList;
@@ -375,6 +381,8 @@ namespace Ryujinx.UI.Windows
_fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode;
_systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset;
+ _gdbStubPortSpinAdjustment.Value = ConfigurationState.Instance.Debug.GdbStubPort;
+
_gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
_gameDirsBoxStore = new ListStore(typeof(string));
_gameDirsBox.Model = _gameDirsBoxStore;
diff --git a/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.glade b/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.glade
index f0dbd6b63..22ccfe861 100644
--- a/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.glade
+++ b/src/Ryujinx.Gtk3/UI/Windows/SettingsWindow.glade
@@ -46,6 +46,12 @@
True
True
+
diff --git a/src/Ryujinx.HLE/HLEConfiguration.cs b/src/Ryujinx.HLE/HLEConfiguration.cs
index 955fee4b5..f6026e7b8 100644
--- a/src/Ryujinx.HLE/HLEConfiguration.cs
+++ b/src/Ryujinx.HLE/HLEConfiguration.cs
@@ -169,6 +169,16 @@ namespace Ryujinx.HLE
///
public Action RefreshInputConfig { internal get; set; }
+ ///
+ /// Enables gdbstub to allow for debugging of the guest .
+ ///
+ public bool EnableGdbStub { get; internal set; }
+
+ ///
+ /// A TCP port to use to expose a gdbstub for a debugger to connect to.
+ ///
+ public ushort GdbStubPort { get; internal set; }
+
public HLEConfiguration(VirtualFileSystem virtualFileSystem,
LibHacHorizonManager libHacHorizonManager,
ContentManager contentManager,
@@ -194,7 +204,9 @@ namespace Ryujinx.HLE
float audioVolume,
bool useHypervisor,
string multiplayerLanInterfaceId,
- MultiplayerMode multiplayerMode)
+ MultiplayerMode multiplayerMode,
+ bool enableGdbStub,
+ ushort gdbStubPort)
{
VirtualFileSystem = virtualFileSystem;
LibHacHorizonManager = libHacHorizonManager;
@@ -222,6 +234,8 @@ namespace Ryujinx.HLE
UseHypervisor = useHypervisor;
MultiplayerLanInterfaceId = multiplayerLanInterfaceId;
MultiplayerMode = multiplayerMode;
+ EnableGdbStub = enableGdbStub;
+ GdbStubPort = gdbStubPort;
}
}
}
diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs
index af3ad0a1d..d041bf63e 100644
--- a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs
+++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs
@@ -386,6 +386,16 @@ namespace Ryujinx.UI.Common.Configuration
///
public bool UseHypervisor { get; set; }
+ ///
+ /// Enables or disables the GDB stub
+ ///
+ public bool EnableGdbStub { get; set; }
+
+ ///
+ /// Which TCP port should the GDB stub listen on
+ ///
+ public ushort GdbStubPort { get; set; }
+
///
/// Loads a configuration file from disk
///
@@ -416,4 +426,4 @@ namespace Ryujinx.UI.Common.Configuration
JsonHelper.SerializeToFile(path, this, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
index 8420dc5d9..d5ee41e64 100644
--- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
+++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
@@ -577,6 +577,30 @@ namespace Ryujinx.UI.Common.Configuration
}
}
+ ///
+ /// Debug configuration section
+ ///
+ public class DebugSection
+ {
+ ///
+ /// Enables or disables the GDB stub
+ ///
+ public ReactiveObject EnableGdbStub { get; private set; }
+
+ ///
+ /// Which TCP port should the GDB stub listen on
+ ///
+ public ReactiveObject GdbStubPort { get; private set; }
+
+ public DebugSection()
+ {
+ EnableGdbStub = new ReactiveObject();
+ EnableGdbStub.Event += static (sender, e) => LogValueChange(e, nameof(EnableGdbStub));
+ GdbStubPort = new ReactiveObject();
+ GdbStubPort.Event += static (sender, e) => LogValueChange(e, nameof(GdbStubPort));
+ }
+ }
+
///
/// The default configuration instance
///
@@ -607,6 +631,11 @@ namespace Ryujinx.UI.Common.Configuration
///
public HidSection Hid { get; private set; }
+ ///
+ /// The Debug
+ ///
+ public DebugSection Debug { get; private set; }
+
///
/// The Multiplayer section
///
@@ -649,6 +678,7 @@ namespace Ryujinx.UI.Common.Configuration
System = new SystemSection();
Graphics = new GraphicsSection();
Hid = new HidSection();
+ Debug = new DebugSection();
Multiplayer = new MultiplayerSection();
EnableDiscordIntegration = new ReactiveObject();
CheckUpdatesOnStart = new ReactiveObject();
@@ -766,6 +796,8 @@ namespace Ryujinx.UI.Common.Configuration
PreferredGpu = Graphics.PreferredGpu,
MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId,
MultiplayerMode = Multiplayer.Mode,
+ EnableGdbStub = Debug.EnableGdbStub,
+ GdbStubPort = Debug.GdbStubPort,
};
return configurationFile;
@@ -923,6 +955,8 @@ namespace Ryujinx.UI.Common.Configuration
},
},
};
+ Debug.EnableGdbStub.Value = false;
+ Debug.GdbStubPort.Value = 55555;
}
public void Load(ConfigurationFileFormat configurationFileFormat, string configurationFilePath)
@@ -1437,6 +1471,15 @@ namespace Ryujinx.UI.Common.Configuration
configurationFileUpdated = true;
}
+ if (configurationFileFormat.Version < 48)
+ {
+ Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 38.");
+
+ configurationFileFormat.EnableGdbStub = false;
+ configurationFileFormat.GdbStubPort = 55555;
+
+ configurationFileUpdated = true;
+ }
if (configurationFileFormat.Version < 48)
{
@@ -1564,6 +1607,8 @@ namespace Ryujinx.UI.Common.Configuration
Hid.EnableMouse.Value = configurationFileFormat.EnableMouse;
Hid.Hotkeys.Value = configurationFileFormat.Hotkeys;
Hid.InputConfig.Value = configurationFileFormat.InputConfig;
+ Debug.EnableGdbStub.Value = configurationFileFormat.EnableGdbStub;
+ Debug.GdbStubPort.Value = configurationFileFormat.GdbStubPort;
if (Hid.InputConfig.Value == null)
{