From 4ddb2116bf77c4d69fb6e40867ca10cee3dbdb05 Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Wed, 31 May 2023 01:56:35 -0700 Subject: [PATCH] qt: Allow toggling whether to enter system setup on home menu boot. (#6574) --- .../configuration/configure_system.cpp | 12 + src/citra_qt/configuration/configure_system.h | 1 + .../configuration/configure_system.ui | 247 +++++++++--------- src/core/hle/service/cfg/cfg.cpp | 11 + src/core/hle/service/cfg/cfg.h | 12 + 5 files changed, 163 insertions(+), 120 deletions(-) diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp index 8cfbefedf..25a18ce6f 100644 --- a/src/citra_qt/configuration/configure_system.cpp +++ b/src/citra_qt/configuration/configure_system.cpp @@ -337,6 +337,10 @@ void ConfigureSystem::ReadSystemSettings() { country_code = cfg->GetCountryCode(); ui->combo_country->setCurrentIndex(ui->combo_country->findData(country_code)); + // set whether system setup is needed + system_setup = cfg->IsSystemSetupNeeded(); + ui->toggle_system_setup->setChecked(system_setup); + // set the console id u64 console_id = cfg->GetConsoleUniqueId(); ui->label_console_id->setText( @@ -390,6 +394,13 @@ void ConfigureSystem::ApplyConfiguration() { modified = true; } + // apply whether system setup is needed + bool new_system_setup = static_cast(ui->toggle_system_setup->isChecked()); + if (system_setup != new_system_setup) { + cfg->SetSystemSetupNeeded(new_system_setup); + modified = true; + } + // apply play coin u16 new_play_coin = static_cast(ui->spinBox_play_coins->value()); if (play_coin != new_play_coin) { @@ -523,6 +534,7 @@ void ConfigureSystem::SetupPerGameUI() { ui->label_init_time_offset->setVisible(false); ui->edit_init_time_offset_days->setVisible(false); ui->edit_init_time_offset_time->setVisible(false); + ui->toggle_system_setup->setVisible(false); ui->button_regenerate_console_id->setVisible(false); // Apps can change the state of the plugin loader, so plugins load // to a chainloaded app with specific parameters. Don't allow diff --git a/src/citra_qt/configuration/configure_system.h b/src/citra_qt/configuration/configure_system.h index d8b0e25fb..6e2408465 100644 --- a/src/citra_qt/configuration/configure_system.h +++ b/src/citra_qt/configuration/configure_system.h @@ -57,4 +57,5 @@ private: int sound_index = 0; u8 country_code; u16 play_coin; + bool system_setup; }; diff --git a/src/citra_qt/configuration/configure_system.ui b/src/citra_qt/configuration/configure_system.ui index cfb50818b..728db6c76 100644 --- a/src/citra_qt/configuration/configure_system.ui +++ b/src/citra_qt/configuration/configure_system.ui @@ -22,71 +22,11 @@ System Settings - - - - Note: this can be overridden when region setting is auto-select + + + + Enable New 3DS mode - - - Japanese (日本語) - - - - - English - - - - - French (français) - - - - - German (Deutsch) - - - - - Italian (italiano) - - - - - Spanish (español) - - - - - Simplified Chinese (简体中文) - - - - - Korean (한국어) - - - - - Dutch (Nederlands) - - - - - Portuguese (português) - - - - - Russian (Русский) - - - - - Traditional Chinese (正體中文) - - @@ -109,23 +49,11 @@ - - - - - Mono - - - - - Stereo - - - - - Surround - - + + + + Birthday + @@ -206,11 +134,71 @@ - - - - Birthday + + + + Note: this can be overridden when region setting is auto-select + + + Japanese (日本語) + + + + + English + + + + + French (français) + + + + + German (Deutsch) + + + + + Italian (italiano) + + + + + Spanish (español) + + + + + Simplified Chinese (简体中文) + + + + + Korean (한국어) + + + + + Dutch (Nederlands) + + + + + Portuguese (português) + + + + + Russian (Русский) + + + + + Traditional Chinese (正體中文) + + @@ -220,8 +208,24 @@ - - + + + + + Mono + + + + + Stereo + + + + + Surround + + + @@ -230,6 +234,16 @@ + + + + + + + Clock + + + @@ -244,13 +258,6 @@ - - - - Clock - - - @@ -296,13 +303,6 @@ - - - - 300 - - - @@ -310,7 +310,28 @@ - + + + + 300 + + + + + + + Run System Setup when Home Menu is launched + + + + + + + Console ID: + + + + @@ -327,48 +348,34 @@ - - - Console ID: - - - - - - - Enable New 3DS mode - - - - 3GX Plugin Loader: - + Enable 3GX plugin loader - + Allow games to change plugin loader state - + Download System Files from Nitendo servers - + diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 0652ad8bf..9a2956b31 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -898,6 +898,17 @@ void Module::SetEULAVersion(const EULAVersion& version) { SetConfigInfoBlock(EULAVersionBlockID, sizeof(data), 0xE, &data); } +void Module::SetSystemSetupNeeded(bool setup_needed) { + u32 block = setup_needed ? 0 : 1; + SetConfigInfoBlock(SystemSetupRequiredBlockID, sizeof(block), 0xC, &block); +} + +bool Module::IsSystemSetupNeeded() { + u32 block; + GetConfigInfoBlock(SystemSetupRequiredBlockID, sizeof(block), 0xC, &block); + return (block & 0xFFFF) == 0; +} + std::shared_ptr GetModule(Core::System& system) { auto cfg = system.ServiceManager().GetService("cfg:u"); if (!cfg) diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h index e887a9645..65085aa09 100644 --- a/src/core/hle/service/cfg/cfg.h +++ b/src/core/hle/service/cfg/cfg.h @@ -460,6 +460,18 @@ public: */ EULAVersion GetEULAVersion(); + /** + * Sets whether system initial setup is needed in config savegame. + * @param setup_needed Whether system initial setup is needed. + */ + void SetSystemSetupNeeded(bool setup_needed); + + /** + * Gets whether system initial setup is needed from config savegame. + * @returns Whether system initial setup is needed. + */ + bool IsSystemSetupNeeded(); + /** * Writes the config savegame memory buffer to the config savegame file in the filesystem * @returns ResultCode indicating the result of the operation, 0 on success