Merge pull request #4209 from zhaowenlan1779/play-coin

service/ptm, citra_qt: Add Play Coins setting
This commit is contained in:
Weiyi Wang 2018-09-27 10:09:02 -04:00 committed by GitHub
commit 892ca2a94a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 102 additions and 19 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();