From f26044bb880ae529592cae55dfcb87c8cfd13d0a Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:13:06 -0800 Subject: [PATCH] frontend: Add setting for whether to use LLE applets. (#7345) --- .../features/settings/model/IntSetting.kt | 2 + .../settings/ui/SettingsFragmentPresenter.kt | 9 +++ src/android/app/src/main/jni/config.cpp | 1 + src/android/app/src/main/jni/default_ini.h | 4 ++ .../app/src/main/res/values/strings.xml | 1 + src/citra/config.cpp | 1 + src/citra/default_ini.h | 4 ++ src/citra_qt/configuration/config.cpp | 2 + .../configuration/configure_system.cpp | 7 ++ src/citra_qt/configuration/configure_system.h | 1 + .../configuration/configure_system.ui | 67 ++++++++++--------- src/common/settings.cpp | 2 + src/common/settings.h | 1 + src/core/hle/service/apt/applet_manager.cpp | 24 ++++--- src/core/telemetry_session.cpp | 2 + 15 files changed, 88 insertions(+), 40 deletions(-) diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/IntSetting.kt b/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/IntSetting.kt index cc64d29a62..b2c3783970 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/IntSetting.kt +++ b/src/android/app/src/main/java/org/citra/citra_emu/features/settings/model/IntSetting.kt @@ -25,6 +25,7 @@ enum class IntSetting( SCREEN_LAYOUT("layout_option", Settings.SECTION_LAYOUT, 0), AUDIO_INPUT_TYPE("output_type", Settings.SECTION_AUDIO, 0), NEW_3DS("is_new_3ds", Settings.SECTION_SYSTEM, 1), + LLE_APPLETS("lle_applets", Settings.SECTION_SYSTEM, 0), CPU_CLOCK_SPEED("cpu_clock_percentage", Settings.SECTION_CORE, 100), LINEAR_FILTERING("filter_mode", Settings.SECTION_RENDERER, 1), SHADERS_ACCURATE_MUL("shaders_accurate_mul", Settings.SECTION_RENDERER, 0), @@ -61,6 +62,7 @@ enum class IntSetting( EMULATED_REGION, INIT_CLOCK, NEW_3DS, + LLE_APPLETS, GRAPHICS_API, VSYNC, DEBUG_RENDERER, diff --git a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentPresenter.kt index efaf835407..c196da08e7 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/citra/citra_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -907,6 +907,15 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView) IntSetting.NEW_3DS.defaultValue ) ) + add( + SwitchSetting( + IntSetting.LLE_APPLETS, + R.string.lle_applets, + 0, + IntSetting.LLE_APPLETS.key, + IntSetting.LLE_APPLETS.defaultValue + ) + ) add( SliderSetting( IntSetting.CPU_CLOCK_SPEED, diff --git a/src/android/app/src/main/jni/config.cpp b/src/android/app/src/main/jni/config.cpp index 551617ae70..f2210f2255 100644 --- a/src/android/app/src/main/jni/config.cpp +++ b/src/android/app/src/main/jni/config.cpp @@ -206,6 +206,7 @@ void Config::ReadValues() { // System ReadSetting("System", Settings::values.is_new_3ds); + ReadSetting("System", Settings::values.lle_applets); ReadSetting("System", Settings::values.region_value); ReadSetting("System", Settings::values.init_clock); { diff --git a/src/android/app/src/main/jni/default_ini.h b/src/android/app/src/main/jni/default_ini.h index a2cd02c859..31df12c5fb 100644 --- a/src/android/app/src/main/jni/default_ini.h +++ b/src/android/app/src/main/jni/default_ini.h @@ -270,6 +270,10 @@ use_virtual_sd = # 0: Old 3DS (default), 1: New 3DS is_new_3ds = +# Whether to use LLE system applets, if installed +# 0 (default): No, 1: Yes +lle_applets = + # The system region that Citra will use during emulation # -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan region_value = diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index a7caab91f3..303632162c 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -171,6 +171,7 @@ Username New 3DS Mode + Use LLE Applets (if installed) Clock Offset Time If the clock is set to \"Simulated clock\", this changes the fixed date and time to start at. diff --git a/src/citra/config.cpp b/src/citra/config.cpp index b6cfa27243..baf5bbdeda 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -203,6 +203,7 @@ void Config::ReadValues() { // System ReadSetting("System", Settings::values.is_new_3ds); + ReadSetting("System", Settings::values.lle_applets); ReadSetting("System", Settings::values.region_value); ReadSetting("System", Settings::values.init_clock); { diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index 273e9a423d..be3c679487 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -294,6 +294,10 @@ nand_directory = # 0: Old 3DS, 1: New 3DS (default) is_new_3ds = +# Whether to use LLE system applets, if installed +# 0 (default): No, 1: Yes +lle_applets = + # The system region that Citra will use during emulation # -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan region_value = diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index 58495ae0cd..389a3becf8 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -682,6 +682,7 @@ void Config::ReadSystemValues() { qt_config->beginGroup(QStringLiteral("System")); ReadGlobalSetting(Settings::values.is_new_3ds); + ReadGlobalSetting(Settings::values.lle_applets); ReadGlobalSetting(Settings::values.region_value); if (global) { @@ -1172,6 +1173,7 @@ void Config::SaveSystemValues() { qt_config->beginGroup(QStringLiteral("System")); WriteGlobalSetting(Settings::values.is_new_3ds); + WriteGlobalSetting(Settings::values.lle_applets); WriteGlobalSetting(Settings::values.region_value); if (global) { diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp index 7936df2565..653957ca77 100644 --- a/src/citra_qt/configuration/configure_system.cpp +++ b/src/citra_qt/configuration/configure_system.cpp @@ -309,6 +309,7 @@ void ConfigureSystem::SetConfiguration() { } ui->toggle_new_3ds->setChecked(Settings::values.is_new_3ds.GetValue()); + ui->toggle_lle_applets->setChecked(Settings::values.lle_applets.GetValue()); ui->plugin_loader->setChecked(Settings::values.plugin_loader_enabled.GetValue()); ui->allow_plugin_loader->setChecked(Settings::values.allow_plugin_loader.GetValue()); } @@ -415,6 +416,8 @@ void ConfigureSystem::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.is_new_3ds, ui->toggle_new_3ds, is_new_3ds); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.lle_applets, + ui->toggle_lle_applets, lle_applets); Settings::values.init_clock = static_cast(ui->combo_init_clock->currentIndex()); @@ -434,6 +437,7 @@ void ConfigureSystem::ApplyConfiguration() { Settings::values.init_time_offset = time_offset_days + time_offset_time; Settings::values.is_new_3ds = ui->toggle_new_3ds->isChecked(); + Settings::values.lle_applets = ui->toggle_lle_applets->isChecked(); Settings::values.plugin_loader_enabled.SetValue(ui->plugin_loader->isChecked()); Settings::values.allow_plugin_loader.SetValue(ui->allow_plugin_loader->isChecked()); @@ -526,6 +530,7 @@ void ConfigureSystem::SetupPerGameUI() { // Block the global settings if a game is currently running that overrides them if (Settings::IsConfiguringGlobal()) { ui->toggle_new_3ds->setEnabled(Settings::values.is_new_3ds.UsingGlobal()); + ui->toggle_lle_applets->setEnabled(Settings::values.lle_applets.UsingGlobal()); return; } @@ -569,6 +574,8 @@ void ConfigureSystem::SetupPerGameUI() { ConfigurationShared::SetColoredTristate(ui->toggle_new_3ds, Settings::values.is_new_3ds, is_new_3ds); + ConfigurationShared::SetColoredTristate(ui->toggle_lle_applets, Settings::values.lle_applets, + lle_applets); } void ConfigureSystem::DownloadFromNUS() { diff --git a/src/citra_qt/configuration/configure_system.h b/src/citra_qt/configuration/configure_system.h index 2c1d30649e..8a258bc2b1 100644 --- a/src/citra_qt/configuration/configure_system.h +++ b/src/citra_qt/configuration/configure_system.h @@ -54,6 +54,7 @@ private: std::unique_ptr ui; Core::System& system; ConfigurationShared::CheckState is_new_3ds; + ConfigurationShared::CheckState lle_applets; bool enabled = false; std::shared_ptr cfg; diff --git a/src/citra_qt/configuration/configure_system.ui b/src/citra_qt/configuration/configure_system.ui index bd3332bfd5..81f764b053 100644 --- a/src/citra_qt/configuration/configure_system.ui +++ b/src/citra_qt/configuration/configure_system.ui @@ -29,7 +29,14 @@ - + + + + Use LLE applets (if installed) + + + + @@ -42,21 +49,21 @@ - + Username - + Birthday - + @@ -127,14 +134,14 @@ - + Language - + Note: this can be overridden when region setting is auto-select @@ -201,14 +208,14 @@ - + Sound output mode - + @@ -227,24 +234,24 @@ - + Country - + - + Clock - + @@ -258,28 +265,28 @@ - + Startup time - + yyyy-MM-ddTHH:mm:ss - + Offset time - + @@ -303,14 +310,14 @@ - + Initial System Ticks - + @@ -324,14 +331,14 @@ - + Initial System Ticks Override - + @@ -344,35 +351,35 @@ - + Play Coins: - + 300 - + Run System Setup when Home Menu is launched - + Console ID: - + @@ -388,35 +395,35 @@ - + 3GX Plugin Loader: - + Enable 3GX plugin loader - + Allow games to change plugin loader state - + Download System Files from Nitendo servers - + diff --git a/src/common/settings.cpp b/src/common/settings.cpp index e7e3d59f15..657747b617 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -138,6 +138,7 @@ void LogSettings() { log_setting("DataStorage_NandDir", FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)); } log_setting("System_IsNew3ds", values.is_new_3ds.GetValue()); + log_setting("System_LLEApplets", values.lle_applets.GetValue()); log_setting("System_RegionValue", values.region_value.GetValue()); log_setting("System_PluginLoader", values.plugin_loader_enabled.GetValue()); log_setting("System_PluginLoaderAllowed", values.allow_plugin_loader.GetValue()); @@ -175,6 +176,7 @@ void RestoreGlobalState(bool is_powered_on) { // Core values.cpu_clock_percentage.SetGlobal(true); values.is_new_3ds.SetGlobal(true); + values.lle_applets.SetGlobal(true); // Renderer values.graphics_api.SetGlobal(true); diff --git a/src/common/settings.h b/src/common/settings.h index 8fc0f36c42..a52e797ac8 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -432,6 +432,7 @@ struct Values { Setting use_cpu_jit{true, "use_cpu_jit"}; SwitchableSetting cpu_clock_percentage{100, 5, 400, "cpu_clock_percentage"}; SwitchableSetting is_new_3ds{true, "is_new_3ds"}; + SwitchableSetting lle_applets{false, "lle_applets"}; // Data Storage Setting use_virtual_sd{true, "use_virtual_sd"}; diff --git a/src/core/hle/service/apt/applet_manager.cpp b/src/core/hle/service/apt/applet_manager.cpp index 7e976a50e1..fe640b5c5b 100644 --- a/src/core/hle/service/apt/applet_manager.cpp +++ b/src/core/hle/service/apt/applet_manager.cpp @@ -568,11 +568,13 @@ Result AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) { capture_buffer_info.reset(); - auto cfg = Service::CFG::GetModule(system); - auto process = - NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue())); - if (process) { - return ResultSuccess; + if (Settings::values.lle_applets) { + auto cfg = Service::CFG::GetModule(system); + auto process = NS::LaunchTitle(FS::MediaType::NAND, + GetTitleIdForApplet(applet_id, cfg->GetRegionValue())); + if (process) { + return ResultSuccess; + } } // If we weren't able to load the native applet title, try to fallback to an HLE implementation. @@ -595,11 +597,13 @@ Result AppletManager::PreloadLibraryApplet(AppletId applet_id) { last_library_launcher_slot = active_slot; last_prepared_library_applet = applet_id; - auto cfg = Service::CFG::GetModule(system); - auto process = - NS::LaunchTitle(FS::MediaType::NAND, GetTitleIdForApplet(applet_id, cfg->GetRegionValue())); - if (process) { - return ResultSuccess; + if (Settings::values.lle_applets) { + auto cfg = Service::CFG::GetModule(system); + auto process = NS::LaunchTitle(FS::MediaType::NAND, + GetTitleIdForApplet(applet_id, cfg->GetRegionValue())); + if (process) { + return ResultSuccess; + } } // If we weren't able to load the native applet title, try to fallback to an HLE implementation. diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 968e36eacb..8a4f945992 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -155,6 +155,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) { static_cast(Settings::values.mono_render_option.GetValue())); AddField(Telemetry::FieldType::UserConfig, "System_IsNew3ds", Settings::values.is_new_3ds.GetValue()); + AddField(Telemetry::FieldType::UserConfig, "System_LLEApplets", + Settings::values.lle_applets.GetValue()); AddField(Telemetry::FieldType::UserConfig, "System_RegionValue", Settings::values.region_value.GetValue()); }