From 9a9bcd56614daa08bac1f9108f6ad4b1c416a298 Mon Sep 17 00:00:00 2001 From: uberhalit Date: Tue, 3 May 2016 12:57:28 +0200 Subject: [PATCH] Added language selector to configuration widget --- src/citra/config.cpp | 3 ++ src/citra/default_ini.h | 5 +++ src/citra_qt/config.cpp | 8 ++++ src/citra_qt/configure_general.cpp | 2 + src/citra_qt/configure_general.ui | 70 ++++++++++++++++++++++++++++++ src/core/hle/service/cfg/cfg.cpp | 4 +- src/core/settings.h | 3 ++ 7 files changed, 94 insertions(+), 1 deletion(-) diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 0d17c80bf..1b14c0b1c 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -80,6 +80,9 @@ void Config::ReadValues() { // System Region Settings::values.region_value = sdl2_config->GetInteger("System Region", "region_value", 1); + // System Language + Settings::values.language_value = sdl2_config->GetInteger("System Language", "language_value", 1); + // Miscellaneous Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Info"); diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index 0e6171736..e6647a277 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -71,6 +71,11 @@ use_virtual_sd = # 0: Japan, 1: USA (default), 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan region_value = +[System Language] +# The system language that Citra will use during emulation +# 0: Japanese, 1: English (default), 2: French, 3: German, 4: Italian, 5: Spanish, 6: Chinese, 7: Korean, 8: Dutch, 9: Portuguese, 10: Russian +language_value = + [Miscellaneous] # A filter which removes logs below a certain logging level. # Examples: *:Debug Kernel.SVC:Trace Service.*:Critical diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index b5bb75537..bad0e204c 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp @@ -64,6 +64,10 @@ void Config::ReadValues() { Settings::values.region_value = qt_config->value("region_value", 1).toInt(); qt_config->endGroup(); + qt_config->beginGroup("System Language"); + Settings::values.language_value = qt_config->value("language_value", 1).toInt(); + qt_config->endGroup(); + qt_config->beginGroup("Miscellaneous"); Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString(); qt_config->endGroup(); @@ -154,6 +158,10 @@ void Config::SaveValues() { qt_config->setValue("region_value", Settings::values.region_value); qt_config->endGroup(); + qt_config->beginGroup("System Language"); + qt_config->setValue("language_value", Settings::values.language_value); + qt_config->endGroup(); + qt_config->beginGroup("Miscellaneous"); qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter)); qt_config->endGroup(); diff --git a/src/citra_qt/configure_general.cpp b/src/citra_qt/configure_general.cpp index 62648e665..06bca3544 100644 --- a/src/citra_qt/configure_general.cpp +++ b/src/citra_qt/configure_general.cpp @@ -23,6 +23,7 @@ void ConfigureGeneral::setConfiguration() { ui->toogle_deepscan->setChecked(UISettings::values.gamedir_deepscan); ui->toogle_check_exit->setChecked(UISettings::values.confirm_before_closing); ui->region_combobox->setCurrentIndex(Settings::values.region_value); + ui->language_combobox->setCurrentIndex(Settings::values.language_value); ui->toogle_hw_renderer->setChecked(Settings::values.use_hw_renderer); ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit); ui->toogle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution); @@ -32,6 +33,7 @@ void ConfigureGeneral::applyConfiguration() { UISettings::values.gamedir_deepscan = ui->toogle_deepscan->isChecked(); UISettings::values.confirm_before_closing = ui->toogle_check_exit->isChecked(); Settings::values.region_value = ui->region_combobox->currentIndex(); + Settings::values.language_value = ui->language_combobox->currentIndex(); Settings::values.use_hw_renderer = ui->toogle_hw_renderer->isChecked(); Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked(); Settings::values.use_scaled_resolution = ui->toogle_scaled_resolution->isChecked(); diff --git a/src/citra_qt/configure_general.ui b/src/citra_qt/configure_general.ui index 5eb309793..1c395b1ab 100644 --- a/src/citra_qt/configure_general.ui +++ b/src/citra_qt/configure_general.ui @@ -101,6 +101,76 @@ + + + + + + Language: + + + + + + + + JPN (日本語) + + + + + ENG (English) + + + + + FRA (français) + + + + + DEU (Deutsch) + + + + + ITA (italiano) + + + + + SPA (español) + + + + + ZHO (中文) + + + + + KOR (한국어) + + + + + NLD (Nederlands) + + + + + POR (português) + + + + + RUS (Русский) + + + + + + diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index b9322c55d..ed84d5146 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -353,7 +353,8 @@ ResultCode FormatConfig() { res = CreateConfigInfoBlk(0x000A0001, sizeof(profile_birthday), 0xE, profile_birthday); if (!res.IsSuccess()) return res; - res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xE, &CONSOLE_LANGUAGE); + const u8 console_language = Settings::values.language_value; + res = CreateConfigInfoBlk(0x000A0002, sizeof(console_language), 0xE, &console_language); if (!res.IsSuccess()) return res; res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO); if (!res.IsSuccess()) return res; @@ -429,6 +430,7 @@ void Init() { auto config_result = Service::FS::OpenFileFromArchive(*archive_result, config_path, open_mode); // Read the file if it already exists + // TODO: Check if user has made any changes to Emulation settings (region, language) and apply these to file if (config_result.Succeeded()) { auto config = config_result.MoveFrom(); config->backend->Read(0, CONFIG_SAVEFILE_SIZE, cfg_config_file_buffer.data()); diff --git a/src/core/settings.h b/src/core/settings.h index ce2a31164..1692fbfb7 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -53,6 +53,9 @@ struct Values { // System Region int region_value; + // System Language + int language_value; + // Renderer bool use_hw_renderer; bool use_shader_jit;