summaryrefslogtreecommitdiff
path: root/src/citra_qt/configuration/configure_system.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2017-10-12 21:21:49 -0400
committerGravatar bunnei2017-10-12 21:21:49 -0400
commit72b03025ac4ef0d8633c2f3e55b513cd149c59e5 (patch)
treef1fbeb915a0b3df8e4e988a6a562a763e18ea666 /src/citra_qt/configuration/configure_system.cpp
parenthle: Remove a large amount of 3ds-specific service code. (diff)
downloadyuzu-72b03025ac4ef0d8633c2f3e55b513cd149c59e5.tar.gz
yuzu-72b03025ac4ef0d8633c2f3e55b513cd149c59e5.tar.xz
yuzu-72b03025ac4ef0d8633c2f3e55b513cd149c59e5.zip
Remove lots more 3DS-specific code.
Diffstat (limited to 'src/citra_qt/configuration/configure_system.cpp')
-rw-r--r--src/citra_qt/configuration/configure_system.cpp94
1 files changed, 1 insertions, 93 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
13static const std::array<int, 12> days_in_month = {{ 11static const std::array<int, 12> days_in_month = {{
@@ -29,100 +27,14 @@ ConfigureSystem::~ConfigureSystem() {}
29 27
30void ConfigureSystem::setConfiguration() { 28void 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
55void ConfigureSystem::ReadSystemSettings() { 32void 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
85void ConfigureSystem::applyConfiguration() { 35void 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
128void ConfigureSystem::updateBirthdayComboBox(int birthmonth_index) { 40void 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}