const QString display = mountControllerDisplayForConfigValue(catalog, value);
const WinUaeQtMountControllerChoice choice = mountControllerChoiceByDisplay(catalog, display);
if (choice.valid && !choice.boardKey.isEmpty()) {
- return QStringLiteral("%1:%2").arg(mountControllerBaseDisplay(display)).arg(mountControllerUnit(entry, fallback));
+ QString board = mountControllerBaseDisplay(display);
+ const QString busSuffix = QStringLiteral(" (%1)").arg(mountControllerBusName(choice.bus));
+ if (board.endsWith(busSuffix)) {
+ board.chop(busSuffix.size());
+ }
+ return QStringLiteral("%1:%2").arg(board).arg(mountControllerUnit(entry, fallback));
}
const QString upper = value.toUpper();
if (upper.startsWith(QStringLiteral("IDE"))) {
static bool hardfileIsRdb(const WinUaeQtMountEntry &entry)
{
- const QStringList geometry = hardfileGeometryParts(entry);
- return geometry.value(0).toInt() == 0
- && geometry.value(1).toInt() == 0
- && geometry.value(2).toInt() == 0;
+ return winUaeQtHardfileIsRdb(entry);
}
static bool hardfileHasPhysicalGeometry(const WinUaeQtMountEntry &entry)
normalized.device = winUaeQtSanitizedAmigaName(normalized.device, nextMountDeviceName(), true);
normalized.volume = winUaeQtSanitizedAmigaName(normalized.volume, winUaeQtDefaultVolumeName(normalized.path), false);
} else if (normalized.kind == QStringLiteral("hdf")) {
- normalized.device = winUaeQtSanitizedAmigaName(normalized.device, nextMountDeviceName(), true);
+ if (winUaeQtHardfileIsRdb(normalized)
+ && winUaeQtHardfileUsesNonUaeController(normalized)) {
+ normalized.device.clear();
+ normalized.bootPri = 0;
+ } else {
+ normalized.device = winUaeQtSanitizedAmigaName(
+ normalized.device,
+ nextMountDeviceName(),
+ true);
+ }
} else if (normalized.kind == QStringLiteral("cd")) {
normalized.device.clear();
normalized.volume = QStringLiteral("CD");
} else if (normalized.kind == QStringLiteral("hdf")) {
const QStringList geometry = normalized.hardfileGeometry.split(QLatin1Char(','));
blockSizeText = geometry.value(3, QStringLiteral("512"));
+ if (winUaeQtHardfileUsesNonUaeController(normalized)) {
+ deviceText = mountControllerDisplay(boardCatalog, normalized);
+ volumeText = QStringLiteral("HDF");
+ bootPriText = QStringLiteral("n/a");
+ }
}
item->setText(0, QString());
QLineEdit *path = new QLineEdit(entry->path);
QLineEdit *geometryFile = new QLineEdit(hardfileTailGeometryFile(*entry));
QLineEdit *filesys = new QLineEdit(mountControllerParts(entry->hardfileTail).value(0));
- QLineEdit *device = new QLineEdit(entry->device.isEmpty() ? nextMountDeviceName() : entry->device);
+ const bool controllerBackedRdb = hardfileIsRdb(*entry)
+ && winUaeQtHardfileUsesNonUaeController(*entry);
+ QLineEdit *device = new QLineEdit(
+ entry->device.isEmpty() && !controllerBackedRdb ? nextMountDeviceName() : entry->device);
QSpinBox *bootPri = new QSpinBox;
bootPri->setRange(-129, 127);
bootPri->setValue(entry->bootPri);
fields->addWidget(label(QStringLiteral("FileSys:")), 2, 0);
fields->addWidget(filesys, 2, 1, 1, 2);
fields->addWidget(filesysBrowse, 2, 3);
- fields->addWidget(label(QStringLiteral("Device:")), 3, 0);
+ QLabel *deviceLabel = label(QStringLiteral("Device:"));
+ QLabel *bootPriLabel = label(QStringLiteral("Boot priority:"));
+ fields->addWidget(deviceLabel, 3, 0);
fields->addWidget(device, 3, 1);
- fields->addWidget(label(QStringLiteral("Boot priority:")), 3, 2);
+ fields->addWidget(bootPriLabel, 3, 2);
fields->addWidget(bootPri, 3, 3);
fields->addWidget(readWrite, 4, 1);
fields->addWidget(autoboot, 4, 2);
readWrite->setEnabled(!nativeDrive);
browse->setEnabled(!nativeDrive);
};
+ auto updateControllerBackedRdbControls =
+ [this, controller, sectors, surfaces, reserved, device,
+ deviceLabel, bootPri, bootPriLabel, autoboot, doNotMount]() {
+ const WinUaeQtMountControllerBus bus =
+ mountControllerBusFromDisplay(boardCatalog, controller->currentText());
+ const bool controllerBacked = sectors->value() == 0
+ && surfaces->value() == 0
+ && reserved->value() == 0
+ && bus != MountControllerBusUae
+ && bus != MountControllerBusUnknown;
+
+ if (controllerBacked) {
+ QSignalBlocker blockDevice(device);
+ QSignalBlocker blockBootPri(bootPri);
+ device->clear();
+ bootPri->setValue(0);
+ } else if (device->text().trimmed().isEmpty()) {
+ QSignalBlocker blockDevice(device);
+ device->setText(nextMountDeviceName());
+ }
+ deviceLabel->setEnabled(!controllerBacked);
+ device->setEnabled(!controllerBacked);
+ bootPriLabel->setVisible(!controllerBacked);
+ bootPri->setVisible(!controllerBacked);
+ autoboot->setVisible(!controllerBacked);
+ doNotMount->setVisible(!controllerBacked);
+ };
updateBootChecks();
updatePhysicalControls();
updateControllerUnitRange(controllerUnit, controller->currentText());
setFeatureItems(hardfileFeatureText(boardCatalog, *entry, controller->currentText()));
updateNativeDriveControls();
+ updateControllerBackedRdbControls();
connect(browse, &QPushButton::clicked, this, [this, path]() {
const QString initialPath = fileDialogInitialPath(path->text());
bootPri->setValue(-128);
}
});
- connect(rdbMode, &QCheckBox::toggled, this, [sectors, surfaces, reserved, blockSize, device, filesys, bootPri](bool checked) {
+ connect(rdbMode, &QCheckBox::toggled, this,
+ [sectors, surfaces, reserved, blockSize, device, filesys,
+ bootPri, updateControllerBackedRdbControls](bool checked) {
if (checked) {
sectors->setValue(0);
surfaces->setValue(0);
reserved->setValue(2);
blockSize->setValue(512);
}
+ updateControllerBackedRdbControls();
});
connect(manualGeometry, &QCheckBox::toggled, this, updatePhysicalControls);
- connect(controller, &QComboBox::currentTextChanged, this, [this, controllerUnit, setFeatureItems](const QString &text) {
+ connect(controller, &QComboBox::currentTextChanged, this,
+ [this, controllerUnit, setFeatureItems,
+ updateControllerBackedRdbControls](const QString &text) {
updateControllerUnitRange(controllerUnit, text);
setFeatureItems(QStringLiteral("Default"));
+ updateControllerBackedRdbControls();
});
+ for (QSpinBox *spin : { sectors, surfaces, reserved }) {
+ connect(spin, QOverload<int>::of(&QSpinBox::valueChanged),
+ this, updateControllerBackedRdbControls);
+ }
connect(path, &QLineEdit::editingFinished, this, updateNativeDriveControls);
connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
}
entry->kind = QStringLiteral("hdf");
- entry->device = winUaeQtSanitizedAmigaName(device->text(), nextMountDeviceName(), true);
entry->path = path->text().trimmed();
- entry->bootPri = bootPri->value();
entry->readOnly = !readWrite->isChecked() || entry->path.startsWith(QLatin1Char(':'));
entry->hardfileGeometry = QStringLiteral("%1,%2,%3,%4")
.arg(sectors->value())
}
tailFields.append(hardfilePreservedTailExtras(*entry));
entry->hardfileTail = winUaeQtConfigJoinFields(tailFields);
+ const bool acceptedControllerBackedRdb = winUaeQtHardfileIsRdb(*entry)
+ && winUaeQtHardfileUsesNonUaeController(*entry);
+ entry->device = winUaeQtSanitizedAmigaName(
+ device->text(),
+ acceptedControllerBackedRdb ? QString() : nextMountDeviceName(),
+ true);
+ entry->bootPri = acceptedControllerBackedRdb ? 0 : bootPri->value();
return true;
}
return escapedFields.join(QLatin1Char(','));
}
+static QString hardfileControllerValue(const WinUaeQtMountEntry &entry)
+{
+ QString tail = entry.hardfileTail;
+ if (!tail.startsWith(QLatin1Char(','))) {
+ tail.prepend(QLatin1Char(','));
+ }
+ const QStringList fields = winUaeQtConfigFieldList(tail);
+ return fields.value(1, QStringLiteral("uae0")).trimmed();
+}
+
+bool winUaeQtHardfileIsRdb(const WinUaeQtMountEntry &entry)
+{
+ if (entry.hardfileGeometry.trimmed().isEmpty()) {
+ return false;
+ }
+ const QStringList geometry = entry.hardfileGeometry.split(QLatin1Char(','));
+ return geometry.value(0).toInt() == 0
+ && geometry.value(1).toInt() == 0
+ && geometry.value(2).toInt() == 0;
+}
+
+bool winUaeQtHardfileUsesNonUaeController(const WinUaeQtMountEntry &entry)
+{
+ const QString controller = hardfileControllerValue(entry).toLower();
+ return controller.startsWith(QStringLiteral("ide"))
+ || controller.startsWith(QStringLiteral("scsi"))
+ || controller.startsWith(QStringLiteral("custom"));
+}
+
static bool parseAccessValue(const QString &value, bool *readOnly)
{
if (value.compare(QStringLiteral("ro"), Qt::CaseInsensitive) == 0) {
{
const QString geometry = entry.hardfileGeometry.isEmpty() ? QStringLiteral("32,1,2,512") : entry.hardfileGeometry;
const QString tail = entry.hardfileGeometry.isEmpty() && entry.hardfileTail.isEmpty() ? QStringLiteral(",uae0") : entry.hardfileTail;
+ const bool controllerBackedRdb = winUaeQtHardfileIsRdb(entry)
+ && winUaeQtHardfileUsesNonUaeController(entry);
+ const QString device = controllerBackedRdb
+ ? QString()
+ : winUaeQtSanitizedAmigaName(entry.device, QStringLiteral("DH0"), true);
+ const int bootPri = controllerBackedRdb ? 0 : entry.bootPri;
QString value = QStringLiteral("%1,%2:%3,%4,%5")
.arg(winUaeQtConfigAccessValue(entry.readOnly),
- winUaeQtSanitizedAmigaName(entry.device, QStringLiteral("DH0"), true),
+ device,
winUaeQtConfigEscapeMin(entry.path),
geometry,
- QString::number(entry.bootPri));
+ QString::number(bootPri));
if (!tail.isEmpty()) {
value += QStringLiteral(",") + tail;
}