From c0d2091620602614fb04a4fd3fd77e26d99d480c Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 25 Jun 2021 20:58:35 +0500 Subject: [PATCH 1/3] Fix the default joystick type --- src/game/gameport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index 16e5a1d74..34b77adec 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -59,7 +59,7 @@ typedef struct _joystick_instance_ { } joystick_instance_t; -int joystick_type = 1; +int joystick_type = 0; static const joystick_if_t joystick_none = { From 7824e99341c887dd4fc000ddbcaff0ea3b1d1b94 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 25 Jun 2021 21:01:58 +0500 Subject: [PATCH 2/3] Fix game ports at a non-standard addresses not being added if there were none previously --- src/game/gameport.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index 34b77adec..c9a388382 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -324,17 +324,16 @@ gameport_remap(void *priv, uint16_t address) if (dev->addr) { /* Add this port to the active ports list. */ - if ((dev->addr & 0xfff8) == 0x200) { - /* Port within 200-207h: add to top. */ + if ( !active_gameports || ((dev->addr & 0xfff8) == 0x200)) { + /* No ports have been added yet, or port within 200-207h: add to top. */ dev->next = active_gameports; active_gameports = dev; } else { /* Port at other addresses: add to bottom. */ other_dev = active_gameports; - while (other_dev && other_dev->next) + while (other_dev->next) other_dev = other_dev->next; - if (other_dev) - other_dev->next = dev; + other_dev->next = dev; } io_sethandler(dev->addr, dev->len, From 5f5a0dc2a64317c81b88b3abc60a3ba3091d104d Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 25 Jun 2021 21:02:28 +0500 Subject: [PATCH 3/3] Move the Super I/O game port flag to a #define --- src/game/gameport.c | 2 +- src/include/86box/gameport.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/gameport.c b/src/game/gameport.c index c9a388382..b0caff22a 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -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 & 0x1000000) || (machines[machine].flags & MACHINE_GAMEPORT)) + if (!(gameport_type->local & GAMEPORT_SIO) || (machines[machine].flags & MACHINE_GAMEPORT)) standalone_gameport_type = NULL; /* Add game port device. */ diff --git a/src/include/86box/gameport.h b/src/include/86box/gameport.h index be8eec813..25027d59e 100644 --- a/src/include/86box/gameport.h +++ b/src/include/86box/gameport.h @@ -33,6 +33,7 @@ #define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0) +#define GAMEPORT_SIO 0x1000000 typedef struct { char name[260];