Implemented the Pro Audio Spectrum Plus serial mixer, Pro Audio Spectrum 16 parallel mixer, Pro Audio Spectrum Plus/16 SCSI, ESS ES688, all three ESS PnP AudioDrives, made the wavetables use a separate 44.1 kHz source, and made the Sound Blaster 16 PNP use a proper PNP ROM dump.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QFormLayout>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
@@ -29,9 +30,7 @@
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QDir>
|
||||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
#include <QSizePolicy>
|
||||
|
||||
extern "C" {
|
||||
#include <86box/86box.h>
|
||||
@@ -87,10 +86,15 @@ EnumerateSerialDevices()
|
||||
#ifdef Q_OS_WINDOWS
|
||||
for (int i = 1; i < 256; i++) {
|
||||
devstr[0] = 0;
|
||||
snprintf(devstr.data(), 1024, "\\\\.\\COM%d", i);
|
||||
auto handle = CreateFileA(devstr.data(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, 0);
|
||||
auto dwError = GetLastError();
|
||||
if (handle != INVALID_HANDLE_VALUE || (handle == INVALID_HANDLE_VALUE && ((dwError == ERROR_ACCESS_DENIED) || (dwError == ERROR_GEN_FAILURE) || (dwError == ERROR_SHARING_VIOLATION) || (dwError == ERROR_SEM_TIMEOUT)))) {
|
||||
snprintf(devstr.data(), 1024, R"(\\.\COM%d)", i);
|
||||
const auto handle = CreateFileA(devstr.data(),
|
||||
GENERIC_READ | GENERIC_WRITE, 0,
|
||||
nullptr, OPEN_EXISTING,
|
||||
0, nullptr);
|
||||
const auto dwError = GetLastError();
|
||||
if ((handle != INVALID_HANDLE_VALUE) || (dwError == ERROR_ACCESS_DENIED) ||
|
||||
(dwError == ERROR_GEN_FAILURE) || (dwError == ERROR_SHARING_VIOLATION) ||
|
||||
(dwError == ERROR_SEM_TIMEOUT)) {
|
||||
if (handle != INVALID_HANDLE_VALUE) CloseHandle(handle);
|
||||
serialDevices.push_back(QString(devstr));
|
||||
}
|
||||
@@ -108,233 +112,266 @@ EnumerateSerialDevices()
|
||||
}
|
||||
|
||||
void
|
||||
DeviceConfig::ConfigureDevice(const _device_ *device, int instance, Settings *settings)
|
||||
DeviceConfig::ProcessConfig(void *dc, const void *c, const bool is_dep)
|
||||
{
|
||||
DeviceConfig dc(settings);
|
||||
dc.setWindowTitle(QString("%1 Device Configuration").arg(device->name));
|
||||
int p;
|
||||
int q;
|
||||
auto * device_context = static_cast<device_context_t *>(dc);
|
||||
const auto * config = static_cast<const _device_config_ *>(c);
|
||||
const QString blank = "";
|
||||
int p;
|
||||
int q;
|
||||
|
||||
device_context_t device_context;
|
||||
device_set_context(&device_context, device, instance);
|
||||
|
||||
auto device_label = new QLabel(device->name);
|
||||
device_label->setAlignment(Qt::AlignCenter);
|
||||
dc.ui->formLayout->addRow(device_label);
|
||||
auto line = new QFrame;
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
dc.ui->formLayout->addRow(line);
|
||||
const auto *config = device->config;
|
||||
while (config->type != -1) {
|
||||
const int config_type = config->type & CONFIG_TYPE_MASK;
|
||||
|
||||
/* Ignore options of the wrong class. */
|
||||
if (!!(config->type & CONFIG_DEP) != is_dep)
|
||||
continue;
|
||||
|
||||
/* If this is a BIOS-dependent option and it's BIOS, ignore it. */
|
||||
if (!!(config->type & CONFIG_DEP) && (config_type == CONFIG_BIOS))
|
||||
continue;
|
||||
|
||||
const int config_major_type = (config_type >> CONFIG_SHIFT) << CONFIG_SHIFT;
|
||||
|
||||
int value = 0;
|
||||
auto selected = static_cast<const char *>(blank.toStdString().c_str());
|
||||
|
||||
switch (config_major_type) {
|
||||
default:
|
||||
break;
|
||||
case CONFIG_TYPE_INT:
|
||||
value = config_get_int(device_context->name, const_cast<char *>(config->name),
|
||||
config->default_int);
|
||||
break;
|
||||
case CONFIG_TYPE_HEX16:
|
||||
value = config_get_hex16(device_context->name, const_cast<char *>(config->name),
|
||||
config->default_int);
|
||||
break;
|
||||
case CONFIG_TYPE_HEX20:
|
||||
value = config_get_hex20(device_context->name, const_cast<char *>(config->name),
|
||||
config->default_int);
|
||||
break;
|
||||
case CONFIG_TYPE_STRING:
|
||||
selected = config_get_string(device_context->name, const_cast<char *>(config->name),
|
||||
const_cast<char *>(config->default_string));
|
||||
break;
|
||||
}
|
||||
|
||||
switch (config->type) {
|
||||
default:
|
||||
break;
|
||||
case CONFIG_BINARY:
|
||||
{
|
||||
auto value = config_get_int(device_context.name, const_cast<char *>(config->name), config->default_int);
|
||||
auto *cbox = new QCheckBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setChecked(value > 0);
|
||||
dc.ui->formLayout->addRow(config->description, cbox);
|
||||
break;
|
||||
}
|
||||
{
|
||||
auto *cbox = new QCheckBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setChecked(value > 0);
|
||||
this->ui->formLayout->addRow(config->description, cbox);
|
||||
break;
|
||||
}
|
||||
#ifdef USE_RTMIDI
|
||||
case CONFIG_MIDI_OUT:
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = -1;
|
||||
int selected = config_get_int(device_context.name, const_cast<char *>(config->name), config->default_int);
|
||||
for (int i = 0; i < rtmidi_out_get_num_devs(); i++) {
|
||||
char midiName[512] = { 0 };
|
||||
rtmidi_out_get_dev_name(i, midiName);
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = -1;
|
||||
for (int i = 0; i < rtmidi_out_get_num_devs(); i++) {
|
||||
char midiName[512] = { 0 };
|
||||
rtmidi_out_get_dev_name(i, midiName);
|
||||
|
||||
Models::AddEntry(model, midiName, i);
|
||||
if (selected == i) {
|
||||
currentIndex = i;
|
||||
}
|
||||
}
|
||||
dc.ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
Models::AddEntry(model, midiName, i);
|
||||
if (i == value)
|
||||
currentIndex = i;
|
||||
}
|
||||
this->ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
}
|
||||
case CONFIG_MIDI_IN:
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = -1;
|
||||
int selected = config_get_int(device_context.name, const_cast<char *>(config->name), config->default_int);
|
||||
for (int i = 0; i < rtmidi_in_get_num_devs(); i++) {
|
||||
char midiName[512] = { 0 };
|
||||
rtmidi_in_get_dev_name(i, midiName);
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = -1;
|
||||
for (int i = 0; i < rtmidi_in_get_num_devs(); i++) {
|
||||
char midiName[512] = { 0 };
|
||||
rtmidi_in_get_dev_name(i, midiName);
|
||||
|
||||
Models::AddEntry(model, midiName, i);
|
||||
if (selected == i) {
|
||||
currentIndex = i;
|
||||
}
|
||||
}
|
||||
dc.ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
Models::AddEntry(model, midiName, i);
|
||||
if (i == value)
|
||||
currentIndex = i;
|
||||
}
|
||||
this->ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case CONFIG_INT:
|
||||
case CONFIG_SELECTION:
|
||||
case CONFIG_HEX16:
|
||||
case CONFIG_HEX20:
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = -1;
|
||||
int selected = 0;
|
||||
switch (config->type) {
|
||||
case CONFIG_SELECTION:
|
||||
selected = config_get_int(device_context.name, const_cast<char *>(config->name), config->default_int);
|
||||
break;
|
||||
case CONFIG_HEX16:
|
||||
selected = config_get_hex16(device_context.name, const_cast<char *>(config->name), config->default_int);
|
||||
break;
|
||||
case CONFIG_HEX20:
|
||||
selected = config_get_hex20(device_context.name, const_cast<char *>(config->name), config->default_int);
|
||||
break;
|
||||
}
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = -1;
|
||||
|
||||
for (auto *sel = config->selection; (sel != nullptr) && (sel->description != nullptr) && (strlen(sel->description) > 0); ++sel) {
|
||||
int row = Models::AddEntry(model, sel->description, sel->value);
|
||||
if (selected == sel->value) {
|
||||
currentIndex = row;
|
||||
}
|
||||
}
|
||||
dc.ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
for (auto *sel = config->selection; (sel != nullptr) && (sel->description != nullptr) &&
|
||||
(strlen(sel->description) > 0); ++sel) {
|
||||
int row = Models::AddEntry(model, sel->description, sel->value);
|
||||
|
||||
if (sel->value == value)
|
||||
currentIndex = row;
|
||||
}
|
||||
this->ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
}
|
||||
case CONFIG_BIOS:
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = -1;
|
||||
char *selected;
|
||||
selected = config_get_string(device_context.name, const_cast<char *>(config->name), const_cast<char *>(config->default_string));
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = -1;
|
||||
|
||||
q = 0;
|
||||
for (auto *bios = config->bios; (bios != nullptr) && (bios->name != nullptr) && (strlen(bios->name) > 0); ++bios) {
|
||||
p = 0;
|
||||
for (int d = 0; d < bios->files_no; d++)
|
||||
p += !!rom_present(const_cast<char *>(bios->files[d]));
|
||||
if (p == bios->files_no) {
|
||||
int row = Models::AddEntry(model, bios->name, q);
|
||||
if (!strcmp(selected, bios->internal_name)) {
|
||||
currentIndex = row;
|
||||
}
|
||||
}
|
||||
q++;
|
||||
}
|
||||
dc.ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
}
|
||||
case CONFIG_SPINNER:
|
||||
{
|
||||
int value = config_get_int(device_context.name, const_cast<char *>(config->name), config->default_int);
|
||||
auto *spinBox = new QSpinBox();
|
||||
spinBox->setObjectName(config->name);
|
||||
spinBox->setMaximum(config->spinner.max);
|
||||
spinBox->setMinimum(config->spinner.min);
|
||||
if (config->spinner.step > 0) {
|
||||
spinBox->setSingleStep(config->spinner.step);
|
||||
}
|
||||
spinBox->setValue(value);
|
||||
dc.ui->formLayout->addRow(config->description, spinBox);
|
||||
break;
|
||||
}
|
||||
case CONFIG_FNAME:
|
||||
{
|
||||
auto *fileName = config_get_string(device_context.name, const_cast<char *>(config->name), const_cast<char *>(config->default_string));
|
||||
auto *fileField = new FileField();
|
||||
fileField->setObjectName(config->name);
|
||||
fileField->setFileName(fileName);
|
||||
fileField->setFilter(QString(config->file_filter).left(strcspn(config->file_filter, "|")));
|
||||
dc.ui->formLayout->addRow(config->description, fileField);
|
||||
break;
|
||||
}
|
||||
case CONFIG_STRING:
|
||||
{
|
||||
auto lineEdit = new QLineEdit;
|
||||
lineEdit->setObjectName(config->name);
|
||||
lineEdit->setCursor(Qt::IBeamCursor);
|
||||
lineEdit->setText(config_get_string(device_context.name, const_cast<char *>(config->name), const_cast<char *>(config->default_string)));
|
||||
dc.ui->formLayout->addRow(config->description, lineEdit);
|
||||
break;
|
||||
}
|
||||
case CONFIG_SERPORT:
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = 0;
|
||||
auto serialDevices = EnumerateSerialDevices();
|
||||
char *selected = config_get_string(device_context.name, const_cast<char *>(config->name), const_cast<char *>(config->default_string));
|
||||
|
||||
Models::AddEntry(model, "None", -1);
|
||||
for (int i = 0; i < serialDevices.size(); i++) {
|
||||
int row = Models::AddEntry(model, serialDevices[i], i);
|
||||
if (selected == serialDevices[i]) {
|
||||
q = 0;
|
||||
for (auto *bios = config->bios; (bios != nullptr) && (bios->name != nullptr) &&
|
||||
(strlen(bios->name) > 0); ++bios) {
|
||||
p = 0;
|
||||
for (int d = 0; d < bios->files_no; d++)
|
||||
p += !!rom_present(const_cast<char *>(bios->files[d]));
|
||||
if (p == bios->files_no) {
|
||||
const int row = Models::AddEntry(model, bios->name, q);
|
||||
if (!strcmp(selected, bios->internal_name))
|
||||
currentIndex = row;
|
||||
}
|
||||
}
|
||||
|
||||
dc.ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
q++;
|
||||
}
|
||||
this->ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
}
|
||||
case CONFIG_SPINNER:
|
||||
{
|
||||
auto *spinBox = new QSpinBox();
|
||||
spinBox->setObjectName(config->name);
|
||||
spinBox->setMaximum(config->spinner.max);
|
||||
spinBox->setMinimum(config->spinner.min);
|
||||
if (config->spinner.step > 0)
|
||||
spinBox->setSingleStep(config->spinner.step);
|
||||
spinBox->setValue(value);
|
||||
this->ui->formLayout->addRow(config->description, spinBox);
|
||||
break;
|
||||
}
|
||||
case CONFIG_FNAME:
|
||||
{
|
||||
auto *fileField = new FileField();
|
||||
fileField->setObjectName(config->name);
|
||||
fileField->setFileName(selected);
|
||||
fileField->setFilter(QString(config->file_filter).left(static_cast<int>(strcspn(config->file_filter,
|
||||
"|"))));
|
||||
this->ui->formLayout->addRow(config->description, fileField);
|
||||
break;
|
||||
}
|
||||
case CONFIG_STRING:
|
||||
{
|
||||
const auto lineEdit = new QLineEdit;
|
||||
lineEdit->setObjectName(config->name);
|
||||
lineEdit->setCursor(Qt::IBeamCursor);
|
||||
lineEdit->setText(selected);
|
||||
this->ui->formLayout->addRow(config->description, lineEdit);
|
||||
break;
|
||||
}
|
||||
case CONFIG_SERPORT:
|
||||
{
|
||||
auto *cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
cbox->setMaxVisibleItems(30);
|
||||
auto *model = cbox->model();
|
||||
int currentIndex = 0;
|
||||
auto serialDevices = EnumerateSerialDevices();
|
||||
|
||||
Models::AddEntry(model, "None", -1);
|
||||
for (int i = 0; i < serialDevices.size(); i++) {
|
||||
const int row = Models::AddEntry(model, serialDevices[i], i);
|
||||
if (selected == serialDevices[i])
|
||||
currentIndex = row;
|
||||
}
|
||||
|
||||
this->ui->formLayout->addRow(config->description, cbox);
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
}
|
||||
case CONFIG_MAC:
|
||||
{
|
||||
// QHBoxLayout for the line edit widget and the generate button
|
||||
auto hboxLayout = new QHBoxLayout();
|
||||
auto generateButton = new QPushButton(tr("Generate"));
|
||||
auto lineEdit = new QLineEdit;
|
||||
const auto hboxLayout = new QHBoxLayout();
|
||||
const auto generateButton = new QPushButton(tr("Generate"));
|
||||
const auto lineEdit = new QLineEdit;
|
||||
// Allow the line edit to expand and fill available space
|
||||
lineEdit->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Preferred);
|
||||
lineEdit->setInputMask("HH:HH:HH;0");
|
||||
lineEdit->setObjectName(config->name);
|
||||
// Display the current or generated MAC in uppercase
|
||||
// When stored it will be converted to lowercase
|
||||
if (config_get_mac(device_context.name, config->name, config->default_int) & 0xFF000000) {
|
||||
lineEdit->setText(QString::asprintf("%02X:%02X:%02X", random_generate(), random_generate(), random_generate()));
|
||||
if (config_get_mac(device_context->name, config->name,
|
||||
config->default_int) & 0xFF000000) {
|
||||
lineEdit->setText(QString::asprintf("%02X:%02X:%02X", random_generate(),
|
||||
random_generate(), random_generate()));
|
||||
} else {
|
||||
auto current_mac = QString(config_get_string(device_context.name, config->name, const_cast<char *>(config->default_string)));
|
||||
auto current_mac = QString(config_get_string(device_context->name, config->name,
|
||||
const_cast<char *>(config->default_string)));
|
||||
lineEdit->setText(current_mac.toUpper());
|
||||
}
|
||||
// Action for the generate button
|
||||
connect(generateButton, &QPushButton::clicked, [lineEdit] {
|
||||
lineEdit->setText(QString::asprintf("%02X:%02X:%02X", random_generate(), random_generate(), random_generate()));
|
||||
lineEdit->setText(QString::asprintf("%02X:%02X:%02X", random_generate(),
|
||||
random_generate(), random_generate()));
|
||||
});
|
||||
hboxLayout->addWidget(lineEdit);
|
||||
hboxLayout->addWidget(generateButton);
|
||||
dc.ui->formLayout->addRow(config->description, hboxLayout);
|
||||
this->ui->formLayout->addRow(config->description, hboxLayout);
|
||||
break;
|
||||
}
|
||||
}
|
||||
++config;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DeviceConfig::ConfigureDevice(const _device_ *device, int instance, Settings *settings)
|
||||
{
|
||||
DeviceConfig dc(settings);
|
||||
dc.setWindowTitle(QString("%1 Device Configuration").arg(device->name));
|
||||
|
||||
device_context_t device_context;
|
||||
device_set_context(&device_context, device, instance);
|
||||
|
||||
const auto device_label = new QLabel(device->name);
|
||||
device_label->setAlignment(Qt::AlignCenter);
|
||||
dc.ui->formLayout->addRow(device_label);
|
||||
const auto line = new QFrame;
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
dc.ui->formLayout->addRow(line);
|
||||
const _device_config_ *config = device->config;
|
||||
|
||||
dc.ProcessConfig(&device_context, config, false);
|
||||
|
||||
dc.setFixedSize(dc.minimumSizeHint());
|
||||
int res = dc.exec();
|
||||
if (res == QDialog::Accepted) {
|
||||
if (dc.exec() == QDialog::Accepted) {
|
||||
config = device->config;
|
||||
while (config->type != -1) {
|
||||
switch (config->type) {
|
||||
default:
|
||||
break;
|
||||
case CONFIG_BINARY:
|
||||
{
|
||||
auto *cbox = dc.findChild<QCheckBox *>(config->name);
|
||||
const auto *cbox = dc.findChild<QCheckBox *>(config->name);
|
||||
config_set_int(device_context.name, const_cast<char *>(config->name), cbox->isChecked() ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
@@ -408,15 +445,15 @@ DeviceConfig::ConfigureDevice(const _device_ *device, int instance, Settings *se
|
||||
}
|
||||
|
||||
QString
|
||||
DeviceConfig::DeviceName(const _device_ *device, const char *internalName, int bus)
|
||||
DeviceConfig::DeviceName(const _device_ *device, const char *internalName, const int bus)
|
||||
{
|
||||
if (QStringLiteral("none") == internalName) {
|
||||
if (QStringLiteral("none") == internalName)
|
||||
return tr("None");
|
||||
} else if (QStringLiteral("internal") == internalName) {
|
||||
else if (QStringLiteral("internal") == internalName)
|
||||
return tr("Internal controller");
|
||||
} else if (device == nullptr) {
|
||||
return QString();
|
||||
} else {
|
||||
else if (device == nullptr)
|
||||
return "";
|
||||
else {
|
||||
char temp[512];
|
||||
device_get_name(device, bus, temp);
|
||||
return tr(temp, nullptr, 512);
|
||||
|
||||
@@ -20,13 +20,15 @@ class DeviceConfig : public QDialog {
|
||||
|
||||
public:
|
||||
explicit DeviceConfig(QWidget *parent = nullptr);
|
||||
~DeviceConfig();
|
||||
~DeviceConfig() override;
|
||||
|
||||
static void ConfigureDevice(const _device_ *device, int instance = 0, Settings *settings = nullptr);
|
||||
static void ConfigureDevice(const _device_ *device, int instance = 0,
|
||||
Settings *settings = nullptr);
|
||||
static QString DeviceName(const _device_ *device, const char *internalName, int bus);
|
||||
|
||||
private:
|
||||
Ui::DeviceConfig *ui;
|
||||
void ProcessConfig(void *dc, const void *c, bool is_dep);
|
||||
};
|
||||
|
||||
#endif // QT_DEVICECONFIG_HPP
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
extern "C" {
|
||||
#include <86box/hdd.h>
|
||||
#include <86box/scsi.h>
|
||||
#include <86box/cdrom.h>
|
||||
}
|
||||
|
||||
@@ -109,9 +110,16 @@ Harddrives::populateBusChannels(QAbstractItemModel *model, int bus, SettingsBusT
|
||||
QList<int> channelsInUse;
|
||||
switch (bus) {
|
||||
case HDD_BUS_MFM:
|
||||
busRows = 2;
|
||||
busesToCheck.append(HDD_BUS_MFM);
|
||||
break;
|
||||
case HDD_BUS_XTA:
|
||||
busRows = 2;
|
||||
busesToCheck.append(HDD_BUS_XTA);
|
||||
break;
|
||||
case HDD_BUS_ESDI:
|
||||
busRows = 2;
|
||||
busesToCheck.append(HDD_BUS_ESDI);
|
||||
break;
|
||||
case HDD_BUS_IDE:
|
||||
busRows = 8;
|
||||
@@ -126,7 +134,7 @@ Harddrives::populateBusChannels(QAbstractItemModel *model, int bus, SettingsBusT
|
||||
case HDD_BUS_SCSI:
|
||||
shifter = 4;
|
||||
orer = 15;
|
||||
busRows = 64;
|
||||
busRows = /*64*/ SCSI_BUS_MAX * SCSI_ID_MAX;
|
||||
subChannelWidth = 2;
|
||||
busesToCheck.append(HDD_BUS_SCSI);
|
||||
break;
|
||||
|
||||
@@ -272,13 +272,13 @@ MachineStatus::hasCassette()
|
||||
bool
|
||||
MachineStatus::hasIDE()
|
||||
{
|
||||
return machine_has_flags(machine, MACHINE_IDE_QUAD) > 0;
|
||||
return (machine_has_flags(machine, MACHINE_IDE_QUAD) > 0) || other_ide_present;
|
||||
}
|
||||
|
||||
bool
|
||||
MachineStatus::hasSCSI()
|
||||
{
|
||||
return machine_has_flags(machine, MACHINE_SCSI) > 0;
|
||||
return (machine_has_flags(machine, MACHINE_SCSI) > 0) || other_scsi_present;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -91,26 +91,23 @@ void qt_set_sequence_auto_mnemonic(bool b);
|
||||
void
|
||||
main_thread_fn()
|
||||
{
|
||||
uint64_t old_time;
|
||||
uint64_t new_time;
|
||||
int drawits;
|
||||
int frames;
|
||||
|
||||
QThread::currentThread()->setPriority(QThread::HighestPriority);
|
||||
plat_set_thread_name(NULL, "main_thread_fn");
|
||||
plat_set_thread_name(nullptr, "main_thread_fn");
|
||||
framecountx = 0;
|
||||
// title_update = 1;
|
||||
old_time = elapsed_timer.elapsed();
|
||||
drawits = frames = 0;
|
||||
uint64_t old_time = elapsed_timer.elapsed();
|
||||
int drawits = frames = 0;
|
||||
while (!is_quit && cpu_thread_run) {
|
||||
/* See if it is time to run a frame of code. */
|
||||
new_time = elapsed_timer.elapsed();
|
||||
const uint64_t new_time = elapsed_timer.elapsed();
|
||||
#ifdef USE_GDBSTUB
|
||||
if (gdbstub_next_asap && (drawits <= 0))
|
||||
drawits = 10;
|
||||
else
|
||||
#endif
|
||||
drawits += (new_time - old_time);
|
||||
drawits += static_cast<int>(new_time - old_time);
|
||||
old_time = new_time;
|
||||
if (drawits > 0 && !dopause) {
|
||||
/* Yes, so do one frame now. */
|
||||
@@ -395,7 +392,7 @@ main(int argc, char *argv[])
|
||||
plat_pause(0);
|
||||
});
|
||||
|
||||
auto ret = app.exec();
|
||||
const auto ret = app.exec();
|
||||
cpu_thread_run = 0;
|
||||
main_thread->join();
|
||||
pc_close(nullptr);
|
||||
|
||||
@@ -91,6 +91,7 @@ extern int qt_nvr_save(void);
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "qt_settings.hpp"
|
||||
@@ -289,14 +290,15 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
resizableonce = true;
|
||||
}
|
||||
if (!QApplication::platformName().contains("eglfs") && vid_resize != 1) {
|
||||
w = (w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.));
|
||||
w = static_cast<int>(w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.));
|
||||
|
||||
int modifiedHeight = (h / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.))
|
||||
const int modifiedHeight =
|
||||
static_cast<int>(h / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.))
|
||||
+ menuBar()->height()
|
||||
+ (statusBar()->height() * !hide_status_bar)
|
||||
+ (ui->toolBar->height() * !hide_tool_bar);
|
||||
|
||||
ui->stackedWidget->resize(w, (h / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.)));
|
||||
ui->stackedWidget->resize(w, static_cast<int>(h / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.)));
|
||||
setFixedSize(w, modifiedHeight);
|
||||
}
|
||||
});
|
||||
@@ -306,9 +308,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
#ifdef QT_RESIZE_DEBUG
|
||||
qDebug() << "Resize";
|
||||
#endif
|
||||
w = (w / (!dpi_scale ? util::screenOfWidget(renderers[monitor_index].get())->devicePixelRatio() : 1.));
|
||||
w = static_cast<int>(w / (!dpi_scale ? util::screenOfWidget(renderers[monitor_index].get())->devicePixelRatio() : 1.));
|
||||
|
||||
int modifiedHeight = (h / (!dpi_scale ? util::screenOfWidget(renderers[monitor_index].get())->devicePixelRatio() : 1.));
|
||||
int modifiedHeight = static_cast<int>(h / (!dpi_scale ? util::screenOfWidget(renderers[monitor_index].get())->devicePixelRatio() : 1.));
|
||||
|
||||
renderers[monitor_index]->setFixedSize(w, modifiedHeight);
|
||||
}
|
||||
@@ -394,9 +396,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->actionVulkan->setVisible(false);
|
||||
}
|
||||
|
||||
QActionGroup *actGroup = nullptr;
|
||||
|
||||
actGroup = new QActionGroup(this);
|
||||
auto actGroup = new QActionGroup(this);
|
||||
actGroup->addAction(ui->actionSoftware_Renderer);
|
||||
actGroup->addAction(ui->actionHardware_Renderer_OpenGL);
|
||||
actGroup->addAction(ui->actionHardware_Renderer_OpenGL_ES);
|
||||
@@ -418,6 +418,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
#endif
|
||||
RendererStack::Renderer newVidApi = RendererStack::Renderer::Software;
|
||||
switch (vid_api) {
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
newVidApi = RendererStack::Renderer::Software;
|
||||
break;
|
||||
@@ -457,7 +459,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
});
|
||||
|
||||
/* Trigger initial renderer switch */
|
||||
for (auto action : actGroup->actions())
|
||||
for (const auto action : actGroup->actions())
|
||||
if (action->property("vid_api").toInt() == vid_api) {
|
||||
action->setChecked(true);
|
||||
emit actGroup->triggered(action);
|
||||
@@ -465,6 +467,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
}
|
||||
|
||||
switch (scale) {
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
ui->action0_5x->setChecked(true);
|
||||
break;
|
||||
@@ -508,6 +512,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
actGroup->addAction(ui->action7x);
|
||||
actGroup->addAction(ui->action8x);
|
||||
switch (video_filter_method) {
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
ui->actionNearest->setChecked(true);
|
||||
break;
|
||||
@@ -519,6 +525,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
actGroup->addAction(ui->actionNearest);
|
||||
actGroup->addAction(ui->actionLinear);
|
||||
switch (video_fullscreen_scale) {
|
||||
default:
|
||||
break;
|
||||
case FULLSCR_SCALE_FULL:
|
||||
ui->actionFullScreen_stretch->setChecked(true);
|
||||
break;
|
||||
@@ -542,6 +550,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
actGroup->addAction(ui->actionFullScreen_int);
|
||||
actGroup->addAction(ui->actionFullScreen_int43);
|
||||
switch (video_grayscale) {
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
ui->actionRGB_Color->setChecked(true);
|
||||
break;
|
||||
@@ -565,6 +575,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
actGroup->addAction(ui->actionWhite_monitor);
|
||||
actGroup->addAction(ui->actionRGB_Color);
|
||||
switch (video_graytype) {
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
ui->actionBT601_NTSC_PAL->setChecked(true);
|
||||
break;
|
||||
@@ -722,7 +734,7 @@ MainWindow::closeEvent(QCloseEvent *event)
|
||||
|
||||
if (confirm_exit && confirm_exit_cmdl && cpu_thread_run) {
|
||||
QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", tr("Are you sure you want to exit 86Box?"), QMessageBox::Yes | QMessageBox::No, this);
|
||||
QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));
|
||||
auto chkbox = new QCheckBox(tr("Don't show this message again"));
|
||||
questionbox.setCheckBox(chkbox);
|
||||
chkbox->setChecked(!confirm_exit);
|
||||
|
||||
@@ -771,7 +783,7 @@ void
|
||||
MainWindow::initRendererMonitorSlot(int monitor_index)
|
||||
{
|
||||
auto &secondaryRenderer = this->renderers[monitor_index];
|
||||
secondaryRenderer.reset(new RendererStack(nullptr, monitor_index));
|
||||
secondaryRenderer = std::make_unique<RendererStack>(nullptr, monitor_index);
|
||||
if (secondaryRenderer) {
|
||||
connect(secondaryRenderer.get(), &RendererStack::rendererChanged, this, [this, monitor_index] {
|
||||
this->renderers[monitor_index]->show();
|
||||
@@ -779,9 +791,8 @@ MainWindow::initRendererMonitorSlot(int monitor_index)
|
||||
secondaryRenderer->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
|
||||
secondaryRenderer->setWindowTitle(QObject::tr("86Box Monitor #") + QString::number(monitor_index + 1));
|
||||
|
||||
if (vid_resize == 2) {
|
||||
if (vid_resize == 2)
|
||||
secondaryRenderer->setFixedSize(fixed_size_x, fixed_size_y);
|
||||
}
|
||||
secondaryRenderer->setWindowIcon(this->windowIcon());
|
||||
if (show_second_monitors) {
|
||||
secondaryRenderer->show();
|
||||
@@ -791,9 +802,8 @@ MainWindow::initRendererMonitorSlot(int monitor_index)
|
||||
monitor_settings[monitor_index].mon_window_w > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_w,
|
||||
monitor_settings[monitor_index].mon_window_h > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_h);
|
||||
}
|
||||
if (monitor_settings[monitor_index].mon_window_maximized) {
|
||||
if (monitor_settings[monitor_index].mon_window_maximized)
|
||||
secondaryRenderer->showMaximized();
|
||||
}
|
||||
secondaryRenderer->switchRenderer((RendererStack::Renderer) vid_api);
|
||||
secondaryRenderer->setMouseTracking(true);
|
||||
|
||||
@@ -877,7 +887,7 @@ MainWindow::on_actionHard_Reset_triggered()
|
||||
QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", tr("Are you sure you want to hard reset the emulated machine?"), QMessageBox::NoButton, this);
|
||||
questionbox.addButton(tr("Reset"), QMessageBox::AcceptRole);
|
||||
questionbox.addButton(tr("Don't reset"), QMessageBox::RejectRole);
|
||||
QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));
|
||||
const auto chkbox = new QCheckBox(tr("Don't show this message again"));
|
||||
questionbox.setCheckBox(chkbox);
|
||||
chkbox->setChecked(!confirm_reset);
|
||||
|
||||
@@ -921,7 +931,7 @@ MainWindow::on_actionExit_triggered()
|
||||
void
|
||||
MainWindow::on_actionSettings_triggered()
|
||||
{
|
||||
int currentPause = dopause;
|
||||
const int currentPause = dopause;
|
||||
plat_pause(1);
|
||||
Settings settings(this);
|
||||
settings.setModal(true);
|
||||
@@ -932,6 +942,8 @@ MainWindow::on_actionSettings_triggered()
|
||||
settings.exec();
|
||||
|
||||
switch (settings.result()) {
|
||||
default:
|
||||
break;
|
||||
case QDialog::Accepted:
|
||||
pc_reset_hard_close();
|
||||
settings.save();
|
||||
@@ -968,6 +980,9 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
|
||||
|
||||
/* Apply special cases. */
|
||||
switch (keycode) {
|
||||
default:
|
||||
break;
|
||||
|
||||
case 0x54: /* Alt + Print Screen (special case, i.e. evdev SELECTIVE_SCREENSHOT) */
|
||||
/* Send Alt as well. */
|
||||
if (down) {
|
||||
@@ -1333,18 +1348,18 @@ MainWindow::checkFullscreenHotkey()
|
||||
{
|
||||
if (!fs_off_signal && video_fullscreen && keyboard_isfsexit()) {
|
||||
/* Signal "exit fullscreen mode". */
|
||||
fs_off_signal = 1;
|
||||
fs_off_signal = true;
|
||||
} else if (fs_off_signal && video_fullscreen && keyboard_isfsexit_up()) {
|
||||
ui->actionFullscreen->trigger();
|
||||
fs_off_signal = 0;
|
||||
fs_off_signal = false;
|
||||
}
|
||||
|
||||
if (!fs_on_signal && !video_fullscreen && keyboard_isfsenter()) {
|
||||
/* Signal "enter fullscreen mode". */
|
||||
fs_on_signal = 1;
|
||||
fs_on_signal = true;
|
||||
} else if (fs_on_signal && !video_fullscreen && keyboard_isfsenter_up()) {
|
||||
ui->actionFullscreen->trigger();
|
||||
fs_on_signal = 0;
|
||||
fs_on_signal = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1699,7 +1714,7 @@ MainWindow::on_actionAbout_86Box_triggered()
|
||||
msgBox.setInformativeText(tr("An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information."));
|
||||
msgBox.setWindowTitle("About 86Box");
|
||||
msgBox.addButton("OK", QMessageBox::ButtonRole::AcceptRole);
|
||||
auto webSiteButton = msgBox.addButton(EMU_SITE, QMessageBox::ButtonRole::HelpRole);
|
||||
const auto webSiteButton = msgBox.addButton(EMU_SITE, QMessageBox::ButtonRole::HelpRole);
|
||||
webSiteButton->connect(webSiteButton, &QPushButton::released, []() {
|
||||
QDesktopServices::openUrl(QUrl("https://" EMU_SITE));
|
||||
});
|
||||
@@ -1847,8 +1862,8 @@ void
|
||||
MainWindow::on_actionTake_screenshot_triggered()
|
||||
{
|
||||
startblit();
|
||||
for (int i = 0; i < MONITORS_NUM; i++)
|
||||
monitors[i].mon_screenshots++;
|
||||
for (auto & monitor : monitors)
|
||||
++monitor.mon_screenshots;
|
||||
endblit();
|
||||
device_force_redraw();
|
||||
}
|
||||
@@ -1869,8 +1884,10 @@ MainWindow::setSendKeyboardInput(bool enabled)
|
||||
void
|
||||
MainWindow::updateUiPauseState()
|
||||
{
|
||||
auto pause_icon = dopause ? QIcon(":/menuicons/qt/icons/run.ico") : QIcon(":/menuicons/qt/icons/pause.ico");
|
||||
auto tooltip_text = dopause ? QString(tr("Resume execution")) : QString(tr("Pause execution"));
|
||||
const auto pause_icon = dopause ? QIcon(":/menuicons/qt/icons/run.ico") :
|
||||
QIcon(":/menuicons/qt/icons/pause.ico");
|
||||
const auto tooltip_text = dopause ? QString(tr("Resume execution")) :
|
||||
QString(tr("Pause execution"));
|
||||
ui->actionPause->setIcon(pause_icon);
|
||||
ui->actionPause->setToolTip(tooltip_text);
|
||||
}
|
||||
@@ -1932,9 +1949,7 @@ MainWindow::changeEvent(QEvent *event)
|
||||
void
|
||||
MainWindow::on_actionRenderer_options_triggered()
|
||||
{
|
||||
auto dlg = ui->stackedWidget->getOptions(this);
|
||||
|
||||
if (dlg) {
|
||||
if (const auto dlg = ui->stackedWidget->getOptions(this)) {
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
for (int i = 1; i < MONITORS_NUM; i++) {
|
||||
if (renderers[i] && renderers[i]->hasOptions())
|
||||
@@ -1947,20 +1962,18 @@ MainWindow::on_actionRenderer_options_triggered()
|
||||
void
|
||||
MainWindow::on_actionMCA_devices_triggered()
|
||||
{
|
||||
auto dlg = new MCADeviceList(this);
|
||||
|
||||
if (dlg)
|
||||
if (const auto dlg = new MCADeviceList(this))
|
||||
dlg->exec();
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::on_actionShow_non_primary_monitors_triggered()
|
||||
{
|
||||
show_second_monitors = (int) ui->actionShow_non_primary_monitors->isChecked();
|
||||
show_second_monitors = static_cast<int>(ui->actionShow_non_primary_monitors->isChecked());
|
||||
|
||||
if (show_second_monitors) {
|
||||
for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) {
|
||||
auto &secondaryRenderer = renderers[monitor_index];
|
||||
const auto &secondaryRenderer = renderers[monitor_index];
|
||||
if (!renderers[monitor_index])
|
||||
continue;
|
||||
secondaryRenderer->show();
|
||||
@@ -1970,8 +1983,8 @@ MainWindow::on_actionShow_non_primary_monitors_triggered()
|
||||
monitor_settings[monitor_index].mon_window_w > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_w,
|
||||
monitor_settings[monitor_index].mon_window_h > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_h);
|
||||
}
|
||||
secondaryRenderer->switchRenderer((RendererStack::Renderer) vid_api);
|
||||
ui->stackedWidget->switchRenderer((RendererStack::Renderer) vid_api);
|
||||
secondaryRenderer->switchRenderer(static_cast<RendererStack::Renderer>(vid_api));
|
||||
ui->stackedWidget->switchRenderer(static_cast<RendererStack::Renderer>(vid_api));
|
||||
}
|
||||
} else {
|
||||
for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) {
|
||||
@@ -1992,7 +2005,7 @@ MainWindow::on_actionShow_non_primary_monitors_triggered()
|
||||
void
|
||||
MainWindow::on_actionOpen_screenshots_folder_triggered()
|
||||
{
|
||||
QDir(QString(usr_path) + QString("/screenshots/")).mkpath(".");
|
||||
static_cast<void>(QDir(QString(usr_path) + QString("/screenshots/")).mkpath("."));
|
||||
QDesktopServices::openUrl(QUrl(QString("file:///") + usr_path + QString("/screenshots/")));
|
||||
}
|
||||
|
||||
@@ -2001,7 +2014,7 @@ MainWindow::on_actionApply_fullscreen_stretch_mode_when_maximized_triggered(bool
|
||||
{
|
||||
video_fullscreen_scale_maximized = checked;
|
||||
|
||||
auto widget = ui->stackedWidget->currentWidget();
|
||||
const auto widget = ui->stackedWidget->currentWidget();
|
||||
ui->stackedWidget->onResize(widget->width(), widget->height());
|
||||
|
||||
for (int i = 1; i < MONITORS_NUM; i++) {
|
||||
|
||||
@@ -73,7 +73,7 @@ private slots:
|
||||
void on_actionCtrl_Alt_Esc_triggered();
|
||||
void on_actionHard_Reset_triggered();
|
||||
void on_actionRight_CTRL_is_left_ALT_triggered();
|
||||
void on_actionKeyboard_requires_capture_triggered();
|
||||
static void on_actionKeyboard_requires_capture_triggered();
|
||||
void on_actionResizable_window_triggered(bool checked);
|
||||
void on_actionInverted_VGA_monitor_triggered();
|
||||
void on_action0_5x_triggered();
|
||||
|
||||
@@ -252,7 +252,7 @@ void
|
||||
MediaMenu::cassetteUpdateMenu()
|
||||
{
|
||||
QString name = cassette_fname;
|
||||
QString mode = cassette_mode;
|
||||
const QString mode = cassette_mode;
|
||||
auto childs = cassetteMenu->children();
|
||||
auto *recordMenu = dynamic_cast<QAction *>(childs[cassetteRecordPos]);
|
||||
auto *playMenu = dynamic_cast<QAction *>(childs[cassettePlayPos]);
|
||||
@@ -266,11 +266,12 @@ MediaMenu::cassetteUpdateMenu()
|
||||
fastFwdMenu->setEnabled(!name.isEmpty());
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
|
||||
bool isSaving = mode == QStringLiteral("save");
|
||||
const bool isSaving = (mode == QStringLiteral("save"));
|
||||
recordMenu->setChecked(isSaving);
|
||||
playMenu->setChecked(!isSaving);
|
||||
|
||||
cassetteMenu->setTitle(QString::asprintf(tr("Cassette: %s").toUtf8().constData(), (name.isEmpty() ? tr("(empty)") : name).toUtf8().constData()));
|
||||
cassetteMenu->setTitle(QString::asprintf(tr("Cassette: %s").toUtf8().constData(),
|
||||
(name.isEmpty() ? tr("(empty)") : name).toUtf8().constData()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -289,7 +290,7 @@ MediaMenu::cartridgeMount(int i, const QString &filename)
|
||||
void
|
||||
MediaMenu::cartridgeSelectImage(int i)
|
||||
{
|
||||
auto filename = QFileDialog::getOpenFileName(
|
||||
const auto filename = QFileDialog::getOpenFileName(
|
||||
parentWidget,
|
||||
QString(),
|
||||
getMediaOpenDirectory(),
|
||||
@@ -314,8 +315,8 @@ MediaMenu::cartridgeEject(int i)
|
||||
void
|
||||
MediaMenu::cartridgeUpdateMenu(int i)
|
||||
{
|
||||
QString name = cart_fns[i];
|
||||
auto *menu = cartridgeMenus[i];
|
||||
const QString name = cart_fns[i];
|
||||
auto *menu = cartridgeMenus[i];
|
||||
auto childs = menu->children();
|
||||
auto *ejectMenu = dynamic_cast<QAction *>(childs[cartridgeEjectPos]);
|
||||
ejectMenu->setEnabled(!name.isEmpty());
|
||||
@@ -328,8 +329,10 @@ MediaMenu::floppyNewImage(int i)
|
||||
{
|
||||
NewFloppyDialog dialog(NewFloppyDialog::MediaType::Floppy, parentWidget);
|
||||
switch (dialog.exec()) {
|
||||
default:
|
||||
break;
|
||||
case QDialog::Accepted:
|
||||
QByteArray filename = dialog.fileName().toUtf8();
|
||||
const QByteArray filename = dialog.fileName().toUtf8();
|
||||
floppyMount(i, filename, false);
|
||||
break;
|
||||
}
|
||||
@@ -516,7 +519,7 @@ MediaMenu::cdromEject(int i)
|
||||
void
|
||||
MediaMenu::cdromReload(int index, int slot)
|
||||
{
|
||||
QString filename = mhm.getImageForSlot(index, slot, ui::MediaType::Optical);
|
||||
const QString filename = mhm.getImageForSlot(index, slot, ui::MediaType::Optical);
|
||||
cdromMount(index, filename.toUtf8().constData());
|
||||
cdromUpdateMenu(index);
|
||||
ui_sb_update_tip(SB_CDROM | index);
|
||||
@@ -572,7 +575,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
|
||||
return;
|
||||
}
|
||||
|
||||
QString menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
const QString menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
imageHistoryUpdatePos->setText(QString::asprintf(tr("%s").toUtf8().constData(), menu_item_name.toUtf8().constData()));
|
||||
imageHistoryUpdatePos->setVisible(!fi.fileName().isEmpty());
|
||||
imageHistoryUpdatePos->setVisible(fi.exists());
|
||||
@@ -602,8 +605,8 @@ MediaMenu::cdromUpdateMenu(int i)
|
||||
|
||||
auto *imageMenu = dynamic_cast<QAction *>(childs[cdromImagePos]);
|
||||
imageMenu->setEnabled(!name.isEmpty());
|
||||
QString menu_item_name = name.isEmpty() ? QString().toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
auto menu_icon = fi.isDir() ? QApplication::style()->standardIcon(QStyle::SP_DirIcon) : ProgSettings::loadIcon("/cdrom.ico");
|
||||
const QString menu_item_name = name.isEmpty() ? QString().toUtf8().constData() : fi.fileName().toUtf8().constData();
|
||||
const auto menu_icon = fi.isDir() ? QApplication::style()->standardIcon(QStyle::SP_DirIcon) : ProgSettings::loadIcon("/cdrom.ico");
|
||||
imageMenu->setIcon(menu_icon);
|
||||
imageMenu->setText(QString::asprintf(tr("Eject %s").toUtf8().constData(), menu_item_name.toUtf8().constData()));
|
||||
|
||||
@@ -613,15 +616,17 @@ MediaMenu::cdromUpdateMenu(int i)
|
||||
|
||||
QString busName = tr("Unknown Bus");
|
||||
switch (cdrom[i].bus_type) {
|
||||
default:
|
||||
break;
|
||||
case CDROM_BUS_ATAPI:
|
||||
busName = "ATAPI";
|
||||
break;
|
||||
case CDROM_BUS_SCSI:
|
||||
busName = "SCSI";
|
||||
break;
|
||||
case CDROM_BUS_MITSUMI:
|
||||
busName = "Mitsumi";
|
||||
break;
|
||||
case CDROM_BUS_MITSUMI:
|
||||
busName = "Mitsumi";
|
||||
break;
|
||||
}
|
||||
|
||||
// menu->setTitle(tr("CD-ROM %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name));
|
||||
@@ -633,6 +638,8 @@ MediaMenu::zipNewImage(int i)
|
||||
{
|
||||
NewFloppyDialog dialog(NewFloppyDialog::MediaType::Zip, parentWidget);
|
||||
switch (dialog.exec()) {
|
||||
default:
|
||||
break;
|
||||
case QDialog::Accepted:
|
||||
QByteArray filename = dialog.fileName().toUtf8();
|
||||
zipMount(i, filename, false);
|
||||
@@ -643,7 +650,7 @@ MediaMenu::zipNewImage(int i)
|
||||
void
|
||||
MediaMenu::zipSelectImage(int i, bool wp)
|
||||
{
|
||||
auto filename = QFileDialog::getOpenFileName(
|
||||
const auto filename = QFileDialog::getOpenFileName(
|
||||
parentWidget,
|
||||
QString(),
|
||||
QString(),
|
||||
@@ -656,7 +663,7 @@ MediaMenu::zipSelectImage(int i, bool wp)
|
||||
void
|
||||
MediaMenu::zipMount(int i, const QString &filename, bool wp)
|
||||
{
|
||||
zip_t *dev = (zip_t *) zip_drives[i].priv;
|
||||
const auto dev = static_cast<zip_t *>(zip_drives[i].priv);
|
||||
|
||||
zip_disk_close(dev);
|
||||
zip_drives[i].read_only = wp;
|
||||
@@ -676,7 +683,7 @@ MediaMenu::zipMount(int i, const QString &filename, bool wp)
|
||||
void
|
||||
MediaMenu::zipEject(int i)
|
||||
{
|
||||
zip_t *dev = (zip_t *) zip_drives[i].priv;
|
||||
const auto dev = static_cast<zip_t *>(zip_drives[i].priv);
|
||||
|
||||
zip_disk_close(dev);
|
||||
zip_drives[i].image_path[0] = 0;
|
||||
@@ -694,7 +701,7 @@ MediaMenu::zipEject(int i)
|
||||
void
|
||||
MediaMenu::zipReload(int i)
|
||||
{
|
||||
zip_t *dev = (zip_t *) zip_drives[i].priv;
|
||||
const auto dev = static_cast<zip_t *>(zip_drives[i].priv);
|
||||
|
||||
zip_disk_reload(dev);
|
||||
if (strlen(zip_drives[i].image_path) == 0) {
|
||||
@@ -712,8 +719,8 @@ MediaMenu::zipReload(int i)
|
||||
void
|
||||
MediaMenu::zipUpdateMenu(int i)
|
||||
{
|
||||
QString name = zip_drives[i].image_path;
|
||||
QString prev_name = zip_drives[i].prev_image_path;
|
||||
const QString name = zip_drives[i].image_path;
|
||||
const QString prev_name = zip_drives[i].prev_image_path;
|
||||
if (!zipMenus.contains(i))
|
||||
return;
|
||||
auto *menu = zipMenus[i];
|
||||
@@ -726,6 +733,8 @@ MediaMenu::zipUpdateMenu(int i)
|
||||
|
||||
QString busName = tr("Unknown Bus");
|
||||
switch (zip_drives[i].bus_type) {
|
||||
default:
|
||||
break;
|
||||
case ZIP_BUS_ATAPI:
|
||||
busName = "ATAPI";
|
||||
break;
|
||||
@@ -743,6 +752,8 @@ MediaMenu::moNewImage(int i)
|
||||
{
|
||||
NewFloppyDialog dialog(NewFloppyDialog::MediaType::Mo, parentWidget);
|
||||
switch (dialog.exec()) {
|
||||
default:
|
||||
break;
|
||||
case QDialog::Accepted:
|
||||
QByteArray filename = dialog.fileName().toUtf8();
|
||||
moMount(i, filename, false);
|
||||
@@ -753,7 +764,7 @@ MediaMenu::moNewImage(int i)
|
||||
void
|
||||
MediaMenu::moSelectImage(int i, bool wp)
|
||||
{
|
||||
auto filename = QFileDialog::getOpenFileName(
|
||||
const auto filename = QFileDialog::getOpenFileName(
|
||||
parentWidget,
|
||||
QString(),
|
||||
getMediaOpenDirectory(),
|
||||
@@ -769,7 +780,7 @@ MediaMenu::moSelectImage(int i, bool wp)
|
||||
void
|
||||
MediaMenu::moMount(int i, const QString &filename, bool wp)
|
||||
{
|
||||
mo_t *dev = (mo_t *) mo_drives[i].priv;
|
||||
const auto dev = static_cast<mo_t *>(mo_drives[i].priv);
|
||||
|
||||
mo_disk_close(dev);
|
||||
mo_drives[i].read_only = wp;
|
||||
@@ -789,7 +800,7 @@ MediaMenu::moMount(int i, const QString &filename, bool wp)
|
||||
void
|
||||
MediaMenu::moEject(int i)
|
||||
{
|
||||
mo_t *dev = (mo_t *) mo_drives[i].priv;
|
||||
const auto dev = static_cast<mo_t *>(mo_drives[i].priv);
|
||||
|
||||
mo_disk_close(dev);
|
||||
mo_drives[i].image_path[0] = 0;
|
||||
@@ -839,6 +850,8 @@ MediaMenu::moUpdateMenu(int i)
|
||||
|
||||
QString busName = tr("Unknown Bus");
|
||||
switch (mo_drives[i].bus_type) {
|
||||
default:
|
||||
break;
|
||||
case MO_BUS_ATAPI:
|
||||
busName = "ATAPI";
|
||||
break;
|
||||
@@ -876,6 +889,8 @@ MediaMenu::nicUpdateMenu(int i)
|
||||
|
||||
QString netType = tr("Null Driver");
|
||||
switch (net_cards_conf[i].net_type) {
|
||||
default:
|
||||
break;
|
||||
case NET_TYPE_SLIRP:
|
||||
netType = "SLiRP";
|
||||
break;
|
||||
@@ -901,9 +916,10 @@ QString
|
||||
MediaMenu::getMediaOpenDirectory()
|
||||
{
|
||||
QString openDirectory;
|
||||
if (open_dir_usr_path > 0) {
|
||||
|
||||
if (open_dir_usr_path > 0)
|
||||
openDirectory = QString::fromUtf8(usr_path);
|
||||
}
|
||||
|
||||
return openDirectory;
|
||||
}
|
||||
|
||||
|
||||
@@ -404,7 +404,10 @@ RendererStack::createRenderer(Renderer renderer)
|
||||
void
|
||||
RendererStack::blit(int x, int y, int w, int h)
|
||||
{
|
||||
if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (monitors[m_monitor_index].target_buffer == NULL) || imagebufs.empty() || std::get<std::atomic_flag *>(imagebufs[currentBuf])->test_and_set()) {
|
||||
if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) ||
|
||||
(w > 2048) || (h > 2048) ||
|
||||
(monitors[m_monitor_index].target_buffer == NULL) || imagebufs.empty() ||
|
||||
std::get<std::atomic_flag *>(imagebufs[currentBuf])->test_and_set()) {
|
||||
video_blit_complete_monitor(m_monitor_index);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -155,8 +155,28 @@ Settings::Settings(QWidget *parent)
|
||||
&SettingsOtherPeripherals::onCurrentMachineChanged);
|
||||
connect(floppyCdrom, &SettingsFloppyCDROM::cdromChannelChanged, harddisks,
|
||||
&SettingsHarddisks::reloadBusChannels);
|
||||
connect(floppyCdrom, &SettingsFloppyCDROM::cdromChannelChanged, otherRemovable,
|
||||
&SettingsOtherRemovable::reloadBusChannels_MO);
|
||||
connect(floppyCdrom, &SettingsFloppyCDROM::cdromChannelChanged, otherRemovable,
|
||||
&SettingsOtherRemovable::reloadBusChannels_ZIP);
|
||||
connect(harddisks, &SettingsHarddisks::driveChannelChanged, floppyCdrom,
|
||||
&SettingsFloppyCDROM::reloadBusChannels);
|
||||
connect(harddisks, &SettingsHarddisks::driveChannelChanged, otherRemovable,
|
||||
&SettingsOtherRemovable::reloadBusChannels_MO);
|
||||
connect(harddisks, &SettingsHarddisks::driveChannelChanged, otherRemovable,
|
||||
&SettingsOtherRemovable::reloadBusChannels_ZIP);
|
||||
connect(otherRemovable, &SettingsOtherRemovable::moChannelChanged, harddisks,
|
||||
&SettingsHarddisks::reloadBusChannels);
|
||||
connect(otherRemovable, &SettingsOtherRemovable::moChannelChanged, floppyCdrom,
|
||||
&SettingsFloppyCDROM::reloadBusChannels);
|
||||
connect(otherRemovable, &SettingsOtherRemovable::moChannelChanged, otherRemovable,
|
||||
&SettingsOtherRemovable::reloadBusChannels_ZIP);
|
||||
connect(otherRemovable, &SettingsOtherRemovable::zipChannelChanged, harddisks,
|
||||
&SettingsHarddisks::reloadBusChannels);
|
||||
connect(otherRemovable, &SettingsOtherRemovable::zipChannelChanged, floppyCdrom,
|
||||
&SettingsFloppyCDROM::reloadBusChannels);
|
||||
connect(otherRemovable, &SettingsOtherRemovable::zipChannelChanged, otherRemovable,
|
||||
&SettingsOtherRemovable::reloadBusChannels_MO);
|
||||
|
||||
connect(ui->listView->selectionModel(), &QItemSelectionModel::currentChanged, this,
|
||||
[this](const QModelIndex ¤t, const QModelIndex &previous) {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <cstring>
|
||||
|
||||
#include "86box/hdd.h"
|
||||
#include "86box/scsi.h"
|
||||
#include "qt_settings_bus_tracking.hpp"
|
||||
|
||||
SettingsBusTracking::SettingsBusTracking()
|
||||
@@ -30,12 +31,11 @@ SettingsBusTracking::SettingsBusTracking()
|
||||
esdi_tracking = 0x0000000000000000ULL;
|
||||
xta_tracking = 0x0000000000000000ULL;
|
||||
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
if (i < 4)
|
||||
ide_tracking[i] = 0x0000000000000000ULL;
|
||||
for (uint8_t i = 0; i < 4; i++)
|
||||
ide_tracking[i] = 0x0000000000000000ULL;
|
||||
|
||||
for (uint8_t i = 0; i < 32; i++)
|
||||
scsi_tracking[i] = 0x0000000000000000ULL;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
@@ -101,7 +101,7 @@ SettingsBusTracking::next_free_scsi_id()
|
||||
uint64_t mask;
|
||||
uint8_t ret = CHANNEL_NONE;
|
||||
|
||||
for (uint8_t i = 0; i < 64; i++) {
|
||||
for (uint8_t i = 0; i < (SCSI_BUS_MAX * SCSI_ID_MAX); i++) {
|
||||
element = ((i << 3) >> 6);
|
||||
mask = 0xffULL << ((uint64_t) ((i << 3) & 0x3f));
|
||||
|
||||
@@ -187,7 +187,7 @@ SettingsBusTracking::scsi_bus_full()
|
||||
uint64_t mask;
|
||||
uint8_t count = 0;
|
||||
|
||||
for (uint8_t i = 0; i < 64; i++) {
|
||||
for (uint8_t i = 0; i < (SCSI_BUS_MAX * SCSI_ID_MAX); i++) {
|
||||
element = ((i << 3) >> 6);
|
||||
mask = 0xffULL << ((uint64_t) ((i << 3) & 0x3f));
|
||||
|
||||
@@ -204,26 +204,45 @@ QList<int> SettingsBusTracking::busChannelsInUse(const int bus) {
|
||||
int element;
|
||||
uint64_t mask;
|
||||
switch (bus) {
|
||||
case HDD_BUS_MFM:
|
||||
for (uint8_t i = 0; i < 32; i++) {
|
||||
mask = 0xffULL << ((uint64_t) ((i << 3) & 0x3f));
|
||||
if (mfm_tracking & mask)
|
||||
channelsInUse.append(i);
|
||||
}
|
||||
break;
|
||||
case HDD_BUS_ESDI:
|
||||
for (uint8_t i = 0; i < 32; i++) {
|
||||
mask = 0xffULL << ((uint64_t) ((i << 3) & 0x3f));
|
||||
if (esdi_tracking & mask)
|
||||
channelsInUse.append(i);
|
||||
}
|
||||
break;
|
||||
case HDD_BUS_XTA:
|
||||
for (uint8_t i = 0; i < 32; i++) {
|
||||
mask = 0xffULL << ((uint64_t) ((i << 3) & 0x3f));
|
||||
if (xta_tracking & mask)
|
||||
channelsInUse.append(i);
|
||||
}
|
||||
break;
|
||||
case HDD_BUS_IDE:
|
||||
for (uint8_t i = 0; i < 32; i++) {
|
||||
element = ((i << 3) >> 6);
|
||||
mask = ((uint64_t) DEV_HDD) << ((uint64_t) ((i << 3) & 0x3f));
|
||||
if (ide_tracking[element] & mask) {
|
||||
mask = ((uint64_t) 0xffULL) << ((uint64_t) ((i << 3) & 0x3f));
|
||||
if (ide_tracking[element] & mask)
|
||||
channelsInUse.append(i);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HDD_BUS_ATAPI:
|
||||
for (uint8_t i = 0; i < 32; i++) {
|
||||
element = ((i << 3) >> 6);
|
||||
mask = ((uint64_t) DEV_CDROM) << ((uint64_t) ((i << 3) & 0x3f));
|
||||
if (ide_tracking[element] & mask) {
|
||||
mask = ((uint64_t) 0xffULL) << ((uint64_t) ((i << 3) & 0x3f));
|
||||
if (ide_tracking[element] & mask)
|
||||
channelsInUse.append(i);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HDD_BUS_SCSI:
|
||||
for (uint8_t i = 0; i < 64; i++) {
|
||||
for (uint8_t i = 0; i < (SCSI_BUS_MAX * SCSI_ID_MAX); i++) {
|
||||
element = ((i << 3) >> 6);
|
||||
mask = 0xffULL << ((uint64_t) ((i << 3) & 0x3f));
|
||||
if (scsi_tracking[element] & mask)
|
||||
|
||||
@@ -57,8 +57,10 @@ private:
|
||||
uint64_t xta_tracking { 0 };
|
||||
/* 16 channels (prepatation for that weird IDE card), 2 devices per channel, 8 bits per device = 256 bits. */
|
||||
uint64_t ide_tracking[4] { 0, 0, 0, 0 };
|
||||
/* 4 buses, 16 devices per bus, 8 bits per device (future-proofing) = 512 bits. */
|
||||
uint64_t scsi_tracking[8] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
/* 9 buses (rounded upwards to 16for future-proofing), 16 devices per bus,
|
||||
8 bits per device (future-proofing) = 2048 bits. */
|
||||
uint64_t scsi_tracking[32] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
};
|
||||
|
||||
#endif // QT_SETTINGS_BUS_TRACKING_HPP
|
||||
|
||||
@@ -368,6 +368,7 @@ SettingsFloppyCDROM::on_comboBoxBus_activated(int)
|
||||
setCDROMType(ui->tableViewCDROM->model(),
|
||||
ui->tableViewCDROM->selectionModel()->currentIndex(),
|
||||
ui->comboBoxCDROMType->currentData().toUInt());
|
||||
emit cdromChannelChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -201,6 +201,7 @@ SettingsOtherRemovable::onMORowChanged(const QModelIndex ¤t)
|
||||
if (!match.isEmpty())
|
||||
ui->comboBoxMOChannel->setCurrentIndex(match.first().row());
|
||||
ui->comboBoxMOType->setCurrentIndex(type);
|
||||
enableCurrentlySelectedChannel_MO();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -221,6 +222,16 @@ SettingsOtherRemovable::onZIPRowChanged(const QModelIndex ¤t)
|
||||
if (!match.isEmpty())
|
||||
ui->comboBoxZIPChannel->setCurrentIndex(match.first().row());
|
||||
ui->checkBoxZIP250->setChecked(is250);
|
||||
enableCurrentlySelectedChannel_ZIP();
|
||||
}
|
||||
|
||||
void
|
||||
SettingsOtherRemovable::reloadBusChannels_MO() {
|
||||
auto selected = ui->comboBoxMOChannel->currentIndex();
|
||||
Harddrives::populateBusChannels(ui->comboBoxMOChannel->model(),
|
||||
ui->comboBoxMOBus->currentData().toInt(), Harddrives::busTrackClass);
|
||||
ui->comboBoxMOChannel->setCurrentIndex(selected);
|
||||
enableCurrentlySelectedChannel_MO();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -231,7 +242,7 @@ SettingsOtherRemovable::on_comboBoxMOBus_currentIndexChanged(int index)
|
||||
bool enabled = (bus != MO_BUS_DISABLED);
|
||||
ui->comboBoxMOChannel->setEnabled(enabled);
|
||||
ui->comboBoxMOType->setEnabled(enabled);
|
||||
Harddrives::populateBusChannels(ui->comboBoxMOChannel->model(), bus);
|
||||
Harddrives::populateBusChannels(ui->comboBoxMOChannel->model(), bus, Harddrives::busTrackClass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +269,17 @@ SettingsOtherRemovable::on_comboBoxMOBus_activated(int)
|
||||
Harddrives::busTrackClass->device_track(1, DEV_MO, ui->tableViewMO->model()->data(i,
|
||||
Qt::UserRole).toInt(), ui->tableViewMO->model()->data(i,
|
||||
Qt::UserRole + 1).toInt());
|
||||
emit moChannelChanged();
|
||||
}
|
||||
|
||||
void
|
||||
SettingsOtherRemovable::enableCurrentlySelectedChannel_MO()
|
||||
{
|
||||
const auto *item_model = qobject_cast<QStandardItemModel*>(ui->comboBoxMOChannel->model());
|
||||
const auto index = ui->comboBoxMOChannel->currentIndex();
|
||||
auto *item = item_model->item(index);
|
||||
if (item)
|
||||
item->setEnabled(true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -274,6 +296,7 @@ SettingsOtherRemovable::on_comboBoxMOChannel_activated(int)
|
||||
Harddrives::busTrackClass->device_track(1, DEV_MO, ui->tableViewMO->model()->data(i,
|
||||
Qt::UserRole).toInt(), ui->tableViewMO->model()->data(i,
|
||||
Qt::UserRole + 1).toInt());
|
||||
emit moChannelChanged();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -286,6 +309,15 @@ SettingsOtherRemovable::on_comboBoxMOType_activated(int)
|
||||
ui->tableViewMO->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
}
|
||||
|
||||
void
|
||||
SettingsOtherRemovable::reloadBusChannels_ZIP() {
|
||||
auto selected = ui->comboBoxZIPChannel->currentIndex();
|
||||
Harddrives::populateBusChannels(ui->comboBoxZIPChannel->model(),
|
||||
ui->comboBoxZIPBus->currentData().toInt(), Harddrives::busTrackClass);
|
||||
ui->comboBoxZIPChannel->setCurrentIndex(selected);
|
||||
enableCurrentlySelectedChannel_ZIP();
|
||||
}
|
||||
|
||||
void
|
||||
SettingsOtherRemovable::on_comboBoxZIPBus_currentIndexChanged(int index)
|
||||
{
|
||||
@@ -294,7 +326,7 @@ SettingsOtherRemovable::on_comboBoxZIPBus_currentIndexChanged(int index)
|
||||
bool enabled = (bus != ZIP_BUS_DISABLED);
|
||||
ui->comboBoxZIPChannel->setEnabled(enabled);
|
||||
ui->checkBoxZIP250->setEnabled(enabled);
|
||||
Harddrives::populateBusChannels(ui->comboBoxZIPChannel->model(), bus);
|
||||
Harddrives::populateBusChannels(ui->comboBoxZIPChannel->model(), bus, Harddrives::busTrackClass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,6 +347,17 @@ SettingsOtherRemovable::on_comboBoxZIPBus_activated(int)
|
||||
Harddrives::busTrackClass->device_track(1, DEV_ZIP, ui->tableViewZIP->model()->data(i,
|
||||
Qt::UserRole).toInt(), ui->tableViewZIP->model()->data(i,
|
||||
Qt::UserRole + 1).toInt());
|
||||
emit zipChannelChanged();
|
||||
}
|
||||
|
||||
void
|
||||
SettingsOtherRemovable::enableCurrentlySelectedChannel_ZIP()
|
||||
{
|
||||
const auto *item_model = qobject_cast<QStandardItemModel*>(ui->comboBoxZIPChannel->model());
|
||||
const auto index = ui->comboBoxZIPChannel->currentIndex();
|
||||
auto *item = item_model->item(index);
|
||||
if (item)
|
||||
item->setEnabled(true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -331,6 +374,7 @@ SettingsOtherRemovable::on_comboBoxZIPChannel_activated(int)
|
||||
Harddrives::busTrackClass->device_track(1, DEV_ZIP, ui->tableViewZIP->model()->data(i,
|
||||
Qt::UserRole).toInt(),
|
||||
ui->tableViewZIP->model()->data(i, Qt::UserRole + 1).toInt());
|
||||
emit zipChannelChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -13,9 +13,14 @@ class SettingsOtherRemovable : public QWidget {
|
||||
public:
|
||||
explicit SettingsOtherRemovable(QWidget *parent = nullptr);
|
||||
~SettingsOtherRemovable();
|
||||
void reloadBusChannels_MO();
|
||||
void reloadBusChannels_ZIP();
|
||||
|
||||
void save();
|
||||
|
||||
signals:
|
||||
void moChannelChanged();
|
||||
void zipChannelChanged();
|
||||
private slots:
|
||||
void on_checkBoxZIP250_stateChanged(int arg1);
|
||||
|
||||
@@ -46,6 +51,8 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::SettingsOtherRemovable *ui;
|
||||
void enableCurrentlySelectedChannel_MO();
|
||||
void enableCurrentlySelectedChannel_ZIP();
|
||||
};
|
||||
|
||||
#endif // QT_SETTINGSOTHERREMOVABLE_HPP
|
||||
|
||||
@@ -67,17 +67,17 @@ SettingsSound::save()
|
||||
}
|
||||
|
||||
void
|
||||
SettingsSound::onCurrentMachineChanged(int machineId)
|
||||
SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
{
|
||||
this->machineId = machineId;
|
||||
|
||||
int c = 0;
|
||||
int selectedRow = 0;
|
||||
int c;
|
||||
int selectedRow;
|
||||
|
||||
for (uint8_t i = 0; i < SOUND_CARD_MAX; ++i) {
|
||||
auto *cbox = findChild<QComboBox *>(QString("comboBoxSoundCard%1").arg(i + 1));
|
||||
auto *model = cbox->model();
|
||||
auto removeRows = model->rowCount();
|
||||
auto * cbox = findChild<QComboBox *>(QString("comboBoxSoundCard%1").arg(i + 1));
|
||||
auto * model = cbox->model();
|
||||
const auto removeRows = model->rowCount();
|
||||
c = 0;
|
||||
selectedRow = 0;
|
||||
|
||||
@@ -207,7 +207,7 @@ SettingsSound::on_pushButtonConfigureSoundCard1_clicked()
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
if (sndCard == SOUND_INTERNAL)
|
||||
device = machine_get_snd_device(machineId);
|
||||
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
|
||||
DeviceConfig::ConfigureDevice(device, 1, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -225,7 +225,7 @@ SettingsSound::on_pushButtonConfigureSoundCard2_clicked()
|
||||
{
|
||||
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
|
||||
DeviceConfig::ConfigureDevice(device, 2, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -243,7 +243,7 @@ SettingsSound::on_pushButtonConfigureSoundCard3_clicked()
|
||||
{
|
||||
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
|
||||
DeviceConfig::ConfigureDevice(device, 3, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -261,7 +261,7 @@ SettingsSound::on_pushButtonConfigureSoundCard4_clicked()
|
||||
{
|
||||
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
|
||||
DeviceConfig::ConfigureDevice(device, 4, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -278,7 +278,8 @@ SettingsSound::on_comboBoxMidiOut_currentIndexChanged(int index)
|
||||
void
|
||||
SettingsSound::on_pushButtonConfigureMidiOut_clicked()
|
||||
{
|
||||
DeviceConfig::ConfigureDevice(midi_out_device_getdevice(ui->comboBoxMidiOut->currentData().toInt()), 0, qobject_cast<Settings *>(Settings::settings));
|
||||
DeviceConfig::ConfigureDevice(midi_out_device_getdevice(ui->comboBoxMidiOut->currentData().toInt()), 0,
|
||||
qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -295,7 +296,8 @@ SettingsSound::on_comboBoxMidiIn_currentIndexChanged(int index)
|
||||
void
|
||||
SettingsSound::on_pushButtonConfigureMidiIn_clicked()
|
||||
{
|
||||
DeviceConfig::ConfigureDevice(midi_in_device_getdevice(ui->comboBoxMidiIn->currentData().toInt()), 0, qobject_cast<Settings *>(Settings::settings));
|
||||
DeviceConfig::ConfigureDevice(midi_in_device_getdevice(ui->comboBoxMidiIn->currentData().toInt()), 0,
|
||||
qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -307,9 +309,8 @@ SettingsSound::on_checkBoxMPU401_stateChanged(int state)
|
||||
void
|
||||
SettingsSound::on_pushButtonConfigureMPU401_clicked()
|
||||
{
|
||||
if (machine_has_bus(machineId, MACHINE_BUS_MCA) > 0) {
|
||||
if (machine_has_bus(machineId, MACHINE_BUS_MCA) > 0)
|
||||
DeviceConfig::ConfigureDevice(&mpu401_mca_device, 0, qobject_cast<Settings *>(Settings::settings));
|
||||
} else {
|
||||
else
|
||||
DeviceConfig::ConfigureDevice(&mpu401_device, 0, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void
|
||||
SettingsStorageControllers::save()
|
||||
{
|
||||
/* Storage devices category */
|
||||
for (int i = 0; i < SCSI_BUS_MAX; ++i) {
|
||||
for (int i = 0; i < SCSI_CARD_MAX; ++i) {
|
||||
auto *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
|
||||
scsi_card_current[i] = cbox->currentData().toInt();
|
||||
}
|
||||
@@ -161,7 +161,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
ui->comboBoxCDInterface->setCurrentIndex(-1);
|
||||
ui->comboBoxCDInterface->setCurrentIndex(selectedRow);
|
||||
|
||||
for (int i = 0; i < SCSI_BUS_MAX; ++i) {
|
||||
for (int i = 0; i < SCSI_CARD_MAX; ++i) {
|
||||
auto *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
|
||||
model = cbox->model();
|
||||
removeRows = model->rowCount();
|
||||
|
||||
@@ -66,13 +66,13 @@ wchar_t *
|
||||
ui_window_title(wchar_t *str)
|
||||
{
|
||||
if (str == nullptr) {
|
||||
static wchar_t title[512];
|
||||
memset(title, 0, sizeof(title));
|
||||
static wchar_t title[512] = { 0 };
|
||||
|
||||
main_window->getTitle(title);
|
||||
str = title;
|
||||
} else {
|
||||
} else
|
||||
emit main_window->setTitle(QString::fromWCharArray(str));
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -122,8 +122,10 @@ plat_mouse_capture(int on)
|
||||
int
|
||||
ui_msgbox_header(int flags, void *header, void *message)
|
||||
{
|
||||
auto hdr = (flags & MBX_ANSI) ? QString((char *) header) : QString::fromWCharArray(reinterpret_cast<const wchar_t *>(header));
|
||||
auto msg = (flags & MBX_ANSI) ? QString((char *) message) : QString::fromWCharArray(reinterpret_cast<const wchar_t *>(message));
|
||||
const auto hdr = (flags & MBX_ANSI) ? QString(static_cast<char *>(header)) :
|
||||
QString::fromWCharArray(static_cast<const wchar_t *>(header));
|
||||
const auto msg = (flags & MBX_ANSI) ? QString(static_cast<char *>(message)) :
|
||||
QString::fromWCharArray(static_cast<const wchar_t *>(message));
|
||||
|
||||
// any error in early init
|
||||
if (main_window == nullptr) {
|
||||
@@ -220,9 +222,13 @@ ui_sb_set_ready(int ready)
|
||||
void
|
||||
ui_sb_update_icon_state(int tag, int state)
|
||||
{
|
||||
int category = tag & 0xfffffff0;
|
||||
int item = tag & 0xf;
|
||||
const auto temp = static_cast<unsigned int>(tag);
|
||||
const int category = static_cast<int>(temp & 0xfffffff0);
|
||||
const int item = tag & 0xf;
|
||||
|
||||
switch (category) {
|
||||
default:
|
||||
break;
|
||||
case SB_CASSETTE:
|
||||
machine_status.cassette.empty = state > 0 ? true : false;
|
||||
break;
|
||||
@@ -247,7 +253,6 @@ ui_sb_update_icon_state(int tag, int state)
|
||||
machine_status.net[item].empty = state > 0 ? true : false;
|
||||
break;
|
||||
case SB_SOUND:
|
||||
break;
|
||||
case SB_TEXT:
|
||||
break;
|
||||
}
|
||||
@@ -256,11 +261,13 @@ ui_sb_update_icon_state(int tag, int state)
|
||||
void
|
||||
ui_sb_update_icon(int tag, int active)
|
||||
{
|
||||
int category = tag & 0xfffffff0;
|
||||
int item = tag & 0xf;
|
||||
const auto temp = static_cast<unsigned int>(tag);
|
||||
const int category = static_cast<int>(temp & 0xfffffff0);
|
||||
const int item = tag & 0xf;
|
||||
|
||||
switch (category) {
|
||||
default:
|
||||
case SB_CASSETTE:
|
||||
break;
|
||||
case SB_CARTRIDGE:
|
||||
break;
|
||||
case SB_FLOPPY:
|
||||
@@ -282,7 +289,6 @@ ui_sb_update_icon(int tag, int active)
|
||||
machine_status.net[item].active = active > 0 ? true : false;
|
||||
break;
|
||||
case SB_SOUND:
|
||||
break;
|
||||
case SB_TEXT:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user