Add License Area Setting

This commit is contained in:
Megamouse 2020-10-30 20:54:49 +01:00 committed by Ivan
parent 5ca2b1200d
commit 54fd224fd8
9 changed files with 53 additions and 22 deletions

View File

@ -108,6 +108,26 @@ void fmt_class_string<CellSysutilLang>::format(std::string& out, u64 arg)
});
}
template <>
void fmt_class_string<CellSysutilLicenseArea>::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<CellSysutilParamId>::format(std::string& out, u64 arg)
{

View File

@ -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

View File

@ -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", []()

View File

@ -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<CellSysutilLicenseArea> license_area{ this, "License Area", CellSysutilLicenseArea{1} }; // CELL_SYSUTIL_LICENSE_AREA_A
cfg::_enum<CellSysutilLang> language{ this, "Language", CellSysutilLang{1} }; // CELL_SYSUTIL_LANG_ENGLISH_US
cfg::_enum<CellKbMappingType> keyboard_type{ this, "Keyboard Type", CellKbMappingType{0} }; // CELL_KB_MAPPING_101 = US
cfg::_enum<enter_button_assign> enter_button_assignment{ this, "Enter button assignment", enter_button_assign::cross };

View File

@ -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<CellSysutilLicenseArea>(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;
}

View File

@ -132,6 +132,7 @@ enum class emu_settings_type
PSNStatus,
// System
LicenseArea,
Language,
KeyboardType,
EnterButtonAssignment,
@ -276,6 +277,7 @@ static const QMap<emu_settings_type, cfg_location> 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"}},

View File

@ -841,6 +841,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> 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);

View File

@ -1433,9 +1433,6 @@
<layout class="QHBoxLayout" name="systemTabLayout2" stretch="1,1,1">
<item>
<widget class="QGroupBox" name="gb_console_region">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Console Region</string>
</property>

View File

@ -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.");