Add per-game overrides (mainly for compatibility)
This commit is contained in:
@ -74,6 +74,11 @@ void GamePropertiesDialog::populate(const GameListEntry* ge)
|
||||
}
|
||||
|
||||
populateTracksInfo(ge->path);
|
||||
|
||||
m_game_code = ge->code;
|
||||
m_game_title = ge->title;
|
||||
m_game_settings = ge->settings;
|
||||
populateGameSettings();
|
||||
}
|
||||
|
||||
void GamePropertiesDialog::populateCompatibilityInfo(const std::string& game_code)
|
||||
@ -107,6 +112,43 @@ void GamePropertiesDialog::setupAdditionalUi()
|
||||
tr(GameList::GetGameListCompatibilityRatingString(static_cast<GameListCompatibilityRating>(i))));
|
||||
}
|
||||
|
||||
m_ui.userAspectRatio->addItem(tr("(unchanged)"));
|
||||
for (u32 i = 0; i < static_cast<u32>(DisplayAspectRatio::Count); i++)
|
||||
{
|
||||
m_ui.userAspectRatio->addItem(
|
||||
QString::fromUtf8(Settings::GetDisplayAspectRatioName(static_cast<DisplayAspectRatio>(i))));
|
||||
}
|
||||
|
||||
m_ui.userCropMode->addItem(tr("(unchanged)"));
|
||||
for (u32 i = 0; i < static_cast<u32>(DisplayCropMode::Count); i++)
|
||||
{
|
||||
m_ui.userCropMode->addItem(
|
||||
QString::fromUtf8(Settings::GetDisplayCropModeDisplayName(static_cast<DisplayCropMode>(i))));
|
||||
}
|
||||
|
||||
m_ui.userControllerType1->addItem(tr("(unchanged)"));
|
||||
for (u32 i = 0; i < static_cast<u32>(ControllerType::Count); i++)
|
||||
{
|
||||
m_ui.userControllerType1->addItem(
|
||||
QString::fromUtf8(Settings::GetControllerTypeDisplayName(static_cast<ControllerType>(i))));
|
||||
}
|
||||
|
||||
m_ui.userControllerType2->addItem(tr("(unchanged)"));
|
||||
for (u32 i = 0; i < static_cast<u32>(ControllerType::Count); i++)
|
||||
{
|
||||
m_ui.userControllerType2->addItem(
|
||||
QString::fromUtf8(Settings::GetControllerTypeDisplayName(static_cast<ControllerType>(i))));
|
||||
}
|
||||
|
||||
QGridLayout* traits_layout = new QGridLayout(m_ui.compatibilityTraits);
|
||||
for (u32 i = 0; i < static_cast<u32>(GameSettings::Trait::Count); i++)
|
||||
{
|
||||
m_trait_checkboxes[i] =
|
||||
new QCheckBox(QString::fromUtf8(GameSettings::GetTraitDisplayName(static_cast<GameSettings::Trait>(i))),
|
||||
m_ui.compatibilityTraits);
|
||||
traits_layout->addWidget(m_trait_checkboxes[i], i / 2, i % 2);
|
||||
}
|
||||
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
@ -133,7 +175,7 @@ void GamePropertiesDialog::populateTracksInfo(const std::string& image_path)
|
||||
{"Audio", "Mode 1", "Mode 1/Raw", "Mode 2", "Mode 2/Form 1", "Mode 2/Form 2", "Mode 2/Mix", "Mode 2/Raw"}};
|
||||
|
||||
m_ui.tracks->clearContents();
|
||||
m_image_path = image_path;
|
||||
m_path = image_path;
|
||||
|
||||
std::unique_ptr<CDImage> image = CDImage::Open(image_path.c_str());
|
||||
if (!image)
|
||||
@ -155,6 +197,66 @@ void GamePropertiesDialog::populateTracksInfo(const std::string& image_path)
|
||||
}
|
||||
}
|
||||
|
||||
void GamePropertiesDialog::populateGameSettings()
|
||||
{
|
||||
const GameSettings::Entry& gs = m_game_settings;
|
||||
|
||||
for (u32 i = 0; i < static_cast<u32>(GameSettings::Trait::Count); i++)
|
||||
{
|
||||
QSignalBlocker sb(m_trait_checkboxes[i]);
|
||||
m_trait_checkboxes[i]->setChecked(gs.HasTrait(static_cast<GameSettings::Trait>(i)));
|
||||
}
|
||||
|
||||
if (gs.display_active_start_offset.has_value())
|
||||
{
|
||||
QSignalBlocker sb(m_ui.displayActiveStartOffset);
|
||||
m_ui.displayActiveStartOffset->setValue(static_cast<int>(gs.display_active_start_offset.value()));
|
||||
}
|
||||
if (gs.display_active_end_offset.has_value())
|
||||
{
|
||||
QSignalBlocker sb(m_ui.displayActiveEndOffset);
|
||||
m_ui.displayActiveEndOffset->setValue(static_cast<int>(gs.display_active_end_offset.value()));
|
||||
}
|
||||
|
||||
if (gs.display_crop_mode.has_value())
|
||||
{
|
||||
QSignalBlocker sb(m_ui.userCropMode);
|
||||
m_ui.userCropMode->setCurrentIndex(static_cast<int>(gs.display_crop_mode.value()) + 1);
|
||||
}
|
||||
if (gs.display_aspect_ratio.has_value())
|
||||
{
|
||||
QSignalBlocker sb(m_ui.userAspectRatio);
|
||||
m_ui.userAspectRatio->setCurrentIndex(static_cast<int>(gs.display_aspect_ratio.value()) + 1);
|
||||
}
|
||||
|
||||
if (gs.controller_1_type.has_value())
|
||||
{
|
||||
QSignalBlocker sb(m_ui.userControllerType1);
|
||||
m_ui.userControllerType1->setCurrentIndex(static_cast<int>(gs.controller_1_type.value()) + 1);
|
||||
}
|
||||
if (gs.controller_2_type.has_value())
|
||||
{
|
||||
QSignalBlocker sb(m_ui.userControllerType2);
|
||||
m_ui.userControllerType2->setCurrentIndex(static_cast<int>(gs.controller_2_type.value()) + 1);
|
||||
}
|
||||
if (gs.gpu_widescreen_hack.has_value())
|
||||
{
|
||||
QSignalBlocker sb(m_ui.userControllerType2);
|
||||
m_ui.userWidescreenHack->setCheckState(Qt::Checked);
|
||||
}
|
||||
else
|
||||
{
|
||||
QSignalBlocker sb(m_ui.userControllerType2);
|
||||
m_ui.userWidescreenHack->setCheckState(Qt::PartiallyChecked);
|
||||
}
|
||||
}
|
||||
|
||||
void GamePropertiesDialog::saveGameSettings()
|
||||
{
|
||||
m_host_interface->getGameList()->UpdateGameSettings(m_path, m_game_code, m_game_title, m_game_settings, true, true);
|
||||
m_host_interface->applySettings(true);
|
||||
}
|
||||
|
||||
void GamePropertiesDialog::closeEvent(QCloseEvent* ev)
|
||||
{
|
||||
deleteLater();
|
||||
@ -186,6 +288,69 @@ void GamePropertiesDialog::connectUi()
|
||||
connect(m_ui.exportCompatibilityInfo, &QPushButton::clicked, this,
|
||||
&GamePropertiesDialog::onExportCompatibilityInfoClicked);
|
||||
connect(m_ui.close, &QPushButton::clicked, this, &QDialog::close);
|
||||
|
||||
connect(m_ui.userAspectRatio, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||
if (index <= 0)
|
||||
m_game_settings.display_aspect_ratio.reset();
|
||||
else
|
||||
m_game_settings.display_aspect_ratio = static_cast<DisplayAspectRatio>(index - 1);
|
||||
saveGameSettings();
|
||||
});
|
||||
|
||||
connect(m_ui.userCropMode, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||
if (index <= 0)
|
||||
m_game_settings.display_crop_mode.reset();
|
||||
else
|
||||
m_game_settings.display_crop_mode = static_cast<DisplayCropMode>(index - 1);
|
||||
saveGameSettings();
|
||||
});
|
||||
|
||||
connect(m_ui.userControllerType1, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||
if (index <= 0)
|
||||
m_game_settings.controller_1_type.reset();
|
||||
else
|
||||
m_game_settings.controller_1_type = static_cast<ControllerType>(index - 1);
|
||||
saveGameSettings();
|
||||
});
|
||||
|
||||
connect(m_ui.userControllerType2, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||
if (index <= 0)
|
||||
m_game_settings.controller_2_type.reset();
|
||||
else
|
||||
m_game_settings.controller_2_type = static_cast<ControllerType>(index - 1);
|
||||
saveGameSettings();
|
||||
});
|
||||
|
||||
connect(m_ui.userWidescreenHack, &QCheckBox::stateChanged, [this](int state) {
|
||||
if (state == Qt::PartiallyChecked)
|
||||
m_game_settings.gpu_widescreen_hack.reset();
|
||||
else
|
||||
m_game_settings.gpu_widescreen_hack = (state == Qt::Checked);
|
||||
saveGameSettings();
|
||||
});
|
||||
|
||||
for (u32 i = 0; i < static_cast<u32>(GameSettings::Trait::Count); i++)
|
||||
{
|
||||
connect(m_trait_checkboxes[i], &QCheckBox::toggled, [this, i](bool checked) {
|
||||
m_game_settings.SetTrait(static_cast<GameSettings::Trait>(i), checked);
|
||||
saveGameSettings();
|
||||
});
|
||||
}
|
||||
|
||||
connect(m_ui.displayActiveStartOffset, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||
if (value == 0)
|
||||
m_game_settings.display_active_start_offset.reset();
|
||||
else
|
||||
m_game_settings.display_active_start_offset = static_cast<s16>(value);
|
||||
saveGameSettings();
|
||||
});
|
||||
connect(m_ui.displayActiveEndOffset, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||
if (value == 0)
|
||||
m_game_settings.display_active_end_offset.reset();
|
||||
else
|
||||
m_game_settings.display_active_end_offset = static_cast<s16>(value);
|
||||
saveGameSettings();
|
||||
});
|
||||
}
|
||||
|
||||
void GamePropertiesDialog::fillEntryFromUi(GameListCompatibilityEntry* entry)
|
||||
@ -263,10 +428,10 @@ void GamePropertiesDialog::onExportCompatibilityInfoClicked()
|
||||
|
||||
void GamePropertiesDialog::computeTrackHashes()
|
||||
{
|
||||
if (m_image_path.empty())
|
||||
if (m_path.empty())
|
||||
return;
|
||||
|
||||
std::unique_ptr<CDImage> image = CDImage::Open(m_image_path.c_str());
|
||||
std::unique_ptr<CDImage> image = CDImage::Open(m_path.c_str());
|
||||
if (!image)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user