Merge pull request #1507 from lemondrops/master

Various game port fixes
This commit is contained in:
Miran Grča
2021-06-25 19:21:53 +02:00
committed by GitHub
2 changed files with 7 additions and 7 deletions

View File

@@ -59,7 +59,7 @@ typedef struct _joystick_instance_ {
} joystick_instance_t; } joystick_instance_t;
int joystick_type = 1; int joystick_type = 0;
static const joystick_if_t joystick_none = { static const joystick_if_t joystick_none = {
@@ -324,17 +324,16 @@ gameport_remap(void *priv, uint16_t address)
if (dev->addr) { if (dev->addr) {
/* Add this port to the active ports list. */ /* Add this port to the active ports list. */
if ((dev->addr & 0xfff8) == 0x200) { if ( !active_gameports || ((dev->addr & 0xfff8) == 0x200)) {
/* Port within 200-207h: add to top. */ /* No ports have been added yet, or port within 200-207h: add to top. */
dev->next = active_gameports; dev->next = active_gameports;
active_gameports = dev; active_gameports = dev;
} else { } else {
/* Port at other addresses: add to bottom. */ /* Port at other addresses: add to bottom. */
other_dev = active_gameports; other_dev = active_gameports;
while (other_dev && other_dev->next) while (other_dev->next)
other_dev = 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, io_sethandler(dev->addr, dev->len,
@@ -361,7 +360,7 @@ gameport_add(const device_t *gameport_type)
{ {
/* Prevent a standalone game port from being added later on, unless this /* 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). */ 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; standalone_gameport_type = NULL;
/* Add game port device. */ /* Add game port device. */

View File

@@ -33,6 +33,7 @@
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0) #define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
#define GAMEPORT_SIO 0x1000000
typedef struct { typedef struct {
char name[260]; char name[260];