Merge remote-tracking branch 'origin/master' into mke

This commit is contained in:
Cacodemon345
2025-07-27 02:27:14 +06:00
17 changed files with 673 additions and 255 deletions

View File

@@ -52,15 +52,16 @@ void
SettingsStorageControllers::save()
{
/* Storage devices category */
for (uint8_t i = 0; i < HDC_MAX; ++i) {
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxHD%1").arg(i + 1));
hdc_current[i] = cbox->currentData().toInt();
}
for (uint8_t i = 0; i < SCSI_CARD_MAX; ++i) {
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
scsi_card_current[i] = cbox->currentData().toInt();
}
fdc_current[0] = ui->comboBoxFD->currentData().toInt();
hdc_current[0] = ui->comboBoxHD->currentData().toInt();
cdrom_interface_current = ui->comboBoxCDInterface->currentData().toInt();
ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0;
ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0;
cassette_enable = ui->checkBoxCassette->isChecked() ? 1 : 0;
}
@@ -69,44 +70,12 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
{
this->machineId = machineId;
/*HD controller config*/
/* FD controller config */
int c = 0;
auto *model = ui->comboBoxHD->model();
auto *model = ui->comboBoxFD->model();
auto removeRows = model->rowCount();
int selectedRow = 0;
while (true) {
/* Skip "internal" if machine doesn't have it. */
if ((c == 1) && (machine_has_flags(machineId, MACHINE_HDC) == 0)) {
c++;
continue;
}
QString name = DeviceConfig::DeviceName(hdc_get_device(c), hdc_get_internal_name(c), 1);
if (name.isEmpty())
break;
if (hdc_available(c)) {
const device_t *hdc_dev = hdc_get_device(c);
if (device_is_valid(hdc_dev, machineId)) {
int row = Models::AddEntry(model, name, c);
if (c == hdc_current[0])
selectedRow = row - removeRows;
}
}
c++;
}
model->removeRows(0, removeRows);
ui->comboBoxHD->setEnabled(model->rowCount() > 0);
ui->comboBoxHD->setCurrentIndex(-1);
ui->comboBoxHD->setCurrentIndex(selectedRow);
/* FD controller config */
model = ui->comboBoxFD->model();
removeRows = model->rowCount();
c = 0;
selectedRow = 0;
while (true) {
#if 0
/* Skip "internal" if machine doesn't have it. */
@@ -177,6 +146,51 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
ui->comboBoxCDInterface->setCurrentIndex(-1);
ui->comboBoxCDInterface->setCurrentIndex(selectedRow);
// HD Controller
QComboBox * hd_cbox[HDC_MAX] = { 0 };
QAbstractItemModel *hd_models[HDC_MAX] = { 0 };
int hd_removeRows_[HDC_MAX] = { 0 };
int hd_selectedRows[HDC_MAX] = { 0 };
for (uint8_t i = 0; i < HDC_MAX; ++i) {
hd_cbox[i] = findChild<QComboBox *>(QString("comboBoxHD%1").arg(i + 1));
hd_models[i] = hd_cbox[i]->model();
hd_removeRows_[i] = hd_models[i]->rowCount();
}
c = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(hdc_get_device(c),
hdc_get_internal_name(c), 1);
if (name.isEmpty())
break;
if (hdc_available(c)) {
if (device_is_valid(hdc_get_device(c), machineId)) {
for (uint8_t i = 0; i < HDC_MAX; ++i) {
/* Skip "internal" if machine doesn't have it. */
if ((c == 1) && ((i > 0) || (machine_has_flags(machineId, MACHINE_HDC) == 0)))
continue;
int row = Models::AddEntry(hd_models[i], name, c);
if (c == hdc_current[i])
hd_selectedRows[i] = row - hd_removeRows_[i];
}
}
}
c++;
}
for (uint8_t i = 0; i < HDC_MAX; ++i) {
hd_models[i]->removeRows(0, hd_removeRows_[i]);
hd_cbox[i]->setEnabled(hd_models[i]->rowCount() > 1);
hd_cbox[i]->setCurrentIndex(-1);
hd_cbox[i]->setCurrentIndex(hd_selectedRows[i]);
}
// SCSI Card
QComboBox * cbox[SCSI_CARD_MAX] = { 0 };
QAbstractItemModel *models[SCSI_CARD_MAX] = { 0 };
@@ -208,7 +222,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
}
}
c++;
c++;
}
for (uint8_t i = 0; i < SCSI_CARD_MAX; ++i) {
@@ -218,12 +232,6 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
cbox[i]->setCurrentIndex(selectedRows[i]);
}
int is_at = IS_AT(machineId);
ui->checkBoxTertiaryIDE->setEnabled(is_at > 0);
ui->checkBoxQuaternaryIDE->setEnabled(is_at > 0);
ui->checkBoxTertiaryIDE->setChecked(ui->checkBoxTertiaryIDE->isEnabled() && ide_ter_enabled);
ui->checkBoxQuaternaryIDE->setChecked(ui->checkBoxQuaternaryIDE->isEnabled() && ide_qua_enabled);
if (machine_has_bus(machineId, MACHINE_BUS_CASSETTE)) {
ui->checkBoxCassette->setChecked(cassette_enable > 0);
ui->checkBoxCassette->setEnabled(true);
@@ -243,12 +251,39 @@ SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index)
}
void
SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index)
SettingsStorageControllers::on_comboBoxHD1_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0);
ui->pushButtonHD1->setEnabled(hdc_has_config(ui->comboBoxHD1->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxHD2_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonHD2->setEnabled(hdc_has_config(ui->comboBoxHD2->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxHD3_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonHD3->setEnabled(hdc_has_config(ui->comboBoxHD3->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxHD4_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonHD4->setEnabled(hdc_has_config(ui->comboBoxHD4->currentData().toInt()) > 0);
}
void
@@ -260,18 +295,6 @@ SettingsStorageControllers::on_comboBoxCDInterface_currentIndexChanged(int index
ui->pushButtonCDInterface->setEnabled(cdrom_interface_has_config(ui->comboBoxCDInterface->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_checkBoxTertiaryIDE_stateChanged(int arg1)
{
ui->pushButtonTertiaryIDE->setEnabled(arg1 == Qt::Checked);
}
void
SettingsStorageControllers::on_checkBoxQuaternaryIDE_stateChanged(int arg1)
{
ui->pushButtonQuaternaryIDE->setEnabled(arg1 == Qt::Checked);
}
void
SettingsStorageControllers::on_pushButtonFD_clicked()
{
@@ -279,9 +302,27 @@ SettingsStorageControllers::on_pushButtonFD_clicked()
}
void
SettingsStorageControllers::on_pushButtonHD_clicked()
SettingsStorageControllers::on_pushButtonHD1_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD->currentData().toInt()));
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD1->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonHD2_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD2->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonHD3_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD3->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonHD4_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD4->currentData().toInt()));
}
void
@@ -290,18 +331,6 @@ SettingsStorageControllers::on_pushButtonCDInterface_clicked()
DeviceConfig::ConfigureDevice(cdrom_interface_get_device(ui->comboBoxCDInterface->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonTertiaryIDE_clicked()
{
DeviceConfig::ConfigureDevice(&ide_ter_device);
}
void
SettingsStorageControllers::on_pushButtonQuaternaryIDE_clicked()
{
DeviceConfig::ConfigureDevice(&ide_qua_device);
}
void
SettingsStorageControllers::on_comboBoxSCSI1_currentIndexChanged(int index)
{

View File

@@ -23,18 +23,18 @@ private slots:
void on_comboBoxFD_currentIndexChanged(int index);
void on_pushButtonFD_clicked();
void on_comboBoxHD_currentIndexChanged(int index);
void on_pushButtonHD_clicked();
void on_comboBoxHD1_currentIndexChanged(int index);
void on_pushButtonHD1_clicked();
void on_comboBoxHD2_currentIndexChanged(int index);
void on_pushButtonHD2_clicked();
void on_comboBoxHD3_currentIndexChanged(int index);
void on_pushButtonHD3_clicked();
void on_comboBoxHD4_currentIndexChanged(int index);
void on_pushButtonHD4_clicked();
void on_comboBoxCDInterface_currentIndexChanged(int index);
void on_pushButtonCDInterface_clicked();
void on_checkBoxTertiaryIDE_stateChanged(int arg1);
void on_pushButtonTertiaryIDE_clicked();
void on_checkBoxQuaternaryIDE_stateChanged(int arg1);
void on_pushButtonQuaternaryIDE_clicked();
void on_comboBoxSCSI1_currentIndexChanged(int index);
void on_pushButtonSCSI1_clicked();
void on_comboBoxSCSI2_currentIndexChanged(int index);

View File

@@ -50,89 +50,145 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelHD">
<property name="text">
<string>HD Controller:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxHD">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonHD">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelCDInterface">
<property name="text">
<string>CD-ROM Controller:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxCDInterface">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonCDInterface">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxTertiaryIDE">
<property name="text">
<string>Tertiary IDE Controller</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonTertiaryIDE">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxQuaternaryIDE">
<property name="text">
<string>Quaternary IDE Controller</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonQuaternaryIDE">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBoxHD">
<property name="title">
<string>Hard disk</string>
</property>
<layout class="QGridLayout" name="gridLayoutHD">
<item row="0" column="0">
<widget class="QLabel" name="labelHD1">
<property name="text">
<string>Controller 1:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBoxHD1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButtonHD1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelHD2">
<property name="text">
<string>Controller 2:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxHD2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonHD2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelHD3">
<property name="text">
<string>Controller 3:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="comboBoxHD3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonHD3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelHD4">
<property name="text">
<string>Controller 4:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="comboBoxHD4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonHD4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxSCSI">
<property name="title">

View File

@@ -315,6 +315,7 @@ ioctl_get_track_info(const void *local, const uint32_t track,
const raw_track_info_t *rti = (const raw_track_info_t *) ioctl->cur_rti;
int ret = 1;
int trk = -1;
int next = -1;
if ((track >= 1) && (track < 99))
for (int i = 0; i < ioctl->blocks_num; i++)
@@ -323,13 +324,35 @@ ioctl_get_track_info(const void *local, const uint32_t track,
break;
}
if ((track >= 1) && (track < 98))
for (int i = 0; i < ioctl->blocks_num; i++)
if ((rti[i].point == (track + 1)) && (rti[i].session == rti[trk].session)) {
next = i;
break;
}
if ((track >= 1) && (track < 99) && (trk != -1) && (next == -1))
for (int i = 0; i < ioctl->blocks_num; i++)
if ((rti[i].point == 0xa2) && (rti[i].session == rti[trk].session)) {
next = i;
break;
}
if ((track == 0xaa) || (trk == -1)) {
ioctl_log(ioctl->log, "ioctl_get_track_info(%02i)\n", track);
ret = 0;
} else {
ti->m = rti[trk].pm;
ti->s = rti[trk].ps;
ti->f = rti[trk].pf;
if (end) {
if (next != -1) {
ti->m = rti[next].pm;
ti->s = rti[next].ps;
ti->f = rti[next].pf;
}
} else {
ti->m = rti[trk].pm;
ti->s = rti[trk].ps;
ti->f = rti[trk].pf;
}
ti->number = rti[trk].point;
ti->attr = rti[trk].adr_ctl;