From 74368bfe7ab523f92d3533f0bdaf49c7c0611b4b Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 6 Mar 2025 19:26:11 +0600 Subject: [PATCH 1/4] Don't include `cpu.h` in `timer.h` Change the name of the define used to indicate SVGA multi-monitor-capable cards --- src/chipset/ali1531.c | 1 + src/chipset/ali1541.c | 1 + src/chipset/ali1543.c | 1 + src/chipset/ali6117.c | 1 + src/chipset/gc100.c | 1 + src/chipset/sis_5511_h2p.c | 1 + src/chipset/sis_5513_p2i.c | 1 + src/chipset/sis_5571_h2p.c | 1 + src/chipset/sis_5581_h2p.c | 1 + src/chipset/sis_5591_h2p.c | 1 + src/chipset/sis_5600_h2p.c | 1 + src/chipset/sis_85c50x.c | 1 + src/device/cartridge.c | 1 + src/device/keyboard_xt.c | 1 + src/device/serial.c | 1 + src/include/86box/timer.h | 2 +- src/include/86box/video.h | 2 ++ src/machine/m_at_socket5.c | 1 + src/machine/m_xt_olivetti.c | 1 + src/machine/m_xt_philips.c | 1 + src/mem/sst_flash.c | 1 + src/qt/qt_main.cpp | 1 + src/qt/qt_settingsdisplay.cpp | 6 +++--- src/scsi/scsi_t128.c | 1 + src/sound/snd_audiopci.c | 1 + src/sound/snd_gus.c | 1 + src/sound/snd_opl_esfm.c | 1 + src/sound/snd_opl_nuked.c | 1 + src/sound/snd_sb.c | 1 + src/timer.c | 1 + src/video/vid_ati_mach64.c | 1 + src/video/vid_ati_mach8.c | 1 + src/video/vid_chips_69000.c | 1 + src/video/vid_mga.c | 1 + src/video/vid_nga.c | 1 + src/video/vid_ogc.c | 1 + src/video/vid_table.c | 6 +++--- 37 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/chipset/ali1531.c b/src/chipset/ali1531.c index e765e6d45..53324f8e6 100644 --- a/src/chipset/ali1531.c +++ b/src/chipset/ali1531.c @@ -22,6 +22,7 @@ #include #define HAVE_STDARG_H #include <86box/86box.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/device.h> diff --git a/src/chipset/ali1541.c b/src/chipset/ali1541.c index eed6ddbc5..ebbcd7e63 100644 --- a/src/chipset/ali1541.c +++ b/src/chipset/ali1541.c @@ -22,6 +22,7 @@ #include #define HAVE_STDARG_H #include <86box/86box.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/device.h> diff --git a/src/chipset/ali1543.c b/src/chipset/ali1543.c index 69a8990e9..2f9273736 100644 --- a/src/chipset/ali1543.c +++ b/src/chipset/ali1543.c @@ -22,6 +22,7 @@ #include #define HAVE_STDARG_H #include <86box/86box.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/device.h> #include <86box/io.h> diff --git a/src/chipset/ali6117.c b/src/chipset/ali6117.c index 707b528b2..88bb4b572 100644 --- a/src/chipset/ali6117.c +++ b/src/chipset/ali6117.c @@ -26,6 +26,7 @@ #include <86box/io.h> #include <86box/pci.h> #include <86box/pic.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/pit.h> #include <86box/device.h> diff --git a/src/chipset/gc100.c b/src/chipset/gc100.c index 23455b952..e9eb05ecf 100644 --- a/src/chipset/gc100.c +++ b/src/chipset/gc100.c @@ -27,6 +27,7 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/nmi.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/pit.h> #include <86box/mem.h> diff --git a/src/chipset/sis_5511_h2p.c b/src/chipset/sis_5511_h2p.c index 543fcacc5..b94e69f26 100644 --- a/src/chipset/sis_5511_h2p.c +++ b/src/chipset/sis_5511_h2p.c @@ -22,6 +22,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/dma.h> #include <86box/mem.h> diff --git a/src/chipset/sis_5513_p2i.c b/src/chipset/sis_5513_p2i.c index 95a890fcf..b2346bbc4 100644 --- a/src/chipset/sis_5513_p2i.c +++ b/src/chipset/sis_5513_p2i.c @@ -22,6 +22,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/dma.h> diff --git a/src/chipset/sis_5571_h2p.c b/src/chipset/sis_5571_h2p.c index d04964581..a28553487 100644 --- a/src/chipset/sis_5571_h2p.c +++ b/src/chipset/sis_5571_h2p.c @@ -22,6 +22,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/dma.h> #include <86box/mem.h> diff --git a/src/chipset/sis_5581_h2p.c b/src/chipset/sis_5581_h2p.c index d01e9dd28..83983376d 100644 --- a/src/chipset/sis_5581_h2p.c +++ b/src/chipset/sis_5581_h2p.c @@ -22,6 +22,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/dma.h> #include <86box/mem.h> diff --git a/src/chipset/sis_5591_h2p.c b/src/chipset/sis_5591_h2p.c index 048e7deea..74dd6dfbd 100644 --- a/src/chipset/sis_5591_h2p.c +++ b/src/chipset/sis_5591_h2p.c @@ -22,6 +22,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/dma.h> #include <86box/mem.h> diff --git a/src/chipset/sis_5600_h2p.c b/src/chipset/sis_5600_h2p.c index a15c6fff5..c23309de4 100644 --- a/src/chipset/sis_5600_h2p.c +++ b/src/chipset/sis_5600_h2p.c @@ -22,6 +22,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/dma.h> #include <86box/mem.h> diff --git a/src/chipset/sis_85c50x.c b/src/chipset/sis_85c50x.c index 192ae3767..e932ff6ca 100644 --- a/src/chipset/sis_85c50x.c +++ b/src/chipset/sis_85c50x.c @@ -24,6 +24,7 @@ #include <86box/86box.h> #include <86box/device.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/apm.h> #include <86box/machine.h> diff --git a/src/device/cartridge.c b/src/device/cartridge.c index d2e91ecb3..00464026a 100644 --- a/src/device/cartridge.c +++ b/src/device/cartridge.c @@ -22,6 +22,7 @@ #include #define HAVE_STDARG_H #include <86box/86box.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/plat.h> #include <86box/ui.h> diff --git a/src/device/keyboard_xt.c b/src/device/keyboard_xt.c index 644168004..ddbcae61b 100644 --- a/src/device/keyboard_xt.c +++ b/src/device/keyboard_xt.c @@ -29,6 +29,7 @@ #include #include <86box/86box.h> #include <86box/device.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/fdd.h> #include <86box/machine.h> diff --git a/src/device/serial.c b/src/device/serial.c index c25da0070..deb97225a 100644 --- a/src/device/serial.c +++ b/src/device/serial.c @@ -27,6 +27,7 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/device.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/machine.h> #include <86box/io.h> diff --git a/src/include/86box/timer.h b/src/include/86box/timer.h index 25aff6b2f..37a03d9ca 100644 --- a/src/include/86box/timer.h +++ b/src/include/86box/timer.h @@ -1,7 +1,7 @@ #ifndef _TIMER_H_ #define _TIMER_H_ -#include "cpu.h" +extern uint64_t tsc; /* Maximum period, currently 1 second. */ #define MAX_USEC64 1000000ULL diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 7ad29838c..2985559e1 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -69,6 +69,8 @@ enum { #define VIDEO_FLAG_TYPE_NONE 5 #define VIDEO_FLAG_TYPE_MASK 7 +#define VIDEO_FLAG_TYPE_SECONDARY VIDEO_FLAG_TYPE_SPECIAL + typedef struct video_timings_t { int type; int write_b; diff --git a/src/machine/m_at_socket5.c b/src/machine/m_at_socket5.c index b6e82301b..02922b425 100644 --- a/src/machine/m_at_socket5.c +++ b/src/machine/m_at_socket5.c @@ -29,6 +29,7 @@ #include <86box/fdc_ext.h> #include <86box/hdc.h> #include <86box/hdc_ide.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/fdd.h> #include <86box/fdc.h> diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index b6e4fb94a..34ca441ec 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -30,6 +30,7 @@ #include #define HAVE_STDARG_H #include <86box/86box.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/io.h> #include <86box/pic.h> diff --git a/src/machine/m_xt_philips.c b/src/machine/m_xt_philips.c index 604ccebaf..eed54e07f 100644 --- a/src/machine/m_xt_philips.c +++ b/src/machine/m_xt_philips.c @@ -23,6 +23,7 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/nmi.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/pit.h> #include <86box/mem.h> diff --git a/src/mem/sst_flash.c b/src/mem/sst_flash.c index b41e0f2e2..34bfae83a 100644 --- a/src/mem/sst_flash.c +++ b/src/mem/sst_flash.c @@ -25,6 +25,7 @@ #include <86box/device.h> #include <86box/mem.h> #include <86box/machine.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/nvr.h> #include <86box/plat.h> diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 7723261b4..719208c18 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -86,6 +86,7 @@ extern MainWindow *main_window; extern "C" { #include <86box/keyboard.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/nvr.h> extern int qt_nvr_save(void); diff --git a/src/qt/qt_settingsdisplay.cpp b/src/qt/qt_settingsdisplay.cpp index 75f8d376b..b7a930711 100644 --- a/src/qt/qt_settingsdisplay.cpp +++ b/src/qt/qt_settingsdisplay.cpp @@ -220,9 +220,9 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index) int secondaryFlags = video_card_get_flags(c); if (video_card_available(c) && device_is_valid(video_dev, machineId) - && !((secondaryFlags == primaryFlags) && (secondaryFlags != VIDEO_FLAG_TYPE_SPECIAL)) - && !(((primaryFlags == VIDEO_FLAG_TYPE_8514) || (primaryFlags == VIDEO_FLAG_TYPE_XGA)) && (secondaryFlags != VIDEO_FLAG_TYPE_MDA) && (secondaryFlags != VIDEO_FLAG_TYPE_SPECIAL)) - && !((primaryFlags != VIDEO_FLAG_TYPE_MDA) && (primaryFlags != VIDEO_FLAG_TYPE_SPECIAL) && ((secondaryFlags == VIDEO_FLAG_TYPE_8514) || (secondaryFlags == VIDEO_FLAG_TYPE_XGA)))) { + && !((secondaryFlags == primaryFlags) && (secondaryFlags != VIDEO_FLAG_TYPE_SECONDARY)) + && !(((primaryFlags == VIDEO_FLAG_TYPE_8514) || (primaryFlags == VIDEO_FLAG_TYPE_XGA)) && (secondaryFlags != VIDEO_FLAG_TYPE_MDA) && (secondaryFlags != VIDEO_FLAG_TYPE_SECONDARY)) + && !((primaryFlags != VIDEO_FLAG_TYPE_MDA) && (primaryFlags != VIDEO_FLAG_TYPE_SECONDARY) && ((secondaryFlags == VIDEO_FLAG_TYPE_8514) || (secondaryFlags == VIDEO_FLAG_TYPE_XGA)))) { ui->comboBoxVideoSecondary->addItem(name, c); if (c == curVideoCard_2) ui->comboBoxVideoSecondary->setCurrentIndex(ui->comboBoxVideoSecondary->count() - 1); diff --git a/src/scsi/scsi_t128.c b/src/scsi/scsi_t128.c index a40d803f1..5ac3b5d67 100644 --- a/src/scsi/scsi_t128.c +++ b/src/scsi/scsi_t128.c @@ -29,6 +29,7 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/dma.h> #include <86box/pic.h> diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index e3e2b9f1a..8d1de442b 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -39,6 +39,7 @@ #include <86box/pci.h> #include <86box/snd_ac97.h> #include <86box/sound.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/plat_unused.h> #include <86box/snd_akm4531.h> diff --git a/src/sound/snd_gus.c b/src/sound/snd_gus.c index 43638473c..1885581a5 100644 --- a/src/sound/snd_gus.c +++ b/src/sound/snd_gus.c @@ -15,6 +15,7 @@ #include <86box/nmi.h> #include <86box/pic.h> #include <86box/sound.h> +#include "cpu.h" #include <86box/timer.h> #ifdef USE_GUSMAX # include <86box/snd_ad1848.h> diff --git a/src/sound/snd_opl_esfm.c b/src/sound/snd_opl_esfm.c index bcd2a56e9..b80d264d5 100644 --- a/src/sound/snd_opl_esfm.c +++ b/src/sound/snd_opl_esfm.c @@ -32,6 +32,7 @@ #include <86box/86box.h> #include <86box/sound.h> #include <86box/device.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/snd_opl.h> #include <86box/plat_unused.h> diff --git a/src/sound/snd_opl_nuked.c b/src/sound/snd_opl_nuked.c index 03851a589..60f5ed2a6 100644 --- a/src/sound/snd_opl_nuked.c +++ b/src/sound/snd_opl_nuked.c @@ -46,6 +46,7 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/sound.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/device.h> #include <86box/snd_opl.h> diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index 4f8b8a0bd..689d0b91e 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -39,6 +39,7 @@ #include <86box/pic.h> #include <86box/rom.h> #include <86box/sound.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/snd_sb.h> #include <86box/plat_unused.h> diff --git a/src/timer.c b/src/timer.c index 9fed37511..03908890f 100644 --- a/src/timer.c +++ b/src/timer.c @@ -3,6 +3,7 @@ #include #include #include <86box/86box.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/nv/vid_nv_rivatimer.h> diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 2df7782ff..24935e3a2 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -28,6 +28,7 @@ #include <86box/device.h> #include <86box/io.h> #include <86box/mem.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/pci.h> #include <86box/rom.h> diff --git a/src/video/vid_ati_mach8.c b/src/video/vid_ati_mach8.c index 71dd973da..2038f1b1d 100644 --- a/src/video/vid_ati_mach8.c +++ b/src/video/vid_ati_mach8.c @@ -27,6 +27,7 @@ #include <86box/device.h> #include <86box/io.h> #include <86box/mem.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/mca.h> #include <86box/pci.h> diff --git a/src/video/vid_chips_69000.c b/src/video/vid_chips_69000.c index 012a16348..a387e99fa 100644 --- a/src/video/vid_chips_69000.c +++ b/src/video/vid_chips_69000.c @@ -27,6 +27,7 @@ #include <86box/mem.h> #include <86box/rom.h> #include <86box/device.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/video.h> #include <86box/vid_svga.h> diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index f11983a20..00570bd9f 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -23,6 +23,7 @@ #include #include <86box/86box.h> #include <86box/io.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/mem.h> #include <86box/pci.h> diff --git a/src/video/vid_nga.c b/src/video/vid_nga.c index 3640e5106..ef1c6cd40 100644 --- a/src/video/vid_nga.c +++ b/src/video/vid_nga.c @@ -30,6 +30,7 @@ #include <86box/io.h> #include <86box/video.h> #include <86box/86box.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/mem.h> #include <86box/pit.h> diff --git a/src/video/vid_ogc.c b/src/video/vid_ogc.c index 7fe5fbbeb..a49cd8a22 100644 --- a/src/video/vid_ogc.c +++ b/src/video/vid_ogc.c @@ -31,6 +31,7 @@ #include <86box/io.h> #include <86box/video.h> #include <86box/86box.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/mem.h> #include <86box/pit.h> diff --git a/src/video/vid_table.c b/src/video/vid_table.c index ff3073c73..d1df2ba20 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -141,10 +141,10 @@ video_cards[] = { { .device = &chips_69000_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &gd5430_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &gd5434_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &gd5436_pci_device, .flags = VIDEO_FLAG_TYPE_SPECIAL }, + { .device = &gd5436_pci_device, .flags = VIDEO_FLAG_TYPE_SECONDARY }, { .device = &gd5440_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &gd5446_pci_device, .flags = VIDEO_FLAG_TYPE_SPECIAL }, - { .device = &gd5446_stb_pci_device, .flags = VIDEO_FLAG_TYPE_SPECIAL }, + { .device = &gd5446_pci_device, .flags = VIDEO_FLAG_TYPE_SECONDARY }, + { .device = &gd5446_stb_pci_device, .flags = VIDEO_FLAG_TYPE_SECONDARY }, { .device = &gd5480_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &et4000w32p_videomagic_revb_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &et4000w32p_revc_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, From 0e42547cca39beb1d07fd007b4c2d8a1e0a92a8d Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 6 Mar 2025 19:34:24 +0600 Subject: [PATCH 2/4] Remove some `timer.h`-related include hacks --- src/qt/qt_machinestatus.cpp | 3 --- src/qt/qt_mainwindow.cpp | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qt/qt_machinestatus.cpp b/src/qt/qt_machinestatus.cpp index d1335873c..dee90f11c 100644 --- a/src/qt/qt_machinestatus.cpp +++ b/src/qt/qt_machinestatus.cpp @@ -19,9 +19,6 @@ #include "qt_machinestatus.hpp" extern "C" { -#define EMU_CPU_H // superhack - don't want timer.h to include cpu.h here, and some combo is preventing a compile -extern uint64_t tsc; - #include <86box/hdd.h> #include <86box/timer.h> #include <86box/86box.h> diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 89d17a07c..552fd0310 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -48,11 +48,10 @@ extern "C" { #include <86box/machine.h> #include <86box/vid_ega.h> #include <86box/version.h> -#if 0 -#include <86box/acpi.h> /* Requires timer.h include, which conflicts with Qt headers */ -#endif -extern atomic_int acpi_pwrbut_pressed; -extern int acpi_enabled; +#include <86box/timer.h> +#include <86box/apm.h> +#include <86box/nvr.h> +#include <86box/acpi.h> #ifdef USE_VNC # include <86box/vnc.h> From 9badd32c9cc14efde3fc7352d4edc9e8c1e1ec71 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 6 Mar 2025 19:44:37 +0600 Subject: [PATCH 3/4] Remove more `nvr.h` hacks --- src/qt/qt_settingsmachine.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/qt/qt_settingsmachine.cpp b/src/qt/qt_settingsmachine.cpp index 771f1cbec..9b1f9849e 100644 --- a/src/qt/qt_settingsmachine.cpp +++ b/src/qt/qt_settingsmachine.cpp @@ -32,13 +32,9 @@ extern "C" { #include <86box/config.h> #include <86box/device.h> #include <86box/machine.h> +#include <86box/nvr.h> } -// from nvr.h, which we can't import into CPP code -#define TIME_SYNC_DISABLED 0 -#define TIME_SYNC_ENABLED 1 -#define TIME_SYNC_UTC 2 - #include "qt_deviceconfig.hpp" #include "qt_models_common.hpp" From 4090c5a62cf61bc4f4437bb7df0577aed37106ee Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 6 Mar 2025 19:56:08 +0600 Subject: [PATCH 4/4] Fix SDL builds --- src/unix/unix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/unix.c b/src/unix/unix.c index 7f653b9b6..33b78ddb1 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -38,6 +38,7 @@ #include <86box/device.h> #include <86box/gameport.h> #include <86box/unix_sdl.h> +#include "cpu.h" #include <86box/timer.h> #include <86box/nvr.h> #include <86box/version.h>