summaryrefslogtreecommitdiff
path: root/src/citra_qt/configuration/configure_system.cpp
diff options
context:
space:
mode:
authorGravatar B3n302017-05-06 02:55:51 +0200
committerGravatar bunnei2017-05-05 20:55:51 -0400
commit8bee0161458a082491d611ba4353cda84881b067 (patch)
tree776f900e7797f81bef52324cbc3f0202fc7fe8b7 /src/citra_qt/configuration/configure_system.cpp
parentMerge pull request #2606 from wwylele/ir (diff)
downloadyuzu-8bee0161458a082491d611ba4353cda84881b067.tar.gz
yuzu-8bee0161458a082491d611ba4353cda84881b067.tar.xz
yuzu-8bee0161458a082491d611ba4353cda84881b067.zip
Create a random console_unique_id (#2668)
* Create a random console_id when config save_file is created Added button in system config to refresh the console unique id * Moved the connect for the button from .ui file to constructor of ConfigureSystem * Added warning and info dialog Fixup: Make use of qt5 style connects, renamed the refresh button, removed some duplicate code, changed random device and moved all to the generate function * Changed the random generator to reflect what a real 3DS stores as console unique id Fixup: Changed the warning message * Fixup: Set and Create * Fixup: Added console id label, therfore removed second message box * Fixup: fixed the endianess * Fixup: more endianness fixes * Fixup: Endianness the 3rd
Diffstat (limited to 'src/citra_qt/configuration/configure_system.cpp')
-rw-r--r--src/citra_qt/configuration/configure_system.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp
index a3a9015a4..9b1e6711d 100644
--- a/src/citra_qt/configuration/configure_system.cpp
+++ b/src/citra_qt/configuration/configure_system.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <QMessageBox>
5#include "citra_qt/configuration/configure_system.h" 6#include "citra_qt/configuration/configure_system.h"
6#include "citra_qt/ui_settings.h" 7#include "citra_qt/ui_settings.h"
7#include "core/core.h" 8#include "core/core.h"
@@ -15,8 +16,11 @@ static const std::array<int, 12> days_in_month = {{
15 16
16ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) { 17ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) {
17 ui->setupUi(this); 18 ui->setupUi(this);
18 connect(ui->combo_birthmonth, SIGNAL(currentIndexChanged(int)), 19 connect(ui->combo_birthmonth,
19 SLOT(updateBirthdayComboBox(int))); 20 static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
21 &ConfigureSystem::updateBirthdayComboBox);
22 connect(ui->button_regenerate_console_id, &QPushButton::clicked, this,
23 &ConfigureSystem::refreshConsoleID);
20 24
21 this->setConfiguration(); 25 this->setConfiguration();
22} 26}
@@ -71,6 +75,10 @@ void ConfigureSystem::ReadSystemSettings() {
71 // set sound output mode 75 // set sound output mode
72 sound_index = Service::CFG::GetSoundOutputMode(); 76 sound_index = Service::CFG::GetSoundOutputMode();
73 ui->combo_sound->setCurrentIndex(sound_index); 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("Console ID: 0x" + QString::number(console_id, 16).toUpper());
74} 82}
75 83
76void ConfigureSystem::applyConfiguration() { 84void ConfigureSystem::applyConfiguration() {
@@ -140,3 +148,21 @@ void ConfigureSystem::updateBirthdayComboBox(int birthmonth_index) {
140 // restore the day selection 148 // restore the day selection
141 ui->combo_birthday->setCurrentIndex(birthday_index); 149 ui->combo_birthday->setCurrentIndex(birthday_index);
142} 150}
151
152void ConfigureSystem::refreshConsoleID() {
153 QMessageBox::StandardButton reply;
154 QString warning_text = tr("This will replace your current virtual 3DS with a new one. "
155 "Your current virtual 3DS will not be recoverable. "
156 "This might have unexpected effects in games. This might fail, "
157 "if you use an outdated config savegame. Continue?");
158 reply = QMessageBox::critical(this, tr("Warning"), warning_text,
159 QMessageBox::No | QMessageBox::Yes);
160 if (reply == QMessageBox::No)
161 return;
162 u32 random_number;
163 u64 console_id;
164 Service::CFG::GenerateConsoleUniqueId(random_number, console_id);
165 Service::CFG::SetConsoleUniqueId(random_number, console_id);
166 Service::CFG::UpdateConfigNANDSavegame();
167 ui->label_console_id->setText("Console ID: 0x" + QString::number(console_id, 16).toUpper());
168}