Permalink
Browse files

Qt: only show supported resolutions in custom configs

  • Loading branch information...
Megamouse committed Feb 10, 2019
1 parent d6995f4 commit 982b2ab88fa1a3b5dc710a8ad963ccecdf03154c
Showing with 51 additions and 4 deletions.
  1. +3 −3 rpcs3/rpcs3qt/game_list_frame.cpp
  2. +48 −1 rpcs3/rpcs3qt/settings_dialog.cpp
@@ -414,9 +414,9 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
game.app_ver = psf::get_string(psf, "APP_VER", cat_unknown);
game.category = psf::get_string(psf, "CATEGORY", cat_unknown);
game.fw = psf::get_string(psf, "PS3_SYSTEM_VER", cat_unknown);
game.parental_lvl = psf::get_integer(psf, "PARENTAL_LEVEL");
game.resolution = psf::get_integer(psf, "RESOLUTION");
game.sound_format = psf::get_integer(psf, "SOUND_FORMAT");
game.parental_lvl = psf::get_integer(psf, "PARENTAL_LEVEL", 0);
game.resolution = psf::get_integer(psf, "RESOLUTION", 0);
game.sound_format = psf::get_integer(psf, "SOUND_FORMAT", 0);
game.bootable = psf::get_integer(psf, "BOOTABLE", 0);
game.attr = psf::get_integer(psf, "ATTRIBUTE", 0);

@@ -464,8 +464,55 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
ui->renderBox->setItemText(ui->renderBox->findData("D3D12"), render_creator.name_D3D12);

xemu_settings->EnhanceComboBox(ui->resBox, emu_settings::Resolution);
ui->resBox->setItemText(ui->resBox->findData("1280x720"), tr("1280x720 (Recommended)"));
SubscribeTooltip(ui->resBox, json_gpu_cbo["resBox"].toString());
// remove unsupported resolutions from the dropdown
const int saved_index = ui->resBox->currentIndex();
bool saved_index_removed = false;
if (game && game->resolution > 0)
{
const std::map<u32, std::string> resolutions
{
{ 1 << 0, fmt::format("%s", video_resolution::_480) },
{ 1 << 1, fmt::format("%s", video_resolution::_576) },
{ 1 << 2, fmt::format("%s", video_resolution::_720) },
{ 1 << 3, fmt::format("%s", video_resolution::_1080) },
// { 1 << 4, fmt::format("%s", video_resolution::_480p_16:9) },
// { 1 << 5, fmt::format("%s", video_resolution::_576p_16:9) },
};

for (int i = ui->resBox->count() - 1; i >= 0; i--)
{
bool hasResolution = false;
for (const auto& res : resolutions)
{
if ((game->resolution & res.first) && res.second == sstr(ui->resBox->itemText(i)))
{
hasResolution = true;
break;
}
}
if (!hasResolution)
{
ui->resBox->removeItem(i);
if (i == saved_index)
{
saved_index_removed = true;
}
}
}
}
const int res_index = ui->resBox->findData("1280x720");
if (res_index >= 0)
{
// Rename the default resolution for users
ui->resBox->setItemText(res_index, tr("1280x720 (Recommended)"));

// Set the current selection to the default if the original setting wasn't valid
if (saved_index_removed)
{
ui->resBox->setCurrentIndex(res_index);
}
}

xemu_settings->EnhanceComboBox(ui->aspectBox, emu_settings::AspectRatio);
SubscribeTooltip(ui->aspectBox, json_gpu_cbo["aspectBox"].toString());

0 comments on commit 982b2ab

Please sign in to comment.