diff --git a/rpcs3/Emu/Cell/Modules/cellSysutil.cpp b/rpcs3/Emu/Cell/Modules/cellSysutil.cpp index b1f5ea48f..00dd1d891 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutil.cpp @@ -108,6 +108,26 @@ void fmt_class_string::format(std::string& out, u64 arg) }); } +template <> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](CellSysutilLicenseArea value) + { + switch (value) + { + case CELL_SYSUTIL_LICENSE_AREA_J: return "SCEJ"; + case CELL_SYSUTIL_LICENSE_AREA_A: return "SCEA"; + case CELL_SYSUTIL_LICENSE_AREA_E: return "SCEE"; + case CELL_SYSUTIL_LICENSE_AREA_H: return "SCEH"; + case CELL_SYSUTIL_LICENSE_AREA_K: return "SCEK"; + case CELL_SYSUTIL_LICENSE_AREA_C: return "SCH"; + case CELL_SYSUTIL_LICENSE_AREA_OTHER: return "Other"; + } + + return unknown; + }); +} + template <> void fmt_class_string::format(std::string& out, u64 arg) { diff --git a/rpcs3/Emu/Cell/Modules/cellSysutil.h b/rpcs3/Emu/Cell/Modules/cellSysutil.h index 4c14a36d5..d6b034fb5 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutil.h +++ b/rpcs3/Emu/Cell/Modules/cellSysutil.h @@ -210,15 +210,15 @@ enum }; // License areas -enum +enum CellSysutilLicenseArea : s32 // Made up name { - CELL_SYSUTIL_LICENSE_AREA_J = 0, - CELL_SYSUTIL_LICENSE_AREA_A = 1, - CELL_SYSUTIL_LICENSE_AREA_E = 2, - CELL_SYSUTIL_LICENSE_AREA_H = 3, - CELL_SYSUTIL_LICENSE_AREA_K = 4, - CELL_SYSUTIL_LICENSE_AREA_C = 5, - CELL_SYSUTIL_LICENSE_AREA_OTHER = 100, + CELL_SYSUTIL_LICENSE_AREA_J = 0, // SCEJ (Japan) + CELL_SYSUTIL_LICENSE_AREA_A = 1, // SCEA (North America, South America, Canada, Brazil) + CELL_SYSUTIL_LICENSE_AREA_E = 2, // SCEE (UK, Europe, Eastern Europe, Oceania, Russia) + CELL_SYSUTIL_LICENSE_AREA_H = 3, // SCEH (Hong Kong, Taiwan, Southeast Asia) + CELL_SYSUTIL_LICENSE_AREA_K = 4, // SCEK (Korea) + CELL_SYSUTIL_LICENSE_AREA_C = 5, // SCH (China) + CELL_SYSUTIL_LICENSE_AREA_OTHER = 100, // Other }; enum diff --git a/rpcs3/Emu/Cell/Modules/cellSysutilMisc.cpp b/rpcs3/Emu/Cell/Modules/cellSysutilMisc.cpp index 153cdedc4..d78d7d625 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutilMisc.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutilMisc.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/System.h" +#include "Emu/system_config.h" #include "Emu/Cell/PPUModule.h" #include "cellSysutil.h" @@ -9,16 +9,9 @@ s32 cellSysutilGetLicenseArea() { cellSysutilMisc.warning("cellSysutilGetLicenseArea()"); - switch (const char region = Emu.GetTitleID().size() >= 3u ? Emu.GetTitleID().at(2) : '\0') - { - case 'J': return CELL_SYSUTIL_LICENSE_AREA_J; - case 'U': return CELL_SYSUTIL_LICENSE_AREA_A; - case 'E': return CELL_SYSUTIL_LICENSE_AREA_E; - case 'H': return CELL_SYSUTIL_LICENSE_AREA_H; - case 'K': return CELL_SYSUTIL_LICENSE_AREA_K; - case 'A': return CELL_SYSUTIL_LICENSE_AREA_C; - default: cellSysutilMisc.todo("Unknown license area: %s", Emu.GetTitleID()); return CELL_SYSUTIL_LICENSE_AREA_OTHER; - } + const CellSysutilLicenseArea license_area = g_cfg.sys.license_area; + cellSysutilMisc.notice("cellSysutilGetLicenseArea(): %s", license_area); + return license_area; } DECLARE(ppu_module_manager::cellSysutilMisc)("cellSysutilMisc", []() diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index 94bce51bd..ca5f74145 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -4,6 +4,7 @@ #include "Utilities/Config.h" enum CellNetCtlState : s32; +enum CellSysutilLicenseArea : s32; enum CellSysutilLang : s32; enum CellKbMappingType : s32; @@ -251,6 +252,7 @@ struct cfg_root : cfg::node { node_sys(cfg::node* _this) : cfg::node(_this, "System") {} + cfg::_enum license_area{ this, "License Area", CellSysutilLicenseArea{1} }; // CELL_SYSUTIL_LICENSE_AREA_A cfg::_enum language{ this, "Language", CellSysutilLang{1} }; // CELL_SYSUTIL_LANG_ENGLISH_US cfg::_enum keyboard_type{ this, "Keyboard Type", CellKbMappingType{0} }; // CELL_KB_MAPPING_101 = US cfg::_enum enter_button_assignment{ this, "Enter button assignment", enter_button_assign::cross }; diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 06cc6910e..b6039171a 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -8,6 +8,7 @@ #include "Emu/System.h" #include "Emu/system_config.h" +#include "Emu/Cell/Modules/cellSysutil.h" #include "util/yaml.hpp" @@ -902,6 +903,18 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_ case audio_downmix::use_application_settings: return tr("Use application settings", "Audio downmix"); } break; + case emu_settings_type::LicenseArea: + switch (static_cast(index)) + { + case CellSysutilLicenseArea::CELL_SYSUTIL_LICENSE_AREA_J: return tr("Japan", "License Area"); + case CellSysutilLicenseArea::CELL_SYSUTIL_LICENSE_AREA_A: return tr("America", "License Area"); + case CellSysutilLicenseArea::CELL_SYSUTIL_LICENSE_AREA_E: return tr("Europe, Oceania, Middle East, Russia", "License Area"); + case CellSysutilLicenseArea::CELL_SYSUTIL_LICENSE_AREA_H: return tr("Southeast Asia", "License Area"); + case CellSysutilLicenseArea::CELL_SYSUTIL_LICENSE_AREA_K: return tr("Korea", "License Area"); + case CellSysutilLicenseArea::CELL_SYSUTIL_LICENSE_AREA_C: return tr("China", "License Area"); + case CellSysutilLicenseArea::CELL_SYSUTIL_LICENSE_AREA_OTHER: return tr("Other", "License Area"); + } + break; default: break; } diff --git a/rpcs3/rpcs3qt/emu_settings_type.h b/rpcs3/rpcs3qt/emu_settings_type.h index 835efdc4e..34efa8a42 100644 --- a/rpcs3/rpcs3qt/emu_settings_type.h +++ b/rpcs3/rpcs3qt/emu_settings_type.h @@ -132,6 +132,7 @@ enum class emu_settings_type PSNStatus, // System + LicenseArea, Language, KeyboardType, EnterButtonAssignment, @@ -276,6 +277,7 @@ static const QMap settings_location = { emu_settings_type::PSNStatus, { "Net", "PSN status"}}, // System + { emu_settings_type::LicenseArea, { "System", "License Area"}}, { emu_settings_type::Language, { "System", "Language"}}, { emu_settings_type::KeyboardType, { "System", "Keyboard Type"} }, { emu_settings_type::EnterButtonAssignment, { "System", "Enter button assignment"}}, diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 0b200e04d..1121ddbcf 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -841,6 +841,9 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std m_emu_settings->EnhanceComboBox(ui->sysLangBox, emu_settings_type::Language, false, false, 0, true); SubscribeTooltip(ui->gb_sysLang, tooltips.settings.system_language); + m_emu_settings->EnhanceComboBox(ui->console_region, emu_settings_type::LicenseArea, false, false, 0, true); + SubscribeTooltip(ui->gb_console_region, tooltips.settings.license_area); + m_emu_settings->EnhanceComboBox(ui->keyboardType, emu_settings_type::KeyboardType, false, false, 0, true); SubscribeTooltip(ui->gb_keyboardType, tooltips.settings.keyboard_type); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index c74ff0d4b..a573e60c5 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -1433,9 +1433,6 @@ - - false - Console Region diff --git a/rpcs3/rpcs3qt/tooltips.h b/rpcs3/rpcs3qt/tooltips.h index 0bedd27e6..692c24c7a 100644 --- a/rpcs3/rpcs3qt/tooltips.h +++ b/rpcs3/rpcs3qt/tooltips.h @@ -191,6 +191,7 @@ public: // system + const QString license_area = tr("The console region defines the license area of the PS3.\nDepending on the license area, some games may not work."); const QString system_language = tr("Some games may fail to boot if the system language is not available in the game itself.\nOther games will switch language automatically to what is selected here.\nIt is recommended leaving this on a language supported by the game."); const QString keyboard_type = tr("Sets the used keyboard layout.\nCurrently only US, Japanese and German layouts are fully supported at this moment."); const QString enter_button_assignment = tr("The button used for enter/accept/confirm in system dialogs.\nChange this to use the Circle button instead, which is the default configuration on Japanese systems and in many Japanese games.\nIn these cases having the cross button assigned can often lead to confusion.");