mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Add Fallback Region to configuration menu
Fallback Region A user-selected fallback to use instead of the default PAL This is used for unknown region or region free titles to give them the ability to force region to use. This replaces the current fallback region of PAL. This can be useful if a user is trying to play a region free tilte that is originally NTSC and expects to be run at NTSC speeds. This may be done when a user attempts to dump a WAD of their own without understanding the settings they have chosen, or could be an intentional decision by a developer of a ROM hack that can be injected into a Virtual Console WAD. Remove using System Menu region being checked in GetFallbackRegion Use DiscIO::Region instead of std::String for fallback Add explanation text for Fallback Region
This commit is contained in:
@ -41,6 +41,11 @@ constexpr const char* AUTO_UPDATE_STABLE_STRING = "stable";
|
||||
constexpr const char* AUTO_UPDATE_BETA_STRING = "beta";
|
||||
constexpr const char* AUTO_UPDATE_DEV_STRING = "dev";
|
||||
|
||||
constexpr int FALLBACK_REGION_NTSCJ_INDEX = 0;
|
||||
constexpr int FALLBACK_REGION_NTSCU_INDEX = 1;
|
||||
constexpr int FALLBACK_REGION_PAL_INDEX = 2;
|
||||
constexpr int FALLBACK_REGION_NTSCK_INDEX = 3;
|
||||
|
||||
GeneralPane::GeneralPane(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
CreateLayout();
|
||||
@ -63,6 +68,8 @@ void GeneralPane::CreateLayout()
|
||||
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
CreateAutoUpdate();
|
||||
|
||||
CreateFallbackRegion();
|
||||
|
||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||
CreateAnalytics();
|
||||
#endif
|
||||
@ -81,6 +88,7 @@ void GeneralPane::OnEmulationStateChanged(Core::State state)
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
m_checkbox_discord_presence->setEnabled(!running);
|
||||
#endif
|
||||
m_combobox_fallback_region->setEnabled(!running);
|
||||
}
|
||||
|
||||
void GeneralPane::ConnectLayout()
|
||||
@ -106,6 +114,10 @@ void GeneralPane::ConnectLayout()
|
||||
connect(m_combobox_speedlimit, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
[this]() { OnSaveConfig(); });
|
||||
|
||||
connect(m_combobox_fallback_region, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&GeneralPane::OnSaveConfig);
|
||||
connect(&Settings::Instance(), &Settings::FallbackRegionChanged, this, &GeneralPane::LoadConfig);
|
||||
|
||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||
connect(&Settings::Instance(), &Settings::AnalyticsToggled, this, &GeneralPane::LoadConfig);
|
||||
connect(m_checkbox_enable_analytics, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||
@ -179,6 +191,33 @@ void GeneralPane::CreateAutoUpdate()
|
||||
m_combobox_update_track->addItem(option);
|
||||
}
|
||||
|
||||
void GeneralPane::CreateFallbackRegion()
|
||||
{
|
||||
auto* fallback_region_group = new QGroupBox(tr("Fallback Region"));
|
||||
auto* layout = new QVBoxLayout;
|
||||
fallback_region_group->setLayout(layout);
|
||||
m_main_layout->addWidget(fallback_region_group);
|
||||
|
||||
m_combobox_fallback_region = new QComboBox(this);
|
||||
|
||||
auto* form_widget = new QWidget;
|
||||
auto* form_layout = new QFormLayout;
|
||||
form_widget->setLayout(form_layout);
|
||||
form_layout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
form_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
form_layout->addRow(tr("Fallback Region:"), m_combobox_fallback_region);
|
||||
layout->addWidget(form_widget);
|
||||
|
||||
auto* fallback_region_description =
|
||||
new QLabel(tr("Dolphin will use this for titles whose region cannot be determined "
|
||||
"automatically."));
|
||||
fallback_region_description->setWordWrap(true);
|
||||
layout->addWidget(fallback_region_description);
|
||||
|
||||
for (const QString& option : {tr("NTSC-J"), tr("NTSC-U"), tr("PAL"), tr("NTSC-K")})
|
||||
m_combobox_fallback_region->addItem(option);
|
||||
}
|
||||
|
||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||
void GeneralPane::CreateAnalytics()
|
||||
{
|
||||
@ -224,6 +263,19 @@ void GeneralPane::LoadConfig()
|
||||
if (selection < m_combobox_speedlimit->count())
|
||||
m_combobox_speedlimit->setCurrentIndex(selection);
|
||||
m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread);
|
||||
|
||||
const auto fallback = Settings::Instance().GetFallbackRegion();
|
||||
|
||||
if (fallback == DiscIO::Region::NTSC_J)
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX);
|
||||
else if (fallback == DiscIO::Region::NTSC_U)
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_NTSCU_INDEX);
|
||||
else if (fallback == DiscIO::Region::PAL)
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_PAL_INDEX);
|
||||
else if (fallback == DiscIO::Region::NTSC_K)
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_NTSCK_INDEX);
|
||||
else
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX);
|
||||
}
|
||||
|
||||
static QString UpdateTrackFromIndex(int index)
|
||||
@ -249,6 +301,31 @@ static QString UpdateTrackFromIndex(int index)
|
||||
return value;
|
||||
}
|
||||
|
||||
static DiscIO::Region UpdateFallbackRegionFromIndex(int index)
|
||||
{
|
||||
DiscIO::Region value = DiscIO::Region::Unknown;
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case FALLBACK_REGION_NTSCJ_INDEX:
|
||||
value = DiscIO::Region::NTSC_J;
|
||||
break;
|
||||
case FALLBACK_REGION_NTSCU_INDEX:
|
||||
value = DiscIO::Region::NTSC_U;
|
||||
break;
|
||||
case FALLBACK_REGION_PAL_INDEX:
|
||||
value = DiscIO::Region::PAL;
|
||||
break;
|
||||
case FALLBACK_REGION_NTSCK_INDEX:
|
||||
value = DiscIO::Region::NTSC_K;
|
||||
break;
|
||||
default:
|
||||
value = DiscIO::Region::NTSC_J;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void GeneralPane::OnSaveConfig()
|
||||
{
|
||||
Config::ConfigChangeCallbackGuard config_guard;
|
||||
@ -277,6 +354,8 @@ void GeneralPane::OnSaveConfig()
|
||||
Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, m_checkbox_cheats->isChecked());
|
||||
settings.m_EmulationSpeed = m_combobox_speedlimit->currentIndex() * 0.1f;
|
||||
Settings::Instance().SetFallbackRegion(
|
||||
UpdateFallbackRegionFromIndex(m_combobox_fallback_region->currentIndex()));
|
||||
|
||||
settings.SaveSettings();
|
||||
}
|
||||
|
Reference in New Issue
Block a user