citra-emu
/
citra-canary
Archived
1
0
Fork 0

citra_qt/configuration: Add Play Coins setting

This commit is contained in:
zhupengfei 2018-09-13 23:01:58 +08:00
parent 458f8d103b
commit 31dc9003c5
No known key found for this signature in database
GPG Key ID: 85B82A3E62174206
3 changed files with 31 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#include "core/core.h"
#include "core/hle/service/cfg/cfg.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/ptm/ptm.h"
#include "core/settings.h"
#include "ui_configure_system.h"
@ -254,9 +255,9 @@ void ConfigureSystem::setConfiguration() {
// Temporarily register archive types and load the config savegame file to memory.
Service::FS::RegisterArchiveTypes();
cfg = std::make_shared<Service::CFG::Module>();
ReadSystemSettings();
Service::FS::UnregisterArchiveTypes();
ReadSystemSettings();
ui->label_disable_info->hide();
}
}
@ -293,6 +294,10 @@ void ConfigureSystem::ReadSystemSettings() {
u64 console_id = cfg->GetConsoleUniqueId();
ui->label_console_id->setText(
tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper()));
// set play coin
play_coin = Service::PTM::Module::GetPlayCoins();
ui->spinBox_play_coins->setValue(play_coin);
}
void ConfigureSystem::applyConfiguration() {
@ -340,6 +345,15 @@ void ConfigureSystem::applyConfiguration() {
modified = true;
}
// apply play coin
u16 new_play_coin = static_cast<u16>(ui->spinBox_play_coins->value());
if (play_coin != new_play_coin) {
// archive types must be registered to set play coins
Service::FS::RegisterArchiveTypes();
Service::PTM::Module::SetPlayCoins(new_play_coin);
Service::FS::UnregisterArchiveTypes();
}
// update the config savegame if any item is modified.
if (modified)
cfg->UpdateConfigNANDSavegame();

View File

@ -47,4 +47,5 @@ private:
int language_index;
int sound_index;
u8 country_code;
u16 play_coin;
};

View File

@ -264,13 +264,27 @@
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_play_coins">
<property name="text">
<string>Play Coins:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QSpinBox" name="spinBox_play_coins">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_console_id">
<property name="text">
<string>Console ID:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QPushButton" name="button_regenerate_console_id">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">