qt: Allow toggling whether to enter system setup on home menu boot. (#6574)

This commit is contained in:
Steveice10 2023-05-31 01:56:35 -07:00 committed by GitHub
parent 691e09473e
commit 4ddb2116bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 163 additions and 120 deletions

View file

@ -337,6 +337,10 @@ void ConfigureSystem::ReadSystemSettings() {
country_code = cfg->GetCountryCode(); country_code = cfg->GetCountryCode();
ui->combo_country->setCurrentIndex(ui->combo_country->findData(country_code)); 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 // set the console id
u64 console_id = cfg->GetConsoleUniqueId(); u64 console_id = cfg->GetConsoleUniqueId();
ui->label_console_id->setText( ui->label_console_id->setText(
@ -390,6 +394,13 @@ void ConfigureSystem::ApplyConfiguration() {
modified = true; modified = true;
} }
// apply whether system setup is needed
bool new_system_setup = static_cast<u8>(ui->toggle_system_setup->isChecked());
if (system_setup != new_system_setup) {
cfg->SetSystemSetupNeeded(new_system_setup);
modified = true;
}
// apply play coin // apply play coin
u16 new_play_coin = static_cast<u16>(ui->spinBox_play_coins->value()); u16 new_play_coin = static_cast<u16>(ui->spinBox_play_coins->value());
if (play_coin != new_play_coin) { if (play_coin != new_play_coin) {
@ -523,6 +534,7 @@ void ConfigureSystem::SetupPerGameUI() {
ui->label_init_time_offset->setVisible(false); ui->label_init_time_offset->setVisible(false);
ui->edit_init_time_offset_days->setVisible(false); ui->edit_init_time_offset_days->setVisible(false);
ui->edit_init_time_offset_time->setVisible(false); ui->edit_init_time_offset_time->setVisible(false);
ui->toggle_system_setup->setVisible(false);
ui->button_regenerate_console_id->setVisible(false); ui->button_regenerate_console_id->setVisible(false);
// Apps can change the state of the plugin loader, so plugins load // Apps can change the state of the plugin loader, so plugins load
// to a chainloaded app with specific parameters. Don't allow // to a chainloaded app with specific parameters. Don't allow

View file

@ -57,4 +57,5 @@ private:
int sound_index = 0; int sound_index = 0;
u8 country_code; u8 country_code;
u16 play_coin; u16 play_coin;
bool system_setup;
}; };

View file

@ -22,71 +22,11 @@
<string>System Settings</string> <string>System Settings</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="4" column="1"> <item row="1" column="0">
<widget class="QComboBox" name="combo_language"> <widget class="QCheckBox" name="toggle_new_3ds">
<property name="toolTip"> <property name="text">
<string>Note: this can be overridden when region setting is auto-select</string> <string>Enable New 3DS mode</string>
</property> </property>
<item>
<property name="text">
<string>Japanese (日本語)</string>
</property>
</item>
<item>
<property name="text">
<string>English</string>
</property>
</item>
<item>
<property name="text">
<string>French (français)</string>
</property>
</item>
<item>
<property name="text">
<string>German (Deutsch)</string>
</property>
</item>
<item>
<property name="text">
<string>Italian (italiano)</string>
</property>
</item>
<item>
<property name="text">
<string>Spanish (español)</string>
</property>
</item>
<item>
<property name="text">
<string>Simplified Chinese (简体中文)</string>
</property>
</item>
<item>
<property name="text">
<string>Korean (한국어)</string>
</property>
</item>
<item>
<property name="text">
<string>Dutch (Nederlands)</string>
</property>
</item>
<item>
<property name="text">
<string>Portuguese (português)</string>
</property>
</item>
<item>
<property name="text">
<string>Russian (Русский)</string>
</property>
</item>
<item>
<property name="text">
<string>Traditional Chinese (正體中文)</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
@ -109,23 +49,11 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="3" column="0">
<widget class="QComboBox" name="combo_sound"> <widget class="QLabel" name="label_birthday">
<item> <property name="text">
<property name="text"> <string>Birthday</string>
<string>Mono</string> </property>
</property>
</item>
<item>
<property name="text">
<string>Stereo</string>
</property>
</item>
<item>
<property name="text">
<string>Surround</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
@ -206,11 +134,71 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="1">
<widget class="QLabel" name="label_birthday"> <widget class="QComboBox" name="combo_language">
<property name="text"> <property name="toolTip">
<string>Birthday</string> <string>Note: this can be overridden when region setting is auto-select</string>
</property> </property>
<item>
<property name="text">
<string>Japanese (日本語)</string>
</property>
</item>
<item>
<property name="text">
<string>English</string>
</property>
</item>
<item>
<property name="text">
<string>French (français)</string>
</property>
</item>
<item>
<property name="text">
<string>German (Deutsch)</string>
</property>
</item>
<item>
<property name="text">
<string>Italian (italiano)</string>
</property>
</item>
<item>
<property name="text">
<string>Spanish (español)</string>
</property>
</item>
<item>
<property name="text">
<string>Simplified Chinese (简体中文)</string>
</property>
</item>
<item>
<property name="text">
<string>Korean (한국어)</string>
</property>
</item>
<item>
<property name="text">
<string>Dutch (Nederlands)</string>
</property>
</item>
<item>
<property name="text">
<string>Portuguese (português)</string>
</property>
</item>
<item>
<property name="text">
<string>Russian (Русский)</string>
</property>
</item>
<item>
<property name="text">
<string>Traditional Chinese (正體中文)</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="0">
@ -220,8 +208,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="5" column="1">
<widget class="QComboBox" name="combo_country"/> <widget class="QComboBox" name="combo_sound">
<item>
<property name="text">
<string>Mono</string>
</property>
</item>
<item>
<property name="text">
<string>Stereo</string>
</property>
</item>
<item>
<property name="text">
<string>Surround</string>
</property>
</item>
</widget>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_country"> <widget class="QLabel" name="label_country">
@ -230,6 +234,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1">
<widget class="QComboBox" name="combo_country"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_init_clock">
<property name="text">
<string>Clock</string>
</property>
</widget>
</item>
<item row="7" column="1"> <item row="7" column="1">
<widget class="QComboBox" name="combo_init_clock"> <widget class="QComboBox" name="combo_init_clock">
<item> <item>
@ -244,13 +258,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="7" column="0">
<widget class="QLabel" name="label_init_clock">
<property name="text">
<string>Clock</string>
</property>
</widget>
</item>
<item row="8" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_init_time"> <widget class="QLabel" name="label_init_time">
<property name="text"> <property name="text">
@ -296,13 +303,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="9" column="1">
<widget class="QSpinBox" name="spinBox_play_coins">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="9" column="0"> <item row="9" column="0">
<widget class="QLabel" name="label_play_coins"> <widget class="QLabel" name="label_play_coins">
<property name="text"> <property name="text">
@ -310,7 +310,28 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1"> <item row="9" column="1">
<widget class="QSpinBox" name="spinBox_play_coins">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="toggle_system_setup">
<property name="text">
<string>Run System Setup when Home Menu is launched</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_console_id">
<property name="text">
<string>Console ID:</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QPushButton" name="button_regenerate_console_id"> <widget class="QPushButton" name="button_regenerate_console_id">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -327,48 +348,34 @@
</widget> </widget>
</item> </item>
<item row="12" column="0"> <item row="12" column="0">
<widget class="QLabel" name="label_console_id">
<property name="text">
<string>Console ID:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="toggle_new_3ds">
<property name="text">
<string>Enable New 3DS mode</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_plugin_loader"> <widget class="QLabel" name="label_plugin_loader">
<property name="text"> <property name="text">
<string>3GX Plugin Loader:</string> <string>3GX Plugin Loader:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="1"> <item row="12" column="1">
<widget class="QCheckBox" name="plugin_loader"> <widget class="QCheckBox" name="plugin_loader">
<property name="text"> <property name="text">
<string>Enable 3GX plugin loader</string> <string>Enable 3GX plugin loader</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="1"> <item row="13" column="1">
<widget class="QCheckBox" name="allow_plugin_loader"> <widget class="QCheckBox" name="allow_plugin_loader">
<property name="text"> <property name="text">
<string>Allow games to change plugin loader state</string> <string>Allow games to change plugin loader state</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="0"> <item row="14" column="0">
<widget class="QLabel" name="label_nus_download"> <widget class="QLabel" name="label_nus_download">
<property name="text"> <property name="text">
<string>Download System Files from Nitendo servers</string> <string>Download System Files from Nitendo servers</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="1"> <item row="14" column="1">
<widget class="QWidget" name="body_nus_download"> <widget class="QWidget" name="body_nus_download">
<layout class="QHBoxLayout" name="horizontalLayout_nus_download"> <layout class="QHBoxLayout" name="horizontalLayout_nus_download">
<item> <item>

View file

@ -898,6 +898,17 @@ void Module::SetEULAVersion(const EULAVersion& version) {
SetConfigInfoBlock(EULAVersionBlockID, sizeof(data), 0xE, &data); 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<Module> GetModule(Core::System& system) { std::shared_ptr<Module> GetModule(Core::System& system) {
auto cfg = system.ServiceManager().GetService<Service::CFG::Module::Interface>("cfg:u"); auto cfg = system.ServiceManager().GetService<Service::CFG::Module::Interface>("cfg:u");
if (!cfg) if (!cfg)

View file

@ -460,6 +460,18 @@ public:
*/ */
EULAVersion GetEULAVersion(); 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 * 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 * @returns ResultCode indicating the result of the operation, 0 on success