From 2ccf17532456f4480a40fea06e00242d5fd3483c Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Wed, 28 Dec 2022 19:08:31 +0000 Subject: [PATCH 1/3] settings: warn on invalid regon/language combinations --- src/yuzu/configuration/configure_system.cpp | 30 +++++++++++++++++++++ src/yuzu/configuration/configure_system.ui | 12 ++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 9b14e5903f..37a98bea19 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -14,6 +14,20 @@ #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_system.h" +constexpr std::array LOCALE_BLOCKLIST{ + 0b100011100001100000, // Japan + 0b000001101001100100, // Americas + 0b100110100001000010, // Europe + 0b100110100001000010, // Australia + 0b000000000000000000, // China + 0b100111100001000000, // Korea + 0b100111100001000000, // Taiwan +}; + +static bool IsValidLocale(u32 region_index, u32 language_index) { + return ((LOCALE_BLOCKLIST[region_index] >> language_index) & 1) == 0; +} + ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); @@ -34,6 +48,22 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) } }); + const auto locale_check = [this](int index) { + const bool valid_locale = + IsValidLocale(ui->combo_region->currentIndex(), ui->combo_language->currentIndex()); + ui->label_warn_invalid_locale->setVisible(!valid_locale); + if (!valid_locale) { + ui->label_warn_invalid_locale->setText( + tr("Warning: \"%1\" is not a valid language for region \"%2\"") + .arg(ui->combo_language->currentText()) + .arg(ui->combo_region->currentText())); + } + }; + + connect(ui->combo_language, qOverload(&QComboBox::currentIndexChanged), this, + locale_check); + connect(ui->combo_region, qOverload(&QComboBox::currentIndexChanged), this, locale_check); + ui->label_console_id->setVisible(Settings::IsConfiguringGlobal()); ui->button_regenerate_console_id->setVisible(Settings::IsConfiguringGlobal()); diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui index 46892f5c1e..0459cd9242 100644 --- a/src/yuzu/configuration/configure_system.ui +++ b/src/yuzu/configuration/configure_system.ui @@ -326,7 +326,7 @@ - English + American English @@ -545,6 +545,16 @@ + + + + + + + true + + + From 8594f287b83006a0aa11dfadbf174e5320873ab3 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Thu, 29 Dec 2022 14:25:22 +0000 Subject: [PATCH 2/3] settings: added regon/language warning bounds check --- src/yuzu/configuration/configure_system.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 37a98bea19..13bbc4ad9b 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -25,7 +25,7 @@ constexpr std::array LOCALE_BLOCKLIST{ }; static bool IsValidLocale(u32 region_index, u32 language_index) { - return ((LOCALE_BLOCKLIST[region_index] >> language_index) & 1) == 0; + return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0; } ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) From 28cfc2146f1226aa0b43efb15b8147130c92f8ae Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Thu, 29 Dec 2022 16:29:50 +0000 Subject: [PATCH 3/3] settings: comment language blocklist columns --- src/yuzu/configuration/configure_system.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 13bbc4ad9b..94049f2f44 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -15,13 +15,19 @@ #include "yuzu/configuration/configure_system.h" constexpr std::array LOCALE_BLOCKLIST{ - 0b100011100001100000, // Japan - 0b000001101001100100, // Americas - 0b100110100001000010, // Europe - 0b100110100001000010, // Australia - 0b000000000000000000, // China - 0b100111100001000000, // Korea - 0b100111100001000000, // Taiwan + // pzzefezrpnkzeidfej + // thhsrnhutlohsternp + // BHH4CG U + // Raa1AB S + // nn9 + // ts + 0b0100011100001100000, // Japan + 0b0000001101001100100, // Americas + 0b0100110100001000010, // Europe + 0b0100110100001000010, // Australia + 0b0000000000000000000, // China + 0b0100111100001000000, // Korea + 0b0100111100001000000, // Taiwan }; static bool IsValidLocale(u32 region_index, u32 language_index) {