mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	core_timing: Allow configuring a fixed or random initial system tick value. (#7309)
* core_timing: Apply random base ticks value on startup. * core: Maintain consistent base system ticks in TAS movies. * frontend: Add setting to configure a fixed base system ticks value.
This commit is contained in:
		
							parent
							
								
									96aa1b3a08
								
							
						
					
					
						commit
						0165012ba4
					
				
					 14 changed files with 150 additions and 17 deletions
				
			
		|  | @ -687,6 +687,8 @@ void Config::ReadSystemValues() { | |||
|         ReadBasicSetting(Settings::values.init_clock); | ||||
|         ReadBasicSetting(Settings::values.init_time); | ||||
|         ReadBasicSetting(Settings::values.init_time_offset); | ||||
|         ReadBasicSetting(Settings::values.init_ticks_type); | ||||
|         ReadBasicSetting(Settings::values.init_ticks_override); | ||||
|         ReadBasicSetting(Settings::values.plugin_loader_enabled); | ||||
|         ReadBasicSetting(Settings::values.allow_plugin_loader); | ||||
|     } | ||||
|  | @ -1173,6 +1175,8 @@ void Config::SaveSystemValues() { | |||
|         WriteBasicSetting(Settings::values.init_clock); | ||||
|         WriteBasicSetting(Settings::values.init_time); | ||||
|         WriteBasicSetting(Settings::values.init_time_offset); | ||||
|         WriteBasicSetting(Settings::values.init_ticks_type); | ||||
|         WriteBasicSetting(Settings::values.init_ticks_override); | ||||
|         WriteBasicSetting(Settings::values.plugin_loader_enabled); | ||||
|         WriteBasicSetting(Settings::values.allow_plugin_loader); | ||||
|     } | ||||
|  |  | |||
|  | @ -230,6 +230,8 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) | |||
|             &ConfigureSystem::UpdateBirthdayComboBox); | ||||
|     connect(ui->combo_init_clock, qOverload<int>(&QComboBox::currentIndexChanged), this, | ||||
|             &ConfigureSystem::UpdateInitTime); | ||||
|     connect(ui->combo_init_ticks_type, qOverload<int>(&QComboBox::currentIndexChanged), this, | ||||
|             &ConfigureSystem::UpdateInitTicks); | ||||
|     connect(ui->button_regenerate_console_id, &QPushButton::clicked, this, | ||||
|             &ConfigureSystem::RefreshConsoleID); | ||||
|     connect(ui->button_start_download, &QPushButton::clicked, this, | ||||
|  | @ -293,6 +295,11 @@ void ConfigureSystem::SetConfiguration() { | |||
|     QTime time = QTime::fromMSecsSinceStartOfDay(static_cast<int>(time_offset * 1000)); | ||||
|     ui->edit_init_time_offset_time->setTime(time); | ||||
| 
 | ||||
|     ui->combo_init_ticks_type->setCurrentIndex( | ||||
|         static_cast<u8>(Settings::values.init_ticks_type.GetValue())); | ||||
|     ui->edit_init_ticks_value->setText( | ||||
|         QString::number(Settings::values.init_ticks_override.GetValue())); | ||||
| 
 | ||||
|     cfg = Service::CFG::GetModule(system); | ||||
|     ReadSystemSettings(); | ||||
| 
 | ||||
|  | @ -413,6 +420,11 @@ void ConfigureSystem::ApplyConfiguration() { | |||
|             static_cast<Settings::InitClock>(ui->combo_init_clock->currentIndex()); | ||||
|         Settings::values.init_time = ui->edit_init_time->dateTime().toSecsSinceEpoch(); | ||||
| 
 | ||||
|         Settings::values.init_ticks_type = | ||||
|             static_cast<Settings::InitTicks>(ui->combo_init_ticks_type->currentIndex()); | ||||
|         Settings::values.init_ticks_override = | ||||
|             static_cast<s64>(ui->edit_init_ticks_value->text().toLongLong()); | ||||
| 
 | ||||
|         s64 time_offset_time = ui->edit_init_time_offset_time->time().msecsSinceStartOfDay() / 1000; | ||||
|         s64 time_offset_days = ui->edit_init_time_offset_days->value() * 86400; | ||||
| 
 | ||||
|  | @ -462,6 +474,7 @@ void ConfigureSystem::ConfigureTime() { | |||
|     SetConfiguration(); | ||||
| 
 | ||||
|     UpdateInitTime(ui->combo_init_clock->currentIndex()); | ||||
|     UpdateInitTicks(ui->combo_init_ticks_type->currentIndex()); | ||||
| } | ||||
| 
 | ||||
| void ConfigureSystem::UpdateInitTime(int init_clock) { | ||||
|  | @ -477,6 +490,15 @@ void ConfigureSystem::UpdateInitTime(int init_clock) { | |||
|     ui->edit_init_time_offset_time->setVisible(!is_fixed_time && is_global); | ||||
| } | ||||
| 
 | ||||
| void ConfigureSystem::UpdateInitTicks(int init_ticks_type) { | ||||
|     const bool is_global = Settings::IsConfiguringGlobal(); | ||||
|     const bool is_fixed = | ||||
|         static_cast<Settings::InitTicks>(init_ticks_type) == Settings::InitTicks::Fixed; | ||||
| 
 | ||||
|     ui->label_init_ticks_value->setVisible(is_fixed && is_global); | ||||
|     ui->edit_init_ticks_value->setVisible(is_fixed && is_global); | ||||
| } | ||||
| 
 | ||||
| void ConfigureSystem::RefreshConsoleID() { | ||||
|     QMessageBox::StandardButton reply; | ||||
|     QString warning_text = tr("This will replace your current virtual 3DS with a new one. " | ||||
|  | @ -512,6 +534,8 @@ void ConfigureSystem::SetupPerGameUI() { | |||
|     ui->label_birthday->setVisible(false); | ||||
|     ui->label_init_clock->setVisible(false); | ||||
|     ui->label_init_time->setVisible(false); | ||||
|     ui->label_init_ticks_type->setVisible(false); | ||||
|     ui->label_init_ticks_value->setVisible(false); | ||||
|     ui->label_console_id->setVisible(false); | ||||
|     ui->label_sound->setVisible(false); | ||||
|     ui->label_language->setVisible(false); | ||||
|  | @ -522,12 +546,14 @@ void ConfigureSystem::SetupPerGameUI() { | |||
|     ui->combo_birthday->setVisible(false); | ||||
|     ui->combo_birthmonth->setVisible(false); | ||||
|     ui->combo_init_clock->setVisible(false); | ||||
|     ui->combo_init_ticks_type->setVisible(false); | ||||
|     ui->combo_sound->setVisible(false); | ||||
|     ui->combo_language->setVisible(false); | ||||
|     ui->combo_country->setVisible(false); | ||||
|     ui->label_init_time_offset->setVisible(false); | ||||
|     ui->edit_init_time_offset_days->setVisible(false); | ||||
|     ui->edit_init_time_offset_time->setVisible(false); | ||||
|     ui->edit_init_ticks_value->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
 | ||||
|  |  | |||
|  | @ -43,6 +43,7 @@ private: | |||
| 
 | ||||
|     void UpdateBirthdayComboBox(int birthmonth_index); | ||||
|     void UpdateInitTime(int init_clock); | ||||
|     void UpdateInitTicks(int init_ticks_type); | ||||
|     void RefreshConsoleID(); | ||||
| 
 | ||||
|     void SetupPerGameUI(); | ||||
|  |  | |||
|  | @ -304,34 +304,75 @@ | |||
|          </layout> | ||||
|         </item> | ||||
|         <item row="9" column="0"> | ||||
|          <widget class="QLabel" name="label_init_ticks_type"> | ||||
|           <property name="text"> | ||||
|            <string>Initial System Ticks</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="9" column="1"> | ||||
|          <widget class="QComboBox" name="combo_init_ticks_type"> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>Random</string> | ||||
|            </property> | ||||
|           </item> | ||||
|           <item> | ||||
|            <property name="text"> | ||||
|             <string>Fixed</string> | ||||
|            </property> | ||||
|           </item> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="10" column="0"> | ||||
|          <widget class="QLabel" name="label_init_ticks_value"> | ||||
|           <property name="text"> | ||||
|            <string>Initial System Ticks Override</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="10" column="1"> | ||||
|          <widget class="QLineEdit" name="edit_init_ticks_value"> | ||||
|           <property name="sizePolicy"> | ||||
|            <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||||
|             <horstretch>0</horstretch> | ||||
|             <verstretch>0</verstretch> | ||||
|            </sizepolicy> | ||||
|           </property> | ||||
|           <property name="maxLength"> | ||||
|            <number>20</number> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="11" column="0"> | ||||
|          <widget class="QLabel" name="label_play_coins"> | ||||
|           <property name="text"> | ||||
|            <string>Play Coins:</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="9" column="1"> | ||||
|         <item row="11" column="1"> | ||||
|          <widget class="QSpinBox" name="spinBox_play_coins"> | ||||
|           <property name="maximum"> | ||||
|            <number>300</number> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="10" column="1"> | ||||
|         <item row="12" 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"> | ||||
|         <item row="13" column="0"> | ||||
|          <widget class="QLabel" name="label_console_id"> | ||||
|           <property name="text"> | ||||
|            <string>Console ID:</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="11" column="1"> | ||||
|         <item row="13" column="1"> | ||||
|          <widget class="QPushButton" name="button_regenerate_console_id"> | ||||
|           <property name="sizePolicy"> | ||||
|            <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||||
|  | @ -347,35 +388,35 @@ | |||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="12" column="0"> | ||||
|         <item row="14" column="0"> | ||||
|          <widget class="QLabel" name="label_plugin_loader"> | ||||
|           <property name="text"> | ||||
|            <string>3GX Plugin Loader:</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="12" column="1"> | ||||
|         <item row="14" column="1"> | ||||
|          <widget class="QCheckBox" name="plugin_loader"> | ||||
|           <property name="text"> | ||||
|            <string>Enable 3GX plugin loader</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="13" column="1"> | ||||
|         <item row="15" column="1"> | ||||
|          <widget class="QCheckBox" name="allow_plugin_loader"> | ||||
|           <property name="text"> | ||||
|            <string>Allow games to change plugin loader state</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="14" column="0"> | ||||
|         <item row="16" column="0"> | ||||
|          <widget class="QLabel" name="label_nus_download"> | ||||
|           <property name="text"> | ||||
|            <string>Download System Files from Nitendo servers</string> | ||||
|           </property> | ||||
|          </widget> | ||||
|         </item> | ||||
|         <item row="14" column="1"> | ||||
|         <item row="16" column="1"> | ||||
|          <widget class="QWidget" name="body_nus_download"> | ||||
|           <layout class="QHBoxLayout" name="horizontalLayout_nus_download"> | ||||
|            <item> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue