diff --git a/README.md b/README.md index 3046dc6b7..de8a7d5fc 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Other features include: - Namco GunCon lightgun support (simulated with mouse) - Qt and SDL frontends for desktop - Automatic content scanning - game titles/regions are provided by redump.org + - Optional automatic switching of memory cards for each game ## System Requirements - A CPU faster than a potato. diff --git a/src/duckstation-qt/portsettingswidget.cpp b/src/duckstation-qt/portsettingswidget.cpp index aa5979577..2dfa05eed 100644 --- a/src/duckstation-qt/portsettingswidget.cpp +++ b/src/duckstation-qt/portsettingswidget.cpp @@ -78,6 +78,18 @@ void PortSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* ui) ui->widget = new QWidget(m_tab_widget); ui->layout = new QVBoxLayout(ui->widget); + ui->memory_card_type = new QComboBox(ui->widget); + for (int i = 0; i < static_cast(MemoryCardType::Count); i++) + { + ui->memory_card_type->addItem( + QString::fromUtf8(Settings::GetMemoryCardTypeDisplayName(static_cast(i)))); + } + SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, ui->memory_card_type, + QStringLiteral("MemoryCards/Card%1Type").arg(index + 1), + &Settings::ParseMemoryCardTypeName, &Settings::GetMemoryCardTypeName); + ui->layout->addWidget(new QLabel(tr("Memory Card Type:"), ui->widget)); + ui->layout->addWidget(ui->memory_card_type); + QHBoxLayout* memory_card_layout = new QHBoxLayout(); ui->memory_card_path = new QLineEdit(ui->widget); SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, ui->memory_card_path, @@ -92,7 +104,7 @@ void PortSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* ui) connect(memory_card_remove, &QPushButton::clicked, [this, index]() { onEjectMemoryCardClicked(index); }); memory_card_layout->addWidget(memory_card_remove); - ui->layout->addWidget(new QLabel(tr("Memory Card Path:"), ui->widget)); + ui->layout->addWidget(new QLabel(tr("Shared Memory Card Path:"), ui->widget)); ui->layout->addLayout(memory_card_layout); ui->layout->addWidget(new QLabel(tr("Controller Type:"), ui->widget)); @@ -101,7 +113,7 @@ void PortSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* ui) for (int i = 0; i < static_cast(ControllerType::Count); i++) { ui->controller_type->addItem( - QString::fromLocal8Bit(Settings::GetControllerTypeDisplayName(static_cast(i)))); + QString::fromUtf8(Settings::GetControllerTypeDisplayName(static_cast(i)))); } ControllerType ctype = Settings::ParseControllerTypeName( m_host_interface->getSettingValue(QStringLiteral("Controller%1/Type").arg(index + 1)) @@ -327,8 +339,10 @@ void PortSettingsWidget::onBrowseMemoryCardPathClicked(int index) void PortSettingsWidget::onEjectMemoryCardClicked(int index) { QSignalBlocker blocker(m_port_ui[index].memory_card_path); + m_port_ui[index].memory_card_type->setCurrentIndex(0); m_port_ui[index].memory_card_path->setText(QString()); - m_host_interface->removeSettingValue(QStringLiteral("MemoryCards/Card%1Path").arg(index + 1)); + m_host_interface->putSettingValue(QStringLiteral("MemoryCards/Card%1Type").arg(index + 1), QStringLiteral("None")); + m_host_interface->putSettingValue(QStringLiteral("MemoryCards/Card%1Path").arg(index + 1), QString()); m_host_interface->applySettings(); } diff --git a/src/duckstation-qt/portsettingswidget.h b/src/duckstation-qt/portsettingswidget.h index 073c3fda9..ad567024e 100644 --- a/src/duckstation-qt/portsettingswidget.h +++ b/src/duckstation-qt/portsettingswidget.h @@ -36,6 +36,7 @@ private: QWidget* widget; QVBoxLayout* layout; QComboBox* controller_type; + QComboBox* memory_card_type; QLineEdit* memory_card_path; QWidget* button_binding_container; InputBindingWidget* first_button; diff --git a/src/duckstation-qt/settingsdialog.ui b/src/duckstation-qt/settingsdialog.ui index 42a4a05ce..f2acf4378 100644 --- a/src/duckstation-qt/settingsdialog.ui +++ b/src/duckstation-qt/settingsdialog.ui @@ -9,8 +9,8 @@ 0 0 - 700 - 500 + 780 + 820 @@ -30,7 +30,7 @@ - 200 + 230 16777215 @@ -122,7 +122,13 @@ 16777215 - 110 + 120 + + + + + 16777215 + 120