From e536c4ca69cbbd4be6b3c91e729d97e7fbc860f9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 19 Feb 2023 22:49:30 +0600 Subject: [PATCH 1/4] device: Add extended parameters infrastructure --- src/device.c | 70 ++++++++++++++++++++++++++++++++------ src/include/86box/device.h | 43 +++++++++++++++-------- 2 files changed, 87 insertions(+), 26 deletions(-) diff --git a/src/device.c b/src/device.c index 52d2bb18e..79c84cd10 100644 --- a/src/device.c +++ b/src/device.c @@ -135,7 +135,7 @@ device_context_restore(void) } static void * -device_add_common(const device_t *d, const device_t *cd, void *p, int inst) +device_add_common(const device_t *d, const device_t *cd, void *p, void* params, int inst) { void *priv = NULL; int c; @@ -160,7 +160,7 @@ device_add_common(const device_t *d, const device_t *cd, void *p, int inst) device_set_context(&device_current, cd, inst); if (d->init != NULL) { - priv = d->init(d); + priv = (d->flags & DEVICE_EXTPARAMS) ? d->init_ext(d, params) : d->init(d); if (priv == NULL) { if (d->name) device_log("DEVICE: device '%s' init failed\n", d->name); @@ -199,55 +199,103 @@ device_get_internal_name(const device_t *d) void * device_add(const device_t *d) { - return device_add_common(d, d, NULL, 0); + return device_add_common(d, d, NULL, NULL, 0); +} + +void * +device_add_parameters(const device_t *d, void* params) +{ + return device_add_common(d, d, NULL, params, 0); } /* For devices that do not have an init function (internal video etc.) */ void device_add_ex(const device_t *d, void *priv) { - device_add_common(d, d, priv, 0); + device_add_common(d, d, priv, NULL, 0); +} + +void +device_add_ex_parameters(const device_t *d, void* priv, void *params) +{ + device_add_common(d, d, priv, params, 0); } void * device_add_inst(const device_t *d, int inst) { - return device_add_common(d, d, NULL, inst); + return device_add_common(d, d, NULL, NULL, inst); +} + +void * +device_add_inst_parameters(const device_t *d, int inst, void *params) +{ + return device_add_common(d, d, NULL, params, inst); } /* For devices that do not have an init function (internal video etc.) */ void device_add_inst_ex(const device_t *d, void *priv, int inst) { - device_add_common(d, d, priv, inst); + device_add_common(d, d, priv, NULL, inst); } -/* These four are to add a device with another device's context - will be +void +device_add_inst_ex_parameters(const device_t *d, void *priv, int inst, void *params) +{ + device_add_common(d, d, priv, params, inst); +} + +/* These eight are to add a device with another device's context - will be used to add machines' internal devices. */ void * device_cadd(const device_t *d, const device_t *cd) { - return device_add_common(d, cd, NULL, 0); + return device_add_common(d, cd, NULL, NULL, 0); +} + +void * +device_cadd_parameters(const device_t *d, const device_t *cd, void *params) +{ + return device_add_common(d, cd, NULL, params, 0); } /* For devices that do not have an init function (internal video etc.) */ void device_cadd_ex(const device_t *d, const device_t *cd, void *priv) { - device_add_common(d, cd, priv, 0); + device_add_common(d, cd, priv, NULL, 0); +} + +void +device_cadd_ex_parameters(const device_t *d, const device_t *cd, void *priv, void *params) +{ + device_add_common(d, cd, priv, params, 0); } void * device_cadd_inst(const device_t *d, const device_t *cd, int inst) { - return device_add_common(d, cd, NULL, inst); + return device_add_common(d, cd, NULL, NULL, inst); +} + +void * +device_cadd_inst_parameters(const device_t *d, const device_t *cd, int inst, void *params) +{ + return device_add_common(d, cd, NULL, params, inst); } /* For devices that do not have an init function (internal video etc.) */ void device_cadd_inst_ex(const device_t *d, const device_t *cd, void *priv, int inst) { - device_add_common(d, cd, priv, inst); + device_add_common(d, cd, priv, NULL, inst); +} + +void +device_cadd_inst_ex_parameters(const device_t *d, const device_t *cd, void *priv, int inst, void* params) +{ + device_add_common(d, cd, priv, params, inst); } void diff --git a/src/include/86box/device.h b/src/include/86box/device.h index 877ef660a..1c0e34045 100644 --- a/src/include/86box/device.h +++ b/src/include/86box/device.h @@ -57,19 +57,21 @@ #define CONFIG_SERPORT 12 enum { - DEVICE_PCJR = 2, /* requires an IBM PCjr */ - DEVICE_AT = 4, /* requires an AT-compatible system */ - DEVICE_PS2 = 8, /* requires a PS/1 or PS/2 system */ - DEVICE_ISA = 0x10, /* requires the ISA bus */ - DEVICE_CBUS = 0x20, /* requires the C-BUS bus */ - DEVICE_MCA = 0x40, /* requires the MCA bus */ - DEVICE_EISA = 0x80, /* requires the EISA bus */ - DEVICE_VLB = 0x100, /* requires the PCI bus */ - DEVICE_PCI = 0x200, /* requires the VLB bus */ - DEVICE_AGP = 0x400, /* requires the AGP bus */ - DEVICE_AC97 = 0x800, /* requires the AC'97 bus */ - DEVICE_COM = 0x1000, /* requires a serial port */ - DEVICE_LPT = 0x2000 /* requires a parallel port */ + DEVICE_PCJR = 2, /* requires an IBM PCjr */ + DEVICE_AT = 4, /* requires an AT-compatible system */ + DEVICE_PS2 = 8, /* requires a PS/1 or PS/2 system */ + DEVICE_ISA = 0x10, /* requires the ISA bus */ + DEVICE_CBUS = 0x20, /* requires the C-BUS bus */ + DEVICE_MCA = 0x40, /* requires the MCA bus */ + DEVICE_EISA = 0x80, /* requires the EISA bus */ + DEVICE_VLB = 0x100, /* requires the PCI bus */ + DEVICE_PCI = 0x200, /* requires the VLB bus */ + DEVICE_AGP = 0x400, /* requires the AGP bus */ + DEVICE_AC97 = 0x800, /* requires the AC'97 bus */ + DEVICE_COM = 0x1000, /* requires a serial port */ + DEVICE_LPT = 0x2000, /* requires a parallel port */ + + DEVICE_EXTPARAMS = 0x40000000 /* accepts extended parameters */ }; #define BIOS_NORMAL 0 @@ -118,9 +120,12 @@ typedef struct _device_ { const char *name; const char *internal_name; uint32_t flags; /* system flags */ - uint32_t local; /* flags local to device */ + uintptr_t local; /* flags local to device */ - void *(*init)(const struct _device_ *); + union { + void *(*init)(const struct _device_ *); + void *(*init_ext)(const struct _device_ *, void*); + }; void (*close)(void *priv); void (*reset)(void *priv); union { @@ -150,13 +155,21 @@ extern void device_context(const device_t *d); extern void device_context_inst(const device_t *d, int inst); extern void device_context_restore(void); extern void *device_add(const device_t *d); +extern void *device_add_parameters(const device_t *d, void *params); extern void device_add_ex(const device_t *d, void *priv); +extern void device_add_ex_parameters(const device_t *d, void *priv, void *params); extern void *device_add_inst(const device_t *d, int inst); +extern void *device_add_inst_parameters(const device_t *d, int inst, void *params); extern void device_add_inst_ex(const device_t *d, void *priv, int inst); +extern void device_add_inst_ex_parameters(const device_t *d, void *priv, int inst, void *params); extern void *device_cadd(const device_t *d, const device_t *cd); +extern void *device_cadd_parameters(const device_t *d, const device_t *cd, void *params); extern void device_cadd_ex(const device_t *d, const device_t *cd, void *priv); +extern void device_cadd_ex_parameters(const device_t *d, const device_t *cd, void *priv, void *params); extern void *device_cadd_inst(const device_t *d, const device_t *cd, int inst); +extern void *device_cadd_inst_parameters(const device_t *d, const device_t *cd, int inst, void *params); extern void device_cadd_inst_ex(const device_t *d, const device_t *cd, void *priv, int inst); +extern void device_cadd_inst_ex_parameters(const device_t *d, const device_t *cd, void *priv, int inst, void *params); extern void device_close_all(void); extern void device_reset_all(void); extern void device_reset_all_pci(void); From 424c9489c502ae4d4e91cfcc931db28d1b26d468 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 20 Feb 2023 00:55:03 +0600 Subject: [PATCH 2/4] machine.h: Make `chipset` `uintptr_t` --- src/include/86box/machine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 5a5b0bfda..4d1effe9a 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -279,7 +279,7 @@ typedef struct _machine_ { const char *name; const char *internal_name; uint32_t type; - uint32_t chipset; + uintptr_t chipset; int (*init)(const struct _machine_ *); uintptr_t pad, pad0, pad1, pad2; const machine_cpu_t cpu; From 35029deb8ef47d400dbc3cc567a024410bb80391 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 24 Feb 2023 15:07:42 +0600 Subject: [PATCH 3/4] qt: Poll for 4th and 5th mouse buttons on Windows --- src/qt/qt_winrawinputfilter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qt/qt_winrawinputfilter.cpp b/src/qt/qt_winrawinputfilter.cpp index 6690a08eb..08af142a6 100644 --- a/src/qt/qt_winrawinputfilter.cpp +++ b/src/qt/qt_winrawinputfilter.cpp @@ -340,6 +340,16 @@ WindowsRawInputFilter::mouse_handle(PRAWINPUT raw) else if (state.usButtonFlags & RI_MOUSE_RIGHT_BUTTON_UP) buttons &= ~2; + if (state.usButtonFlags & RI_MOUSE_BUTTON_4_DOWN) + buttons |= 8; + else if (state.usButtonFlags & RI_MOUSE_BUTTON_4_UP) + buttons &= ~8; + + if (state.usButtonFlags & RI_MOUSE_BUTTON_5_DOWN) + buttons |= 16; + else if (state.usButtonFlags & RI_MOUSE_BUTTON_5_UP) + buttons &= ~16; + if (state.usButtonFlags & RI_MOUSE_WHEEL) { dwheel += (SHORT) state.usButtonData / 120; } From d7134acacc61edf28a0c04357a8e444142661d35 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Tue, 28 Feb 2023 00:03:43 -0500 Subject: [PATCH 4/4] Bump version to 4.0 --- CMakeLists.txt | 2 +- debian/changelog | 4 ++-- src/include_make/86box/version.h | 8 ++++---- src/unix/assets/86Box.spec | 4 ++-- src/unix/assets/net.86box.86Box.metainfo.xml | 2 +- vcpkg.json | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4d5c4061..8070ff263 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ if(MUNT_EXTERNAL) endif() project(86Box - VERSION 3.11 + VERSION 4.0 DESCRIPTION "Emulator of x86-based systems" HOMEPAGE_URL "https://86box.net" LANGUAGES C CXX) diff --git a/debian/changelog b/debian/changelog index 45b701f83..1bca318dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,5 @@ -86box (3.11.0-1) UNRELEASED; urgency=medium +86box (4.0) UNRELEASED; urgency=medium * Bump release. - -- Jasmine Iwanek Sun, 18 Nov 2022 23:27:00 -0500 + -- Jasmine Iwanek Tue, 28 Feb 2023 00:02:16 -0500 diff --git a/src/include_make/86box/version.h b/src/include_make/86box/version.h index e4792969c..96e81ce5f 100644 --- a/src/include_make/86box/version.h +++ b/src/include_make/86box/version.h @@ -22,11 +22,11 @@ #define EMU_NAME "86Box" #define EMU_NAME_W LSTR(EMU_NAME) -#define EMU_VERSION "3.11" +#define EMU_VERSION "4.0" #define EMU_VERSION_W LSTR(EMU_VERSION) #define EMU_VERSION_EX "3.50" /* frozen due to IDE re-detection behavior on Windows */ -#define EMU_VERSION_MAJ 3 -#define EMU_VERSION_MIN 11 +#define EMU_VERSION_MAJ 4 +#define EMU_VERSION_MIN 0 #define EMU_VERSION_PATCH 0 #define EMU_BUILD_NUM 0 @@ -42,7 +42,7 @@ #define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest" #define EMU_ROMS_URL_W LSTR(EMU_ROMS_URL) #ifdef RELEASE_BUILD -# define EMU_DOCS_URL "https://86box.readthedocs.io/en/v3.11/" +# define EMU_DOCS_URL "https://86box.readthedocs.io/en/v4.0/" #else # define EMU_DOCS_URL "https://86box.readthedocs.io" #endif diff --git a/src/unix/assets/86Box.spec b/src/unix/assets/86Box.spec index 9fac0dde4..e994ca4a7 100644 --- a/src/unix/assets/86Box.spec +++ b/src/unix/assets/86Box.spec @@ -15,7 +15,7 @@ %global romver v3.11 Name: 86Box -Version: 3.11 +Version: 4.0 Release: 1%{?dist} Summary: Classic PC emulator License: GPLv2+ @@ -117,5 +117,5 @@ popd %{_datadir}/%{name}/roms %changelog -* Fri Nov 18 2022 Robert de Rooy 3.11-1 +* Tue Feb 28 2023 Robert de Rooy 4.0-1 - Bump release diff --git a/src/unix/assets/net.86box.86Box.metainfo.xml b/src/unix/assets/net.86box.86Box.metainfo.xml index 3cd4b9ba2..59671d0f9 100644 --- a/src/unix/assets/net.86box.86Box.metainfo.xml +++ b/src/unix/assets/net.86box.86Box.metainfo.xml @@ -10,7 +10,7 @@ net.86box.86Box.desktop - + diff --git a/vcpkg.json b/vcpkg.json index c9fd8eceb..890aeed46 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "86box", - "version-string": "3.11", + "version-string": "4.0", "homepage": "https://86box.net/", "documentation": "https://86box.readthedocs.io/", "license": "GPL-2.0-or-later",