Beginnings of CONFIG_BIOS support
ported from machine&kb
This commit is contained in:
@@ -31,6 +31,8 @@ extern "C" {
|
||||
#include <86box/config.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/midi_rtmidi.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
}
|
||||
|
||||
#include "qt_filefield.hpp"
|
||||
@@ -51,6 +53,8 @@ DeviceConfig::~DeviceConfig()
|
||||
void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Settings* settings) {
|
||||
DeviceConfig dc(settings);
|
||||
dc.setWindowTitle(QString("%1 Device Configuration").arg(device->name));
|
||||
int combo_to_struct[256];
|
||||
int c, d, p, q;
|
||||
|
||||
device_context_t device_context;
|
||||
device_set_context(&device_context, device, instance);
|
||||
@@ -140,6 +144,33 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting
|
||||
cbox->setCurrentIndex(currentIndex);
|
||||
break;
|
||||
}
|
||||
case CONFIG_BIOS:
|
||||
{
|
||||
auto* cbox = new QComboBox();
|
||||
cbox->setObjectName(config->name);
|
||||
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));
|
||||
|
||||
c = q = 0;
|
||||
for (auto* bios = config->bios; (bios != nullptr) && (bios->name != nullptr) && (strlen(bios->name) > 0); ++bios) {
|
||||
p = 0;
|
||||
for (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;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
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);
|
||||
@@ -188,6 +219,13 @@ void DeviceConfig::ConfigureDevice(const _device_* device, int instance, Setting
|
||||
config_set_int(device_context.name, const_cast<char*>(config->name), cbox->currentData().toInt());
|
||||
break;
|
||||
}
|
||||
case CONFIG_BIOS:
|
||||
{
|
||||
auto* cbox = dc.findChild<QComboBox*>(config->name);
|
||||
int idx = cbox->currentData().toInt();
|
||||
config_set_string(device_context.name, const_cast<char*>(config->name), const_cast<char*>(config->bios[idx].internal_name));
|
||||
break;
|
||||
}
|
||||
case CONFIG_HEX16:
|
||||
{
|
||||
auto* cbox = dc.findChild<QComboBox*>(config->name);
|
||||
|
||||
Reference in New Issue
Block a user