Merge branch 'qt' of https://github.com/jgilje/86Box into qt
This commit is contained in:
12
src/config.c
12
src/config.c
@@ -831,9 +831,9 @@ load_machine(void)
|
||||
|
||||
mem_size = config_get_int(cat, "mem_size", 64);
|
||||
#if 0
|
||||
if (mem_size < (((machines[machine].flags & MACHINE_AT) &&
|
||||
if (mem_size < ((machine_has_bus(machine, MACHINE_AT) &&
|
||||
(machines[machine].ram_granularity < 128)) ? machines[machine].min_ram*1024 : machines[machine].min_ram))
|
||||
mem_size = (((machines[machine].flags & MACHINE_AT) && (machines[machine].ram_granularity < 128)) ? machines[machine].min_ram*1024 : machines[machine].min_ram);
|
||||
mem_size = (((machine_has_bus(machine, MACHINE_AT) && (machines[machine].ram_granularity < 128)) ? machines[machine].min_ram*1024 : machines[machine].min_ram);
|
||||
#endif
|
||||
|
||||
if (mem_size > 2097152)
|
||||
@@ -874,13 +874,13 @@ load_video(void)
|
||||
char *p;
|
||||
int free_p = 0;
|
||||
|
||||
if (machines[machine].flags & MACHINE_VIDEO_ONLY) {
|
||||
if (machine_has_flags(machine, MACHINE_VIDEO_ONLY)) {
|
||||
config_delete_var(cat, "gfxcard");
|
||||
gfxcard = VID_INTERNAL;
|
||||
} else {
|
||||
p = config_get_string(cat, "gfxcard", NULL);
|
||||
if (p == NULL) {
|
||||
if (machines[machine].flags & MACHINE_VIDEO) {
|
||||
if (machine_has_flags(machine, MACHINE_VIDEO)) {
|
||||
p = (char *)malloc((strlen("internal")+1)*sizeof(char));
|
||||
strcpy(p, "internal");
|
||||
} else {
|
||||
@@ -1120,7 +1120,7 @@ load_storage_controllers(void)
|
||||
|
||||
p = config_get_string(cat, "hdc", NULL);
|
||||
if (p == NULL) {
|
||||
if (machines[machine].flags & MACHINE_HDC) {
|
||||
if (machine_has_flags(machine, MACHINE_HDC)) {
|
||||
p = (char *)malloc((strlen("internal")+1)*sizeof(char));
|
||||
strcpy(p, "internal");
|
||||
} else {
|
||||
@@ -1948,7 +1948,7 @@ load_other_peripherals(void)
|
||||
|
||||
p = config_get_string(cat, "hdc", NULL);
|
||||
if (p == NULL) {
|
||||
if (machines[machine].flags & MACHINE_HDC) {
|
||||
if (machine_has_flags(machine, MACHINE_HDC)) {
|
||||
p = (char *)malloc((strlen("internal")+1)*sizeof(char));
|
||||
strcpy(p, "internal");
|
||||
} else {
|
||||
|
||||
22
src/device.c
22
src/device.c
@@ -646,29 +646,29 @@ device_set_config_mac(const char *s, int val)
|
||||
|
||||
|
||||
int
|
||||
device_is_valid(const device_t *device, int mflags)
|
||||
device_is_valid(const device_t *device, int m)
|
||||
{
|
||||
if (device == NULL) return(1);
|
||||
|
||||
if ((device->flags & DEVICE_AT) && !(mflags & MACHINE_BUS_ISA16)) return(0);
|
||||
if ((device->flags & DEVICE_AT) && !machine_has_bus(m, MACHINE_BUS_ISA16)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_CBUS) && !(mflags & MACHINE_BUS_CBUS)) return(0);
|
||||
if ((device->flags & DEVICE_CBUS) && !machine_has_bus(m, MACHINE_BUS_CBUS)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_ISA) && !(mflags & MACHINE_BUS_ISA)) return(0);
|
||||
if ((device->flags & DEVICE_ISA) && !machine_has_bus(m, MACHINE_BUS_ISA)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_MCA) && !(mflags & MACHINE_BUS_MCA)) return(0);
|
||||
if ((device->flags & DEVICE_MCA) && !machine_has_bus(m, MACHINE_BUS_MCA)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_EISA) && !(mflags & MACHINE_BUS_EISA)) return(0);
|
||||
if ((device->flags & DEVICE_EISA) && !machine_has_bus(m, MACHINE_BUS_EISA)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_VLB) && !(mflags & MACHINE_BUS_VLB)) return(0);
|
||||
if ((device->flags & DEVICE_VLB) && !machine_has_bus(m, MACHINE_BUS_VLB)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_PCI) && !(mflags & MACHINE_BUS_PCI)) return(0);
|
||||
if ((device->flags & DEVICE_PCI) && !machine_has_bus(m, MACHINE_BUS_PCI)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_AGP) && !(mflags & MACHINE_BUS_AGP)) return(0);
|
||||
if ((device->flags & DEVICE_AGP) && !machine_has_bus(m, MACHINE_BUS_AGP)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_PS2) && !(mflags & MACHINE_BUS_PS2)) return(0);
|
||||
if ((device->flags & DEVICE_PS2) && !machine_has_bus(m, MACHINE_BUS_PS2)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_AC97) && !(mflags & MACHINE_BUS_AC97)) return(0);
|
||||
if ((device->flags & DEVICE_AC97) && !machine_has_bus(m, MACHINE_BUS_AC97)) return(0);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ cart_reset(void)
|
||||
cart_image_close(1);
|
||||
cart_image_close(0);
|
||||
|
||||
if (!(machines[machine].flags & MACHINE_CARTRIDGE))
|
||||
if (!machine_has_cartridge(machine))
|
||||
return;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
||||
@@ -1063,7 +1063,7 @@ write_output(atkbd_t *dev, uint8_t val)
|
||||
val |= ((dev->mem[0] << 4) & 0x10);
|
||||
|
||||
/*IRQ 12*/
|
||||
if ((dev->output_port ^ val) & 0x20) {
|
||||
if ((old ^ val) & 0x20) {
|
||||
if (val & 0x20)
|
||||
picint(1 << 12);
|
||||
else
|
||||
@@ -1071,14 +1071,14 @@ write_output(atkbd_t *dev, uint8_t val)
|
||||
}
|
||||
|
||||
/*IRQ 1*/
|
||||
if ((dev->output_port ^ val) & 0x10) {
|
||||
if ((old ^ val) & 0x10) {
|
||||
if (val & 0x10)
|
||||
picint(1 << 1);
|
||||
else
|
||||
picintc(1 << 1);
|
||||
}
|
||||
|
||||
if ((dev->output_port ^ val) & 0x02) { /*A20 enable change*/
|
||||
if ((old ^ val) & 0x02) { /*A20 enable change*/
|
||||
mem_a20_key = val & 0x02;
|
||||
mem_a20_recalc();
|
||||
flushmmucache();
|
||||
@@ -1086,7 +1086,7 @@ write_output(atkbd_t *dev, uint8_t val)
|
||||
|
||||
/* 0 holds the CPU in the RESET state, 1 releases it. To simplify this,
|
||||
we just do everything on release. */
|
||||
if ((dev->output_port ^ val) & 0x01) { /*Reset*/
|
||||
if ((old ^ val) & 0x01) { /*Reset*/
|
||||
if (! (val & 0x01)) { /* Pin 0 selected. */
|
||||
/* Pin 0 selected. */
|
||||
kbd_log("write_output(): Pulse reset!\n");
|
||||
|
||||
@@ -111,15 +111,15 @@ postcard_init(const device_t *info)
|
||||
{
|
||||
postcard_reset();
|
||||
|
||||
if (machines[machine].flags & MACHINE_MCA)
|
||||
if (machine_has_bus(machine, MACHINE_BUS_MCA))
|
||||
postcard_port = 0x680; /* MCA machines */
|
||||
else if (strstr(machines[machine].name, " PS/2 ") || strstr(machines[machine].name, " PS/1 "))
|
||||
else if (strstr(machines[machine].name, " PS/2 ") || strstr(machine_getname_ex(machine), " PS/1 "))
|
||||
postcard_port = 0x190; /* ISA PS/2 machines */
|
||||
else if (strstr(machines[machine].name, " IBM XT "))
|
||||
postcard_port = 0x60; /* IBM XT */
|
||||
else if (strstr(machines[machine].name, " IBM PCjr"))
|
||||
postcard_port = 0x10; /* IBM PCjr */
|
||||
else if (strstr(machines[machine].name, " Compaq ") && !(machines[machine].flags & MACHINE_PCI))
|
||||
else if (strstr(machines[machine].name, " Compaq ") && !machine_has_bus(machine, MACHINE_BUS_PCI))
|
||||
postcard_port = 0x84; /* ISA Compaq machines */
|
||||
else
|
||||
postcard_port = 0x80; /* AT and clone machines */
|
||||
|
||||
@@ -360,7 +360,7 @@ gameport_add(const device_t *gameport_type)
|
||||
{
|
||||
/* Prevent a standalone game port from being added later on, unless this
|
||||
is an unused Super I/O game port (no MACHINE_GAMEPORT machine flag). */
|
||||
if (!(gameport_type->local & GAMEPORT_SIO) || (machines[machine].flags & MACHINE_GAMEPORT))
|
||||
if (!(gameport_type->local & GAMEPORT_SIO) || machine_has_flags(machine, MACHINE_GAMEPORT))
|
||||
standalone_gameport_type = NULL;
|
||||
|
||||
/* Add game port device. */
|
||||
|
||||
@@ -145,7 +145,7 @@ extern void device_speed_changed(void);
|
||||
extern void device_force_redraw(void);
|
||||
extern void device_get_name(const device_t *d, int bus, char *name);
|
||||
|
||||
extern int device_is_valid(const device_t *, int machine_flags);
|
||||
extern int device_is_valid(const device_t *, int m);
|
||||
|
||||
extern int device_get_config_int(const char *name);
|
||||
extern int device_get_config_int_ex(const char *s, int dflt_int);
|
||||
|
||||
@@ -189,6 +189,7 @@ extern int AT, PCI;
|
||||
extern int machine_count(void);
|
||||
extern int machine_available(int m);
|
||||
extern char *machine_getname(void);
|
||||
extern char *machine_getname_ex(int m);
|
||||
extern char *machine_get_internal_name(void);
|
||||
extern int machine_get_machine_from_internal_name(char *s);
|
||||
extern void machine_init(void);
|
||||
@@ -197,6 +198,13 @@ extern const device_t *machine_getdevice(int m);
|
||||
#endif
|
||||
extern char *machine_get_internal_name_ex(int m);
|
||||
extern int machine_get_nvrmask(int m);
|
||||
extern int machine_has_flags(int m, int flags);
|
||||
extern int machine_has_bus(int m, int bus_flags);
|
||||
extern int machine_has_cartridge(int m);
|
||||
extern int machine_get_min_ram(int m);
|
||||
extern int machine_get_max_ram(int m);
|
||||
extern int machine_get_ram_granularity(int m);
|
||||
extern int machine_get_type(int m);
|
||||
extern void machine_close(void);
|
||||
|
||||
|
||||
|
||||
@@ -979,6 +979,55 @@ machine_get_nvrmask(int m)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_has_flags(int m, int flags)
|
||||
{
|
||||
return(machines[m].flags & flags);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_has_bus(int m, int bus_flags)
|
||||
{
|
||||
return(machines[m].flags & bus_flags);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_has_cartridge(int m)
|
||||
{
|
||||
return(machine_has_flags(m, MACHINE_CARTRIDGE) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_get_min_ram(int m)
|
||||
{
|
||||
return(machines[m].min_ram);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_get_max_ram(int m)
|
||||
{
|
||||
return(machines[m].max_ram);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_get_ram_granularity(int m)
|
||||
{
|
||||
return(machines[m].ram_granularity);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_get_type(int m)
|
||||
{
|
||||
return(machines[m].type);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_get_machine_from_internal_name(char *s)
|
||||
{
|
||||
|
||||
@@ -406,7 +406,7 @@ spd_write_drbs_interleaved(uint8_t *regs, uint8_t reg_min, uint8_t reg_max, uint
|
||||
{
|
||||
uint8_t row, dimm;
|
||||
uint8_t drb;
|
||||
uint16_t size, size_acc;
|
||||
uint16_t size, size_acc = 0;
|
||||
uint16_t rows[SPD_MAX_SLOTS];
|
||||
|
||||
/* No SPD: split SIMMs into pairs as if they were "DIMM"s. */
|
||||
|
||||
@@ -6,7 +6,13 @@ set(CMAKE_AUTORCC ON)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_library(plat STATIC qt.c qt_main.cpp qt_platform.cpp cpp11_thread.cpp)
|
||||
add_library(plat STATIC
|
||||
qt.c
|
||||
qt_main.cpp
|
||||
qt_platform.cpp
|
||||
sdl_joystick.cpp
|
||||
cpp11_thread.cpp
|
||||
)
|
||||
add_library(ui STATIC
|
||||
qt_ui.cpp
|
||||
qt_cdrom.c
|
||||
@@ -69,6 +75,9 @@ add_library(ui STATIC
|
||||
qt_deviceconfig.cpp
|
||||
qt_deviceconfig.hpp
|
||||
qt_deviceconfig.ui
|
||||
qt_joystickconfiguration.cpp
|
||||
qt_joystickconfiguration.hpp
|
||||
qt_joystickconfiguration.ui
|
||||
|
||||
qt_filefield.cpp
|
||||
qt_filefield.hpp
|
||||
|
||||
183
src/qt/qt_joystickconfiguration.cpp
Normal file
183
src/qt/qt_joystickconfiguration.cpp
Normal file
@@ -0,0 +1,183 @@
|
||||
#include "qt_joystickconfiguration.hpp"
|
||||
#include "ui_qt_joystickconfiguration.h"
|
||||
|
||||
extern "C" {
|
||||
#include <86box/device.h>
|
||||
#include <86box/gameport.h>
|
||||
}
|
||||
|
||||
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include "qt_models_common.hpp"
|
||||
|
||||
JoystickConfiguration::JoystickConfiguration(int type, int joystick_nr, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::JoystickConfiguration),
|
||||
type(type),
|
||||
joystick_nr(joystick_nr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
auto model = ui->comboBoxDevice->model();
|
||||
Models::AddEntry(model, "None", 0);
|
||||
for (int c = 0; c < joysticks_present; c++) {
|
||||
Models::AddEntry(model, plat_joystick_state[c].name, c+1);
|
||||
}
|
||||
|
||||
ui->comboBoxDevice->setCurrentIndex(joystick_state[joystick_nr].plat_joystick_nr);
|
||||
}
|
||||
|
||||
JoystickConfiguration::~JoystickConfiguration()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int JoystickConfiguration::selectedDevice() {
|
||||
return ui->comboBoxDevice->currentIndex();
|
||||
}
|
||||
|
||||
int JoystickConfiguration::selectedAxis(int axis) {
|
||||
auto* cbox = findChild<QComboBox*>(QString("cboxAxis%1").arg(QString::number(axis)));
|
||||
if (cbox == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return cbox->currentIndex();
|
||||
}
|
||||
|
||||
int JoystickConfiguration::selectedButton(int button) {
|
||||
auto* cbox = findChild<QComboBox*>(QString("cboxButton%1").arg(QString::number(button)));
|
||||
if (cbox == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return cbox->currentIndex();
|
||||
}
|
||||
|
||||
int JoystickConfiguration::selectedPov(int pov) {
|
||||
auto* cbox = findChild<QComboBox*>(QString("cboxPov%1").arg(QString::number(pov)));
|
||||
if (cbox == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return cbox->currentIndex();
|
||||
}
|
||||
|
||||
void JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index) {
|
||||
for (auto w : widgets) {
|
||||
ui->ct->removeWidget(w);
|
||||
}
|
||||
|
||||
if (index == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int joystick = index - 1;
|
||||
int row = 0;
|
||||
for (int c = 0; c < joystick_get_axis_count(type); c++) {
|
||||
/*Combo box*/
|
||||
auto label = new QLabel(joystick_get_axis_name(type, c), this);
|
||||
auto cbox = new QComboBox(this);
|
||||
cbox->setObjectName(QString("cboxAxis%1").arg(QString::number(c)));
|
||||
auto model = cbox->model();
|
||||
|
||||
for (int d = 0; d < plat_joystick_state[joystick].nr_axes; d++) {
|
||||
Models::AddEntry(model, plat_joystick_state[joystick].axis[d].name, 0);
|
||||
}
|
||||
|
||||
for (int d = 0; d < plat_joystick_state[joystick].nr_povs; d++) {
|
||||
Models::AddEntry(model, QString("%1 (X axis)").arg(plat_joystick_state[joystick].pov[d].name), 0);
|
||||
Models::AddEntry(model, QString("%1 (Y axis)").arg(plat_joystick_state[joystick].pov[d].name), 0);
|
||||
}
|
||||
|
||||
for (int d = 0; d < plat_joystick_state[joystick].nr_sliders; d++) {
|
||||
Models::AddEntry(model, plat_joystick_state[joystick].slider[d].name, 0);
|
||||
}
|
||||
|
||||
int nr_axes = plat_joystick_state[joystick].nr_axes;
|
||||
int nr_povs = plat_joystick_state[joystick].nr_povs;
|
||||
int mapping = joystick_state[joystick_nr].axis_mapping[c];
|
||||
if (mapping & POV_X)
|
||||
cbox->setCurrentIndex(nr_axes + (mapping & 3) * 2);
|
||||
else if (mapping & POV_Y)
|
||||
cbox->setCurrentIndex(nr_axes + (mapping & 3) * 2 + 1);
|
||||
else if (mapping & SLIDER)
|
||||
cbox->setCurrentIndex(nr_axes + nr_povs * 2 + (mapping & 3));
|
||||
else
|
||||
cbox->setCurrentIndex(mapping);
|
||||
|
||||
ui->ct->addWidget(label, row, 0);
|
||||
ui->ct->addWidget(cbox, row, 1);
|
||||
|
||||
widgets.append(label);
|
||||
widgets.append(cbox);
|
||||
|
||||
++row;
|
||||
}
|
||||
|
||||
for (int c = 0; c < joystick_get_button_count(type); c++) {
|
||||
auto label = new QLabel(joystick_get_button_name(type, c), this);
|
||||
auto cbox = new QComboBox(this);
|
||||
cbox->setObjectName(QString("cboxButton%1").arg(QString::number(c)));
|
||||
auto model = cbox->model();
|
||||
|
||||
for (int d = 0; d < plat_joystick_state[joystick].nr_buttons; d++) {
|
||||
Models::AddEntry(model, plat_joystick_state[joystick].button[d].name, 0);
|
||||
}
|
||||
|
||||
cbox->setCurrentIndex(joystick_state[joystick_nr].button_mapping[c]);
|
||||
|
||||
ui->ct->addWidget(label, row, 0);
|
||||
ui->ct->addWidget(cbox, row, 1);
|
||||
|
||||
widgets.append(label);
|
||||
widgets.append(cbox);
|
||||
|
||||
++row;
|
||||
}
|
||||
|
||||
for (int c = 0; c < joystick_get_pov_count(type) * 2; c++) {
|
||||
QLabel* label;
|
||||
if (c & 1) {
|
||||
label = new QLabel(QString("%1 (Y axis)").arg(joystick_get_pov_name(type, c/2)), this);
|
||||
} else {
|
||||
label = new QLabel(QString("%1 (X axis)").arg(joystick_get_pov_name(type, c/2)), this);
|
||||
}
|
||||
auto cbox = new QComboBox(this);
|
||||
cbox->setObjectName(QString("cboxPov%1").arg(QString::number(c)));
|
||||
auto model = cbox->model();
|
||||
|
||||
for (int d = 0; d < plat_joystick_state[joystick].nr_povs; d++) {
|
||||
Models::AddEntry(model, QString("%1 (X axis)").arg(plat_joystick_state[joystick].pov[d].name), 0);
|
||||
Models::AddEntry(model, QString("%1 (Y axis)").arg(plat_joystick_state[joystick].pov[d].name), 0);
|
||||
}
|
||||
|
||||
for (int d = 0; d < plat_joystick_state[joystick].nr_axes; d++) {
|
||||
Models::AddEntry(model, plat_joystick_state[joystick].axis[d].name, 0);
|
||||
}
|
||||
|
||||
int mapping = joystick_state[joystick_nr].pov_mapping[c][0];
|
||||
int nr_povs = plat_joystick_state[joystick].nr_povs;
|
||||
if (mapping & POV_X)
|
||||
cbox->setCurrentIndex((mapping & 3) * 2);
|
||||
else if (mapping & POV_Y)
|
||||
cbox->setCurrentIndex((mapping & 3)*2 + 1);
|
||||
else
|
||||
cbox->setCurrentIndex(mapping + nr_povs * 2);
|
||||
|
||||
mapping = joystick_state[joystick_nr].pov_mapping[c][1];
|
||||
if (mapping & POV_X)
|
||||
cbox->setCurrentIndex((mapping & 3)*2);
|
||||
else if (mapping & POV_Y)
|
||||
cbox->setCurrentIndex((mapping & 3)*2 + 1);
|
||||
else
|
||||
cbox->setCurrentIndex(mapping + nr_povs*2);
|
||||
|
||||
ui->ct->addWidget(label, row, 0);
|
||||
ui->ct->addWidget(cbox, row, 1);
|
||||
|
||||
widgets.append(label);
|
||||
widgets.append(cbox);
|
||||
|
||||
++row;
|
||||
}
|
||||
}
|
||||
32
src/qt/qt_joystickconfiguration.hpp
Normal file
32
src/qt/qt_joystickconfiguration.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef QT_JOYSTICKCONFIGURATION_HPP
|
||||
#define QT_JOYSTICKCONFIGURATION_HPP
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class JoystickConfiguration;
|
||||
}
|
||||
|
||||
class JoystickConfiguration : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit JoystickConfiguration(int type, int joystick_nr, QWidget *parent = nullptr);
|
||||
~JoystickConfiguration();
|
||||
|
||||
int selectedDevice();
|
||||
int selectedAxis(int axis);
|
||||
int selectedButton(int button);
|
||||
int selectedPov(int pov);
|
||||
private slots:
|
||||
void on_comboBoxDevice_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::JoystickConfiguration *ui;
|
||||
QList<QWidget*> widgets;
|
||||
int type;
|
||||
int joystick_nr;
|
||||
};
|
||||
|
||||
#endif // QT_JOYSTICKCONFIGURATION_HPP
|
||||
87
src/qt/qt_joystickconfiguration.ui
Normal file
87
src/qt/qt_joystickconfiguration.ui
Normal file
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>JoystickConfiguration</class>
|
||||
<widget class="QDialog" name="JoystickConfiguration">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="ct"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxDevice"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>JoystickConfiguration</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>223</x>
|
||||
<y>278</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>199</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>JoystickConfiguration</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>223</x>
|
||||
<y>278</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>199</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -28,9 +28,16 @@ extern uint64_t tsc;
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QStatusBar>
|
||||
#include <QMenu>
|
||||
|
||||
#include "qt_mediamenu.hpp"
|
||||
#include "qt_mainwindow.hpp"
|
||||
#include "qt_soundgain.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
extern MainWindow* main_window;
|
||||
|
||||
namespace {
|
||||
struct PixmapSetActive {
|
||||
QPixmap normal;
|
||||
@@ -195,7 +202,7 @@ struct MachineStatus::States {
|
||||
std::array<StateEmptyActive, MO_NUM> mo;
|
||||
std::array<StateActive, HDD_BUS_USB> hdds;
|
||||
StateActive net;
|
||||
std::unique_ptr<QLabel> sound;
|
||||
std::unique_ptr<ClickableLabel> sound;
|
||||
std::unique_ptr<QLabel> text;
|
||||
};
|
||||
|
||||
@@ -211,16 +218,12 @@ bool MachineStatus::hasCassette() {
|
||||
return cassette_enable > 0 ? true : false;
|
||||
}
|
||||
|
||||
bool MachineStatus::hasCartridge() {
|
||||
return machines[machine].flags & MACHINE_CARTRIDGE;
|
||||
}
|
||||
|
||||
bool MachineStatus::hasIDE() {
|
||||
return machines[machine].flags & MACHINE_IDE_QUAD;
|
||||
return machine_has_flags(machine, MACHINE_IDE_QUAD) > 0;
|
||||
}
|
||||
|
||||
bool MachineStatus::hasSCSI() {
|
||||
return machines[machine].flags & MACHINE_SCSI_DUAL;
|
||||
return machine_has_flags(machine, MACHINE_SCSI_DUAL) > 0;
|
||||
}
|
||||
|
||||
void MachineStatus::iterateFDD(const std::function<void (int)> &cb) {
|
||||
@@ -296,9 +299,9 @@ static int hdd_count(int bus) {
|
||||
}
|
||||
|
||||
void MachineStatus::refresh(QStatusBar* sbar) {
|
||||
bool has_mfm = machines[machine].flags & MACHINE_MFM;
|
||||
bool has_xta = machines[machine].flags & MACHINE_XTA;
|
||||
bool has_esdi = machines[machine].flags & MACHINE_ESDI;
|
||||
bool has_mfm = machine_has_flags(machine, MACHINE_MFM) > 0;
|
||||
bool has_xta = machine_has_flags(machine, MACHINE_XTA) > 0;
|
||||
bool has_esdi = machine_has_flags(machine, MACHINE_ESDI) > 0;
|
||||
|
||||
int c_mfm = hdd_count(HDD_BUS_MFM);
|
||||
int c_esdi = hdd_count(HDD_BUS_ESDI);
|
||||
@@ -330,15 +333,23 @@ void MachineStatus::refresh(QStatusBar* sbar) {
|
||||
sbar->removeWidget(d->sound.get());
|
||||
|
||||
if (cassette_enable) {
|
||||
d->cassette.label = std::make_unique<QLabel>();
|
||||
d->cassette.label = std::make_unique<ClickableLabel>();
|
||||
d->cassette.setEmpty(QString(cassette_fname).isEmpty());
|
||||
connect((ClickableLabel*)d->cassette.label.get(), &ClickableLabel::clicked, [this](QPoint pos) {
|
||||
MediaMenu::ptr->cassetteMenu->popup(pos);
|
||||
});
|
||||
d->cassette.label->setToolTip(MediaMenu::ptr->cassetteMenu->title());
|
||||
sbar->addWidget(d->cassette.label.get());
|
||||
}
|
||||
|
||||
if (hasCartridge()) {
|
||||
if (machine_has_cartridge(machine)) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
d->cartridge[i].label = std::make_unique<QLabel>();
|
||||
d->cartridge[i].setEmpty(QString(cart_fns[i]).isEmpty());
|
||||
connect((ClickableLabel*)d->cartridge[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) {
|
||||
MediaMenu::ptr->cartridgeMenus[i]->popup(pos);
|
||||
});
|
||||
d->cartridge[i].label->setToolTip(MediaMenu::ptr->cartridgeMenus[i]->title());
|
||||
sbar->addWidget(d->cartridge[i].label.get());
|
||||
}
|
||||
}
|
||||
@@ -352,68 +363,96 @@ void MachineStatus::refresh(QStatusBar* sbar) {
|
||||
} else {
|
||||
d->fdd[i].pixmaps = &d->pixmaps.floppy_35;
|
||||
}
|
||||
d->fdd[i].label = std::make_unique<QLabel>();
|
||||
d->fdd[i].label = std::make_unique<ClickableLabel>();
|
||||
d->fdd[i].setEmpty(QString(floppyfns[i]).isEmpty());
|
||||
d->fdd[i].setActive(false);
|
||||
connect((ClickableLabel*)d->fdd[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) {
|
||||
MediaMenu::ptr->floppyMenus[i]->popup(pos);
|
||||
});
|
||||
d->fdd[i].label->setToolTip(MediaMenu::ptr->floppyMenus[i]->title());
|
||||
sbar->addWidget(d->fdd[i].label.get());
|
||||
});
|
||||
|
||||
iterateCDROM([this, sbar](int i) {
|
||||
d->cdrom[i].label = std::make_unique<QLabel>();
|
||||
d->cdrom[i].label = std::make_unique<ClickableLabel>();
|
||||
d->cdrom[i].setEmpty(cdrom[i].host_drive != 200 || QString(cdrom[i].image_path).isEmpty());
|
||||
d->cdrom[i].setActive(false);
|
||||
connect((ClickableLabel*)d->cdrom[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) {
|
||||
MediaMenu::ptr->cdromMenus[i]->popup(pos);
|
||||
});
|
||||
d->cdrom[i].label->setToolTip(MediaMenu::ptr->cdromMenus[i]->title());
|
||||
sbar->addWidget(d->cdrom[i].label.get());
|
||||
});
|
||||
|
||||
iterateZIP([this, sbar](int i) {
|
||||
d->zip[i].label = std::make_unique<QLabel>();
|
||||
d->zip[i].label = std::make_unique<ClickableLabel>();
|
||||
d->zip[i].setEmpty(QString(zip_drives[i].image_path).isEmpty());
|
||||
d->zip[i].setActive(false);
|
||||
connect((ClickableLabel*)d->zip[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) {
|
||||
MediaMenu::ptr->zipMenus[i]->popup(pos);
|
||||
});
|
||||
d->zip[i].label->setToolTip(MediaMenu::ptr->zipMenus[i]->title());
|
||||
sbar->addWidget(d->zip[i].label.get());
|
||||
});
|
||||
|
||||
iterateMO([this, sbar](int i) {
|
||||
d->mo[i].label = std::make_unique<QLabel>();
|
||||
d->mo[i].label = std::make_unique<ClickableLabel>();
|
||||
d->mo[i].setEmpty(QString(mo_drives[i].image_path).isEmpty());
|
||||
d->mo[i].setActive(false);
|
||||
connect((ClickableLabel*)d->mo[i].label.get(), &ClickableLabel::clicked, [this, i](QPoint pos) {
|
||||
MediaMenu::ptr->moMenus[i]->popup(pos);
|
||||
});
|
||||
d->mo[i].label->setToolTip(MediaMenu::ptr->moMenus[i]->title());
|
||||
sbar->addWidget(d->mo[i].label.get());
|
||||
});
|
||||
|
||||
auto hdc_name = QString(hdc_get_internal_name(hdc_current));
|
||||
if ((has_mfm || hdc_name == QStringLiteral("st506")) && c_mfm > 0) {
|
||||
if ((has_mfm || hdc_name.left(5) == QStringLiteral("st506")) && c_mfm > 0) {
|
||||
d->hdds[HDD_BUS_MFM].label = std::make_unique<QLabel>();
|
||||
d->hdds[HDD_BUS_MFM].setActive(false);
|
||||
d->hdds[HDD_BUS_MFM].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("MFM/RLL"));
|
||||
sbar->addWidget(d->hdds[HDD_BUS_MFM].label.get());
|
||||
}
|
||||
if ((has_esdi || hdc_name == QStringLiteral("esdi")) && c_esdi > 0) {
|
||||
if ((has_esdi || hdc_name.left(4) == QStringLiteral("esdi")) && c_esdi > 0) {
|
||||
d->hdds[HDD_BUS_ESDI].label = std::make_unique<QLabel>();
|
||||
d->hdds[HDD_BUS_ESDI].setActive(false);
|
||||
d->hdds[HDD_BUS_ESDI].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("ESDI"));
|
||||
sbar->addWidget(d->hdds[HDD_BUS_ESDI].label.get());
|
||||
}
|
||||
if ((has_xta || hdc_name == QStringLiteral("xta")) && c_xta > 0) {
|
||||
if ((has_xta || hdc_name.left(3) == QStringLiteral("xta")) && c_xta > 0) {
|
||||
d->hdds[HDD_BUS_XTA].label = std::make_unique<QLabel>();
|
||||
d->hdds[HDD_BUS_XTA].setActive(false);
|
||||
d->hdds[HDD_BUS_XTA].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("XTA"));
|
||||
sbar->addWidget(d->hdds[HDD_BUS_XTA].label.get());
|
||||
}
|
||||
if ((hasIDE() || hdc_name == QStringLiteral("xtide") || hdc_name == QStringLiteral("ide")) && c_ide > 0) {
|
||||
if ((hasIDE() || hdc_name.left(5) == QStringLiteral("xtide") || hdc_name.left(3) == QStringLiteral("ide")) && c_ide > 0) {
|
||||
d->hdds[HDD_BUS_IDE].label = std::make_unique<QLabel>();
|
||||
d->hdds[HDD_BUS_IDE].setActive(false);
|
||||
d->hdds[HDD_BUS_IDE].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("IDE"));
|
||||
sbar->addWidget(d->hdds[HDD_BUS_IDE].label.get());
|
||||
}
|
||||
if ((hasSCSI() || (scsi_card_current[0] != 0) || (scsi_card_current[1] != 0) ||
|
||||
(scsi_card_current[2] != 0) || (scsi_card_current[3] != 0)) && c_scsi > 0) {
|
||||
d->hdds[HDD_BUS_SCSI].label = std::make_unique<QLabel>();
|
||||
d->hdds[HDD_BUS_SCSI].setActive(false);
|
||||
d->hdds[HDD_BUS_SCSI].label->setToolTip(QStringLiteral("Hard Disk (%1)").arg("SCSI"));
|
||||
sbar->addWidget(d->hdds[HDD_BUS_SCSI].label.get());
|
||||
}
|
||||
|
||||
if (do_net) {
|
||||
d->net.label = std::make_unique<QLabel>();
|
||||
d->net.setActive(false);
|
||||
d->net.label->setToolTip("Network");
|
||||
sbar->addWidget(d->net.label.get());
|
||||
}
|
||||
d->sound = std::make_unique<QLabel>();
|
||||
d->sound = std::make_unique<ClickableLabel>();
|
||||
d->sound->setPixmap(d->pixmaps.sound);
|
||||
|
||||
connect(d->sound.get(), &ClickableLabel::doubleClicked, d->sound.get(), [this](QPoint pos) {
|
||||
SoundGain gain(main_window);
|
||||
gain.exec();
|
||||
});
|
||||
d->sound->setToolTip("Sound");
|
||||
sbar->addWidget(d->sound.get());
|
||||
d->text = std::make_unique<QLabel>();
|
||||
sbar->addWidget(d->text.get());
|
||||
@@ -489,3 +528,36 @@ void MachineStatus::message(const QString &msg) {
|
||||
d->text->setText(msg);
|
||||
}
|
||||
|
||||
void MachineStatus::updateTip(int tag)
|
||||
{
|
||||
int category = tag & 0xfffffff0;
|
||||
int item = tag & 0xf;
|
||||
switch (category) {
|
||||
case SB_CASSETTE:
|
||||
d->cassette.label->setToolTip(MediaMenu::ptr->cassetteMenu->title());
|
||||
break;
|
||||
case SB_CARTRIDGE:
|
||||
d->cartridge[item].label->setToolTip(MediaMenu::ptr->cartridgeMenus[item]->title());
|
||||
break;
|
||||
case SB_FLOPPY:
|
||||
d->fdd[item].label->setToolTip(MediaMenu::ptr->floppyMenus[item]->title());
|
||||
break;
|
||||
case SB_CDROM:
|
||||
d->cdrom[item].label->setToolTip(MediaMenu::ptr->cdromMenus[item]->title());
|
||||
break;
|
||||
case SB_ZIP:
|
||||
d->zip[item].label->setToolTip(MediaMenu::ptr->zipMenus[item]->title());
|
||||
break;
|
||||
case SB_MO:
|
||||
d->mo[item].label->setToolTip(MediaMenu::ptr->moMenus[item]->title());
|
||||
break;
|
||||
case SB_HDD:
|
||||
break;
|
||||
case SB_NETWORK:
|
||||
break;
|
||||
case SB_SOUND:
|
||||
break;
|
||||
case SB_TEXT:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,27 @@
|
||||
#define QT_MACHINESTATUS_HPP
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QMouseEvent>
|
||||
|
||||
class QStatusBar;
|
||||
|
||||
class ClickableLabel : public QLabel {
|
||||
Q_OBJECT;
|
||||
public:
|
||||
explicit ClickableLabel(QWidget* parent = nullptr)
|
||||
: QLabel(parent) {}
|
||||
~ClickableLabel() {};
|
||||
|
||||
signals:
|
||||
void clicked(QPoint);
|
||||
void doubleClicked(QPoint);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event) override { emit clicked(event->globalPos()); }
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) override { emit doubleClicked(event->globalPos()); }
|
||||
};
|
||||
|
||||
class MachineStatus : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -14,7 +32,6 @@ public:
|
||||
~MachineStatus();
|
||||
|
||||
static bool hasCassette();
|
||||
static bool hasCartridge();
|
||||
static bool hasIDE();
|
||||
static bool hasSCSI();
|
||||
static void iterateFDD(const std::function<void(int i)>& cb);
|
||||
@@ -26,6 +43,7 @@ public slots:
|
||||
void setActivity(int tag, bool active);
|
||||
void setEmpty(int tag, bool active);
|
||||
void message(const QString& msg);
|
||||
void updateTip(int tag);
|
||||
|
||||
private:
|
||||
struct States;
|
||||
|
||||
@@ -49,9 +49,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
Q_INIT_RESOURCE(qt_resources);
|
||||
status = std::make_unique<MachineStatus>(this);
|
||||
mm = std::make_shared<MediaMenu>(this);
|
||||
MediaMenu::ptr = mm;
|
||||
status = std::make_unique<MachineStatus>(this);
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->stackedWidget->setMouseTracking(true);
|
||||
@@ -63,7 +63,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection);
|
||||
|
||||
connect(this, &MainWindow::setTitleForNonQtThread, this, &MainWindow::setTitle_, Qt::BlockingQueuedConnection);
|
||||
connect(this, &MainWindow::setTitle, this, [this](const QString& title) {
|
||||
setWindowTitle(title);
|
||||
});
|
||||
connect(this, &MainWindow::getTitleForNonQtThread, this, &MainWindow::getTitle_, Qt::BlockingQueuedConnection);
|
||||
|
||||
connect(this, &MainWindow::updateMenuResizeOptions, [this]() {
|
||||
@@ -118,9 +120,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
});
|
||||
|
||||
connect(this, &MainWindow::updateStatusBarPanes, this, [this] {
|
||||
status->refresh(ui->statusbar);
|
||||
refreshMediaMenu();
|
||||
});
|
||||
connect(this, &MainWindow::updateStatusBarPanes, this, &MainWindow::refreshMediaMenu);
|
||||
connect(this, &MainWindow::updateStatusBarTip, status.get(), &MachineStatus::updateTip);
|
||||
connect(this, &MainWindow::updateStatusBarActivity, status.get(), &MachineStatus::setActivity);
|
||||
connect(this, &MainWindow::updateStatusBarEmpty, status.get(), &MachineStatus::setEmpty);
|
||||
connect(this, &MainWindow::statusBarMessage, status.get(), &MachineStatus::message);
|
||||
@@ -879,20 +882,6 @@ void MainWindow::on_actionFullscreen_triggered() {
|
||||
rc->onResize(widget->width(), widget->height());
|
||||
}
|
||||
|
||||
void MainWindow::setTitle_(const wchar_t *title)
|
||||
{
|
||||
this->setWindowTitle(QString::fromWCharArray(title));
|
||||
}
|
||||
|
||||
void MainWindow::setTitle(const wchar_t *title)
|
||||
{
|
||||
if (QThread::currentThread() == this->thread()) {
|
||||
setTitle_(title);
|
||||
} else {
|
||||
emit setTitleForNonQtThread(title);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::getTitle_(wchar_t *title)
|
||||
{
|
||||
this->windowTitle().toWCharArray(title);
|
||||
@@ -927,6 +916,7 @@ bool MainWindow::eventFilter(QObject* receiver, QEvent* event)
|
||||
|
||||
void MainWindow::refreshMediaMenu() {
|
||||
mm->refresh(ui->menuMedia);
|
||||
status->refresh(ui->statusbar);
|
||||
}
|
||||
|
||||
void MainWindow::showMessage(const QString& header, const QString& message) {
|
||||
|
||||
@@ -25,7 +25,6 @@ public:
|
||||
~MainWindow();
|
||||
|
||||
void showMessage(const QString& header, const QString& message);
|
||||
void setTitle(const wchar_t* title);
|
||||
void getTitle(wchar_t* title);
|
||||
void blitToWidget(int x, int y, int w, int h);
|
||||
QSize getRenderWidgetSize();
|
||||
@@ -38,14 +37,15 @@ signals:
|
||||
void updateStatusBarPanes();
|
||||
void updateStatusBarActivity(int tag, bool active);
|
||||
void updateStatusBarEmpty(int tag, bool empty);
|
||||
void updateStatusBarTip(int tag);
|
||||
void updateMenuResizeOptions();
|
||||
void updateWindowRememberOption();
|
||||
|
||||
void setTitle(const QString& title);
|
||||
void setFullscreen(bool state);
|
||||
void setMouseCapture(bool state);
|
||||
|
||||
void showMessageForNonQtThread(const QString& header, const QString& message);
|
||||
void setTitleForNonQtThread(const wchar_t* title);
|
||||
void getTitleForNonQtThread(wchar_t* title);
|
||||
private slots:
|
||||
void on_actionFullscreen_triggered();
|
||||
@@ -94,7 +94,6 @@ private slots:
|
||||
|
||||
void refreshMediaMenu();
|
||||
void showMessage_(const QString& header, const QString& message);
|
||||
void setTitle_(const wchar_t* title);
|
||||
void getTitle_(wchar_t* title);
|
||||
void on_actionTake_screenshot_triggered();
|
||||
|
||||
|
||||
@@ -56,14 +56,14 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
||||
}
|
||||
|
||||
cartridgeMenus.clear();
|
||||
if (MachineStatus::hasCartridge()) {
|
||||
if (machine_has_cartridge(machine)) {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
auto* menu = parentMenu->addMenu("");
|
||||
menu->addAction("Image", [this, i]() { cartridgeSelectImage(i); });
|
||||
menu->addSeparator();
|
||||
cartridgeEjectPos = menu->children().count();
|
||||
menu->addAction("Eject", [this, i]() { cartridgeEject(i); });
|
||||
cartridgeMenus.append(menu);
|
||||
cartridgeMenus[i] = menu;
|
||||
cartridgeUpdateMenu(i);
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
||||
menu->addSeparator();
|
||||
floppyEjectPos = menu->children().count();
|
||||
menu->addAction("Eject", [this, i]() { floppyEject(i); });
|
||||
floppyMenus.append(menu);
|
||||
floppyMenus[i] = menu;
|
||||
floppyUpdateMenu(i);
|
||||
});
|
||||
|
||||
@@ -98,7 +98,7 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
||||
menu->addSeparator();
|
||||
cdromImagePos = menu->children().count();
|
||||
menu->addAction("Image", [this, i]() { cdromMount(i); })->setCheckable(true);
|
||||
cdromMenus.append(menu);
|
||||
cdromMenus[i] = menu;
|
||||
cdromUpdateMenu(i);
|
||||
});
|
||||
|
||||
@@ -114,7 +114,7 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
||||
menu->addAction("Eject", [this, i]() { zipEject(i); });
|
||||
zipReloadPos = menu->children().count();
|
||||
menu->addAction("Reload previous image", [this, i]() { zipReload(i); });
|
||||
zipMenus.append(menu);
|
||||
zipMenus[i] = menu;
|
||||
zipUpdateMenu(i);
|
||||
});
|
||||
|
||||
@@ -130,7 +130,7 @@ void MediaMenu::refresh(QMenu *parentMenu) {
|
||||
menu->addAction("Eject", [this, i]() { moEject(i); });
|
||||
moReloadPos = menu->children().count();
|
||||
menu->addAction("Reload previous image", [this, i]() { moReload(i); });
|
||||
moMenus.append(menu);
|
||||
moMenus[i] = menu;
|
||||
moUpdateMenu(i);
|
||||
});
|
||||
}
|
||||
@@ -161,8 +161,8 @@ void MediaMenu::cassetteMount(const QString& filename, bool wp) {
|
||||
}
|
||||
|
||||
ui_sb_update_icon_state(SB_CASSETTE, filename.isEmpty() ? 1 : 0);
|
||||
ui_sb_update_tip(SB_CASSETTE);
|
||||
cassetteUpdateMenu();
|
||||
ui_sb_update_tip(SB_CASSETTE);
|
||||
config_save();
|
||||
}
|
||||
|
||||
@@ -170,8 +170,8 @@ void MediaMenu::cassetteEject() {
|
||||
pc_cas_set_fname(cassette, nullptr);
|
||||
memset(cassette_fname, 0, sizeof(cassette_fname));
|
||||
ui_sb_update_icon_state(SB_CASSETTE, 1);
|
||||
ui_sb_update_tip(SB_CASSETTE);
|
||||
cassetteUpdateMenu();
|
||||
ui_sb_update_tip(SB_CASSETTE);
|
||||
config_save();
|
||||
}
|
||||
|
||||
@@ -208,16 +208,16 @@ void MediaMenu::cartridgeSelectImage(int i) {
|
||||
cart_load(i, filenameBytes.data());
|
||||
|
||||
ui_sb_update_icon_state(SB_CARTRIDGE | i, filename.isEmpty() ? 1 : 0);
|
||||
ui_sb_update_tip(SB_CARTRIDGE | i);
|
||||
cartridgeUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_CARTRIDGE | i);
|
||||
config_save();
|
||||
}
|
||||
|
||||
void MediaMenu::cartridgeEject(int i) {
|
||||
cart_close(i);
|
||||
ui_sb_update_icon_state(SB_CARTRIDGE | i, 1);
|
||||
ui_sb_update_tip(SB_CARTRIDGE | i);
|
||||
cartridgeUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_CARTRIDGE | i);
|
||||
config_save();
|
||||
}
|
||||
|
||||
@@ -253,16 +253,16 @@ void MediaMenu::floppyMount(int i, const QString &filename, bool wp) {
|
||||
fdd_load(i, filenameBytes.data());
|
||||
}
|
||||
ui_sb_update_icon_state(SB_FLOPPY | i, filename.isEmpty() ? 1 : 0);
|
||||
ui_sb_update_tip(SB_FLOPPY | i);
|
||||
floppyUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_FLOPPY | i);
|
||||
config_save();
|
||||
}
|
||||
|
||||
void MediaMenu::floppyEject(int i) {
|
||||
fdd_close(i);
|
||||
ui_sb_update_icon_state(SB_FLOPPY | i, 1);
|
||||
ui_sb_update_tip(SB_FLOPPY | i);
|
||||
floppyUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_FLOPPY | i);
|
||||
config_save();
|
||||
}
|
||||
|
||||
@@ -329,19 +329,21 @@ void MediaMenu::cdromMount(int i) {
|
||||
} else {
|
||||
ui_sb_update_icon_state(SB_CDROM | i, 1);
|
||||
}
|
||||
ui_sb_update_tip(SB_CDROM | i);
|
||||
cdromUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_CDROM | i);
|
||||
config_save();
|
||||
}
|
||||
|
||||
void MediaMenu::cdromEject(int i) {
|
||||
cdrom_eject(i);
|
||||
cdromUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_CDROM | i);
|
||||
}
|
||||
|
||||
void MediaMenu::cdromReload(int i) {
|
||||
cdrom_reload(i);
|
||||
cdromUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_CDROM | i);
|
||||
}
|
||||
|
||||
void MediaMenu::cdromUpdateMenu(int i) {
|
||||
@@ -400,8 +402,8 @@ void MediaMenu::zipMount(int i, const QString &filename, bool wp) {
|
||||
}
|
||||
|
||||
ui_sb_update_icon_state(SB_ZIP | i, filename.isEmpty() ? 1 : 0);
|
||||
ui_sb_update_tip(SB_ZIP | i);
|
||||
zipUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_ZIP | i);
|
||||
|
||||
config_save();
|
||||
}
|
||||
@@ -416,8 +418,8 @@ void MediaMenu::zipEject(int i) {
|
||||
}
|
||||
|
||||
ui_sb_update_icon_state(SB_ZIP | i, 1);
|
||||
ui_sb_update_tip(SB_ZIP | i);
|
||||
zipUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_ZIP | i);
|
||||
config_save();
|
||||
}
|
||||
|
||||
@@ -431,8 +433,8 @@ void MediaMenu::zipReload(int i) {
|
||||
ui_sb_update_icon_state(SB_ZIP|i, 0);
|
||||
}
|
||||
|
||||
ui_sb_update_tip(SB_ZIP|i);
|
||||
zipUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_ZIP|i);
|
||||
|
||||
config_save();
|
||||
}
|
||||
@@ -488,8 +490,8 @@ void MediaMenu::moMount(int i, const QString &filename, bool wp) {
|
||||
}
|
||||
|
||||
ui_sb_update_icon_state(SB_MO | i, filename.isEmpty() ? 1 : 0);
|
||||
ui_sb_update_tip(SB_MO | i);
|
||||
moUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_MO | i);
|
||||
|
||||
config_save();
|
||||
}
|
||||
@@ -504,8 +506,8 @@ void MediaMenu::moEject(int i) {
|
||||
}
|
||||
|
||||
ui_sb_update_icon_state(SB_MO | i, 1);
|
||||
ui_sb_update_tip(SB_MO | i);
|
||||
moUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_MO | i);
|
||||
config_save();
|
||||
}
|
||||
|
||||
@@ -519,8 +521,8 @@ void MediaMenu::moReload(int i) {
|
||||
ui_sb_update_icon_state(SB_MO|i, 0);
|
||||
}
|
||||
|
||||
ui_sb_update_tip(SB_MO|i);
|
||||
moUpdateMenu(i);
|
||||
ui_sb_update_tip(SB_MO|i);
|
||||
|
||||
config_save();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
|
||||
class QMenu;
|
||||
|
||||
@@ -57,11 +58,11 @@ private:
|
||||
QWidget* parentWidget = nullptr;
|
||||
|
||||
QMenu* cassetteMenu = nullptr;
|
||||
QList<QMenu*> cartridgeMenus;
|
||||
QList<QMenu*> floppyMenus;
|
||||
QList<QMenu*> cdromMenus;
|
||||
QList<QMenu*> zipMenus;
|
||||
QList<QMenu*> moMenus;
|
||||
QMap<int, QMenu*> cartridgeMenus;
|
||||
QMap<int, QMenu*> floppyMenus;
|
||||
QMap<int, QMenu*> cdromMenus;
|
||||
QMap<int, QMenu*> zipMenus;
|
||||
QMap<int, QMenu*> moMenus;
|
||||
|
||||
int cassetteRecordPos;
|
||||
int cassettePlayPos;
|
||||
@@ -84,4 +85,6 @@ private:
|
||||
|
||||
int moEjectPos;
|
||||
int moReloadPos;
|
||||
|
||||
friend class MachineStatus;
|
||||
};
|
||||
|
||||
@@ -70,9 +70,6 @@ int kbd_req_capture = 0;
|
||||
int hide_status_bar = 0;
|
||||
uint32_t lang_id = 0x0409, lang_sys = 0x0409; // Multilangual UI variables, for now all set to LCID of en-US
|
||||
|
||||
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||
joystick_t joystick_state[MAX_JOYSTICKS];
|
||||
|
||||
int stricmp(const char* s1, const char* s2)
|
||||
{
|
||||
return QByteArray(s1).compare(s2, Qt::CaseInsensitive);
|
||||
@@ -406,9 +403,6 @@ void dynld_close(void *handle)
|
||||
delete reinterpret_cast<QLibrary*>(handle);
|
||||
}
|
||||
|
||||
void joystick_init(void) {}
|
||||
void joystick_close(void) {}
|
||||
void joystick_process(void) {}
|
||||
void startblit()
|
||||
{
|
||||
blitmx_contention++;
|
||||
|
||||
@@ -36,7 +36,6 @@ void SettingsDisplay::onCurrentMachineChanged(int machineId) {
|
||||
// win_settings_video_proc, WM_INITDIALOG
|
||||
this->machineId = machineId;
|
||||
|
||||
auto* machine = &machines[machineId];
|
||||
auto* model = ui->comboBoxVideo->model();
|
||||
auto removeRows = model->rowCount();
|
||||
|
||||
@@ -44,7 +43,7 @@ void SettingsDisplay::onCurrentMachineChanged(int machineId) {
|
||||
int selectedRow = 0;
|
||||
while (true) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
if ((c == 1) && !(machine->flags & MACHINE_VIDEO)) {
|
||||
if ((c == 1) && (machine_has_flags(machineId, MACHINE_VIDEO) == 0)) {
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
@@ -56,7 +55,7 @@ void SettingsDisplay::onCurrentMachineChanged(int machineId) {
|
||||
}
|
||||
|
||||
if (video_card_available(c) &&
|
||||
device_is_valid(video_dev, machine->flags)) {
|
||||
device_is_valid(video_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == gfxcard) {
|
||||
selectedRow = row - removeRows;
|
||||
@@ -67,7 +66,7 @@ void SettingsDisplay::onCurrentMachineChanged(int machineId) {
|
||||
}
|
||||
model->removeRows(0, removeRows);
|
||||
|
||||
if (machine->flags & MACHINE_VIDEO_ONLY) {
|
||||
if (machine_has_flags(machineId, MACHINE_VIDEO_ONLY) > 0) {
|
||||
ui->comboBoxVideo->setEnabled(false);
|
||||
selectedRow = 1;
|
||||
} else {
|
||||
@@ -92,7 +91,7 @@ void SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index) {
|
||||
int videoCard = ui->comboBoxVideo->currentData().toInt();
|
||||
ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard) > 0);
|
||||
|
||||
bool machineHasPci = machines[machineId].flags & MACHINE_BUS_PCI;
|
||||
bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0;
|
||||
ui->checkBoxVoodoo->setEnabled(machineHasPci);
|
||||
if (machineHasPci) {
|
||||
ui->checkBoxVoodoo->setChecked(voodoo_enabled);
|
||||
|
||||
@@ -11,7 +11,9 @@ extern "C" {
|
||||
#include <86box/gameport.h>
|
||||
}
|
||||
|
||||
#include "qt_models_common.hpp"
|
||||
#include "qt_deviceconfig.hpp"
|
||||
#include "qt_joystickconfiguration.hpp"
|
||||
|
||||
SettingsInput::SettingsInput(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -43,11 +45,11 @@ void SettingsInput::onCurrentMachineChanged(int machineId) {
|
||||
int selectedRow = 0;
|
||||
for (int i = 0; i < mouse_get_ndev(); ++i) {
|
||||
const auto* dev = mouse_get_device(i);
|
||||
if ((i == MOUSE_TYPE_INTERNAL) && !(machines[machineId].flags & MACHINE_MOUSE)) {
|
||||
if ((i == MOUSE_TYPE_INTERNAL) && (machine_has_flags(machineId, MACHINE_MOUSE) == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_is_valid(dev, machine->flags) == 0) {
|
||||
if (device_is_valid(dev, machineId) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -73,13 +75,7 @@ void SettingsInput::onCurrentMachineChanged(int machineId) {
|
||||
removeRows = joystickModel->rowCount();
|
||||
selectedRow = 0;
|
||||
while (joyName) {
|
||||
int row = joystickModel->rowCount();
|
||||
joystickModel->insertRow(row);
|
||||
auto idx = joystickModel->index(row, 0);
|
||||
|
||||
joystickModel->setData(idx, joyName, Qt::DisplayRole);
|
||||
joystickModel->setData(idx, i, Qt::UserRole);
|
||||
|
||||
int row = Models::AddEntry(joystickModel, joyName, i);
|
||||
if (i == joystick_type) {
|
||||
selectedRow = row - removeRows;
|
||||
}
|
||||
@@ -112,3 +108,80 @@ void SettingsInput::on_pushButtonConfigureMouse_clicked() {
|
||||
int mouseId = ui->comboBoxMouse->currentData().toInt();
|
||||
DeviceConfig::ConfigureDevice(mouse_get_device(mouseId));
|
||||
}
|
||||
|
||||
static int get_axis(JoystickConfiguration& jc, int axis, int joystick_nr) {
|
||||
int axis_sel = jc.selectedAxis(axis);
|
||||
int nr_axes = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_axes;
|
||||
int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_povs;
|
||||
|
||||
if (axis_sel < nr_axes) {
|
||||
return axis_sel;
|
||||
}
|
||||
|
||||
axis_sel -= nr_axes;
|
||||
if (axis_sel < nr_povs * 2) {
|
||||
if (axis_sel & 1)
|
||||
return POV_Y | (axis_sel >> 1);
|
||||
else
|
||||
return POV_X | (axis_sel >> 1);
|
||||
}
|
||||
axis_sel -= nr_povs;
|
||||
|
||||
return SLIDER | (axis_sel >> 1);
|
||||
}
|
||||
|
||||
static int get_pov(JoystickConfiguration& jc, int pov, int joystick_nr) {
|
||||
int pov_sel = jc.selectedPov(pov);
|
||||
int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr-1].nr_povs*2;
|
||||
|
||||
if (pov_sel < nr_povs)
|
||||
{
|
||||
if (pov_sel & 1)
|
||||
return POV_Y | (pov_sel >> 1);
|
||||
else
|
||||
return POV_X | (pov_sel >> 1);
|
||||
}
|
||||
|
||||
return pov_sel - nr_povs;
|
||||
}
|
||||
|
||||
static void updateJoystickConfig(int type, int joystick_nr, QWidget* parent) {
|
||||
JoystickConfiguration jc(type, joystick_nr, parent);
|
||||
switch (jc.exec()) {
|
||||
case QDialog::Rejected:
|
||||
return;
|
||||
case QDialog::Accepted:
|
||||
break;
|
||||
}
|
||||
|
||||
joystick_state[joystick_nr].plat_joystick_nr = jc.selectedDevice();
|
||||
if (joystick_state[joystick_nr].plat_joystick_nr) {
|
||||
for (int c = 0; c < joystick_get_axis_count(type); c++) {
|
||||
joystick_state[joystick_nr].axis_mapping[c] = get_axis(jc, c, joystick_nr);
|
||||
}
|
||||
for (int c = 0; c < joystick_get_button_count(type); c++) {
|
||||
joystick_state[joystick_nr].button_mapping[c] = jc.selectedButton(c);
|
||||
}
|
||||
for (int c = 0; c < joystick_get_button_count(type); c++) {
|
||||
joystick_state[joystick_nr].pov_mapping[c][0] = get_pov(jc, c, joystick_nr);
|
||||
joystick_state[joystick_nr].pov_mapping[c][1] = get_pov(jc, c, joystick_nr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsInput::on_pushButtonJoystick1_clicked() {
|
||||
updateJoystickConfig(ui->comboBoxJoystick->currentData().toInt(), 0, this);
|
||||
}
|
||||
|
||||
void SettingsInput::on_pushButtonJoystick2_clicked() {
|
||||
updateJoystickConfig(ui->comboBoxJoystick->currentData().toInt(), 1, this);
|
||||
}
|
||||
|
||||
void SettingsInput::on_pushButtonJoystick3_clicked() {
|
||||
updateJoystickConfig(ui->comboBoxJoystick->currentData().toInt(), 2, this);
|
||||
}
|
||||
|
||||
void SettingsInput::on_pushButtonJoystick4_clicked() {
|
||||
updateJoystickConfig(ui->comboBoxJoystick->currentData().toInt(), 3, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@ private slots:
|
||||
void on_pushButtonConfigureMouse_clicked();
|
||||
void on_comboBoxJoystick_currentIndexChanged(int index);
|
||||
void on_comboBoxMouse_currentIndexChanged(int index);
|
||||
void on_pushButtonJoystick1_clicked();
|
||||
void on_pushButtonJoystick2_clicked();
|
||||
void on_pushButtonJoystick3_clicked();
|
||||
void on_pushButtonJoystick4_clicked();
|
||||
|
||||
private:
|
||||
Ui::SettingsInput *ui;
|
||||
|
||||
@@ -24,87 +24,6 @@ extern "C" {
|
||||
#include "qt_deviceconfig.hpp"
|
||||
#include "qt_models_common.hpp"
|
||||
|
||||
/*
|
||||
class MachineModel : public QAbstractListModel {
|
||||
public:
|
||||
MachineModel(QObject* parent) : QAbstractListModel(parent) {}
|
||||
|
||||
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
private:
|
||||
struct Entry {
|
||||
QString name;
|
||||
int id;
|
||||
};
|
||||
QList<Entry> entries;
|
||||
};
|
||||
|
||||
bool MachineModel::insertRows(int row, int count, const QModelIndex &parent) {
|
||||
beginInsertRows(parent, row, row + count - 1);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
entries.insert(row, Entry{});
|
||||
}
|
||||
endInsertRows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MachineModel::removeRows(int row, int count, const QModelIndex &parent) {
|
||||
beginRemoveRows(parent, row, row + count - 1);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
entries.removeAt(row);
|
||||
}
|
||||
endRemoveRows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant MachineModel::data(const QModelIndex &index, int role) const {
|
||||
Q_ASSERT(checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid | QAbstractItemModel::CheckIndexOption::ParentIsInvalid));
|
||||
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return entries.at(index.row()).name;
|
||||
case Qt::UserRole:
|
||||
return entries.at(index.row()).id;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
int MachineModel::rowCount(const QModelIndex &parent) const {
|
||||
(void) parent;
|
||||
return entries.size();
|
||||
}
|
||||
|
||||
bool MachineModel::setData(const QModelIndex &index, const QVariant &value, int role) {
|
||||
Entry* entry = nullptr;
|
||||
if (index.row() < entries.size()) {
|
||||
entry = &entries[index.row()];
|
||||
} else if (index.row() == entries.size()) {
|
||||
entries.append(Entry{});
|
||||
entry = &entries.back();
|
||||
}
|
||||
|
||||
bool ret = true;
|
||||
if (entry != nullptr) {
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
entry->name = value.toString();
|
||||
case Qt::UserRole:
|
||||
entry->id = value.toInt();
|
||||
default:
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
SettingsMachine::SettingsMachine(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SettingsMachine)
|
||||
@@ -138,8 +57,8 @@ SettingsMachine::SettingsMachine(QWidget *parent) :
|
||||
int selectedMachineType = 0;
|
||||
auto* machineTypesModel = ui->comboBoxMachineType->model();
|
||||
for (int i = 0; i < MACHINE_TYPE_MAX; ++i) {
|
||||
Models::AddEntry(machineTypesModel, machine_types[i].name, machine_types[i].id);
|
||||
if (machine_types[i].id == machines[machine].type) {
|
||||
Models::AddEntry(machineTypesModel, machine_getname_ex(i), machine_types[i].id);
|
||||
if (machine_types[i].id == machine_get_type(machine)) {
|
||||
selectedMachineType = i;
|
||||
}
|
||||
}
|
||||
@@ -156,11 +75,21 @@ void SettingsMachine::save() {
|
||||
cpu = ui->comboBoxSpeed->currentData().toInt();
|
||||
fpu_type = ui->comboBoxFPU->currentData().toInt();
|
||||
cpu_use_dynarec = ui->checkBoxDynamicRecompiler->isChecked() ? 1 : 0;
|
||||
if (machines[machine].ram_granularity < 1024) {
|
||||
mem_size = ui->spinBoxRAM->value();
|
||||
int64_t temp_mem_size;
|
||||
if (machine_get_ram_granularity(machine) < 1024) {
|
||||
temp_mem_size = ui->spinBoxRAM->value();
|
||||
} else {
|
||||
mem_size = ui->spinBoxRAM->value() * 1024;
|
||||
temp_mem_size = ui->spinBoxRAM->value() * 1024;
|
||||
}
|
||||
|
||||
temp_mem_size &= ~(machine_get_ram_granularity(machine) - 1);
|
||||
if (temp_mem_size < machine_get_min_ram(machine)) {
|
||||
temp_mem_size = machine_get_min_ram(machine);
|
||||
} else if (temp_mem_size > machine_get_max_ram(machine)) {
|
||||
temp_mem_size = machine_get_max_ram(machine);
|
||||
}
|
||||
mem_size = static_cast<uint32_t>(temp_mem_size);
|
||||
|
||||
if (ui->comboBoxWaitStates->isEnabled()) {
|
||||
cpu_waitstates = ui->comboBoxWaitStates->currentData().toInt();
|
||||
} else {
|
||||
@@ -182,7 +111,7 @@ void SettingsMachine::on_comboBoxMachineType_currentIndexChanged(int index) {
|
||||
|
||||
int selectedMachineRow = 0;
|
||||
for (int i = 0; i < machine_count(); ++i) {
|
||||
if ((machines[i].type == index) && machine_available(i)) {
|
||||
if ((machine_get_type(i) == index) && machine_available(i)) {
|
||||
int row = Models::AddEntry(model, machines[i].name, i);
|
||||
if (i == machine) {
|
||||
selectedMachineRow = row - removeRows;
|
||||
@@ -229,26 +158,25 @@ void SettingsMachine::on_comboBoxMachine_currentIndexChanged(int index) {
|
||||
|
||||
auto* machine = &machines[machineId];
|
||||
if ((machine->ram_granularity < 1024)) {
|
||||
ui->spinBoxRAM->setMinimum(machine->min_ram);
|
||||
ui->spinBoxRAM->setMaximum(machine->max_ram);
|
||||
ui->spinBoxRAM->setSingleStep(machine->ram_granularity);
|
||||
ui->spinBoxRAM->setMinimum(machine_get_min_ram(machineId));
|
||||
ui->spinBoxRAM->setMaximum(machine_get_max_ram(machineId));
|
||||
ui->spinBoxRAM->setSingleStep(machine_get_ram_granularity(machineId));
|
||||
ui->spinBoxRAM->setSuffix(" KiB");
|
||||
ui->spinBoxRAM->setValue(mem_size);
|
||||
} else {
|
||||
uint maxram;
|
||||
int maxram;
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
maxram = std::min(machine->max_ram, 2097152U);
|
||||
maxram = std::min(machine->max_ram, 2097152);
|
||||
#else
|
||||
maxram = std::min(machine->max_ram, 3145728U);
|
||||
maxram = std::min(machine_get_max_ram(machineId), 3145728);
|
||||
#endif
|
||||
ui->spinBoxRAM->setMinimum(machine->min_ram / 1024);
|
||||
ui->spinBoxRAM->setMinimum(machine_get_min_ram(machineId) / 1024);
|
||||
ui->spinBoxRAM->setMaximum(maxram / 1024);
|
||||
ui->spinBoxRAM->setSingleStep(machine->ram_granularity / 1024);
|
||||
ui->spinBoxRAM->setSingleStep(machine_get_ram_granularity(machineId) / 1024);
|
||||
ui->spinBoxRAM->setSuffix(" MiB");
|
||||
ui->spinBoxRAM->setValue(mem_size / 1024);
|
||||
}
|
||||
ui->spinBoxRAM->setEnabled(machine->min_ram != machine->max_ram);
|
||||
ui->spinBoxRAM->setEnabled(machine->min_ram != machine->max_ram);
|
||||
ui->spinBoxRAM->setEnabled(machine_get_min_ram(machineId) != machine_get_max_ram(machineId));
|
||||
|
||||
emit currentMachineChanged(machineId);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void SettingsNetwork::onCurrentMachineChanged(int machineId) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (network_card_available(c) && device_is_valid(network_card_getdevice(c), machine->flags)) {
|
||||
if (network_card_available(c) && device_is_valid(network_card_getdevice(c), machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == network_card) {
|
||||
selectedRow = row - removeRows;
|
||||
|
||||
@@ -40,7 +40,6 @@ void SettingsSound::save() {
|
||||
|
||||
void SettingsSound::onCurrentMachineChanged(int machineId) {
|
||||
this->machineId = machineId;
|
||||
auto* machine = &machines[machineId];
|
||||
|
||||
auto* model = ui->comboBoxSoundCard->model();
|
||||
auto removeRows = model->rowCount();
|
||||
@@ -48,7 +47,7 @@ void SettingsSound::onCurrentMachineChanged(int machineId) {
|
||||
int selectedRow = 0;
|
||||
while (true) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
if ((c == 1) && !(machine->flags & MACHINE_SOUND)) {
|
||||
if ((c == 1) && (machine_has_flags(machineId, MACHINE_SOUND) == 0)) {
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
@@ -60,7 +59,7 @@ void SettingsSound::onCurrentMachineChanged(int machineId) {
|
||||
}
|
||||
|
||||
if (sound_card_available(c)) {
|
||||
if (device_is_valid(sound_dev, machine->flags)) {
|
||||
if (device_is_valid(sound_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == sound_card_current) {
|
||||
selectedRow = row - removeRows;
|
||||
@@ -128,9 +127,14 @@ void SettingsSound::onCurrentMachineChanged(int machineId) {
|
||||
ui->checkBoxGUS->setChecked(GUS > 0);
|
||||
ui->checkBoxFloat32->setChecked(sound_is_float > 0);
|
||||
|
||||
ui->pushButtonConfigureSSI2001->setEnabled((SSI2001 > 0) && (machine->flags & MACHINE_BUS_ISA));
|
||||
ui->pushButtonConfigureCMS->setEnabled((GAMEBLASTER > 0) && (machine->flags & MACHINE_BUS_ISA));
|
||||
ui->pushButtonConfigureGUS->setEnabled((GUS > 0) && (machine->flags & MACHINE_BUS_ISA16));
|
||||
bool hasIsa = machine_has_bus(machineId, MACHINE_BUS_ISA) > 0;
|
||||
bool hasIsa16 = machine_has_bus(machineId, MACHINE_BUS_ISA) > 0;
|
||||
ui->checkBoxCMS->setEnabled(hasIsa);
|
||||
ui->pushButtonConfigureCMS->setEnabled((GAMEBLASTER > 0) && hasIsa);
|
||||
ui->checkBoxGUS->setEnabled(hasIsa16);
|
||||
ui->pushButtonConfigureGUS->setEnabled((GUS > 0) && hasIsa16);
|
||||
ui->checkBoxSSI2001->setEnabled(hasIsa);
|
||||
ui->pushButtonConfigureSSI2001->setEnabled((SSI2001 > 0) && hasIsa);
|
||||
}
|
||||
|
||||
static bool allowMpu401(Ui::SettingsSound *ui) {
|
||||
@@ -203,7 +207,7 @@ void SettingsSound::on_checkBoxGUS_stateChanged(int state) {
|
||||
}
|
||||
|
||||
void SettingsSound::on_pushButtonConfigureMPU401_clicked() {
|
||||
if (machines[machineId].flags & MACHINE_MCA) {
|
||||
if (machine_has_bus(machineId, MACHINE_BUS_MCA) > 0) {
|
||||
DeviceConfig::ConfigureDevice(&mpu401_mca_device);
|
||||
} else {
|
||||
DeviceConfig::ConfigureDevice(&mpu401_device);
|
||||
|
||||
@@ -57,7 +57,7 @@ void SettingsStorageControllers::onCurrentMachineChanged(int machineId) {
|
||||
int selectedRow = 0;
|
||||
while (true) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
if ((c == 1) && !(machine->flags & MACHINE_HDC)) {
|
||||
if ((c == 1) && (machine_has_flags(machineId, MACHINE_HDC) == 0)) {
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ void SettingsStorageControllers::onCurrentMachineChanged(int machineId) {
|
||||
if (hdc_available(c)) {
|
||||
auto* hdc_dev = hdc_get_device(c);
|
||||
|
||||
if (device_is_valid(hdc_dev, machine->flags)) {
|
||||
if (device_is_valid(hdc_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == hdc_current) {
|
||||
selectedRow = row - removeRows;
|
||||
@@ -98,7 +98,7 @@ void SettingsStorageControllers::onCurrentMachineChanged(int machineId) {
|
||||
if (fdc_card_available(c)) {
|
||||
auto* fdc_dev = fdc_card_getdevice(c);
|
||||
|
||||
if (device_is_valid(fdc_dev, machine->flags)) {
|
||||
if (device_is_valid(fdc_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == fdc_type) {
|
||||
selectedRow = row - removeRows;
|
||||
@@ -127,7 +127,7 @@ void SettingsStorageControllers::onCurrentMachineChanged(int machineId) {
|
||||
|
||||
if (scsi_card_available(c)) {
|
||||
auto* scsi_dev = scsi_card_getdevice(c);
|
||||
if (device_is_valid(scsi_dev, machine->flags)) {
|
||||
if (device_is_valid(scsi_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == scsi_card_current[i]) {
|
||||
selectedRow = row - removeRows;
|
||||
|
||||
@@ -28,7 +28,7 @@ wchar_t* ui_window_title(wchar_t* str)
|
||||
main_window->getTitle(title);
|
||||
str = title;
|
||||
} else {
|
||||
main_window->setTitle(str);
|
||||
emit main_window->setTitle(QString::fromWCharArray(str));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ void ui_sb_set_text_w(wchar_t *wstr) {
|
||||
|
||||
void
|
||||
ui_sb_update_tip(int arg) {
|
||||
qDebug() << Q_FUNC_INFO << arg;
|
||||
main_window->updateStatusBarTip(arg);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
161
src/qt/sdl_joystick.cpp
Normal file
161
src/qt/sdl_joystick.cpp
Normal file
@@ -0,0 +1,161 @@
|
||||
// Lifted from wx-sdl2-joystick.c in PCem
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
extern "C" {
|
||||
#include <86box/device.h>
|
||||
#include <86box/gameport.h>
|
||||
|
||||
int joysticks_present;
|
||||
joystick_t joystick_state[MAX_JOYSTICKS];
|
||||
plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||
static SDL_Joystick *sdl_joy[MAX_PLAT_JOYSTICKS];
|
||||
}
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
void joystick_init() {
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != 0) {
|
||||
return;
|
||||
}
|
||||
joysticks_present = SDL_NumJoysticks();
|
||||
|
||||
memset(sdl_joy, 0, sizeof(sdl_joy));
|
||||
for (int c = 0; c < joysticks_present; c++)
|
||||
{
|
||||
sdl_joy[c] = SDL_JoystickOpen(c);
|
||||
|
||||
if (sdl_joy[c])
|
||||
{
|
||||
int d;
|
||||
|
||||
strncpy(plat_joystick_state[c].name, SDL_JoystickNameForIndex(c), 64);
|
||||
plat_joystick_state[c].nr_axes = SDL_JoystickNumAxes(sdl_joy[c]);
|
||||
plat_joystick_state[c].nr_buttons = SDL_JoystickNumButtons(sdl_joy[c]);
|
||||
plat_joystick_state[c].nr_povs = SDL_JoystickNumHats(sdl_joy[c]);
|
||||
|
||||
for (d = 0; d < std::min(plat_joystick_state[c].nr_axes, 8); d++)
|
||||
{
|
||||
sprintf(plat_joystick_state[c].axis[d].name, "Axis %i", d);
|
||||
plat_joystick_state[c].axis[d].id = d;
|
||||
}
|
||||
for (d = 0; d < std::min(plat_joystick_state[c].nr_buttons, 8); d++)
|
||||
{
|
||||
sprintf(plat_joystick_state[c].button[d].name, "Button %i", d);
|
||||
plat_joystick_state[c].button[d].id = d;
|
||||
}
|
||||
for (d = 0; d < std::min(plat_joystick_state[c].nr_povs, 4); d++)
|
||||
{
|
||||
sprintf(plat_joystick_state[c].pov[d].name, "POV %i", d);
|
||||
plat_joystick_state[c].pov[d].id = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void joystick_close()
|
||||
{
|
||||
int c;
|
||||
|
||||
for (c = 0; c < joysticks_present; c++)
|
||||
{
|
||||
if (sdl_joy[c])
|
||||
SDL_JoystickClose(sdl_joy[c]);
|
||||
}
|
||||
}
|
||||
|
||||
static int joystick_get_axis(int joystick_nr, int mapping)
|
||||
{
|
||||
if (mapping & POV_X)
|
||||
{
|
||||
switch (plat_joystick_state[joystick_nr].p[mapping & 3])
|
||||
{
|
||||
case SDL_HAT_LEFTUP: case SDL_HAT_LEFT: case SDL_HAT_LEFTDOWN:
|
||||
return -32767;
|
||||
|
||||
case SDL_HAT_RIGHTUP: case SDL_HAT_RIGHT: case SDL_HAT_RIGHTDOWN:
|
||||
return 32767;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (mapping & POV_Y)
|
||||
{
|
||||
switch (plat_joystick_state[joystick_nr].p[mapping & 3])
|
||||
{
|
||||
case SDL_HAT_LEFTUP: case SDL_HAT_UP: case SDL_HAT_RIGHTUP:
|
||||
return -32767;
|
||||
|
||||
case SDL_HAT_LEFTDOWN: case SDL_HAT_DOWN: case SDL_HAT_RIGHTDOWN:
|
||||
return 32767;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
return plat_joystick_state[joystick_nr].a[plat_joystick_state[joystick_nr].axis[mapping].id];
|
||||
}
|
||||
void joystick_process()
|
||||
{
|
||||
int c, d;
|
||||
|
||||
SDL_JoystickUpdate();
|
||||
for (c = 0; c < joysticks_present; c++)
|
||||
{
|
||||
int b;
|
||||
|
||||
plat_joystick_state[c].a[0] = SDL_JoystickGetAxis(sdl_joy[c], 0);
|
||||
plat_joystick_state[c].a[1] = SDL_JoystickGetAxis(sdl_joy[c], 1);
|
||||
plat_joystick_state[c].a[2] = SDL_JoystickGetAxis(sdl_joy[c], 2);
|
||||
plat_joystick_state[c].a[3] = SDL_JoystickGetAxis(sdl_joy[c], 3);
|
||||
plat_joystick_state[c].a[4] = SDL_JoystickGetAxis(sdl_joy[c], 4);
|
||||
plat_joystick_state[c].a[5] = SDL_JoystickGetAxis(sdl_joy[c], 5);
|
||||
|
||||
for (b = 0; b < 16; b++)
|
||||
plat_joystick_state[c].b[b] = SDL_JoystickGetButton(sdl_joy[c], b);
|
||||
|
||||
for (b = 0; b < 4; b++)
|
||||
plat_joystick_state[c].p[b] = SDL_JoystickGetHat(sdl_joy[c], b);
|
||||
// pclog("joystick %i - x=%i y=%i b[0]=%i b[1]=%i %i\n", c, joystick_state[c].x, joystick_state[c].y, joystick_state[c].b[0], joystick_state[c].b[1], joysticks_present);
|
||||
}
|
||||
|
||||
for (c = 0; c < joystick_get_max_joysticks(joystick_type); c++)
|
||||
{
|
||||
if (joystick_state[c].plat_joystick_nr)
|
||||
{
|
||||
int joystick_nr = joystick_state[c].plat_joystick_nr - 1;
|
||||
|
||||
for (d = 0; d < joystick_get_axis_count(joystick_type); d++)
|
||||
joystick_state[c].axis[d] = joystick_get_axis(joystick_nr, joystick_state[c].axis_mapping[d]);
|
||||
for (d = 0; d < joystick_get_button_count(joystick_type); d++)
|
||||
joystick_state[c].button[d] = plat_joystick_state[joystick_nr].b[joystick_state[c].button_mapping[d]];
|
||||
for (d = 0; d < joystick_get_pov_count(joystick_type); d++)
|
||||
{
|
||||
int x, y;
|
||||
double angle, magnitude;
|
||||
|
||||
x = joystick_get_axis(joystick_nr, joystick_state[c].pov_mapping[d][0]);
|
||||
y = joystick_get_axis(joystick_nr, joystick_state[c].pov_mapping[d][1]);
|
||||
|
||||
angle = (atan2((double)y, (double)x) * 360.0) / (2*M_PI);
|
||||
magnitude = sqrt((double)x*(double)x + (double)y*(double)y);
|
||||
|
||||
if (magnitude < 16384)
|
||||
joystick_state[c].pov[d] = -1;
|
||||
else
|
||||
joystick_state[c].pov[d] = ((int)angle + 90 + 360) % 360;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (d = 0; d < joystick_get_axis_count(joystick_type); d++)
|
||||
joystick_state[c].axis[d] = 0;
|
||||
for (d = 0; d < joystick_get_button_count(joystick_type); d++)
|
||||
joystick_state[c].button[d] = 0;
|
||||
for (d = 0; d < joystick_get_pov_count(joystick_type); d++)
|
||||
joystick_state[c].pov[d] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ scsi_card_init(void)
|
||||
|
||||
/* On-board SCSI controllers get the first bus, so if one is present,
|
||||
increase our instance number here. */
|
||||
if (machines[machine].flags & MACHINE_SCSI)
|
||||
if (machine_has_flags(machine, MACHINE_SCSI))
|
||||
max--;
|
||||
|
||||
/* Do not initialize any controllers if we have do not have any SCSI
|
||||
|
||||
@@ -1703,7 +1703,7 @@ mpu401_device_add(void)
|
||||
if (!mpu401_standalone_enable)
|
||||
return;
|
||||
|
||||
if (machines[machine].flags & MACHINE_MCA)
|
||||
if (machine_has_bus(machine, MACHINE_BUS_MCA))
|
||||
device_add(&mpu401_mca_device);
|
||||
else
|
||||
device_add(&mpu401_device);
|
||||
|
||||
@@ -274,7 +274,7 @@ void
|
||||
video_pre_reset(int card)
|
||||
{
|
||||
if ((card == VID_NONE) || \
|
||||
(card == VID_INTERNAL) || (machines[machine].flags & MACHINE_VIDEO_ONLY))
|
||||
(card == VID_INTERNAL) || machine_has_flags(machine, MACHINE_VIDEO_ONLY))
|
||||
video_prepare();
|
||||
}
|
||||
|
||||
@@ -287,13 +287,13 @@ video_reset(int card)
|
||||
return;
|
||||
|
||||
vid_table_log("VIDEO: reset (gfxcard=%d, internal=%d)\n",
|
||||
card, (machines[machine].flags & MACHINE_VIDEO)?1:0);
|
||||
card, machine_has_flags(machine, MACHINE_VIDEO) ? 1 : 0);
|
||||
|
||||
loadfont("roms/video/mda/mda.rom", 0);
|
||||
|
||||
/* Do not initialize internal cards here. */
|
||||
if (!(card == VID_NONE) && \
|
||||
!(card == VID_INTERNAL) && !(machines[machine].flags & MACHINE_VIDEO_ONLY)) {
|
||||
!(card == VID_INTERNAL) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY)) {
|
||||
vid_table_log("VIDEO: initializing '%s'\n", video_cards[card].name);
|
||||
|
||||
video_prepare();
|
||||
|
||||
@@ -274,7 +274,7 @@ END
|
||||
|
||||
#define STR_OK "OK"
|
||||
#define STR_CANCEL "Annuler"
|
||||
#define STR_GLOBAL "Sauver ces paramètres comme valeurs par défaut &globales"
|
||||
#define STR_GLOBAL "Sauvegarder ces paramètres comme valeurs par défaut &globales"
|
||||
#define STR_DEFAULT "&Défaut"
|
||||
#define STR_LANGUAGE "Langue:"
|
||||
#define STR_ICONSET "Ensemble d'icônes:"
|
||||
@@ -478,9 +478,9 @@ BEGIN
|
||||
IDS_2118 "Côntrolleur interne"
|
||||
IDS_2119 "Sortir"
|
||||
IDS_2120 "Pas de ROMs trouvées"
|
||||
IDS_2121 "Voulez-vous sauver les paramètres ?"
|
||||
IDS_2121 "Voulez-vous sauvegarder les paramètres ?"
|
||||
IDS_2122 "Cela entraînera la réinitialisation complète de la machine émulée."
|
||||
IDS_2123 "Sauver"
|
||||
IDS_2123 "Sauvegarder"
|
||||
IDS_2124 "À propos de 86Box"
|
||||
IDS_2125 "86Box v" EMU_VERSION
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include <86box/zip.h>
|
||||
#include <86box/win.h>
|
||||
|
||||
#define MACHINE_HAS_IDE (machines[machine].flags & MACHINE_IDE_QUAD)
|
||||
#define MACHINE_HAS_SCSI (machines[machine].flags & MACHINE_SCSI_DUAL)
|
||||
#define MACHINE_HAS_IDE (machine_has_flags(machine, MACHINE_IDE_QUAD))
|
||||
#define MACHINE_HAS_SCSI (machine_has_flags(machine, MACHINE_SCSI_DUAL))
|
||||
|
||||
#define CASSETTE_FIRST 0
|
||||
#define CARTRIDGE_FIRST CASSETTE_FIRST + 1
|
||||
@@ -403,7 +403,7 @@ media_menu_load_submenus()
|
||||
static inline int
|
||||
is_valid_cartridge(void)
|
||||
{
|
||||
return ((machines[machine].flags & MACHINE_CARTRIDGE) ? 1 : 0);
|
||||
return (machine_has_cartridge(machine));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ win_settings_init(void)
|
||||
int i = 0;
|
||||
|
||||
/* Machine category */
|
||||
temp_machine_type = machines[machine].type;
|
||||
temp_machine_type = machine_get_type(machine);
|
||||
temp_machine = machine;
|
||||
temp_cpu_f = cpu_f;
|
||||
temp_wait_states = cpu_waitstates;
|
||||
@@ -786,13 +786,13 @@ win_settings_machine_recalc_machine(HWND hdlg)
|
||||
|
||||
win_settings_machine_recalc_cpu_m(hdlg);
|
||||
|
||||
if ((machines[temp_machine].ram_granularity & 1023)) {
|
||||
if (machine_get_ram_granularity(temp_machine) & 1023) {
|
||||
/* KB granularity */
|
||||
h = GetDlgItem(hdlg, IDC_MEMSPIN);
|
||||
SendMessage(h, UDM_SETRANGE, 0, (machines[temp_machine].min_ram << 16) | machines[temp_machine].max_ram);
|
||||
SendMessage(h, UDM_SETRANGE, 0, (machine_get_min_ram(temp_machine) << 16) | machine_get_max_ram(temp_machine));
|
||||
|
||||
accel.nSec = 0;
|
||||
accel.nInc = machines[temp_machine].ram_granularity;
|
||||
accel.nInc = machine_get_ram_granularity(temp_machine);
|
||||
SendMessage(h, UDM_SETACCEL, 1, (LPARAM)&accel);
|
||||
|
||||
SendMessage(h, UDM_SETPOS, 0, temp_mem_size);
|
||||
@@ -803,14 +803,14 @@ win_settings_machine_recalc_machine(HWND hdlg)
|
||||
/* MB granularity */
|
||||
h = GetDlgItem(hdlg, IDC_MEMSPIN);
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
i = MIN(machines[temp_machine].max_ram, 2097152);
|
||||
i = MIN(machine_get_max_ram(temp_machine), 2097152);
|
||||
#else
|
||||
i = MIN(machines[temp_machine].max_ram, 3145728);
|
||||
i = MIN(machine_get_max_ram(temp_machine), 3145728);
|
||||
#endif
|
||||
SendMessage(h, UDM_SETRANGE, 0, (machines[temp_machine].min_ram << 6) | (i >> 10));
|
||||
SendMessage(h, UDM_SETRANGE, 0, (machine_get_min_ram(temp_machine) << 6) | (i >> 10));
|
||||
|
||||
accel.nSec = 0;
|
||||
accel.nInc = machines[temp_machine].ram_granularity >> 10;
|
||||
accel.nInc = machine_get_ram_granularity(temp_machine) >> 10;
|
||||
|
||||
SendMessage(h, UDM_SETACCEL, 1, (LPARAM)&accel);
|
||||
|
||||
@@ -820,8 +820,8 @@ win_settings_machine_recalc_machine(HWND hdlg)
|
||||
SendMessage(h, WM_SETTEXT, 0, win_get_string(IDS_2086));
|
||||
}
|
||||
|
||||
settings_enable_window(hdlg, IDC_MEMSPIN, machines[temp_machine].min_ram != machines[temp_machine].max_ram);
|
||||
settings_enable_window(hdlg, IDC_MEMTEXT, machines[temp_machine].min_ram != machines[temp_machine].max_ram);
|
||||
settings_enable_window(hdlg, IDC_MEMSPIN, machine_get_min_ram(temp_machine) != machine_get_max_ram(temp_machine));
|
||||
settings_enable_window(hdlg, IDC_MEMTEXT, machine_get_min_ram(temp_machine) != machine_get_max_ram(temp_machine));
|
||||
|
||||
free(lptsTemp);
|
||||
}
|
||||
@@ -844,7 +844,7 @@ machine_type_available(int id)
|
||||
|
||||
if ((id > 0) && (id < MACHINE_TYPE_MAX)) {
|
||||
while (machine_get_internal_name_ex(c) != NULL) {
|
||||
if (machine_available(c) && (machines[c].type == id))
|
||||
if (machine_available(c) && (machine_get_type(c) == id))
|
||||
return 1;
|
||||
c++;
|
||||
}
|
||||
@@ -891,8 +891,8 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
settings_reset_content(hdlg, IDC_COMBO_MACHINE);
|
||||
memset(listtomachine, 0x00, sizeof(listtomachine));
|
||||
while (machine_get_internal_name_ex(c) != NULL) {
|
||||
if (machine_available(c) && (machines[c].type == temp_machine_type)) {
|
||||
stransi = (char *)machines[c].name;
|
||||
if (machine_available(c) && (machine_get_type(c) == temp_machine_type)) {
|
||||
stransi = machine_getname_ex(c);
|
||||
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
|
||||
settings_add_string(hdlg, IDC_COMBO_MACHINE, (LPARAM) lptsTemp);
|
||||
listtomachine[d] = c;
|
||||
@@ -946,8 +946,8 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
c = d = 0;
|
||||
memset(listtomachine, 0x00, sizeof(listtomachine));
|
||||
while (machine_get_internal_name_ex(c) != NULL) {
|
||||
if (machine_available(c) && (machines[c].type == temp_machine_type)) {
|
||||
stransi = (char *)machines[c].name;
|
||||
if (machine_available(c) && (machine_get_type(c) == temp_machine_type)) {
|
||||
stransi = machine_getname_ex(c);
|
||||
mbstowcs(lptsTemp, stransi, strlen(stransi) + 1);
|
||||
settings_add_string(hdlg, IDC_COMBO_MACHINE, (LPARAM) lptsTemp);
|
||||
listtomachine[d] = c;
|
||||
@@ -1023,13 +1023,13 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
SendMessage(h, WM_GETTEXT, 255, (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
sscanf(stransi, "%u", &temp_mem_size);
|
||||
if (!(machines[temp_machine].ram_granularity & 1023))
|
||||
if (!(machine_get_ram_granularity(temp_machine) & 1023))
|
||||
temp_mem_size = temp_mem_size << 10;
|
||||
temp_mem_size &= ~(machines[temp_machine].ram_granularity - 1);
|
||||
if (temp_mem_size < machines[temp_machine].min_ram)
|
||||
temp_mem_size = machines[temp_machine].min_ram;
|
||||
else if (temp_mem_size > machines[temp_machine].max_ram)
|
||||
temp_mem_size = machines[temp_machine].max_ram;
|
||||
temp_mem_size &= ~(machine_get_ram_granularity(temp_machine) - 1);
|
||||
if (temp_mem_size < machine_get_min_ram(temp_machine))
|
||||
temp_mem_size = machine_get_min_ram(temp_machine);
|
||||
else if (temp_mem_size > machine_get_max_ram(temp_machine))
|
||||
temp_mem_size = machine_get_max_ram(temp_machine);
|
||||
free(stransi);
|
||||
free(lptsTemp);
|
||||
|
||||
@@ -1080,7 +1080,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
while (1) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
if ((c == 1) && !(machines[temp_machine].flags & MACHINE_VIDEO)) {
|
||||
if ((c == 1) && !machine_has_flags(temp_machine, MACHINE_VIDEO)) {
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
if (video_card_available(c) &&
|
||||
device_is_valid(video_card_getdevice(c), machines[temp_machine].flags)) {
|
||||
device_is_valid(video_card_getdevice(c), temp_machine)) {
|
||||
if (c == 0)
|
||||
settings_add_string(hdlg, IDC_COMBO_VIDEO, win_get_string(IDS_2103));
|
||||
else if (c == 1)
|
||||
@@ -1109,12 +1109,12 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
settings_process_messages();
|
||||
}
|
||||
|
||||
settings_enable_window(hdlg, IDC_COMBO_VIDEO, !(machines[temp_machine].flags & MACHINE_VIDEO_ONLY));
|
||||
settings_enable_window(hdlg, IDC_COMBO_VIDEO, !machine_has_flags(temp_machine, MACHINE_VIDEO_ONLY));
|
||||
e = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_VIDEO)];
|
||||
settings_enable_window(hdlg, IDC_CONFIGURE_VID, video_card_has_config(e));
|
||||
settings_enable_window(hdlg, IDC_CHECK_VOODOO, (machines[temp_machine].flags & MACHINE_BUS_PCI));
|
||||
settings_enable_window(hdlg, IDC_CHECK_VOODOO, machine_has_bus(temp_machine, MACHINE_BUS_PCI));
|
||||
settings_set_check(hdlg, IDC_CHECK_VOODOO, temp_voodoo);
|
||||
settings_enable_window(hdlg, IDC_BUTTON_VOODOO, (machines[temp_machine].flags & MACHINE_BUS_PCI) && temp_voodoo);
|
||||
settings_enable_window(hdlg, IDC_BUTTON_VOODOO, machine_has_bus(temp_machine, MACHINE_BUS_PCI) && temp_voodoo);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
@@ -1157,10 +1157,10 @@ mouse_valid(int num, int m)
|
||||
const device_t *dev;
|
||||
|
||||
if ((num == MOUSE_TYPE_INTERNAL) &&
|
||||
!(machines[m].flags & MACHINE_MOUSE)) return(0);
|
||||
!machine_has_flags(m, MACHINE_MOUSE)) return(0);
|
||||
|
||||
dev = mouse_get_device(num);
|
||||
return(device_is_valid(dev, machines[m].flags));
|
||||
return(device_is_valid(dev, m));
|
||||
}
|
||||
|
||||
|
||||
@@ -1294,7 +1294,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
settings_reset_content(hdlg, IDC_COMBO_SOUND);
|
||||
while (1) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
if ((c == 1) && !(machines[temp_machine].flags & MACHINE_SOUND)) {
|
||||
if ((c == 1) && !machine_has_flags(temp_machine, MACHINE_SOUND)) {
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
@@ -1307,7 +1307,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (sound_card_available(c)) {
|
||||
sound_dev = sound_card_getdevice(c);
|
||||
|
||||
if (device_is_valid(sound_dev, machines[temp_machine].flags)) {
|
||||
if (device_is_valid(sound_dev, temp_machine)) {
|
||||
if (c == 0)
|
||||
settings_add_string(hdlg, IDC_COMBO_SOUND, win_get_string(IDS_2103));
|
||||
else if (c == 1)
|
||||
@@ -1377,15 +1377,15 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
settings_set_check(hdlg, IDC_CHECK_MPU401, temp_mpu401);
|
||||
settings_enable_window(hdlg, IDC_CHECK_MPU401, mpu401_standalone_allow());
|
||||
settings_enable_window(hdlg, IDC_CONFIGURE_MPU401, mpu401_standalone_allow() && temp_mpu401);
|
||||
settings_enable_window(hdlg, IDC_CHECK_CMS, (machines[temp_machine].flags & MACHINE_BUS_ISA));
|
||||
settings_enable_window(hdlg, IDC_CHECK_CMS, machine_has_bus(temp_machine, MACHINE_BUS_ISA));
|
||||
settings_set_check(hdlg, IDC_CHECK_CMS, temp_GAMEBLASTER);
|
||||
settings_enable_window(hdlg, IDC_CONFIGURE_CMS, (machines[temp_machine].flags & MACHINE_BUS_ISA) && temp_GAMEBLASTER);
|
||||
settings_enable_window(hdlg, IDC_CHECK_GUS, (machines[temp_machine].flags & MACHINE_BUS_ISA16));
|
||||
settings_enable_window(hdlg, IDC_CONFIGURE_CMS, machine_has_bus(temp_machine, MACHINE_BUS_ISA) && temp_GAMEBLASTER);
|
||||
settings_enable_window(hdlg, IDC_CHECK_GUS, machine_has_bus(temp_machine, MACHINE_BUS_ISA16));
|
||||
settings_set_check(hdlg, IDC_CHECK_GUS, temp_GUS);
|
||||
settings_enable_window(hdlg, IDC_CONFIGURE_GUS, (machines[temp_machine].flags & MACHINE_BUS_ISA16) && temp_GUS);
|
||||
settings_enable_window(hdlg, IDC_CHECK_SSI, (machines[temp_machine].flags & MACHINE_BUS_ISA));
|
||||
settings_enable_window(hdlg, IDC_CONFIGURE_GUS, machine_has_bus(temp_machine, MACHINE_BUS_ISA16) && temp_GUS);
|
||||
settings_enable_window(hdlg, IDC_CHECK_SSI, machine_has_bus(temp_machine, MACHINE_BUS_ISA));
|
||||
settings_set_check(hdlg, IDC_CHECK_SSI, temp_SSI2001);
|
||||
settings_enable_window(hdlg, IDC_CONFIGURE_SSI, (machines[temp_machine].flags & MACHINE_BUS_ISA) && temp_SSI2001);
|
||||
settings_enable_window(hdlg, IDC_CONFIGURE_SSI, machine_has_bus(temp_machine, MACHINE_BUS_ISA) && temp_SSI2001);
|
||||
settings_set_check(hdlg, IDC_CHECK_FLOAT, temp_float);
|
||||
|
||||
free(lptsTemp);
|
||||
@@ -1440,7 +1440,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case IDC_CONFIGURE_MPU401:
|
||||
temp_deviceconfig |= deviceconfig_open(hdlg, (machines[temp_machine].flags & MACHINE_MCA) ?
|
||||
temp_deviceconfig |= deviceconfig_open(hdlg, machine_has_bus(temp_machine, MACHINE_BUS_MCA) ?
|
||||
(void *)&mpu401_mca_device : (void *)&mpu401_device);
|
||||
break;
|
||||
|
||||
@@ -1589,7 +1589,7 @@ win_settings_storage_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
settings_reset_content(hdlg, IDC_COMBO_HDC);
|
||||
while (1) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
if ((c == 1) && !(machines[temp_machine].flags & MACHINE_HDC)) {
|
||||
if ((c == 1) && !machine_has_flags(temp_machine, MACHINE_HDC)) {
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
@@ -1602,7 +1602,7 @@ win_settings_storage_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (hdc_available(c)) {
|
||||
hdc_dev = hdc_get_device(c);
|
||||
|
||||
if (device_is_valid(hdc_dev, machines[temp_machine].flags)) {
|
||||
if (device_is_valid(hdc_dev, temp_machine)) {
|
||||
if (c == 0)
|
||||
settings_add_string(hdlg, IDC_COMBO_HDC, win_get_string(IDS_2103));
|
||||
else if (c == 1)
|
||||
@@ -1634,7 +1634,7 @@ win_settings_storage_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (fdc_card_available(c)) {
|
||||
fdc_dev = fdc_card_getdevice(c);
|
||||
|
||||
if (device_is_valid(fdc_dev, machines[temp_machine].flags)) {
|
||||
if (device_is_valid(fdc_dev, temp_machine)) {
|
||||
if (c == 0)
|
||||
settings_add_string(hdlg, IDC_COMBO_FDC, win_get_string(IDS_2118));
|
||||
else
|
||||
@@ -1665,7 +1665,7 @@ win_settings_storage_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (scsi_card_available(c)) {
|
||||
scsi_dev = scsi_card_getdevice(c);
|
||||
|
||||
if (device_is_valid(scsi_dev, machines[temp_machine].flags)) {
|
||||
if (device_is_valid(scsi_dev, temp_machine)) {
|
||||
for (e = 0; e < SCSI_BUS_MAX; e++) {
|
||||
if (c == 0)
|
||||
settings_add_string(hdlg, IDC_COMBO_SCSI_1 + e, win_get_string(IDS_2103));
|
||||
@@ -1823,7 +1823,7 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (device_name[0] == L'\0')
|
||||
break;
|
||||
|
||||
if (network_card_available(c) && device_is_valid(network_card_getdevice(c), machines[temp_machine].flags)) {
|
||||
if (network_card_available(c) && device_is_valid(network_card_getdevice(c), temp_machine)) {
|
||||
if (c == 0)
|
||||
settings_add_string(hdlg, IDC_COMBO_NET, win_get_string(IDS_2103));
|
||||
else
|
||||
|
||||
@@ -522,12 +522,12 @@ ui_sb_update_panes(void)
|
||||
sb_ready = 0;
|
||||
}
|
||||
|
||||
cart_int = (machines[machine].flags & MACHINE_CARTRIDGE) ? 1 : 0;
|
||||
mfm_int = (machines[machine].flags & MACHINE_MFM) ? 1 : 0;
|
||||
xta_int = (machines[machine].flags & MACHINE_XTA) ? 1 : 0;
|
||||
esdi_int = (machines[machine].flags & MACHINE_ESDI) ? 1 : 0;
|
||||
ide_int = (machines[machine].flags & MACHINE_IDE_QUAD) ? 1 : 0;
|
||||
scsi_int = (machines[machine].flags & MACHINE_SCSI_DUAL) ? 1 : 0;
|
||||
cart_int = machine_has_cartridge(machine) ? 1 : 0;
|
||||
mfm_int = machine_has_flags(machine, MACHINE_MFM) ? 1 : 0;
|
||||
xta_int = machine_has_flags(machine, MACHINE_XTA) ? 1 : 0;
|
||||
esdi_int = machine_has_flags(machine, MACHINE_ESDI) ? 1 : 0;
|
||||
ide_int = machine_has_flags(machine, MACHINE_IDE_QUAD) ? 1 : 0;
|
||||
scsi_int = machine_has_flags(machine, MACHINE_SCSI_DUAL) ? 1 : 0;
|
||||
|
||||
c_mfm = hdd_count(HDD_BUS_MFM);
|
||||
c_esdi = hdd_count(HDD_BUS_ESDI);
|
||||
|
||||
Reference in New Issue
Block a user