From 768406cb67ef91630d571ec1353c9715708c9c89 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Mon, 3 Mar 2025 12:42:00 -0600 Subject: [PATCH] Improve description of Turbo Mode in the UI and localize FPS/Turbo indicator on status bar --- src/Ryujinx.HLE/PerformanceStatistics.cs | 11 -- src/Ryujinx/AppHost.cs | 15 +- src/Ryujinx/Assets/locales.json | 156 ++++++++++++------ src/Ryujinx/Common/LocaleManager.cs | 7 + .../UI/Views/Settings/SettingsCPUView.axaml | 9 +- .../Views/Settings/SettingsHotkeysView.axaml | 2 +- 6 files changed, 130 insertions(+), 70 deletions(-) diff --git a/src/Ryujinx.HLE/PerformanceStatistics.cs b/src/Ryujinx.HLE/PerformanceStatistics.cs index 48f4a0575..9363ff2d3 100644 --- a/src/Ryujinx.HLE/PerformanceStatistics.cs +++ b/src/Ryujinx.HLE/PerformanceStatistics.cs @@ -166,17 +166,6 @@ namespace Ryujinx.HLE return 1000 / _frameRate[FrameTypeGame]; } - public string FormatGameFrameRate() - { - double frameRate = GetGameFrameRate(); - double frameTime = GetGameFrameTime(); - string turboSuffix = _device.TurboMode - ? $" Turbo ({_device.TickScalar}%)" - : string.Empty; - - return $"{frameRate:00.00} FPS ({frameTime:00.00}ms){turboSuffix}"; - } - public string FormatFifoPercent() { double fifoPercent = GetFifoPercent(); diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 36716a0cb..9901d4724 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -4,6 +4,7 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Input; using Avalonia.Threading; using DiscordRPC; +using Gommon; using LibHac.Common; using LibHac.Ns; using LibHac.Tools.FsSystem; @@ -1153,11 +1154,23 @@ namespace Ryujinx.Ava LocaleManager.Instance[LocaleKeys.VolumeShort] + $": {(int)(Device.GetVolume() * 100)}%", dockedMode, ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(), - Device.Statistics.FormatGameFrameRate(), + FormatGameFrameRate(), Device.Statistics.FormatFifoPercent(), _displayCount)); } + private string FormatGameFrameRate() + { + string frameRate = Device.Statistics.GetGameFrameRate().ToString("00.00"); + string frameTime = Device.Statistics.GetGameFrameTime().ToString("00.00"); + + return Device.TurboMode + ? LocaleManager.GetUnformatted(LocaleKeys.FpsTurboStatusBarText) + .Format(frameRate, frameTime, Device.TickScalar) + : LocaleManager.GetUnformatted(LocaleKeys.FpsStatusBarText) + .Format(frameRate, frameTime); + } + public async Task ShowExitPrompt() { bool shouldExit = !ConfigurationState.Instance.ShowConfirmExit; diff --git a/src/Ryujinx/Assets/locales.json b/src/Ryujinx/Assets/locales.json index 659f03f41..e275be454 100644 --- a/src/Ryujinx/Assets/locales.json +++ b/src/Ryujinx/Assets/locales.json @@ -4898,37 +4898,12 @@ } }, { - "ID": "SettingsTabSystemTurboMultiplierValue", + "ID": "SettingsTabSystemTurboMultiplier", "Translations": { "ar_SA": "", "de_DE": "", "el_GR": "", - "en_US": "Turbo multiplier:", - "es_ES": "", - "fr_FR": "", - "he_IL": "", - "it_IT": "", - "ja_JP": "", - "ko_KR": "", - "no_NO": "", - "pl_PL": "", - "pt_BR": "", - "ru_RU": "", - "sv_SE": "", - "th_TH": "", - "tr_TR": "", - "uk_UA": "", - "zh_CN": "", - "zh_TW": "" - } - }, - { - "ID": "SettingsTabSystemTurboMultiplierSliderToolTip", - "Translations": { - "ar_SA": "", - "de_DE": "", - "el_GR": "", - "en_US": "The Turbo mode multiplier target value.\n\nLeave at 100 if unsure.", + "en_US": "Turbo Mode multiplier:", "es_ES": "", "fr_FR": "", "he_IL": "", @@ -4953,7 +4928,32 @@ "ar_SA": "", "de_DE": "", "el_GR": "", - "en_US": "The Turbo mode multiplier, as a percentage of the normal Switch clock speed.\n\nLeave at 100 if unsure.", + "en_US": "The Turbo mode multiplier target value.\n\nLeave at 200 if unsure.", + "es_ES": "", + "fr_FR": "", + "he_IL": "", + "it_IT": "", + "ja_JP": "", + "ko_KR": "", + "no_NO": "", + "pl_PL": "", + "pt_BR": "", + "ru_RU": "", + "sv_SE": "", + "th_TH": "", + "tr_TR": "", + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" + } + }, + { + "ID": "SettingsTabSystemTurboMultiplierToolTip", + "Translations": { + "ar_SA": "", + "de_DE": "", + "el_GR": "", + "en_US": "Turbo mode is an emulator feature which effectively causes speed up or slow down when a game is not frame-rate sensitive.\nYou can toggle this feature in-game with a hotkey, configurable in Ryujinx Keyboard Hotkeys settings.\n\nLeave at 200 if unsure.", "es_ES": "", "fr_FR": "", "he_IL": "", @@ -5172,31 +5172,6 @@ "zh_TW": "可能導致模擬器不穩定" } }, - { - "ID": "SettingsTabCpuHacksNote", - "Translations": { - "ar_SA": "", - "de_DE": "", - "el_GR": "", - "en_US": "Can and will cause crashing, slow/too fast games, etc. Use with caution.", - "es_ES": "", - "fr_FR": "", - "he_IL": "", - "it_IT": "", - "ja_JP": "", - "ko_KR": "", - "no_NO": "", - "pl_PL": "", - "pt_BR": "", - "ru_RU": "", - "sv_SE": "", - "th_TH": "", - "tr_TR": "", - "uk_UA": "", - "zh_CN": "", - "zh_TW": "" - } - }, { "ID": "SettingsTabSystemDramSize", "Translations": { @@ -18172,6 +18147,56 @@ "zh_TW": "更新已停用!" } }, + { + "ID": "FpsStatusBarText", + "Translations": { + "ar_SA": "", + "de_DE": "", + "el_GR": "", + "en_US": "{0} FPS ({1}ms)", + "es_ES": "", + "fr_FR": "", + "he_IL": "", + "it_IT": "", + "ja_JP": "", + "ko_KR": "", + "no_NO": "", + "pl_PL": "", + "pt_BR": "", + "ru_RU": "", + "sv_SE": "", + "th_TH": "", + "tr_TR": "", + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" + } + }, + { + "ID": "FpsTurboStatusBarText", + "Translations": { + "ar_SA": "", + "de_DE": "", + "el_GR": "", + "en_US": "{0} FPS ({1}ms), Turbo ({2}%)", + "es_ES": "", + "fr_FR": "", + "he_IL": "", + "it_IT": "", + "ja_JP": "", + "ko_KR": "", + "no_NO": "", + "pl_PL": "", + "pt_BR": "", + "ru_RU": "", + "sv_SE": "", + "th_TH": "", + "tr_TR": "", + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" + } + }, { "ID": "UpdaterBackgroundStatusBarButtonText", "Translations": { @@ -23922,6 +23947,31 @@ "zh_TW": "" } }, + { + "ID": "SettingsTabHotkeysTurboModeToolTip", + "Translations": { + "ar_SA": "", + "de_DE": "", + "el_GR": "", + "en_US": "The Turbo mode hotkey.\nConfigure the behavior of Turbo mode in Ryujinx CPU settings.\n\nLeave Unbound if unsure.", + "es_ES": "", + "fr_FR": "", + "he_IL": "", + "it_IT": "", + "ja_JP": "", + "ko_KR": "", + "no_NO": "", + "pl_PL": "", + "pt_BR": "", + "ru_RU": "", + "sv_SE": "", + "th_TH": "", + "tr_TR": "", + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" + } + }, { "ID": "SettingsTabHotkeysOnlyWhilePressed", "Translations": { diff --git a/src/Ryujinx/Common/LocaleManager.cs b/src/Ryujinx/Common/LocaleManager.cs index f60cff49b..9320985f7 100644 --- a/src/Ryujinx/Common/LocaleManager.cs +++ b/src/Ryujinx/Common/LocaleManager.cs @@ -57,6 +57,13 @@ namespace Ryujinx.Ava.Common.Locale SetDynamicValues(LocaleKeys.RyujinxRebooter, RyujinxApp.FullAppName); } + public static string GetUnformatted(LocaleKeys key) => Instance.Get(key); + + public string Get(LocaleKeys key) => + _localeStrings.TryGetValue(key, out string value) + ? value + : key.ToString(); + public string this[LocaleKeys key] { get diff --git a/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml index 976309995..9c2977ba1 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsCPUView.axaml @@ -87,7 +87,7 @@ + Text="{ext:Locale SettingsTabSystemHacksNote}" /> - +