[GUI] Add network interface dropdown (#4597)

* Add network adapter dropdown from LDN build

* Ava: Add NetworkInterfaces to SettingsNetworkTab

* Add headless network interface option

* Add network interface dropdown to Avalonia

* Fix handling network interfaces without a gateway address

* gtk: Actually save selected network interface to config

* Increment config version
This commit is contained in:
TSRBerry
2023-04-16 17:25:20 +02:00
committed by GitHub
parent 40e87c634e
commit 69b6ef7a4a
15 changed files with 385 additions and 90 deletions

View File

@ -517,6 +517,22 @@ namespace Ryujinx.Ui.Common.Configuration
}
}
/// <summary>
/// Multiplayer configuration section
/// </summary>
public class MultiplayerSection
{
/// <summary>
/// GUID for the network interface used by LAN (or 0 for default)
/// </summary>
public ReactiveObject<string> LanInterfaceId { get; private set; }
public MultiplayerSection()
{
LanInterfaceId = new ReactiveObject<string>();
}
}
/// <summary>
/// The default configuration instance
/// </summary>
@ -547,6 +563,11 @@ namespace Ryujinx.Ui.Common.Configuration
/// </summary>
public HidSection Hid { get; private set; }
/// <summary>
/// The Multiplayer section
/// </summary>
public MultiplayerSection Multiplayer { get; private set; }
/// <summary>
/// Enables or disables Discord Rich Presence
/// </summary>
@ -574,6 +595,7 @@ namespace Ryujinx.Ui.Common.Configuration
System = new SystemSection();
Graphics = new GraphicsSection();
Hid = new HidSection();
Multiplayer = new MultiplayerSection();
EnableDiscordIntegration = new ReactiveObject<bool>();
CheckUpdatesOnStart = new ReactiveObject<bool>();
ShowConfirmExit = new ReactiveObject<bool>();
@ -674,7 +696,8 @@ namespace Ryujinx.Ui.Common.Configuration
ControllerConfig = new List<JsonObject>(),
InputConfig = Hid.InputConfig,
GraphicsBackend = Graphics.GraphicsBackend,
PreferredGpu = Graphics.PreferredGpu
PreferredGpu = Graphics.PreferredGpu,
MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId
};
return configurationFile;
@ -727,6 +750,7 @@ namespace Ryujinx.Ui.Common.Configuration
System.ExpandRam.Value = false;
System.IgnoreMissingServices.Value = false;
System.UseHypervisor.Value = true;
Multiplayer.LanInterfaceId.Value = "0";
Ui.GuiColumns.FavColumn.Value = true;
Ui.GuiColumns.IconColumn.Value = true;
Ui.GuiColumns.AppColumn.Value = true;
@ -1308,6 +1332,15 @@ namespace Ryujinx.Ui.Common.Configuration
configurationFileUpdated = true;
}
if (configurationFileFormat.Version < 46)
{
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 45.");
configurationFileFormat.MultiplayerLanInterfaceId = "0";
configurationFileUpdated = true;
}
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
Graphics.ResScale.Value = configurationFileFormat.ResScale;
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
@ -1366,12 +1399,12 @@ namespace Ryujinx.Ui.Common.Configuration
Ui.ColumnSort.SortColumnId.Value = configurationFileFormat.ColumnSort.SortColumnId;
Ui.ColumnSort.SortAscending.Value = configurationFileFormat.ColumnSort.SortAscending;
Ui.GameDirs.Value = configurationFileFormat.GameDirs;
Ui.ShownFileTypes.NSP.Value = configurationFileFormat.ShownFileTypes.NSP;
Ui.ShownFileTypes.PFS0.Value = configurationFileFormat.ShownFileTypes.PFS0;
Ui.ShownFileTypes.XCI.Value = configurationFileFormat.ShownFileTypes.XCI;
Ui.ShownFileTypes.NCA.Value = configurationFileFormat.ShownFileTypes.NCA;
Ui.ShownFileTypes.NRO.Value = configurationFileFormat.ShownFileTypes.NRO;
Ui.ShownFileTypes.NSO.Value = configurationFileFormat.ShownFileTypes.NSO;
Ui.ShownFileTypes.NSP.Value = configurationFileFormat.ShownFileTypes.NSP;
Ui.ShownFileTypes.PFS0.Value = configurationFileFormat.ShownFileTypes.PFS0;
Ui.ShownFileTypes.XCI.Value = configurationFileFormat.ShownFileTypes.XCI;
Ui.ShownFileTypes.NCA.Value = configurationFileFormat.ShownFileTypes.NCA;
Ui.ShownFileTypes.NRO.Value = configurationFileFormat.ShownFileTypes.NRO;
Ui.ShownFileTypes.NSO.Value = configurationFileFormat.ShownFileTypes.NSO;
Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme;
Ui.LanguageCode.Value = configurationFileFormat.LanguageCode;
Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath;
@ -1393,6 +1426,8 @@ namespace Ryujinx.Ui.Common.Configuration
Hid.InputConfig.Value = new List<InputConfig>();
}
Multiplayer.LanInterfaceId.Value = configurationFileFormat.MultiplayerLanInterfaceId;
if (configurationFileUpdated)
{
ToFileFormat().SaveConfig(configurationFilePath);
@ -1418,4 +1453,4 @@ namespace Ryujinx.Ui.Common.Configuration
Instance = new ConfigurationState();
}
}
}
}