diff options
Diffstat (limited to 'Ryujinx.Ava')
| -rw-r--r-- | Ryujinx.Ava/AppHost.cs | 10 | ||||
| -rw-r--r-- | Ryujinx.Ava/Assets/Locales/en_US.json | 5 | ||||
| -rw-r--r-- | Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs | 36 | ||||
| -rw-r--r-- | Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml | 15 |
4 files changed, 62 insertions, 4 deletions
diff --git a/Ryujinx.Ava/AppHost.cs b/Ryujinx.Ava/AppHost.cs index ae9e8e53..957a1c9d 100644 --- a/Ryujinx.Ava/AppHost.cs +++ b/Ryujinx.Ava/AppHost.cs @@ -177,6 +177,8 @@ namespace Ryujinx.Ava ConfigurationState.Instance.Graphics.ScalingFilter.Event += UpdateScalingFilter; ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event += UpdateScalingFilterLevel; + ConfigurationState.Instance.Multiplayer.LanInterfaceId.Event += UpdateLanInterfaceIdState; + _gpuCancellationTokenSource = new CancellationTokenSource(); } @@ -383,6 +385,11 @@ namespace Ryujinx.Ava }); } + private void UpdateLanInterfaceIdState(object sender, ReactiveEventArgs<string> e) + { + Device.Configuration.MultiplayerLanInterfaceId = e.NewValue; + } + public void Stop() { _isActive = false; @@ -739,7 +746,8 @@ namespace Ryujinx.Ava ConfigurationState.Instance.System.IgnoreMissingServices, ConfigurationState.Instance.Graphics.AspectRatio, ConfigurationState.Instance.System.AudioVolume, - ConfigurationState.Instance.System.UseHypervisor); + ConfigurationState.Instance.System.UseHypervisor, + ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value); Device = new Switch(configuration); } diff --git a/Ryujinx.Ava/Assets/Locales/en_US.json b/Ryujinx.Ava/Assets/Locales/en_US.json index b2d6b43d..3a4bfc65 100644 --- a/Ryujinx.Ava/Assets/Locales/en_US.json +++ b/Ryujinx.Ava/Assets/Locales/en_US.json @@ -638,5 +638,8 @@ "SmaaHigh": "SMAA High", "SmaaUltra": "SMAA Ultra", "UserEditorTitle" : "Edit User", - "UserEditorTitleCreate" : "Create User" + "UserEditorTitleCreate" : "Create User", + "SettingsTabNetworkInterface": "Network Interface:", + "NetworkInterfaceTooltip": "The network interface used for LAN features", + "NetworkInterfaceDefault": "Default" } diff --git a/Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs b/Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs index cbba7fb9..232c9d43 100644 --- a/Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs +++ b/Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Runtime.InteropServices; +using System.Net.NetworkInformation; using TimeZone = Ryujinx.Ava.UI.Models.TimeZone; namespace Ryujinx.Ava.UI.ViewModels @@ -35,6 +36,8 @@ namespace Ryujinx.Ava.UI.ViewModels private readonly List<string> _validTzRegions; + private readonly Dictionary<string, string> _networkInterfaces; + private float _customResolutionScale; private int _resolutionScale; private int _graphicsBackendMultithreadingIndex; @@ -50,6 +53,7 @@ namespace Ryujinx.Ava.UI.ViewModels public event Action CloseWindow; public event Action SaveSettingsEvent; + private int _networkInterfaceIndex; public int ResolutionScale { @@ -240,6 +244,11 @@ namespace Ryujinx.Ava.UI.ViewModels public AvaloniaList<string> GameDirectories { get; set; } public ObservableCollection<ComboBoxItem> AvailableGpus { get; set; } + public AvaloniaList<string> NetworkInterfaceList + { + get => new AvaloniaList<string>(_networkInterfaces.Keys); + } + public KeyboardHotkeys KeyboardHotkeys { get => _keyboardHotkeys; @@ -251,6 +260,16 @@ namespace Ryujinx.Ava.UI.ViewModels } } + public int NetworkInterfaceIndex + { + get => _networkInterfaceIndex; + set + { + _networkInterfaceIndex = value != -1 ? value : 0; + ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value = _networkInterfaces[NetworkInterfaceList[_networkInterfaceIndex]]; + } + } + public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this() { _virtualFileSystem = virtualFileSystem; @@ -267,8 +286,10 @@ namespace Ryujinx.Ava.UI.ViewModels TimeZones = new AvaloniaList<TimeZone>(); AvailableGpus = new ObservableCollection<ComboBoxItem>(); _validTzRegions = new List<string>(); + _networkInterfaces = new Dictionary<string, string>(); CheckSoundBackends(); + PopulateNetworkInterfaces(); if (Program.PreviewerDetached) { @@ -327,6 +348,17 @@ namespace Ryujinx.Ava.UI.ViewModels } } + private void PopulateNetworkInterfaces() + { + _networkInterfaces.Clear(); + _networkInterfaces.Add(LocaleManager.Instance[LocaleKeys.NetworkInterfaceDefault], "0"); + + foreach (NetworkInterface networkInterface in NetworkInterface.GetAllNetworkInterfaces()) + { + _networkInterfaces.Add(networkInterface.Name, networkInterface.Id); + } + } + public void ValidateAndSetTimeZone(string location) { if (_validTzRegions.Contains(location)) @@ -414,6 +446,8 @@ namespace Ryujinx.Ava.UI.ViewModels EnableFsAccessLog = config.Logger.EnableFsAccessLog; FsGlobalAccessLogMode = config.System.FsGlobalAccessLogMode; OpenglDebugLevel = (int)config.Logger.GraphicsDebugLevel.Value; + + NetworkInterfaceIndex = _networkInterfaces.Values.ToList().IndexOf(config.Multiplayer.LanInterfaceId.Value); } public void SaveSettings() @@ -515,6 +549,8 @@ namespace Ryujinx.Ava.UI.ViewModels config.System.FsGlobalAccessLogMode.Value = FsGlobalAccessLogMode; config.Logger.GraphicsDebugLevel.Value = (GraphicsDebugLevel)OpenglDebugLevel; + config.Multiplayer.LanInterfaceId.Value = _networkInterfaces[NetworkInterfaceList[NetworkInterfaceIndex]]; + config.ToFileFormat().SaveConfig(Program.ConfigurationPath); MainWindow.UpdateGraphicsConfig(); diff --git a/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml b/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml index 8efd367d..ab8a7f6d 100644 --- a/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml +++ b/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml @@ -1,4 +1,4 @@ -<UserControl +<UserControl x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsNetworkView" xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" @@ -29,7 +29,18 @@ <TextBlock Text="{locale:Locale SettingsTabSystemEnableInternetAccess}" ToolTip.Tip="{locale:Locale EnableInternetAccessTooltip}" /> </CheckBox> + <StackPanel Margin="10,0,0,0" Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center" + Text="{locale:Locale SettingsTabNetworkInterface}" + ToolTip.Tip="{locale:Locale NetworkInterfaceTooltip}" + Width="200" /> + <ComboBox SelectedIndex="{Binding NetworkInterfaceIndex}" + ToolTip.Tip="{locale:Locale NetworkInterfaceTooltip}" + HorizontalContentAlignment="Left" + Items="{Binding NetworkInterfaceList}" + Width="250" /> + </StackPanel> </StackPanel> </Border> </ScrollViewer> -</UserControl>
\ No newline at end of file +</UserControl> |
