diff --git a/src/Ryujinx.Input/HLE/NpadManager.cs b/src/Ryujinx.Input/HLE/NpadManager.cs index 07ff15328..b2e3b6cb7 100644 --- a/src/Ryujinx.Input/HLE/NpadManager.cs +++ b/src/Ryujinx.Input/HLE/NpadManager.cs @@ -189,6 +189,15 @@ namespace Ryujinx.Input.HLE } } + public bool InputUpdatesBlocked + { + get + { + lock (_lock) + return _blockInputUpdates; + } + } + public void BlockInputUpdates() { lock (_lock) diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs index b1ed01656..d6aa416f9 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs @@ -16,7 +16,7 @@ namespace Ryujinx.UI.Common.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 62; + public const int CurrentVersion = 63; /// /// Version of the configuration file format @@ -415,6 +415,11 @@ namespace Ryujinx.UI.Common.Configuration /// public bool EnableMouse { get; set; } + /// + /// Enable/disable the ability to control Ryujinx when it's not the currently focused window. + /// + public bool DisableInputWhenOutOfFocus { get; set; } + /// /// Hotkey Keyboard Bindings /// diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index e4f5cb58d..4566fd27f 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -477,6 +477,11 @@ namespace Ryujinx.UI.Common.Configuration /// public ReactiveObject EnableMouse { get; private set; } + /// + /// Enable/disable the ability to control Ryujinx when it's not the currently focused window. + /// + public ReactiveObject DisableInputWhenOutOfFocus { get; private set; } + /// /// Hotkey Keyboard Bindings /// @@ -493,6 +498,7 @@ namespace Ryujinx.UI.Common.Configuration { EnableKeyboard = new ReactiveObject(); EnableMouse = new ReactiveObject(); + DisableInputWhenOutOfFocus = new ReactiveObject(); Hotkeys = new ReactiveObject(); InputConfig = new ReactiveObject>(); } @@ -937,6 +943,7 @@ namespace Ryujinx.UI.Common.Configuration ShowConsole = UI.ShowConsole, EnableKeyboard = Hid.EnableKeyboard, EnableMouse = Hid.EnableMouse, + DisableInputWhenOutOfFocus = Hid.DisableInputWhenOutOfFocus, Hotkeys = Hid.Hotkeys, KeyboardConfig = [], ControllerConfig = [], @@ -1058,6 +1065,8 @@ namespace Ryujinx.UI.Common.Configuration UI.WindowStartup.WindowMaximized.Value = false; Hid.EnableKeyboard.Value = false; Hid.EnableMouse.Value = false; + Hid.DisableInputWhenOutOfFocus.Value = false; + Hid.Hotkeys.Value = new KeyboardHotkeys { ToggleVSyncMode = Key.F1, @@ -1823,6 +1832,15 @@ namespace Ryujinx.UI.Common.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 63) + { + Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 63."); + + configurationFileFormat.DisableInputWhenOutOfFocus = false; + + configurationFileUpdated = true; + } + Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog; Graphics.ResScale.Value = configurationFileFormat.ResScale; Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom; @@ -1922,6 +1940,7 @@ namespace Ryujinx.UI.Common.Configuration UI.WindowStartup.WindowMaximized.Value = configurationFileFormat.WindowStartup.WindowMaximized; Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard; Hid.EnableMouse.Value = configurationFileFormat.EnableMouse; + Hid.DisableInputWhenOutOfFocus.Value = configurationFileFormat.DisableInputWhenOutOfFocus; Hid.Hotkeys.Value = configurationFileFormat.Hotkeys; Hid.InputConfig.Value = configurationFileFormat.InputConfig; diff --git a/src/Ryujinx/Assets/Locales/de_DE.json b/src/Ryujinx/Assets/Locales/de_DE.json index 93652f82a..b52536247 100644 --- a/src/Ryujinx/Assets/Locales/de_DE.json +++ b/src/Ryujinx/Assets/Locales/de_DE.json @@ -108,6 +108,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "Beim Start nach Updates suchen", "SettingsTabGeneralShowConfirmExitDialog": "Zeige den \"Beenden bestätigen\"-Dialog", "SettingsTabGeneralRememberWindowState": "Fenstergröße/-position merken", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "Eingabe deaktivieren wenn nicht fokussiert", "SettingsTabGeneralHideCursor": "Mauszeiger ausblenden", "SettingsTabGeneralHideCursorNever": "Niemals", "SettingsTabGeneralHideCursorOnIdle": "Mauszeiger bei Inaktivität ausblenden", diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index f25332847..570d2727e 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -115,6 +115,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "Check for Updates on Launch", "SettingsTabGeneralShowConfirmExitDialog": "Show \"Confirm Exit\" Dialog", "SettingsTabGeneralRememberWindowState": "Remember Window Size/Position", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "Disable Input when Out of Focus", "SettingsTabGeneralHideCursor": "Hide Cursor:", "SettingsTabGeneralHideCursorNever": "Never", "SettingsTabGeneralHideCursorOnIdle": "On Idle", diff --git a/src/Ryujinx/Assets/Locales/es_ES.json b/src/Ryujinx/Assets/Locales/es_ES.json index ea752b834..bd552e85f 100644 --- a/src/Ryujinx/Assets/Locales/es_ES.json +++ b/src/Ryujinx/Assets/Locales/es_ES.json @@ -107,6 +107,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "Buscar actualizaciones al iniciar", "SettingsTabGeneralShowConfirmExitDialog": "Mostrar diálogo de confirmación al cerrar", "SettingsTabGeneralRememberWindowState": "Remember Window Size/Position", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "Desactivar la Entrada al Perder el Foco", "SettingsTabGeneralHideCursor": "Esconder el cursor:", "SettingsTabGeneralHideCursorNever": "Nunca", "SettingsTabGeneralHideCursorOnIdle": "Ocultar cursor cuando esté inactivo", diff --git a/src/Ryujinx/Assets/Locales/fr_FR.json b/src/Ryujinx/Assets/Locales/fr_FR.json index ddcef3442..64e6f0cbb 100644 --- a/src/Ryujinx/Assets/Locales/fr_FR.json +++ b/src/Ryujinx/Assets/Locales/fr_FR.json @@ -107,6 +107,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "Vérifier les mises à jour au démarrage", "SettingsTabGeneralShowConfirmExitDialog": "Afficher le message de \"Confirmation de sortie\"", "SettingsTabGeneralRememberWindowState": "Mémoriser la taille/position de la fenêtre", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "Désactiver la Saisie en cas de Perte de Focus", "SettingsTabGeneralHideCursor": "Masquer le Curseur :", "SettingsTabGeneralHideCursorNever": "Jamais", "SettingsTabGeneralHideCursorOnIdle": "Masquer le curseur si inactif", diff --git a/src/Ryujinx/Assets/Locales/it_IT.json b/src/Ryujinx/Assets/Locales/it_IT.json index 8cbe96bf2..a49aa15ff 100644 --- a/src/Ryujinx/Assets/Locales/it_IT.json +++ b/src/Ryujinx/Assets/Locales/it_IT.json @@ -114,6 +114,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "Controlla aggiornamenti all'avvio", "SettingsTabGeneralShowConfirmExitDialog": "Mostra dialogo \"Conferma Uscita\"", "SettingsTabGeneralRememberWindowState": "Ricorda la dimensione e la posizione della finestra", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "Disabilità Input quando fuori dal focus", "SettingsTabGeneralHideCursor": "Nascondi il cursore:", "SettingsTabGeneralHideCursorNever": "Mai", "SettingsTabGeneralHideCursorOnIdle": "Quando è inattivo", diff --git a/src/Ryujinx/Assets/Locales/ko_KR.json b/src/Ryujinx/Assets/Locales/ko_KR.json index abfcd9ea6..85d338180 100644 --- a/src/Ryujinx/Assets/Locales/ko_KR.json +++ b/src/Ryujinx/Assets/Locales/ko_KR.json @@ -109,6 +109,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "시작 시, 업데이트 확인", "SettingsTabGeneralShowConfirmExitDialog": "\"종료 확인\" 대화 상자 표시", "SettingsTabGeneralRememberWindowState": "창 크기/위치 기억", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "초점이 맞지 않으면 입력 비활성화", "SettingsTabGeneralHideCursor": "마우스 커서 숨기기", "SettingsTabGeneralHideCursorNever": "절대 안 함", "SettingsTabGeneralHideCursorOnIdle": "유휴 상태", diff --git a/src/Ryujinx/Assets/Locales/pt_BR.json b/src/Ryujinx/Assets/Locales/pt_BR.json index c9289e2a8..7fe7af5b5 100644 --- a/src/Ryujinx/Assets/Locales/pt_BR.json +++ b/src/Ryujinx/Assets/Locales/pt_BR.json @@ -109,6 +109,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "Verificar se há atualizações ao iniciar", "SettingsTabGeneralShowConfirmExitDialog": "Exibir diálogo de confirmação ao sair", "SettingsTabGeneralRememberWindowState": "Lembrar tamanho/posição da Janela", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "Desativar Controles Quando Estiver Fora de Foco", "SettingsTabGeneralHideCursor": "Esconder o cursor do mouse:", "SettingsTabGeneralHideCursorNever": "Nunca", "SettingsTabGeneralHideCursorOnIdle": "Esconder o cursor quando ocioso", diff --git a/src/Ryujinx/Assets/Locales/ru_RU.json b/src/Ryujinx/Assets/Locales/ru_RU.json index c600e31f9..506d13a4e 100644 --- a/src/Ryujinx/Assets/Locales/ru_RU.json +++ b/src/Ryujinx/Assets/Locales/ru_RU.json @@ -114,6 +114,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "Проверять наличие обновлений при запуске", "SettingsTabGeneralShowConfirmExitDialog": "Подтверждать выход из приложения", "SettingsTabGeneralRememberWindowState": "Запомнить размер/положение окна", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "Отключить ввод при потере фокуса", "SettingsTabGeneralHideCursor": "Скрывать курсор", "SettingsTabGeneralHideCursorNever": "Никогда", "SettingsTabGeneralHideCursorOnIdle": "В простое", diff --git a/src/Ryujinx/Assets/Locales/th_TH.json b/src/Ryujinx/Assets/Locales/th_TH.json index 6f9d504ff..ada700bba 100644 --- a/src/Ryujinx/Assets/Locales/th_TH.json +++ b/src/Ryujinx/Assets/Locales/th_TH.json @@ -107,6 +107,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "ตรวจหาการอัปเดตเมื่อเปิดโปรแกรม", "SettingsTabGeneralShowConfirmExitDialog": "แสดง \"ยืนยันการออก\" กล่องข้อความโต้ตอบ", "SettingsTabGeneralRememberWindowState": "Remember Window Size/Position", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "ปิดการพิมพ์เมื่อไม่ได้เลือกช่องอินพุต ไม่ให้กรอกข้อมูลเมื่อช่องอินพุตไม่อยู่ในโฟกัส", "SettingsTabGeneralHideCursor": "ซ่อน เคอร์เซอร์:", "SettingsTabGeneralHideCursorNever": "ไม่มี", "SettingsTabGeneralHideCursorOnIdle": "เมื่อไม่ได้ใช้", diff --git a/src/Ryujinx/Assets/Locales/uk_UA.json b/src/Ryujinx/Assets/Locales/uk_UA.json index 8e48e0016..42d103d26 100644 --- a/src/Ryujinx/Assets/Locales/uk_UA.json +++ b/src/Ryujinx/Assets/Locales/uk_UA.json @@ -109,6 +109,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "Перевіряти наявність оновлень під час запуску", "SettingsTabGeneralShowConfirmExitDialog": "Показати діалогове вікно «Підтвердити вихід».", "SettingsTabGeneralRememberWindowState": "Remember Window Size/Position", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "Вимкнути введення, якщо вікно неактивне", "SettingsTabGeneralHideCursor": "Сховати вказівник:", "SettingsTabGeneralHideCursorNever": "Ніколи", "SettingsTabGeneralHideCursorOnIdle": "Сховати у режимі очікування", diff --git a/src/Ryujinx/Assets/Locales/zh_CN.json b/src/Ryujinx/Assets/Locales/zh_CN.json index 016b0d85b..9671a68a5 100644 --- a/src/Ryujinx/Assets/Locales/zh_CN.json +++ b/src/Ryujinx/Assets/Locales/zh_CN.json @@ -109,6 +109,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "启动时检查更新", "SettingsTabGeneralShowConfirmExitDialog": "退出游戏时需要确认", "SettingsTabGeneralRememberWindowState": "记住窗口大小和位置", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "在后台时禁用输入", "SettingsTabGeneralHideCursor": "隐藏鼠标指针:", "SettingsTabGeneralHideCursorNever": "从不隐藏", "SettingsTabGeneralHideCursorOnIdle": "自动隐藏", diff --git a/src/Ryujinx/Assets/Locales/zh_TW.json b/src/Ryujinx/Assets/Locales/zh_TW.json index 5b975483b..5e29e8783 100644 --- a/src/Ryujinx/Assets/Locales/zh_TW.json +++ b/src/Ryujinx/Assets/Locales/zh_TW.json @@ -109,6 +109,7 @@ "SettingsTabGeneralCheckUpdatesOnLaunch": "啟動時檢查更新", "SettingsTabGeneralShowConfirmExitDialog": "顯示「確認結束」對話方塊", "SettingsTabGeneralRememberWindowState": "記住視窗大小/位置", + "SettingsTabGeneralDisableInputWhenOutOfFocus": "在「失去焦點」時停用輸入", "SettingsTabGeneralHideCursor": "隱藏滑鼠游標:", "SettingsTabGeneralHideCursorNever": "從不", "SettingsTabGeneralHideCursorOnIdle": "閒置時", diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 7df97eb14..7e3b34443 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -152,6 +152,8 @@ 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 VSyncMode VSyncMode { get => _vSyncMode; @@ -592,6 +594,7 @@ namespace Ryujinx.Ava.UI.ViewModels EnableDockedMode = config.System.EnableDockedMode; EnableKeyboard = config.Hid.EnableKeyboard; EnableMouse = config.Hid.EnableMouse; + DisableInputWhenOutOfFocus = config.Hid.DisableInputWhenOutOfFocus; // Keyboard Hotkeys KeyboardHotkey = new HotkeyConfig(config.Hid.Hotkeys.Value); @@ -715,6 +718,7 @@ namespace Ryujinx.Ava.UI.ViewModels config.System.EnableDockedMode.Value = EnableDockedMode; config.Hid.EnableKeyboard.Value = EnableKeyboard; config.Hid.EnableMouse.Value = EnableMouse; + config.Hid.DisableInputWhenOutOfFocus.Value = DisableInputWhenOutOfFocus; // Keyboard Hotkeys config.Hid.Hotkeys.Value = KeyboardHotkey.GetConfig(); diff --git a/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml index b50696a10..cd3bf41e4 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml @@ -39,6 +39,9 @@ + + + + Focusable="True" + GotFocus="AppWindow_OnGotFocus" + LostFocus="AppWindow_OnLostFocus">