mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
Qt: Fix resolution dropdown if resolution flags of game are empty
Fixes custom config creation error for games that have no resolution. Fixes empty dropdowns if resolution flags are 0 by adding all resolutions. Make sure to keep 720p as option if the dropdown would be empty after all.
This commit is contained in:
parent
c533dc969d
commit
82de139be5
4 changed files with 25 additions and 5 deletions
|
@ -51,9 +51,9 @@ namespace cfg_adapter
|
||||||
QStringList get_options(const cfg_location& location)
|
QStringList get_options(const cfg_location& location)
|
||||||
{
|
{
|
||||||
QStringList values;
|
QStringList values;
|
||||||
for (const auto& v : cfg_adapter::get_cfg(g_cfg, location.cbegin(), location.cend()).to_list())
|
for (const std::string& value : cfg_adapter::get_cfg(g_cfg, location.cbegin(), location.cend()).to_list())
|
||||||
{
|
{
|
||||||
values.append(QString::fromStdString(v));
|
values.append(QString::fromStdString(value));
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ void emu_settings::RestoreDefaults()
|
||||||
Q_EMIT RestoreDefaultsSignal();
|
Q_EMIT RestoreDefaultsSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void emu_settings::SaveSettings()
|
void emu_settings::SaveSettings() const
|
||||||
{
|
{
|
||||||
YAML::Emitter out;
|
YAML::Emitter out;
|
||||||
emit_data(out, m_current_settings);
|
emit_data(out, m_current_settings);
|
||||||
|
@ -1345,6 +1345,7 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_
|
||||||
case xfloat_accuracy::relaxed: return tr("Relaxed XFloat");
|
case xfloat_accuracy::relaxed: return tr("Relaxed XFloat");
|
||||||
case xfloat_accuracy::inaccurate: return tr("Inaccurate XFloat");
|
case xfloat_accuracy::inaccurate: return tr("Inaccurate XFloat");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/** Writes the unsaved settings to file. Used in settings dialog on accept.*/
|
/** Writes the unsaved settings to file. Used in settings dialog on accept.*/
|
||||||
void SaveSettings();
|
void SaveSettings() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
YAML::Node m_default_settings; // The default settings as a YAML node.
|
YAML::Node m_default_settings; // The default settings as a YAML node.
|
||||||
|
|
|
@ -479,6 +479,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
};
|
};
|
||||||
|
|
||||||
const int saved_index = ui->resBox->currentIndex();
|
const int saved_index = ui->resBox->currentIndex();
|
||||||
|
bool remove_720p = false;
|
||||||
|
|
||||||
for (int i = ui->resBox->count() - 1; i >= 0; i--)
|
for (int i = ui->resBox->count() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
@ -489,18 +490,36 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
||||||
const bool is_interlaced = (resolution == video_resolution::_1080i ||
|
const bool is_interlaced = (resolution == video_resolution::_1080i ||
|
||||||
resolution == video_resolution::_480i ||
|
resolution == video_resolution::_480i ||
|
||||||
resolution == video_resolution::_576i);
|
resolution == video_resolution::_576i);
|
||||||
const bool supported_by_game = !game || (game && game->resolution > 0 && resolutions.contains(resolution) && (game->resolution & resolutions.at(resolution)));
|
const bool supported_by_game = !game || !game->resolution || (resolutions.contains(resolution) && (game->resolution & resolutions.at(resolution)));
|
||||||
|
|
||||||
if (!supported_by_game || is_interlaced)
|
if (!supported_by_game || is_interlaced)
|
||||||
{
|
{
|
||||||
|
// Don't remove 720p yet. We may need it as fallback if no other resolution is supported.
|
||||||
|
if (resolution == video_resolution::_720p)
|
||||||
|
{
|
||||||
|
remove_720p = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ui->resBox->removeItem(i);
|
ui->resBox->removeItem(i);
|
||||||
|
|
||||||
if (i == saved_index)
|
if (i == saved_index)
|
||||||
{
|
{
|
||||||
saved_index_removed = true;
|
saved_index_removed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove 720p if unsupported unless it's the only option
|
||||||
|
if (remove_720p && ui->resBox->count() > 1)
|
||||||
|
{
|
||||||
|
if (const int index = find_item(ui->resBox, static_cast<int>(video_resolution::_720p)); index >= 0)
|
||||||
|
{
|
||||||
|
ui->resBox->removeItem(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ui->resBox->count(); i++)
|
for (int i = 0; i < ui->resBox->count(); i++)
|
||||||
{
|
{
|
||||||
const auto [text, value] = get_data(ui->resBox, i);
|
const auto [text, value] = get_data(ui->resBox, i);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue