mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Merge pull request #4209 from zhaowenlan1779/play-coin
service/ptm, citra_qt: Add Play Coins setting
This commit is contained in:
		
						commit
						892ca2a94a
					
				
					 5 changed files with 102 additions and 19 deletions
				
			
		|  | @ -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(); | ||||
|  |  | |||
|  | @ -47,4 +47,5 @@ private: | |||
|     int language_index; | ||||
|     int sound_index; | ||||
|     u8 country_code; | ||||
|     u16 play_coin; | ||||
| }; | ||||
|  |  | |||
|  | @ -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"> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue