diff options
Diffstat (limited to 'src/citra_qt')
| -rw-r--r-- | src/citra_qt/configuration/configure_system.cpp | 94 | ||||
| -rw-r--r-- | src/citra_qt/main.cpp | 14 |
2 files changed, 2 insertions, 106 deletions
diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp index 88a067c12..d83c2db23 100644 --- a/src/citra_qt/configuration/configure_system.cpp +++ b/src/citra_qt/configuration/configure_system.cpp | |||
| @@ -6,8 +6,6 @@ | |||
| 6 | #include "citra_qt/configuration/configure_system.h" | 6 | #include "citra_qt/configuration/configure_system.h" |
| 7 | #include "citra_qt/ui_settings.h" | 7 | #include "citra_qt/ui_settings.h" |
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/service/cfg/cfg.h" | ||
| 10 | #include "core/hle/service/fs/archive.h" | ||
| 11 | #include "ui_configure_system.h" | 9 | #include "ui_configure_system.h" |
| 12 | 10 | ||
| 13 | static const std::array<int, 12> days_in_month = {{ | 11 | static const std::array<int, 12> days_in_month = {{ |
| @@ -29,100 +27,14 @@ ConfigureSystem::~ConfigureSystem() {} | |||
| 29 | 27 | ||
| 30 | void ConfigureSystem::setConfiguration() { | 28 | void ConfigureSystem::setConfiguration() { |
| 31 | enabled = !Core::System::GetInstance().IsPoweredOn(); | 29 | enabled = !Core::System::GetInstance().IsPoweredOn(); |
| 32 | |||
| 33 | if (!enabled) { | ||
| 34 | ReadSystemSettings(); | ||
| 35 | ui->group_system_settings->setEnabled(false); | ||
| 36 | } else { | ||
| 37 | // This tab is enabled only when game is not running (i.e. all service are not initialized). | ||
| 38 | // Temporarily register archive types and load the config savegame file to memory. | ||
| 39 | Service::FS::RegisterArchiveTypes(); | ||
| 40 | ResultCode result = Service::CFG::LoadConfigNANDSaveFile(); | ||
| 41 | Service::FS::UnregisterArchiveTypes(); | ||
| 42 | |||
| 43 | if (result.IsError()) { | ||
| 44 | ui->label_disable_info->setText(tr("Failed to load system settings data.")); | ||
| 45 | ui->group_system_settings->setEnabled(false); | ||
| 46 | enabled = false; | ||
| 47 | return; | ||
| 48 | } | ||
| 49 | |||
| 50 | ReadSystemSettings(); | ||
| 51 | ui->label_disable_info->hide(); | ||
| 52 | } | ||
| 53 | } | 30 | } |
| 54 | 31 | ||
| 55 | void ConfigureSystem::ReadSystemSettings() { | 32 | void ConfigureSystem::ReadSystemSettings() { |
| 56 | // set username | ||
| 57 | username = Service::CFG::GetUsername(); | ||
| 58 | // TODO(wwylele): Use this when we move to Qt 5.5 | ||
| 59 | // ui->edit_username->setText(QString::fromStdU16String(username)); | ||
| 60 | ui->edit_username->setText( | ||
| 61 | QString::fromUtf16(reinterpret_cast<const ushort*>(username.data()))); | ||
| 62 | |||
| 63 | // set birthday | ||
| 64 | std::tie(birthmonth, birthday) = Service::CFG::GetBirthday(); | ||
| 65 | ui->combo_birthmonth->setCurrentIndex(birthmonth - 1); | ||
| 66 | updateBirthdayComboBox( | ||
| 67 | birthmonth - | ||
| 68 | 1); // explicitly update it because the signal from setCurrentIndex is not reliable | ||
| 69 | ui->combo_birthday->setCurrentIndex(birthday - 1); | ||
| 70 | |||
| 71 | // set system language | ||
| 72 | language_index = Service::CFG::GetSystemLanguage(); | ||
| 73 | ui->combo_language->setCurrentIndex(language_index); | ||
| 74 | |||
| 75 | // set sound output mode | ||
| 76 | sound_index = Service::CFG::GetSoundOutputMode(); | ||
| 77 | ui->combo_sound->setCurrentIndex(sound_index); | ||
| 78 | |||
| 79 | // set the console id | ||
| 80 | u64 console_id = Service::CFG::GetConsoleUniqueId(); | ||
| 81 | ui->label_console_id->setText( | ||
| 82 | tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper())); | ||
| 83 | } | 33 | } |
| 84 | 34 | ||
| 85 | void ConfigureSystem::applyConfiguration() { | 35 | void ConfigureSystem::applyConfiguration() { |
| 86 | if (!enabled) | 36 | if (!enabled) |
| 87 | return; | 37 | return; |
| 88 | |||
| 89 | bool modified = false; | ||
| 90 | |||
| 91 | // apply username | ||
| 92 | // TODO(wwylele): Use this when we move to Qt 5.5 | ||
| 93 | // std::u16string new_username = ui->edit_username->text().toStdU16String(); | ||
| 94 | std::u16string new_username( | ||
| 95 | reinterpret_cast<const char16_t*>(ui->edit_username->text().utf16())); | ||
| 96 | if (new_username != username) { | ||
| 97 | Service::CFG::SetUsername(new_username); | ||
| 98 | modified = true; | ||
| 99 | } | ||
| 100 | |||
| 101 | // apply birthday | ||
| 102 | int new_birthmonth = ui->combo_birthmonth->currentIndex() + 1; | ||
| 103 | int new_birthday = ui->combo_birthday->currentIndex() + 1; | ||
| 104 | if (birthmonth != new_birthmonth || birthday != new_birthday) { | ||
| 105 | Service::CFG::SetBirthday(new_birthmonth, new_birthday); | ||
| 106 | modified = true; | ||
| 107 | } | ||
| 108 | |||
| 109 | // apply language | ||
| 110 | int new_language = ui->combo_language->currentIndex(); | ||
| 111 | if (language_index != new_language) { | ||
| 112 | Service::CFG::SetSystemLanguage(static_cast<Service::CFG::SystemLanguage>(new_language)); | ||
| 113 | modified = true; | ||
| 114 | } | ||
| 115 | |||
| 116 | // apply sound | ||
| 117 | int new_sound = ui->combo_sound->currentIndex(); | ||
| 118 | if (sound_index != new_sound) { | ||
| 119 | Service::CFG::SetSoundOutputMode(static_cast<Service::CFG::SoundOutputMode>(new_sound)); | ||
| 120 | modified = true; | ||
| 121 | } | ||
| 122 | |||
| 123 | // update the config savegame if any item is modified. | ||
| 124 | if (modified) | ||
| 125 | Service::CFG::UpdateConfigNANDSavegame(); | ||
| 126 | } | 38 | } |
| 127 | 39 | ||
| 128 | void ConfigureSystem::updateBirthdayComboBox(int birthmonth_index) { | 40 | void ConfigureSystem::updateBirthdayComboBox(int birthmonth_index) { |
| @@ -160,10 +72,6 @@ void ConfigureSystem::refreshConsoleID() { | |||
| 160 | QMessageBox::No | QMessageBox::Yes); | 72 | QMessageBox::No | QMessageBox::Yes); |
| 161 | if (reply == QMessageBox::No) | 73 | if (reply == QMessageBox::No) |
| 162 | return; | 74 | return; |
| 163 | u32 random_number; | 75 | u64 console_id{}; |
| 164 | u64 console_id; | ||
| 165 | Service::CFG::GenerateConsoleUniqueId(random_number, console_id); | ||
| 166 | Service::CFG::SetConsoleUniqueId(random_number, console_id); | ||
| 167 | Service::CFG::UpdateConfigNANDSavegame(); | ||
| 168 | ui->label_console_id->setText("Console ID: 0x" + QString::number(console_id, 16).toUpper()); | 76 | ui->label_console_id->setText("Console ID: 0x" + QString::number(console_id, 16).toUpper()); |
| 169 | } | 77 | } |
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 8adbcfe86..943aee30d 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | #include "common/scope_exit.h" | 39 | #include "common/scope_exit.h" |
| 40 | #include "common/string_util.h" | 40 | #include "common/string_util.h" |
| 41 | #include "core/core.h" | 41 | #include "core/core.h" |
| 42 | #include "core/file_sys/archive_source_sd_savedata.h" | ||
| 43 | #include "core/gdbstub/gdbstub.h" | 42 | #include "core/gdbstub/gdbstub.h" |
| 44 | #include "core/loader/loader.h" | 43 | #include "core/loader/loader.h" |
| 45 | #include "core/settings.h" | 44 | #include "core/settings.h" |
| @@ -541,18 +540,7 @@ void GMainWindow::OnGameListLoadFile(QString game_path) { | |||
| 541 | } | 540 | } |
| 542 | 541 | ||
| 543 | void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) { | 542 | void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) { |
| 544 | std::string sdmc_dir = FileUtil::GetUserPath(D_SDMC_IDX); | 543 | UNIMPLEMENTED(); |
| 545 | std::string path = FileSys::ArchiveSource_SDSaveData::GetSaveDataPathFor(sdmc_dir, program_id); | ||
| 546 | QString qpath = QString::fromStdString(path); | ||
| 547 | |||
| 548 | QDir dir(qpath); | ||
| 549 | if (!dir.exists()) { | ||
| 550 | QMessageBox::critical(this, tr("Error Opening Save Folder"), tr("Folder does not exist!")); | ||
| 551 | return; | ||
| 552 | } | ||
| 553 | |||
| 554 | LOG_INFO(Frontend, "Opening save data path for program_id=%" PRIu64, program_id); | ||
| 555 | QDesktopServices::openUrl(QUrl::fromLocalFile(qpath)); | ||
| 556 | } | 544 | } |
| 557 | 545 | ||
| 558 | void GMainWindow::OnMenuLoadFile() { | 546 | void GMainWindow::OnMenuLoadFile() { |