mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-02-25 18:21:08 +00:00
Compare commits
3 Commits
Canary-1.3
...
1.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d83dfd19c | ||
|
|
ce31a47934 | ||
|
|
d31d1f91cf |
@@ -6672,6 +6672,31 @@
|
||||
"zh_TW": "輸入"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "SettingsTabInputUseGlobalInput",
|
||||
"Translations": {
|
||||
"ar_SA": "إدخال عالمي",
|
||||
"de_DE": "Globale Eingabe",
|
||||
"el_GR": "Παγκόσμια εισαγωγή",
|
||||
"en_US": "Global Input",
|
||||
"es_ES": "Entrada Global",
|
||||
"fr_FR": "Saisie Globale",
|
||||
"he_IL": "קלט גלובלי",
|
||||
"it_IT": "Input Globale",
|
||||
"ja_JP": "グローバル入力",
|
||||
"ko_KR": "글로벌 입력",
|
||||
"no_NO": "Global Inndata",
|
||||
"pl_PL": "Globalny Wpis",
|
||||
"pt_BR": "Entrada Global",
|
||||
"ru_RU": "Глобальный Ввод",
|
||||
"sv_SE": "Global Input",
|
||||
"th_TH": "การป้อนข้อมูลแบบโกลบอล",
|
||||
"tr_TR": "Küresel Girdi",
|
||||
"uk_UA": "Глобальний Ввід",
|
||||
"zh_CN": "全局输入",
|
||||
"zh_TW": "全域輸入"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "SettingsTabInputEnableDockedMode",
|
||||
"Translations": {
|
||||
@@ -16547,6 +16572,31 @@
|
||||
"zh_TW": "瀏覽自訂 GUI 佈景主題"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "UseGlobalInputTooltip",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "If this option is enabled in custom settings, the global input configuration will be used.\n\nIn the global settings: you can enable or disable it as needed; this setting will be inherited by any new custom configurations created.",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "Если эта опция включена в пользовательских настройках, будет использована глобальная конфигурация ввода.\n\nВ глобальных настройках: переключите эту опцию по своему усмотрению, это будет унаследовано для вновь созданых пользовательских конфигураций",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "DockModeToggleTooltip",
|
||||
"Translations": {
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Ryujinx.Ava
|
||||
public static string Version { get; private set; }
|
||||
public static string ConfigurationPath { get; private set; }
|
||||
public static string GlobalConfigurationPath { get; private set; }
|
||||
public static bool UseExtraConfig { get; set; }
|
||||
public static bool PreviewerDetached { get; private set; }
|
||||
public static bool UseHardwareAcceleration { get; private set; }
|
||||
public static string BackendThreadingArg { get; private set; }
|
||||
@@ -159,7 +160,8 @@ namespace Ryujinx.Ava
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetDirGameUserConfig(string gameId, bool rememberGlobalDir = false, bool changeFolderForGame = false)
|
||||
|
||||
public static string GetDirGameUserConfig(string gameId, bool changeFolderForGame = false)
|
||||
{
|
||||
if (string.IsNullOrEmpty(gameId))
|
||||
{
|
||||
@@ -168,15 +170,10 @@ namespace Ryujinx.Ava
|
||||
|
||||
string gameDir = Path.Combine(AppDataManager.GamesDirPath, gameId, ReleaseInformation.ConfigName);
|
||||
|
||||
// Should load with the game if there is a custom setting for the game
|
||||
if (rememberGlobalDir)
|
||||
{
|
||||
GlobalConfigurationPath = ConfigurationPath;
|
||||
}
|
||||
|
||||
if (changeFolderForGame)
|
||||
{
|
||||
ConfigurationPath = gameDir;
|
||||
UseExtraConfig = true;
|
||||
}
|
||||
|
||||
return gameDir;
|
||||
@@ -184,8 +181,6 @@ namespace Ryujinx.Ava
|
||||
|
||||
public static void ReloadConfig()
|
||||
{
|
||||
//It is necessary that when a user setting appears, the global setting remains available
|
||||
GlobalConfigurationPath = null;
|
||||
|
||||
string localConfigurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ReleaseInformation.ConfigName);
|
||||
string appDataConfigurationPath = Path.Combine(AppDataManager.BaseDirPath, ReleaseInformation.ConfigName);
|
||||
@@ -225,6 +220,12 @@ namespace Ryujinx.Ava
|
||||
}
|
||||
}
|
||||
|
||||
// When you first load the program, copy to remember the path for the global configuration
|
||||
if (GlobalConfigurationPath == null)
|
||||
{
|
||||
GlobalConfigurationPath = ConfigurationPath;
|
||||
}
|
||||
|
||||
UseHardwareAcceleration = ConfigurationState.Instance.EnableHardwareAcceleration;
|
||||
|
||||
// Check if graphics backend was overridden
|
||||
|
||||
@@ -461,7 +461,15 @@ namespace Ryujinx.Ava.Systems
|
||||
|
||||
DisplaySleep.Prevent();
|
||||
|
||||
NpadManager.Initialize(Device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
if (ConfigurationState.Instance.System.UseInputGlobalConfig.Value && Program.UseExtraConfig)
|
||||
{
|
||||
NpadManager.Initialize(Device, ConfigurationState.InstanceExtra.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
}
|
||||
else
|
||||
{
|
||||
NpadManager.Initialize(Device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
}
|
||||
|
||||
TouchScreenManager.Initialize(Device);
|
||||
|
||||
_viewModel.IsGameRunning = true;
|
||||
|
||||
@@ -556,7 +556,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary
|
||||
data.Favorite = appMetadata.Favorite;
|
||||
data.TimePlayed = appMetadata.TimePlayed;
|
||||
data.LastPlayed = appMetadata.LastPlayed;
|
||||
data.HasIndependentConfiguration = File.Exists(Program.GetDirGameUserConfig(data.IdBaseString, false, false)); // Just check user config
|
||||
data.HasIndependentConfiguration = File.Exists(Program.GetDirGameUserConfig(data.IdBaseString)); // Just check user config
|
||||
}
|
||||
|
||||
data.FileExtension = Path.GetExtension(applicationPath).TrimStart('.').ToUpper();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
/// <summary>
|
||||
/// The current version of the file format
|
||||
/// </summary>
|
||||
public const int CurrentVersion = 69;
|
||||
public const int CurrentVersion = 70;
|
||||
|
||||
/// <summary>
|
||||
/// Version of the configuration file format
|
||||
@@ -152,6 +152,11 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
/// </summary>
|
||||
public bool MatchSystemTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable use global input config (Independent from controllers binding)
|
||||
/// </summary>
|
||||
public bool UseInputGlobalConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Docked Mode
|
||||
/// </summary>
|
||||
|
||||
@@ -90,6 +90,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
System.TimeZone.Value = cff.SystemTimeZone;
|
||||
System.SystemTimeOffset.Value = shouldLoadFromFile ? cff.SystemTimeOffset : System.SystemTimeOffset.Value; // Get from global config only
|
||||
System.MatchSystemTime.Value = shouldLoadFromFile ? cff.MatchSystemTime : System.MatchSystemTime.Value; // Get from global config only
|
||||
System.UseInputGlobalConfig.Value = cff.UseInputGlobalConfig;
|
||||
System.EnableDockedMode.Value = cff.DockedMode;
|
||||
System.EnablePtc.Value = cff.EnablePtc;
|
||||
System.EnableLowPowerPtc.Value = cff.EnableLowPowerPtc;
|
||||
@@ -146,7 +147,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
Hid.EnableMouse.Value = cff.EnableMouse;
|
||||
Hid.DisableInputWhenOutOfFocus.Value = shouldLoadFromFile ? cff.DisableInputWhenOutOfFocus : Hid.DisableInputWhenOutOfFocus.Value; // Get from global config only
|
||||
Hid.Hotkeys.Value = shouldLoadFromFile ? cff.Hotkeys : Hid.Hotkeys.Value; // Get from global config only
|
||||
Hid.InputConfig.Value = cff.InputConfig ?? [];
|
||||
Hid.InputConfig.Value = cff.InputConfig ?? [] ;
|
||||
Hid.RainbowSpeed.Value = cff.RainbowSpeed;
|
||||
|
||||
Multiplayer.LanInterfaceId.Value = cff.MultiplayerLanInterfaceId;
|
||||
|
||||
@@ -326,6 +326,12 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> MatchSystemTime { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable use global input config (Independent from controllers binding)
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> UseInputGlobalConfig { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Docked Mode
|
||||
/// </summary>
|
||||
@@ -417,6 +423,8 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
SystemTimeOffset.LogChangesToValue(nameof(SystemTimeOffset));
|
||||
MatchSystemTime = new ReactiveObject<bool>();
|
||||
MatchSystemTime.LogChangesToValue(nameof(MatchSystemTime));
|
||||
UseInputGlobalConfig = new ReactiveObject<bool>();
|
||||
UseInputGlobalConfig.LogChangesToValue(nameof(UseInputGlobalConfig));
|
||||
EnableDockedMode = new ReactiveObject<bool>();
|
||||
EnableDockedMode.LogChangesToValue(nameof(EnableDockedMode));
|
||||
EnablePtc = new ReactiveObject<bool>();
|
||||
@@ -761,6 +769,8 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
/// </summary>
|
||||
public static ConfigurationState Instance { get; private set; }
|
||||
|
||||
public static ConfigurationState InstanceExtra{ get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The UI section
|
||||
/// </summary>
|
||||
|
||||
@@ -15,12 +15,13 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
if (Instance != null)
|
||||
if (Instance != null || InstanceExtra!= null)
|
||||
{
|
||||
throw new InvalidOperationException("Configuration is already initialized");
|
||||
}
|
||||
|
||||
Instance = new ConfigurationState();
|
||||
InstanceExtra= new ConfigurationState();
|
||||
}
|
||||
|
||||
public ConfigurationFileFormat ToFileFormat()
|
||||
@@ -54,6 +55,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
SystemTimeZone = System.TimeZone,
|
||||
SystemTimeOffset = System.SystemTimeOffset,
|
||||
MatchSystemTime = System.MatchSystemTime,
|
||||
UseInputGlobalConfig = System.UseInputGlobalConfig,
|
||||
DockedMode = System.EnableDockedMode,
|
||||
EnableDiscordIntegration = EnableDiscordIntegration,
|
||||
UpdateCheckerType = UpdateCheckerType,
|
||||
@@ -178,6 +180,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
||||
System.Region.Value = Region.USA;
|
||||
System.TimeZone.Value = "UTC";
|
||||
System.SystemTimeOffset.Value = 0;
|
||||
System.UseInputGlobalConfig.Value = false;
|
||||
System.EnableDockedMode.Value = true;
|
||||
EnableDiscordIntegration.Value = true;
|
||||
UpdateCheckerType.Value = UpdaterType.PromptAtStartup;
|
||||
|
||||
@@ -50,6 +50,9 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
private string _controllerImage;
|
||||
private int _device;
|
||||
private object _configViewModel;
|
||||
private bool _isChangeTrackingActive;
|
||||
private string _chosenProfile;
|
||||
[ObservableProperty] private bool _isModified;
|
||||
[ObservableProperty] private string _profileName;
|
||||
[ObservableProperty] private bool _notificationIsVisible; // Automatically call the NotificationView property with OnPropertyChanged()
|
||||
[ObservableProperty] private string _notificationText; // Automatically call the NotificationText property with OnPropertyChanged()
|
||||
@@ -84,6 +87,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
public AvaloniaList<string> ProfilesList { get; set; }
|
||||
public AvaloniaList<string> DeviceList { get; set; }
|
||||
|
||||
public bool UseGlobalConfig;
|
||||
|
||||
// XAML Flags
|
||||
public bool ShowSettings => _device > 0;
|
||||
public bool IsController => _device > 1;
|
||||
@@ -94,31 +99,16 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
public bool HasLed => SelectedGamepad.Features.HasFlag(GamepadFeaturesFlag.Led);
|
||||
public bool CanClearLed => SelectedGamepad.Name.ContainsIgnoreCase("DualSense");
|
||||
|
||||
public bool _isChangeTrackingActive;
|
||||
|
||||
public bool _isModified;
|
||||
|
||||
public bool IsModified
|
||||
{
|
||||
get => _isModified;
|
||||
set
|
||||
{
|
||||
_isModified = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event Action NotifyChangesEvent;
|
||||
|
||||
public string _profileChoose;
|
||||
public string ProfileChoose
|
||||
|
||||
public string ChosenProfile
|
||||
{
|
||||
get => _profileChoose;
|
||||
get => _chosenProfile;
|
||||
set
|
||||
{
|
||||
// When you select a profile, the settings from the profile will be applied.
|
||||
// To save the settings, you still need to click the apply button
|
||||
_profileChoose = value;
|
||||
_chosenProfile = value;
|
||||
LoadProfile();
|
||||
OnPropertyChanged();
|
||||
}
|
||||
@@ -290,7 +280,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
|
||||
public InputConfig Config { get; set; }
|
||||
|
||||
public InputViewModel(UserControl owner) : this()
|
||||
public InputViewModel(UserControl owner, bool useGlobal = false) : this()
|
||||
{
|
||||
if (Program.PreviewerDetached)
|
||||
{
|
||||
@@ -303,6 +293,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
|
||||
_mainWindow.ViewModel.AppHost?.NpadManager.BlockInputUpdates();
|
||||
|
||||
UseGlobalConfig = useGlobal;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
LoadDevices();
|
||||
@@ -335,9 +327,18 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
PlayerIndexes.Add(new(PlayerIndex.Handheld, LocaleManager.Instance[LocaleKeys.ControllerSettingsHandheld]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void LoadConfiguration(InputConfig inputConfig = null)
|
||||
{
|
||||
Config = inputConfig ?? ConfigurationState.Instance.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId);
|
||||
if (UseGlobalConfig && Program.UseExtraConfig)
|
||||
{
|
||||
Config = inputConfig ?? ConfigurationState.InstanceExtra.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
Config = inputConfig ?? ConfigurationState.Instance.Hid.InputConfig.Value.FirstOrDefault(inputConfig => inputConfig.PlayerIndex == _playerId);
|
||||
}
|
||||
|
||||
if (Config is StandardKeyboardInputConfig keyboardInputConfig)
|
||||
{
|
||||
@@ -902,7 +903,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
|
||||
LoadProfiles();
|
||||
|
||||
ProfileChoose = ProfileName; // Show new profile
|
||||
ChosenProfile = ProfileName; // Show new profile
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -936,7 +937,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
|
||||
LoadProfiles();
|
||||
|
||||
ProfileChoose = ProfilesList[0].ToString(); // Show default profile
|
||||
ChosenProfile = ProfilesList[0].ToString(); // Show default profile
|
||||
}
|
||||
}
|
||||
|
||||
@@ -966,7 +967,14 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
|
||||
List<InputConfig> newConfig = [];
|
||||
|
||||
newConfig.AddRange(ConfigurationState.Instance.Hid.InputConfig.Value);
|
||||
if (UseGlobalConfig && Program.UseExtraConfig)
|
||||
{
|
||||
newConfig.AddRange(ConfigurationState.InstanceExtra.Hid.InputConfig.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
newConfig.AddRange(ConfigurationState.Instance.Hid.InputConfig.Value);
|
||||
}
|
||||
|
||||
newConfig.Remove(newConfig.FirstOrDefault(x => x == null));
|
||||
|
||||
@@ -1007,18 +1015,21 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
}
|
||||
}
|
||||
|
||||
_mainWindow.ViewModel.AppHost?.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
|
||||
// Atomically replace and signal input change.
|
||||
// NOTE: Do not modify InputConfig.Value directly as other code depends on the on-change event.
|
||||
ConfigurationState.Instance.Hid.InputConfig.Value = newConfig;
|
||||
_mainWindow.ViewModel.AppHost?.NpadManager.ReloadConfiguration(newConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse);
|
||||
|
||||
ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath);
|
||||
}
|
||||
|
||||
public void NotifyChange(string property)
|
||||
{
|
||||
OnPropertyChanged(property);
|
||||
if (UseGlobalConfig && Program.UseExtraConfig)
|
||||
{
|
||||
// In User Settings when "Use Global Input" is enabled, it saves global input to global setting
|
||||
ConfigurationState.InstanceExtra.Hid.InputConfig.Value = newConfig;
|
||||
ConfigurationState.InstanceExtra.ToFileFormat().SaveConfig(Program.GlobalConfigurationPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConfigurationState.Instance.Hid.InputConfig.Value = newConfig;
|
||||
ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath);
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyChanges()
|
||||
|
||||
@@ -1575,28 +1575,31 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
public bool InitializeUserConfig(ApplicationData application)
|
||||
{
|
||||
// Code where conditions will be met before loading the user configuration (Global Config)
|
||||
string BackendThreadingInit = Program.BackendThreadingArg;
|
||||
|
||||
BackendThreadingInit ??= ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString();
|
||||
string backendThreadingInit = Program.BackendThreadingArg ?? ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString();
|
||||
|
||||
// If a configuration is found in the "/games/xxxxxxxxxxxxxx" folder, the program will load the user setting.
|
||||
string idGame = application.IdBaseString;
|
||||
if (ConfigurationFileFormat.TryLoad(Program.GetDirGameUserConfig(idGame), out ConfigurationFileFormat configurationFileFormat))
|
||||
{
|
||||
// Loads the user configuration, having previously changed the global configuration to the user configuration
|
||||
ConfigurationState.Instance.Load(configurationFileFormat, Program.GetDirGameUserConfig(idGame, true, true), idGame);
|
||||
// Loads the user configuration, having previously changed the global configuration to the user configuration
|
||||
ConfigurationState.Instance.Load(configurationFileFormat, Program.GetDirGameUserConfig(idGame, true), idGame);
|
||||
|
||||
if (ConfigurationFileFormat.TryLoad(Program.GlobalConfigurationPath, out ConfigurationFileFormat configurationFileFormatExtra))
|
||||
{
|
||||
//This is where the global configuration will be stored.
|
||||
//This allows you to change the global configuration settings during the game (for example, the global input setting)
|
||||
ConfigurationState.InstanceExtra.Load(configurationFileFormatExtra, Program.GlobalConfigurationPath);
|
||||
}
|
||||
}
|
||||
|
||||
// Code where conditions will be executed after loading user configuration
|
||||
if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != BackendThreadingInit)
|
||||
if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != backendThreadingInit)
|
||||
{
|
||||
|
||||
List<string> Arguments = new()
|
||||
{
|
||||
"--bt", ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() // BackendThreading
|
||||
};
|
||||
|
||||
Rebooter.RebootAppWithGame(application.Path, Arguments);
|
||||
Rebooter.RebootAppWithGame(application.Path,
|
||||
[
|
||||
"--bt",
|
||||
ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString()
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1991,7 +1994,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
// just checking for file presence
|
||||
viewModel.SelectedApplication.HasIndependentConfiguration = File.Exists(
|
||||
Program.GetDirGameUserConfig(viewModel.SelectedApplication.IdString, false, false));
|
||||
Program.GetDirGameUserConfig(viewModel.SelectedApplication.IdString));
|
||||
|
||||
viewModel.RefreshView();
|
||||
});
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
[ObservableProperty] private bool _isVulkanAvailable = true;
|
||||
[ObservableProperty] private bool _gameListNeedsRefresh;
|
||||
private readonly List<string> _gpuIds = [];
|
||||
public bool _useInputGlobalConfig;
|
||||
private int _graphicsBackendIndex;
|
||||
private int _scalingFilter;
|
||||
private int _scalingFilterLevel;
|
||||
@@ -64,6 +65,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
public event Action CloseWindow;
|
||||
public event Action SaveSettingsEvent;
|
||||
public event Action<bool> LocalGlobalInputSwitchEvent;
|
||||
private int _networkInterfaceIndex;
|
||||
private int _multiplayerModeIndex;
|
||||
private string _ldnPassphrase;
|
||||
@@ -84,6 +86,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
public bool IsGameTitleNotNull => !string.IsNullOrEmpty(GameTitle);
|
||||
public double PanelOpacity => IsGameTitleNotNull ? 0.5 : 1;
|
||||
|
||||
|
||||
public int ResolutionScale
|
||||
{
|
||||
get => _resolutionScale;
|
||||
@@ -141,13 +144,26 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
public bool EnableDockedMode { get; set; }
|
||||
public bool EnableKeyboard { get; set; }
|
||||
public bool EnableMouse { get; set; }
|
||||
public bool DisableInputWhenOutOfFocus { get; set; }
|
||||
|
||||
public bool DisableInputWhenOutOfFocus { get; set; }
|
||||
public int FocusLostActionType { get; set; }
|
||||
|
||||
public bool UseGlobalInputConfig
|
||||
{
|
||||
get => _useInputGlobalConfig;
|
||||
set
|
||||
{
|
||||
_useInputGlobalConfig = value;
|
||||
LocalGlobalInputSwitchEvent?.Invoke(_useInputGlobalConfig);
|
||||
OnPropertyChanged(nameof(InputPanelOpacity));
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public double InputPanelOpacity => UseGlobalInputConfig ? 0.5 : 1;
|
||||
|
||||
public VSyncMode VSyncMode
|
||||
{
|
||||
get => _vSyncMode;
|
||||
get => _vSyncMode;
|
||||
set
|
||||
{
|
||||
if (value is VSyncMode.Custom or VSyncMode.Switch or VSyncMode.Unbounded)
|
||||
@@ -371,7 +387,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
public bool IsInvalidLdnPassphraseVisible { get; set; }
|
||||
|
||||
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this(false)
|
||||
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
||||
{
|
||||
_virtualFileSystem = virtualFileSystem;
|
||||
_contentManager = contentManager;
|
||||
@@ -392,7 +408,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
string gameName,
|
||||
string gameId,
|
||||
byte[] gameIconData,
|
||||
bool enableToLoadCustomConfig) : this(enableToLoadCustomConfig)
|
||||
bool customConfig) : this()
|
||||
{
|
||||
_virtualFileSystem = virtualFileSystem;
|
||||
_contentManager = contentManager;
|
||||
@@ -408,9 +424,18 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
_gameTitle = gameName;
|
||||
_gameId = gameId;
|
||||
|
||||
if (enableToLoadCustomConfig) // During the game. If there is no user config, then load the global config window
|
||||
if (customConfig) // During the game. If there is no user config, then load the global config window
|
||||
{
|
||||
string gameDir = Program.GetDirGameUserConfig(gameId, false, true);
|
||||
string gameDir = Program.GetDirGameUserConfig(gameId, true);
|
||||
|
||||
Program.UseExtraConfig = true;
|
||||
|
||||
if (ConfigurationFileFormat.TryLoad(Program.GlobalConfigurationPath, out ConfigurationFileFormat configurationFileFormatExtra))
|
||||
{
|
||||
// Extra load global configuration for input setting and save global input setting with other global config
|
||||
ConfigurationState.InstanceExtra.Load(configurationFileFormatExtra, Program.GlobalConfigurationPath);
|
||||
}
|
||||
|
||||
if (ConfigurationFileFormat.TryLoad(gameDir, out ConfigurationFileFormat configurationFileFormat))
|
||||
{
|
||||
ConfigurationState.Instance.Load(configurationFileFormat, gameDir, gameId);
|
||||
@@ -426,7 +451,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public SettingsViewModel(bool noLoadGlobalConfig = false)
|
||||
public SettingsViewModel()
|
||||
{
|
||||
GameDirectories = [];
|
||||
AutoloadDirectories = [];
|
||||
@@ -550,9 +575,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadCurrentConfiguration()
|
||||
public void LoadCurrentConfiguration(bool global = false)
|
||||
{
|
||||
ConfigurationState config = ConfigurationState.Instance;
|
||||
ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance;
|
||||
|
||||
// User Interface
|
||||
EnableDiscordIntegration = config.EnableDiscordIntegration;
|
||||
@@ -578,6 +603,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
};
|
||||
|
||||
// Input
|
||||
UseGlobalInputConfig = config.System.UseInputGlobalConfig;
|
||||
EnableDockedMode = config.System.EnableDockedMode;
|
||||
EnableKeyboard = config.Hid.EnableKeyboard;
|
||||
EnableMouse = config.Hid.EnableMouse;
|
||||
@@ -660,9 +686,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
LdnServer = config.Multiplayer.LdnServer;
|
||||
}
|
||||
|
||||
public void SaveSettings()
|
||||
public void SaveSettings(bool global = false)
|
||||
{
|
||||
ConfigurationState config = ConfigurationState.Instance;
|
||||
ConfigurationState config = global ? ConfigurationState.InstanceExtra: ConfigurationState.Instance;
|
||||
|
||||
// User Interface
|
||||
config.EnableDiscordIntegration.Value = EnableDiscordIntegration;
|
||||
@@ -684,6 +710,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
};
|
||||
|
||||
// Input
|
||||
config.System.UseInputGlobalConfig.Value = UseGlobalInputConfig;
|
||||
config.System.EnableDockedMode.Value = EnableDockedMode;
|
||||
config.Hid.EnableKeyboard.Value = EnableKeyboard;
|
||||
config.Hid.EnableMouse.Value = EnableMouse;
|
||||
@@ -796,11 +823,14 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
private static void RevertIfNotSaved()
|
||||
{
|
||||
// maybe this is an unnecessary check(all options need to be tested)
|
||||
/*
|
||||
maybe this is an unnecessary check(all options need to be tested)
|
||||
if (string.IsNullOrEmpty(Program.GlobalConfigurationPath))
|
||||
{
|
||||
Program.ReloadConfig();
|
||||
}
|
||||
*/
|
||||
Program.ReloadConfig();
|
||||
}
|
||||
|
||||
public void ApplyButton()
|
||||
@@ -810,7 +840,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
|
||||
public void DeleteConfigGame()
|
||||
{
|
||||
string gameDir = Program.GetDirGameUserConfig(GameId, false, false);
|
||||
string gameDir = Program.GetDirGameUserConfig(GameId);
|
||||
|
||||
if (File.Exists(gameDir))
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
Name="ProfileBox"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
SelectedItem="{Binding ProfileChoose, Mode=TwoWay}"
|
||||
SelectedItem="{Binding ChosenProfile, Mode=TwoWay}"
|
||||
SelectionChanged="ComboBox_SelectionChanged"
|
||||
ItemsSource="{Binding ProfilesList}"
|
||||
Text="{Binding ProfileName, Mode=TwoWay}" />
|
||||
@@ -203,7 +203,6 @@
|
||||
</StackPanel>
|
||||
<ContentControl IsVisible="{Binding NotificationIsVisible}">
|
||||
<ContentControl.Content>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
Margin="5,20,0,0"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.UI.Controls;
|
||||
using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.UI.Models;
|
||||
@@ -14,7 +15,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
|
||||
public InputView()
|
||||
{
|
||||
ViewModel = new InputViewModel(this);
|
||||
ViewModel = new InputViewModel(this, ConfigurationState.Instance.System.UseInputGlobalConfig);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -24,6 +25,13 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
ViewModel.Save();
|
||||
}
|
||||
|
||||
public void ToggleLocalGlobalInput(bool enableConfigGlobal)
|
||||
{
|
||||
Dispose();
|
||||
ViewModel = new InputViewModel(this, enableConfigGlobal); // Create new Input Page with global input configs
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (PlayerIndexBox != null)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<UserControl
|
||||
<UserControl
|
||||
x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsInputView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -22,9 +22,16 @@
|
||||
<Panel
|
||||
Margin="10">
|
||||
<Grid RowDefinitions="Auto,*,Auto">
|
||||
<views:InputView
|
||||
Grid.Row="0"
|
||||
Name="InputView" />
|
||||
<StackPanel>
|
||||
<!--
|
||||
Opacity="{Binding PanelOpacityInput}">
|
||||
|
||||
IsEnabled="{Binding !EnableConfigGlobal}">
|
||||
-->
|
||||
<views:InputView
|
||||
Grid.Row="0"
|
||||
Name="InputView" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Orientation="Vertical"
|
||||
Grid.Row="2">
|
||||
@@ -34,6 +41,13 @@
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="10">
|
||||
<CheckBox
|
||||
ToolTip.Tip="{ext:Locale UseGlobalInputTooltip}"
|
||||
MinWidth="0"
|
||||
IsChecked="{Binding UseGlobalInputConfig}">
|
||||
<TextBlock
|
||||
Text="{ext:Locale SettingsTabInputUseGlobalInput}" />
|
||||
</CheckBox>
|
||||
<CheckBox
|
||||
ToolTip.Tip="{ext:Locale DockModeToggleTooltip}"
|
||||
MinWidth="0"
|
||||
|
||||
@@ -120,30 +120,34 @@
|
||||
IconSource="Code" />
|
||||
</ui:NavigationView.MenuItems>
|
||||
</ui:NavigationView>
|
||||
|
||||
<ReversibleStackPanel
|
||||
Grid.Row="2"
|
||||
Margin="10"
|
||||
Spacing="10"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
ReverseOrder="{x:Static helper:RunningPlatform.IsMacOS}">
|
||||
<Button
|
||||
Content="{ext:Locale SettingsButtonSave}"
|
||||
Command="{Binding SaveUserConfig}" />
|
||||
<Button
|
||||
HotKey="Escape"
|
||||
Content="{ext:Locale SettingsButtonClose}"
|
||||
Command="{Binding CancelButton}" />
|
||||
<Button
|
||||
IsVisible="{Binding IsGameRunning}"
|
||||
Content="{ext:Locale SettingsButtonApply}"
|
||||
Command="{Binding ApplyButton}" />
|
||||
<Button
|
||||
IsVisible="{Binding !IsGameRunning}"
|
||||
Content="{ext:Locale UserProfilesDelete}"
|
||||
Command="{Binding DeleteConfigGame}"
|
||||
Classes="red"/>
|
||||
</ReversibleStackPanel>
|
||||
<Grid Grid.Row="3"
|
||||
ColumnDefinitions="Auto,*,Auto">
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" Margin="10" Spacing="10">
|
||||
<Button
|
||||
IsVisible="{Binding !IsGameRunning}"
|
||||
Content="{ext:Locale UserProfilesDelete}"
|
||||
Command="{Binding DeleteConfigGame}"
|
||||
Classes="red"/>
|
||||
</StackPanel>
|
||||
<ReversibleStackPanel
|
||||
Grid.Column="2"
|
||||
Margin="10"
|
||||
Spacing="10"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
ReverseOrder="{x:Static helper:RunningPlatform.IsMacOS}">
|
||||
<Button
|
||||
Classes="accent"
|
||||
Content="{ext:Locale SettingsButtonSave}"
|
||||
Command="{Binding SaveUserConfig}" />
|
||||
<Button
|
||||
HotKey="Escape"
|
||||
Content="{ext:Locale SettingsButtonClose}"
|
||||
Command="{Binding CancelButton}" />
|
||||
<Button
|
||||
Content="{ext:Locale SettingsButtonApply}"
|
||||
Command="{Binding ApplyButton}" />
|
||||
</ReversibleStackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</window:StyleableAppWindow>
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
ViewModel.CloseWindow += Close;
|
||||
ViewModel.SaveSettingsEvent += SaveSettings;
|
||||
|
||||
ViewModel.LocalGlobalInputSwitchEvent += ToggleLocalGlobalInput;
|
||||
|
||||
InitializeComponent();
|
||||
Load();
|
||||
}
|
||||
@@ -37,6 +39,11 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
InputPage.InputView?.SaveCurrentProfile();
|
||||
}
|
||||
|
||||
public void ToggleLocalGlobalInput(bool enableConfigGlobal)
|
||||
{
|
||||
InputPage.InputView?.ToggleLocalGlobalInput(enableConfigGlobal);
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
Pages.Children.Clear();
|
||||
@@ -90,6 +97,7 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
|
||||
protected override void OnClosing(WindowClosingEventArgs e)
|
||||
{
|
||||
Program.UseExtraConfig = false;
|
||||
InputPage.Dispose(); // You need to unload the gamepad settings, otherwise the controls will be blocked
|
||||
base.OnClosing(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user