mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-15 15:10:33 +00:00
Add proxy related configuration and Avalonia settings UI
This commit is contained in:
parent
a8950d6ac4
commit
5ae0b84466
9 changed files with 164 additions and 16 deletions
|
@ -740,6 +740,9 @@ namespace Ryujinx.Ava
|
|||
ConfigurationState.Instance.System.EnableDockedMode,
|
||||
ConfigurationState.Instance.System.EnablePtc,
|
||||
ConfigurationState.Instance.System.EnableInternetAccess,
|
||||
ConfigurationState.Instance.System.EnableHttpProxy,
|
||||
ConfigurationState.Instance.System.HttpProxyIpAddress,
|
||||
ConfigurationState.Instance.System.HttpProxyPort,
|
||||
ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
|
||||
ConfigurationState.Instance.System.FsGlobalAccessLogMode,
|
||||
ConfigurationState.Instance.System.SystemTimeOffset,
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public event Action CloseWindow;
|
||||
public event Action SaveSettingsEvent;
|
||||
private int _networkInterfaceIndex;
|
||||
private bool _enableProxy;
|
||||
|
||||
public int ResolutionScale
|
||||
{
|
||||
|
@ -272,6 +273,19 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public bool EnableProxy
|
||||
{
|
||||
get => _enableProxy;
|
||||
set
|
||||
{
|
||||
_enableProxy = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string ProxyIpAddress { get; set; }
|
||||
public int ProxyPort { get; set; }
|
||||
|
||||
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
||||
{
|
||||
_virtualFileSystem = virtualFileSystem;
|
||||
|
@ -436,6 +450,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
// Network
|
||||
EnableInternetAccess = config.System.EnableInternetAccess;
|
||||
EnableProxy = config.System.EnableHttpProxy;
|
||||
ProxyIpAddress = config.System.HttpProxyIpAddress;
|
||||
ProxyPort = config.System.HttpProxyPort;
|
||||
|
||||
// Logging
|
||||
EnableFileLog = config.Logger.EnableFileLog;
|
||||
|
@ -536,6 +553,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
// Network
|
||||
config.System.EnableInternetAccess.Value = EnableInternetAccess;
|
||||
config.System.EnableHttpProxy.Value = EnableProxy;
|
||||
config.System.HttpProxyIpAddress.Value = ProxyIpAddress;
|
||||
config.System.HttpProxyPort.Value = ProxyPort;
|
||||
|
||||
// Logging
|
||||
config.Logger.EnableFileLog.Value = EnableFileLog;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
Orientation="Vertical"
|
||||
Spacing="10">
|
||||
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabNetworkConnection}" />
|
||||
<StackPanel Margin="10,0,0,0" Orientation="Vertical">
|
||||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding EnableInternetAccess}">
|
||||
<TextBlock Text="{locale:Locale SettingsTabSystemEnableInternetAccess}"
|
||||
ToolTip.Tip="{locale:Locale EnableInternetAccessTooltip}" />
|
||||
|
@ -41,6 +42,39 @@
|
|||
Width="250" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Separator Height="1" />
|
||||
<StackPanel Orientation="Vertical" Spacing="2">
|
||||
<TextBlock Classes="h1" Text="Proxy" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Orientation="Vertical">
|
||||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding EnableProxy}">
|
||||
<TextBlock Text="Proxy enabled"
|
||||
ToolTip.Tip="Sends all HTTP requests through the proxy server. Useful for intercepting network traffic and mocking responses." />
|
||||
</CheckBox>
|
||||
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
Text="Proxy address"
|
||||
ToolTip.Tip="IP address and port of your HTTP proxy server"
|
||||
Width="200" />
|
||||
<TextBox Margin="0,0,5,0"
|
||||
Text="{Binding ProxyIpAddress}"
|
||||
Width="250"
|
||||
Watermark="IP address"
|
||||
ToolTip.Tip="IP address"
|
||||
IsEnabled="{Binding EnableProxy}"/>
|
||||
<NumericUpDown Width="50"
|
||||
Value="{Binding ProxyPort}"
|
||||
ShowButtonSpinner="False"
|
||||
Minimum="0"
|
||||
Maximum="65535"
|
||||
ToolTip.Tip="Port"
|
||||
IsEnabled="{Binding EnableProxy}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
|
@ -102,6 +102,22 @@ namespace Ryujinx.HLE
|
|||
/// </summary>
|
||||
internal readonly bool EnableInternetAccess;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables sending HTTP requests through a proxy server
|
||||
/// </summary>
|
||||
internal readonly bool EnableHttpProxy;
|
||||
|
||||
/// <summary>
|
||||
/// IP address of HTTP proxy server
|
||||
/// </summary>
|
||||
internal readonly string HttpProxyIpAddress;
|
||||
|
||||
/// <summary>
|
||||
/// Port number of HTTP proxy server
|
||||
/// </summary>
|
||||
internal readonly int HttpProxyPort;
|
||||
|
||||
/// <summary>
|
||||
/// Control LibHac's integrity check level.
|
||||
/// </summary>
|
||||
|
@ -178,6 +194,9 @@ namespace Ryujinx.HLE
|
|||
bool enableDockedMode,
|
||||
bool enablePtc,
|
||||
bool enableInternetAccess,
|
||||
bool enableHttpProxy,
|
||||
string httpProxyIpAddress,
|
||||
int httpProxyPort,
|
||||
IntegrityCheckLevel fsIntegrityCheckLevel,
|
||||
int fsGlobalAccessLogMode,
|
||||
long systemTimeOffset,
|
||||
|
@ -204,6 +223,9 @@ namespace Ryujinx.HLE
|
|||
EnableDockedMode = enableDockedMode;
|
||||
EnablePtc = enablePtc;
|
||||
EnableInternetAccess = enableInternetAccess;
|
||||
EnableHttpProxy = enableHttpProxy;
|
||||
HttpProxyIpAddress = httpProxyIpAddress;
|
||||
HttpProxyPort = httpProxyPort;
|
||||
FsIntegrityCheckLevel = fsIntegrityCheckLevel;
|
||||
FsGlobalAccessLogMode = fsGlobalAccessLogMode;
|
||||
SystemTimeOffset = systemTimeOffset;
|
||||
|
|
|
@ -93,6 +93,15 @@ namespace Ryujinx.Headless.SDL2
|
|||
[Option("enable-internet-connection", Required = false, Default = false, HelpText = "Enables guest Internet connection.")]
|
||||
public bool EnableInternetAccess { get; set; }
|
||||
|
||||
[Option("enable-proxy-connection", Required = false, Default = false, HelpText = "Enables using proxy for http requests")]
|
||||
public bool EnableHttpProxy { get; set; }
|
||||
|
||||
[Option("proxy-ip", Required = false, Default = "127.0.0.1", HelpText = "IP address of HTTP proxy server")]
|
||||
public string HttpProxyIpAddress { get; set; }
|
||||
|
||||
[Option("proxy-port", Required = false, Default = 8080, HelpText = "Port number of HTTP proxy server")]
|
||||
public int HttpProxyPortNumber { get; set; }
|
||||
|
||||
[Option("disable-fs-integrity-checks", Required = false, HelpText = "Disables integrity checks on Game content files.")]
|
||||
public bool DisableFsIntegrityChecks { get; set; }
|
||||
|
||||
|
|
|
@ -542,6 +542,9 @@ namespace Ryujinx.Headless.SDL2
|
|||
!options.DisableDockedMode,
|
||||
!options.DisablePtc,
|
||||
options.EnableInternetAccess,
|
||||
options.EnableHttpProxy,
|
||||
options.HttpProxyIpAddress,
|
||||
options.HttpProxyPortNumber,
|
||||
!options.DisableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
|
||||
options.FsGlobalAccessLogMode,
|
||||
options.SystemTimeOffset,
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
/// <summary>
|
||||
/// The current version of the file format
|
||||
/// </summary>
|
||||
public const int CurrentVersion = 47;
|
||||
public const int CurrentVersion = 48;
|
||||
|
||||
/// <summary>
|
||||
/// Version of the configuration file format
|
||||
|
@ -196,6 +196,22 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
/// </summary>
|
||||
public bool EnableInternetAccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables sending HTTP requests through a proxy server
|
||||
/// </summary>
|
||||
public bool EnableHttpProxy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP address of HTTP proxy server
|
||||
/// </summary>
|
||||
public string HttpProxyIpAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Port number of HTTP proxy server
|
||||
/// </summary>
|
||||
public int HttpProxyPort { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enables integrity checks on Game content files
|
||||
/// </summary>
|
||||
|
|
|
@ -323,6 +323,21 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
/// </summary>
|
||||
public ReactiveObject<bool> EnableInternetAccess { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables sending HTTP requests through a proxy server
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableHttpProxy { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP address of HTTP proxy server
|
||||
/// </summary>
|
||||
public ReactiveObject<string> HttpProxyIpAddress { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Port number of HTTP proxy server
|
||||
/// </summary>
|
||||
public ReactiveObject<int> HttpProxyPort { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables integrity checks on Game content files
|
||||
/// </summary>
|
||||
|
@ -375,6 +390,12 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
EnablePtc.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnablePtc));
|
||||
EnableInternetAccess = new ReactiveObject<bool>();
|
||||
EnableInternetAccess.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableInternetAccess));
|
||||
EnableHttpProxy = new ReactiveObject<bool>();
|
||||
EnableHttpProxy.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableHttpProxy));
|
||||
HttpProxyIpAddress = new ReactiveObject<string>();
|
||||
HttpProxyIpAddress.Event += static (sender, e) => LogValueChange(sender, e, nameof(HttpProxyIpAddress));
|
||||
HttpProxyPort = new ReactiveObject<int>();
|
||||
HttpProxyPort.Event += static (sender, e) => LogValueChange(sender, e, nameof(HttpProxyPort));
|
||||
EnableFsIntegrityChecks = new ReactiveObject<bool>();
|
||||
EnableFsIntegrityChecks.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableFsIntegrityChecks));
|
||||
FsGlobalAccessLogMode = new ReactiveObject<int>();
|
||||
|
@ -669,6 +690,9 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
EnableMacroHLE = Graphics.EnableMacroHLE,
|
||||
EnablePtc = System.EnablePtc,
|
||||
EnableInternetAccess = System.EnableInternetAccess,
|
||||
EnableHttpProxy = System.EnableHttpProxy,
|
||||
HttpProxyIpAddress = System.HttpProxyIpAddress,
|
||||
HttpProxyPort = System.HttpProxyPort,
|
||||
EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
|
||||
FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
|
||||
AudioBackend = System.AudioBackend,
|
||||
|
@ -1397,6 +1421,17 @@ 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 48.");
|
||||
|
||||
configurationFileFormat.EnableHttpProxy = false;
|
||||
configurationFileFormat.HttpProxyIpAddress = "127.0.0.1";
|
||||
configurationFileFormat.HttpProxyPort = 8080;
|
||||
|
||||
configurationFileUpdated = true;
|
||||
}
|
||||
|
||||
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
|
||||
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
||||
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
||||
|
@ -1434,6 +1469,9 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
Graphics.EnableMacroHLE.Value = configurationFileFormat.EnableMacroHLE;
|
||||
System.EnablePtc.Value = configurationFileFormat.EnablePtc;
|
||||
System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess;
|
||||
System.EnableHttpProxy.Value = configurationFileFormat.EnableHttpProxy;
|
||||
System.HttpProxyIpAddress.Value = configurationFileFormat.HttpProxyIpAddress;
|
||||
System.HttpProxyPort.Value = configurationFileFormat.HttpProxyPort;
|
||||
System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks;
|
||||
System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode;
|
||||
System.AudioBackend.Value = configurationFileFormat.AudioBackend;
|
||||
|
|
|
@ -585,6 +585,9 @@ namespace Ryujinx.Ui
|
|||
ConfigurationState.Instance.System.EnableDockedMode,
|
||||
ConfigurationState.Instance.System.EnablePtc,
|
||||
ConfigurationState.Instance.System.EnableInternetAccess,
|
||||
ConfigurationState.Instance.System.EnableHttpProxy,
|
||||
ConfigurationState.Instance.System.HttpProxyIpAddress,
|
||||
ConfigurationState.Instance.System.HttpProxyPort,
|
||||
fsIntegrityCheckLevel,
|
||||
ConfigurationState.Instance.System.FsGlobalAccessLogMode,
|
||||
ConfigurationState.Instance.System.SystemTimeOffset,
|
||||
|
|
Loading…
Reference in a new issue