Configuration: Add GDB stub related configuration

# Conflicts:
#	Ryujinx/Configuration/ConfigurationState.cs
#	src/Ryujinx.HLE/HLEConfiguration.cs
#	src/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs
#	src/Ryujinx/Ui/MainWindow.cs
#	src/Ryujinx/Ui/Windows/SettingsWindow.cs
#	src/Ryujinx/Ui/Windows/SettingsWindow.glade
This commit is contained in:
merry 2022-02-08 19:49:54 +00:00 committed by svc64
parent 20bdea45fa
commit 2a17f1314d
6 changed files with 238 additions and 4 deletions

View file

@ -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)

View file

@ -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;

View file

@ -46,6 +46,12 @@
<property name="inline-completion">True</property>
<property name="inline-selection">True</property>
</object>
<object class="GtkAdjustment" id="_gdbStubPortSpinAdjustment">
<property name="lower">1</property>
<property name="upper">65535</property>
<property name="step-increment">1</property>
<property name="page-increment">5</property>
</object>
<object class="GtkWindow" id="_settingsWin">
<property name="can-focus">False</property>
<property name="title" translatable="yes">Ryujinx - Settings</property>
@ -3146,6 +3152,137 @@
<property name="tab-fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="TabDebug">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">10</property>
<property name="margin-top">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="CatDebug">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-bottom">5</property>
<property name="label" translatable="yes">Debug (WARNING: For Developer Use Only)</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="DebugOptions">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="valign">start</property>
<property name="margin-left">10</property>
<property name="margin-right">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="_gdbStubToggle">
<property name="label" translatable="yes">Enable GDB Stub</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">Enables or disables GDB stub (for developer use only)</property>
<property name="halign">start</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Specifies which TCP port for the GDB stub to listen on. Possible values are 1-65535.</property>
<property name="label" translatable="yes">GDB Stub Port</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Specifies which TCP port for the GDB stub to listen on. Possible values are 1-65535.</property>
<property name="text" translatable="yes">55555</property>
<property name="input-purpose">number</property>
<property name="adjustment">_gdbStubPortSpinAdjustment</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">9</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="position">6</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Debug</property>
</object>
<packing>
<property name="position">6</property>
<property name="tab-fill">False</property>
</packing>
</child>
</object>
</child>
</object>

View file

@ -169,6 +169,16 @@ namespace Ryujinx.HLE
/// </summary>
public Action RefreshInputConfig { internal get; set; }
/// <summary>
/// Enables gdbstub to allow for debugging of the guest .
/// </summary>
public bool EnableGdbStub { get; internal set; }
/// <summary>
/// A TCP port to use to expose a gdbstub for a debugger to connect to.
/// </summary>
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;
}
}
}

View file

@ -386,6 +386,16 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public bool UseHypervisor { get; set; }
/// <summary>
/// Enables or disables the GDB stub
/// </summary>
public bool EnableGdbStub { get; set; }
/// <summary>
/// Which TCP port should the GDB stub listen on
/// </summary>
public ushort GdbStubPort { get; set; }
/// <summary>
/// Loads a configuration file from disk
/// </summary>

View file

@ -577,6 +577,30 @@ namespace Ryujinx.UI.Common.Configuration
}
}
/// <summary>
/// Debug configuration section
/// </summary>
public class DebugSection
{
/// <summary>
/// Enables or disables the GDB stub
/// </summary>
public ReactiveObject<bool> EnableGdbStub { get; private set; }
/// <summary>
/// Which TCP port should the GDB stub listen on
/// </summary>
public ReactiveObject<ushort> GdbStubPort { get; private set; }
public DebugSection()
{
EnableGdbStub = new ReactiveObject<bool>();
EnableGdbStub.Event += static (sender, e) => LogValueChange(e, nameof(EnableGdbStub));
GdbStubPort = new ReactiveObject<ushort>();
GdbStubPort.Event += static (sender, e) => LogValueChange(e, nameof(GdbStubPort));
}
}
/// <summary>
/// The default configuration instance
/// </summary>
@ -607,6 +631,11 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public HidSection Hid { get; private set; }
/// <summary>
/// The Debug
/// </summary>
public DebugSection Debug { get; private set; }
/// <summary>
/// The Multiplayer section
/// </summary>
@ -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<bool>();
CheckUpdatesOnStart = new ReactiveObject<bool>();
@ -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)
{