diff --git a/src/android/app/src/main/jni/config.cpp b/src/android/app/src/main/jni/config.cpp index cf8a7bcf40..ae76c8722e 100644 --- a/src/android/app/src/main/jni/config.cpp +++ b/src/android/app/src/main/jni/config.cpp @@ -245,6 +245,7 @@ void Config::ReadValues() { ReadSetting("System", Settings::values.init_ticks_override); ReadSetting("System", Settings::values.plugin_loader_enabled); ReadSetting("System", Settings::values.allow_plugin_loader); + ReadSetting("System", Settings::values.steps_per_hour); // Camera using namespace Service::CAM; diff --git a/src/android/app/src/main/jni/default_ini.h b/src/android/app/src/main/jni/default_ini.h index 17c1cdbe11..a7833103e5 100644 --- a/src/android/app/src/main/jni/default_ini.h +++ b/src/android/app/src/main/jni/default_ini.h @@ -368,6 +368,10 @@ init_ticks_type = # Defaults to 0. init_ticks_override = +# Number of steps per hour reported by the pedometer. +# Defaults to 0. +steps_per_hour = + # Plugin loader state, if enabled plugins will be loaded from the SD card. # You can also set if homebrew apps are allowed to enable the plugin loader plugin_loader = diff --git a/src/common/settings.h b/src/common/settings.h index 47d7bddfc4..e40d1b4a14 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -454,6 +454,7 @@ struct Values { Setting init_ticks_override{0, "init_ticks_override"}; Setting plugin_loader_enabled{false, "plugin_loader"}; Setting allow_plugin_loader{true, "allow_plugin_loader"}; + Setting steps_per_hour{0, "steps_per_hour"}; // Renderer SwitchableSetting graphics_api{ diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index da638dae8b..f3caba55dc 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp @@ -84,9 +84,8 @@ void Module::Interface::GetStepHistory(Kernel::HLERequestContext& ctx) { ASSERT_MSG(sizeof(u16) * hours == buffer.GetSize(), "Buffer for steps count has incorrect size"); - // Stub: set zero steps count for every hour + const u16_le steps_per_hour = Settings::values.steps_per_hour.GetValue(); for (u32 i = 0; i < hours; ++i) { - const u16_le steps_per_hour = 0; buffer.Write(&steps_per_hour, i * sizeof(u16), sizeof(u16)); } diff --git a/src/mandarine/config.cpp b/src/mandarine/config.cpp index c13be3d69c..c5c58d0070 100644 --- a/src/mandarine/config.cpp +++ b/src/mandarine/config.cpp @@ -258,6 +258,7 @@ void Config::ReadValues() { ReadSetting("System", Settings::values.init_ticks_override); ReadSetting("System", Settings::values.plugin_loader_enabled); ReadSetting("System", Settings::values.allow_plugin_loader); + ReadSetting("System", Settings::values.steps_per_hour); { constexpr const char* default_init_time_offset = "0 00:00:00"; diff --git a/src/mandarine/default_ini.h b/src/mandarine/default_ini.h index 3d50dc681a..b5e55a4419 100644 --- a/src/mandarine/default_ini.h +++ b/src/mandarine/default_ini.h @@ -353,6 +353,10 @@ init_ticks_type = # Defaults to 0. init_ticks_override = +# Number of steps per hour reported by the pedometer. +# Defaults to 0. +steps_per_hour = + [Camera] # Which camera engine to use for the right outer camera # blank (default): a dummy camera that always returns black image diff --git a/src/mandarine_qt/configuration/config.cpp b/src/mandarine_qt/configuration/config.cpp index 62fd30bf98..52cc6457d9 100644 --- a/src/mandarine_qt/configuration/config.cpp +++ b/src/mandarine_qt/configuration/config.cpp @@ -739,6 +739,7 @@ void Config::ReadSystemValues() { ReadBasicSetting(Settings::values.init_time_offset); ReadBasicSetting(Settings::values.init_ticks_type); ReadBasicSetting(Settings::values.init_ticks_override); + ReadBasicSetting(Settings::values.steps_per_hour); ReadBasicSetting(Settings::values.plugin_loader_enabled); ReadBasicSetting(Settings::values.allow_plugin_loader); } @@ -1276,6 +1277,7 @@ void Config::SaveSystemValues() { WriteBasicSetting(Settings::values.init_time_offset); WriteBasicSetting(Settings::values.init_ticks_type); WriteBasicSetting(Settings::values.init_ticks_override); + WriteBasicSetting(Settings::values.steps_per_hour); WriteBasicSetting(Settings::values.plugin_loader_enabled); WriteBasicSetting(Settings::values.allow_plugin_loader); } diff --git a/src/mandarine_qt/configuration/configure_system.cpp b/src/mandarine_qt/configuration/configure_system.cpp index 3de44c7f38..3a54ce764b 100644 --- a/src/mandarine_qt/configuration/configure_system.cpp +++ b/src/mandarine_qt/configuration/configure_system.cpp @@ -328,6 +328,8 @@ void ConfigureSystem::SetConfiguration() { ui->edit_init_ticks_value->setText( QString::number(Settings::values.init_ticks_override.GetValue())); + ui->spinBox_steps_per_hour->setValue(Settings::values.steps_per_hour.GetValue()); + cfg = Service::CFG::GetModule(system); ReadSystemSettings(); @@ -460,6 +462,8 @@ void ConfigureSystem::ApplyConfiguration() { Settings::values.init_ticks_override = static_cast(ui->edit_init_ticks_value->text().toLongLong()); + Settings::values.steps_per_hour = static_cast(ui->spinBox_steps_per_hour->value()); + 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; @@ -631,8 +635,10 @@ void ConfigureSystem::SetupPerGameUI() { ui->label_language->setVisible(false); ui->label_country->setVisible(false); ui->label_play_coins->setVisible(false); + ui->label_steps_per_hour->setVisible(false); ui->edit_username->setVisible(false); ui->spinBox_play_coins->setVisible(false); + ui->spinBox_steps_per_hour->setVisible(false); ui->combo_birthday->setVisible(false); ui->combo_birthmonth->setVisible(false); ui->combo_init_clock->setVisible(false); diff --git a/src/mandarine_qt/configuration/configure_system.ui b/src/mandarine_qt/configuration/configure_system.ui index 16a97ed75d..5d5ed79499 100644 --- a/src/mandarine_qt/configuration/configure_system.ui +++ b/src/mandarine_qt/configuration/configure_system.ui @@ -395,21 +395,35 @@ + + + + Pedometer steps per hour: + + + + + + 9999 + + + + Run System Setup when Home Menu is launched - + Console ID: - + @@ -425,35 +439,35 @@ - + 3GX Plugin Loader: - + Enable 3GX plugin loader - + Allow games to change plugin loader state - + Download System Files from Nitendo servers - + @@ -695,6 +709,7 @@ combo_init_clock edit_init_time spinBox_play_coins + spinBox_steps_per_hour button_regenerate_console_id