Added language selector to configuration widget

This commit is contained in:
uberhalit 2016-05-03 12:57:28 +02:00
parent 6d02fe39f5
commit 9a9bcd5661
7 changed files with 94 additions and 1 deletions

View file

@ -80,6 +80,9 @@ void Config::ReadValues() {
// System Region // System Region
Settings::values.region_value = sdl2_config->GetInteger("System Region", "region_value", 1); 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 // Miscellaneous
Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Info"); Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Info");

View file

@ -71,6 +71,11 @@ use_virtual_sd =
# 0: Japan, 1: USA (default), 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan # 0: Japan, 1: USA (default), 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan
region_value = 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] [Miscellaneous]
# A filter which removes logs below a certain logging level. # A filter which removes logs below a certain logging level.
# Examples: *:Debug Kernel.SVC:Trace Service.*:Critical # Examples: *:Debug Kernel.SVC:Trace Service.*:Critical

View file

@ -64,6 +64,10 @@ void Config::ReadValues() {
Settings::values.region_value = qt_config->value("region_value", 1).toInt(); Settings::values.region_value = qt_config->value("region_value", 1).toInt();
qt_config->endGroup(); 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"); qt_config->beginGroup("Miscellaneous");
Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString(); Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString();
qt_config->endGroup(); qt_config->endGroup();
@ -154,6 +158,10 @@ void Config::SaveValues() {
qt_config->setValue("region_value", Settings::values.region_value); qt_config->setValue("region_value", Settings::values.region_value);
qt_config->endGroup(); 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->beginGroup("Miscellaneous");
qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter)); qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter));
qt_config->endGroup(); qt_config->endGroup();

View file

@ -23,6 +23,7 @@ void ConfigureGeneral::setConfiguration() {
ui->toogle_deepscan->setChecked(UISettings::values.gamedir_deepscan); ui->toogle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
ui->toogle_check_exit->setChecked(UISettings::values.confirm_before_closing); ui->toogle_check_exit->setChecked(UISettings::values.confirm_before_closing);
ui->region_combobox->setCurrentIndex(Settings::values.region_value); 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_hw_renderer->setChecked(Settings::values.use_hw_renderer);
ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit); ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit);
ui->toogle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution); 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.gamedir_deepscan = ui->toogle_deepscan->isChecked();
UISettings::values.confirm_before_closing = ui->toogle_check_exit->isChecked(); UISettings::values.confirm_before_closing = ui->toogle_check_exit->isChecked();
Settings::values.region_value = ui->region_combobox->currentIndex(); 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_hw_renderer = ui->toogle_hw_renderer->isChecked();
Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked(); Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked();
Settings::values.use_scaled_resolution = ui->toogle_scaled_resolution->isChecked(); Settings::values.use_scaled_resolution = ui->toogle_scaled_resolution->isChecked();

View file

@ -101,6 +101,76 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Language:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="language_combobox">
<item>
<property name="text">
<string notr="true">JPN (日本語)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">ENG (English)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">FRA (français)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">DEU (Deutsch)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">ITA (italiano)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">SPA (español)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">ZHO (中文)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">KOR (한국어)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">NLD (Nederlands)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">POR (português)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">RUS (Русский)</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View file

@ -353,7 +353,8 @@ ResultCode FormatConfig() {
res = CreateConfigInfoBlk(0x000A0001, sizeof(profile_birthday), 0xE, profile_birthday); res = CreateConfigInfoBlk(0x000A0001, sizeof(profile_birthday), 0xE, profile_birthday);
if (!res.IsSuccess()) return res; 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; if (!res.IsSuccess()) return res;
res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO); res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO);
if (!res.IsSuccess()) return res; if (!res.IsSuccess()) return res;
@ -429,6 +430,7 @@ void Init() {
auto config_result = Service::FS::OpenFileFromArchive(*archive_result, config_path, open_mode); auto config_result = Service::FS::OpenFileFromArchive(*archive_result, config_path, open_mode);
// Read the file if it already exists // 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()) { if (config_result.Succeeded()) {
auto config = config_result.MoveFrom(); auto config = config_result.MoveFrom();
config->backend->Read(0, CONFIG_SAVEFILE_SIZE, cfg_config_file_buffer.data()); config->backend->Read(0, CONFIG_SAVEFILE_SIZE, cfg_config_file_buffer.data());

View file

@ -53,6 +53,9 @@ struct Values {
// System Region // System Region
int region_value; int region_value;
// System Language
int language_value;
// Renderer // Renderer
bool use_hw_renderer; bool use_hw_renderer;
bool use_shader_jit; bool use_shader_jit;