Added the Mach8 and Mach32 ISA/VLB/PCI cards (initial implementation and MCA coming soon for the Mach32) and their corresponding EEPROM's. Added INMOS XGA ISA card and updated the SVGA core to reflect its mapping as well as the Mach8/32 mapping when in 8514 monitor mode. Mark the XGA button as already checked and locked when a standalone XGA BIOS card is present like the INMOS one. (QT only) Same concept as above, but applies to the Mach8 and 32 for the 8514 option as well. (QT only)
231 lines
7.3 KiB
C++
231 lines
7.3 KiB
C++
/*
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
* running old operating systems and software designed for IBM
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
* system designs based on the PCI bus.
|
|
*
|
|
* This file is part of the 86Box distribution.
|
|
*
|
|
* Display settings UI module.
|
|
*
|
|
*
|
|
*
|
|
* Authors: Joakim L. Gilje <jgilje@jgilje.net>
|
|
*
|
|
* Copyright 2021 Joakim L. Gilje
|
|
*/
|
|
#include "qt_settingsdisplay.hpp"
|
|
#include "ui_qt_settingsdisplay.h"
|
|
|
|
#include <QDebug>
|
|
|
|
extern "C" {
|
|
#include <86box/86box.h>
|
|
#include <86box/device.h>
|
|
#include <86box/machine.h>
|
|
#include <86box/video.h>
|
|
#include <86box/vid_xga_device.h>
|
|
}
|
|
|
|
#include "qt_deviceconfig.hpp"
|
|
#include "qt_models_common.hpp"
|
|
|
|
SettingsDisplay::SettingsDisplay(QWidget *parent)
|
|
: QWidget(parent)
|
|
, ui(new Ui::SettingsDisplay)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
videoCard[0] = gfxcard[0];
|
|
videoCard[1] = gfxcard[1];
|
|
onCurrentMachineChanged(machine);
|
|
}
|
|
|
|
SettingsDisplay::~SettingsDisplay()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::save()
|
|
{
|
|
gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
|
|
gfxcard[1] = ui->comboBoxVideoSecondary->currentData().toInt();
|
|
voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0;
|
|
ibm8514_enabled = ui->checkBox8514->isChecked() ? 1 : 0;
|
|
xga_enabled = ui->checkBoxXga->isChecked() ? 1 : 0;
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::onCurrentMachineChanged(int machineId)
|
|
{
|
|
// win_settings_video_proc, WM_INITDIALOG
|
|
this->machineId = machineId;
|
|
auto curVideoCard = videoCard[0];
|
|
|
|
auto *model = ui->comboBoxVideo->model();
|
|
auto removeRows = model->rowCount();
|
|
|
|
int c = 0;
|
|
int selectedRow = 0;
|
|
while (true) {
|
|
/* Skip "internal" if machine doesn't have it. */
|
|
if ((c == 1) && (machine_has_flags(machineId, MACHINE_VIDEO) == 0)) {
|
|
c++;
|
|
continue;
|
|
}
|
|
|
|
const device_t *video_dev = video_card_getdevice(c);
|
|
QString name = DeviceConfig::DeviceName(video_dev, video_get_internal_name(c), 1);
|
|
if (name.isEmpty()) {
|
|
break;
|
|
}
|
|
|
|
if (video_card_available(c) && device_is_valid(video_dev, machineId)) {
|
|
int row = Models::AddEntry(model, name, c);
|
|
if (c == curVideoCard) {
|
|
selectedRow = row - removeRows;
|
|
}
|
|
}
|
|
|
|
c++;
|
|
}
|
|
model->removeRows(0, removeRows);
|
|
|
|
if (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0) {
|
|
ui->comboBoxVideo->setEnabled(false);
|
|
ui->comboBoxVideoSecondary->setEnabled(false);
|
|
ui->pushButtonConfigureSecondary->setEnabled(false);
|
|
selectedRow = 1;
|
|
} else {
|
|
ui->comboBoxVideo->setEnabled(true);
|
|
ui->comboBoxVideoSecondary->setEnabled(true);
|
|
ui->pushButtonConfigureSecondary->setEnabled(true);
|
|
}
|
|
if (video_card_get_flags(gfxcard[0]) != VIDEO_FLAG_TYPE_8514)
|
|
ibm8514_has_vga = 0;
|
|
if (video_card_get_flags(gfxcard[0]) != VIDEO_FLAG_TYPE_XGA)
|
|
xga_has_vga = 0;
|
|
|
|
ui->comboBoxVideo->setCurrentIndex(selectedRow);
|
|
if (gfxcard[1] == 0)
|
|
ui->pushButtonConfigureSecondary->setEnabled(false);
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::on_pushButtonConfigure_clicked()
|
|
{
|
|
auto *device = video_card_getdevice(ui->comboBoxVideo->currentData().toInt());
|
|
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::on_pushButtonConfigureVoodoo_clicked()
|
|
{
|
|
DeviceConfig::ConfigureDevice(&voodoo_device, 0, qobject_cast<Settings *>(Settings::settings));
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::on_pushButtonConfigureXga_clicked()
|
|
{
|
|
if (!xga_has_vga) {
|
|
if (machine_has_bus(machineId, MACHINE_BUS_MCA) > 0) {
|
|
DeviceConfig::ConfigureDevice(&xga_device, 0, qobject_cast<Settings *>(Settings::settings));
|
|
} else {
|
|
DeviceConfig::ConfigureDevice(&xga_isa_device, 0, qobject_cast<Settings *>(Settings::settings));
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
|
|
{
|
|
if (index < 0) {
|
|
return;
|
|
}
|
|
auto curVideoCard_2 = videoCard[1];
|
|
videoCard[0] = ui->comboBoxVideo->currentData().toInt();
|
|
ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0);
|
|
bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0;
|
|
ui->checkBoxVoodoo->setEnabled(machineHasPci);
|
|
if (machineHasPci) {
|
|
ui->checkBoxVoodoo->setChecked(voodoo_enabled);
|
|
}
|
|
ui->pushButtonConfigureVoodoo->setEnabled(machineHasPci && ui->checkBoxVoodoo->isChecked());
|
|
|
|
bool hasIsa16 = machine_has_bus(machineId, MACHINE_BUS_ISA16) > 0;
|
|
bool has_MCA = machine_has_bus(machineId, MACHINE_BUS_MCA) > 0;
|
|
ui->checkBox8514->setEnabled((hasIsa16 || has_MCA) && !ibm8514_has_vga);
|
|
if (hasIsa16 || has_MCA) {
|
|
ui->checkBox8514->setChecked(ibm8514_enabled);
|
|
}
|
|
|
|
ui->checkBoxXga->setEnabled((hasIsa16 || has_MCA) && !xga_has_vga);
|
|
if (hasIsa16 || has_MCA)
|
|
ui->checkBoxXga->setChecked(xga_enabled);
|
|
|
|
ui->pushButtonConfigureXga->setEnabled((hasIsa16 || has_MCA) && ui->checkBoxXga->isChecked() && !xga_has_vga);
|
|
|
|
int c = 2;
|
|
|
|
ui->comboBoxVideoSecondary->clear();
|
|
ui->comboBoxVideoSecondary->addItem(QObject::tr("None"), 0);
|
|
|
|
ui->comboBoxVideoSecondary->setCurrentIndex(0);
|
|
// TODO: Implement support for selecting non-MDA secondary cards properly when MDA cards are the primary ones.
|
|
if (video_card_get_flags(videoCard[0]) == VIDEO_FLAG_TYPE_MDA) {
|
|
ui->comboBoxVideoSecondary->setCurrentIndex(0);
|
|
return;
|
|
}
|
|
while (true) {
|
|
const device_t *video_dev = video_card_getdevice(c);
|
|
QString name = DeviceConfig::DeviceName(video_dev, video_get_internal_name(c), 1);
|
|
if (name.isEmpty()) {
|
|
break;
|
|
}
|
|
|
|
if (video_card_available(c) && device_is_valid(video_dev, machineId) && !(video_card_get_flags(c) == video_card_get_flags(videoCard[0]) && (video_card_get_flags(c) != VIDEO_FLAG_TYPE_SPECIAL))) {
|
|
ui->comboBoxVideoSecondary->addItem(name, c);
|
|
if (c == curVideoCard_2)
|
|
ui->comboBoxVideoSecondary->setCurrentIndex(ui->comboBoxVideoSecondary->count() - 1);
|
|
}
|
|
|
|
c++;
|
|
}
|
|
|
|
if ((videoCard[1] == 0) || (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0)) {
|
|
ui->comboBoxVideoSecondary->setCurrentIndex(0);
|
|
ui->pushButtonConfigureSecondary->setEnabled(false);
|
|
}
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::on_checkBoxVoodoo_stateChanged(int state)
|
|
{
|
|
ui->pushButtonConfigureVoodoo->setEnabled(state == Qt::Checked);
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::on_checkBoxXga_stateChanged(int state)
|
|
{
|
|
ui->pushButtonConfigureXga->setEnabled((state == Qt::Checked) && !xga_has_vga);
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::on_comboBoxVideoSecondary_currentIndexChanged(int index)
|
|
{
|
|
if (index < 0) {
|
|
ui->pushButtonConfigureSecondary->setEnabled(false);
|
|
return;
|
|
}
|
|
videoCard[1] = ui->comboBoxVideoSecondary->currentData().toInt();
|
|
ui->pushButtonConfigureSecondary->setEnabled(index != 0 && video_card_has_config(videoCard[1]) > 0);
|
|
}
|
|
|
|
void
|
|
SettingsDisplay::on_pushButtonConfigureSecondary_clicked()
|
|
{
|
|
auto *device = video_card_getdevice(ui->comboBoxVideoSecondary->currentData().toInt());
|
|
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
|
|
}
|