summaryrefslogtreecommitdiff
path: root/src/yuzu/configuration
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/configuration')
-rw-r--r--src/yuzu/configuration/configure_per_game.h2
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.cpp7
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.h2
-rw-r--r--src/yuzu/configuration/configure_ringcon.cpp2
-rw-r--r--src/yuzu/configuration/configure_system.cpp57
-rw-r--r--src/yuzu/configuration/configure_system.h6
-rw-r--r--src/yuzu/configuration/configure_vibration.cpp8
-rw-r--r--src/yuzu/configuration/shared_translation.cpp4
8 files changed, 72 insertions, 16 deletions
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h
index c8ee46c04..9daae772c 100644
--- a/src/yuzu/configuration/configure_per_game.h
+++ b/src/yuzu/configuration/configure_per_game.h
@@ -11,7 +11,7 @@
#include <QList>
#include "configuration/shared_widget.h"
-#include "core/file_sys/vfs_types.h"
+#include "core/file_sys/vfs/vfs_types.h"
#include "frontend_common/config.h"
#include "vk_device_info.h"
#include "yuzu/configuration/configuration_shared.h"
diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp
index 140a7fe5d..568775027 100644
--- a/src/yuzu/configuration/configure_per_game_addons.cpp
+++ b/src/yuzu/configuration/configure_per_game_addons.cpp
@@ -122,9 +122,8 @@ void ConfigurePerGameAddons::LoadConfiguration() {
const auto& disabled = Settings::values.disabled_addons[title_id];
- for (const auto& patch : pm.GetPatchVersionNames(update_raw)) {
- const auto name =
- QString::fromStdString(patch.first).replace(QStringLiteral("[D] "), QString{});
+ for (const auto& patch : pm.GetPatches(update_raw)) {
+ const auto name = QString::fromStdString(patch.name);
auto* const first_item = new QStandardItem;
first_item->setText(name);
@@ -136,7 +135,7 @@ void ConfigurePerGameAddons::LoadConfiguration() {
first_item->setCheckState(patch_disabled ? Qt::Unchecked : Qt::Checked);
list_items.push_back(QList<QStandardItem*>{
- first_item, new QStandardItem{QString::fromStdString(patch.second)}});
+ first_item, new QStandardItem{QString::fromStdString(patch.version)}});
item_model->appendRow(list_items.back());
}
diff --git a/src/yuzu/configuration/configure_per_game_addons.h b/src/yuzu/configuration/configure_per_game_addons.h
index 53db405c1..32dc5dde6 100644
--- a/src/yuzu/configuration/configure_per_game_addons.h
+++ b/src/yuzu/configuration/configure_per_game_addons.h
@@ -8,7 +8,7 @@
#include <QList>
-#include "core/file_sys/vfs_types.h"
+#include "core/file_sys/vfs/vfs_types.h"
namespace Core {
class System;
diff --git a/src/yuzu/configuration/configure_ringcon.cpp b/src/yuzu/configuration/configure_ringcon.cpp
index 3a7f6101d..9fd094ab6 100644
--- a/src/yuzu/configuration/configure_ringcon.cpp
+++ b/src/yuzu/configuration/configure_ringcon.cpp
@@ -494,4 +494,4 @@ QString ConfigureRingController::AnalogToText(const Common::ParamPackage& param,
}
return QObject::tr("[unknown]");
-} \ No newline at end of file
+}
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index b0b84f967..e193b5f95 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -12,9 +12,10 @@
#include <QGraphicsItem>
#include <QLineEdit>
#include <QMessageBox>
+#include <QSpinBox>
+
#include "common/settings.h"
#include "core/core.h"
-#include "core/hle/service/time/time_manager.h"
#include "ui_configure_system.h"
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_system.h"
@@ -49,6 +50,11 @@ ConfigureSystem::ConfigureSystem(Core::System& system_,
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
ui->setupUi(this);
+ const auto posix_time = std::chrono::system_clock::now().time_since_epoch();
+ const auto current_time_s =
+ std::chrono::duration_cast<std::chrono::seconds>(posix_time).count();
+ previous_time = current_time_s + Settings::values.custom_rtc_offset.GetValue();
+
Setup(builder);
const auto locale_check = [this]() {
@@ -64,13 +70,28 @@ ConfigureSystem::ConfigureSystem(Core::System& system_,
}
};
+ const auto update_date_offset = [this]() {
+ if (!checkbox_rtc->isChecked()) {
+ return;
+ }
+ auto offset = date_rtc_offset->value();
+ offset += date_rtc->dateTime().toSecsSinceEpoch() - previous_time;
+ previous_time = date_rtc->dateTime().toSecsSinceEpoch();
+ date_rtc_offset->setValue(offset);
+ };
+ const auto update_rtc_date = [this]() { UpdateRtcTime(); };
+
connect(combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
connect(combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
+ connect(checkbox_rtc, qOverload<int>(&QCheckBox::stateChanged), this, update_rtc_date);
+ connect(date_rtc_offset, qOverload<int>(&QSpinBox::valueChanged), this, update_rtc_date);
+ connect(date_rtc, &QDateTimeEdit::dateTimeChanged, this, update_date_offset);
ui->label_warn_invalid_locale->setVisible(false);
locale_check();
SetConfiguration();
+ UpdateRtcTime();
}
ConfigureSystem::~ConfigureSystem() = default;
@@ -120,14 +141,28 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) {
continue;
}
+ // Keep track of the region_index (and language_index) combobox to validate the selected
+ // settings
if (setting->Id() == Settings::values.region_index.Id()) {
- // Keep track of the region_index (and language_index) combobox to validate the selected
- // settings
combo_region = widget->combobox;
- } else if (setting->Id() == Settings::values.language_index.Id()) {
+ }
+
+ if (setting->Id() == Settings::values.language_index.Id()) {
combo_language = widget->combobox;
}
+ if (setting->Id() == Settings::values.custom_rtc.Id()) {
+ checkbox_rtc = widget->checkbox;
+ }
+
+ if (setting->Id() == Settings::values.custom_rtc.Id()) {
+ date_rtc = widget->date_time_edit;
+ }
+
+ if (setting->Id() == Settings::values.custom_rtc_offset.Id()) {
+ date_rtc_offset = widget->spinbox;
+ }
+
switch (setting->GetCategory()) {
case Settings::Category::Core:
core_hold.emplace(setting->Id(), widget);
@@ -147,6 +182,19 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) {
}
}
+void ConfigureSystem::UpdateRtcTime() {
+ const auto posix_time = std::chrono::system_clock::now().time_since_epoch();
+ previous_time = std::chrono::duration_cast<std::chrono::seconds>(posix_time).count();
+ date_rtc_offset->setEnabled(checkbox_rtc->isChecked());
+
+ if (checkbox_rtc->isChecked()) {
+ previous_time += date_rtc_offset->value();
+ }
+
+ const auto date = QDateTime::fromSecsSinceEpoch(previous_time);
+ date_rtc->setDateTime(date);
+}
+
void ConfigureSystem::SetConfiguration() {}
void ConfigureSystem::ApplyConfiguration() {
@@ -154,4 +202,5 @@ void ConfigureSystem::ApplyConfiguration() {
for (const auto& func : apply_funcs) {
func(powered_on);
}
+ UpdateRtcTime();
}
diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h
index eab99a48a..4334211f9 100644
--- a/src/yuzu/configuration/configure_system.h
+++ b/src/yuzu/configuration/configure_system.h
@@ -43,6 +43,8 @@ private:
void Setup(const ConfigurationShared::Builder& builder);
+ void UpdateRtcTime();
+
std::vector<std::function<void(bool)>> apply_funcs{};
std::unique_ptr<Ui::ConfigureSystem> ui;
@@ -52,4 +54,8 @@ private:
QComboBox* combo_region;
QComboBox* combo_language;
+ QCheckBox* checkbox_rtc;
+ QDateTimeEdit* date_rtc;
+ QSpinBox* date_rtc_offset;
+ u64 previous_time;
};
diff --git a/src/yuzu/configuration/configure_vibration.cpp b/src/yuzu/configuration/configure_vibration.cpp
index d898d8acc..6b1f4527b 100644
--- a/src/yuzu/configuration/configure_vibration.cpp
+++ b/src/yuzu/configuration/configure_vibration.cpp
@@ -116,8 +116,8 @@ void ConfigureVibration::VibrateController(Core::HID::ControllerTriggerType type
.high_amplitude = 1.0f,
.high_frequency = 320.0f,
};
- controller->SetVibration(0, vibration);
- controller->SetVibration(1, vibration);
+ controller->SetVibration(Core::HID::DeviceIndex::Left, vibration);
+ controller->SetVibration(Core::HID::DeviceIndex::Right, vibration);
// Restore previous values
player.vibration_enabled = old_vibration_enabled;
@@ -127,7 +127,7 @@ void ConfigureVibration::VibrateController(Core::HID::ControllerTriggerType type
void ConfigureVibration::StopVibrations() {
for (std::size_t i = 0; i < NUM_PLAYERS; ++i) {
auto controller = hid_core.GetEmulatedControllerByIndex(i);
- controller->SetVibration(0, Core::HID::DEFAULT_VIBRATION_VALUE);
- controller->SetVibration(1, Core::HID::DEFAULT_VIBRATION_VALUE);
+ controller->SetVibration(Core::HID::DeviceIndex::Left, Core::HID::DEFAULT_VIBRATION_VALUE);
+ controller->SetVibration(Core::HID::DeviceIndex::Right, Core::HID::DEFAULT_VIBRATION_VALUE);
}
}
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp
index 922eb1b1a..ed9c7d859 100644
--- a/src/yuzu/configuration/shared_translation.cpp
+++ b/src/yuzu/configuration/shared_translation.cpp
@@ -143,8 +143,10 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
INSERT(Settings, rng_seed, tr("RNG Seed"), QStringLiteral());
INSERT(Settings, rng_seed_enabled, QStringLiteral(), QStringLiteral());
INSERT(Settings, device_name, tr("Device Name"), QStringLiteral());
- INSERT(Settings, custom_rtc, tr("Custom RTC"), QStringLiteral());
+ INSERT(Settings, custom_rtc, tr("Custom RTC Date:"), QStringLiteral());
INSERT(Settings, custom_rtc_enabled, QStringLiteral(), QStringLiteral());
+ INSERT(Settings, custom_rtc_offset, QStringLiteral(" "),
+ QStringLiteral("The number of seconds from the current unix time"));
INSERT(Settings, language_index, tr("Language:"),
tr("Note: this can be overridden when region setting is auto-select"));
INSERT(Settings, region_index, tr("Region:"), QStringLiteral());