Gameport backend work
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Jasmine Iwanek, <jriwanek@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
@@ -18,7 +19,7 @@
|
||||
* Copyright 2021 Laci bá'
|
||||
* Copyright 2021 dob205
|
||||
* Copyright 2021 Andreas J. Reichel.
|
||||
* Copyright 2021-2022 Jasmine Iwanek.
|
||||
* Copyright 2021-2025 Jasmine Iwanek.
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
@@ -178,6 +179,7 @@ int bugger_enabled = 0; /* (C) enable
|
||||
int novell_keycard_enabled = 0; /* (C) enable Novell NetWare 2.x key card emulation. */
|
||||
int postcard_enabled = 0; /* (C) enable POST card */
|
||||
int unittester_enabled = 0; /* (C) enable unit tester device */
|
||||
int gameport_type[GAMEPORT_MAX] = { 0, 0 }; /* (C) enable gameports */
|
||||
int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */
|
||||
int isartc_type = 0; /* (C) enable ISA RTC card */
|
||||
int gfxcard[GFXCARD_MAX] = { 0, 0 }; /* (C) graphics/video card */
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*
|
||||
* Implementation of a generic Game Port.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* RichardG, <richardg867@gmail.com>
|
||||
@@ -18,7 +16,7 @@
|
||||
* Copyright 2016-2022 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2021 RichardG.
|
||||
* Copyright 2021-2024 Jasmine Iwanek.
|
||||
* Copyright 2021-2025 Jasmine Iwanek.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -35,6 +33,12 @@
|
||||
#include <86box/gameport.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
device_t game_ports[GAMEPORT_MAX];
|
||||
|
||||
typedef struct {
|
||||
const device_t *device;
|
||||
} GAMEPORT;
|
||||
|
||||
typedef struct g_axis_t {
|
||||
pc_timer_t timer;
|
||||
int axis_nr;
|
||||
@@ -733,3 +737,63 @@ const device_t gameport_sio_1io_device = {
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
static const GAMEPORT gameports[] = {
|
||||
{ &device_none },
|
||||
{ &device_internal },
|
||||
{ &gameport_device },
|
||||
{ &gameport_208_device },
|
||||
{ &gameport_pnp_device },
|
||||
{ &gameport_tm_acm_device },
|
||||
{ NULL }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
/* UI */
|
||||
int
|
||||
gameport_available(int port)
|
||||
{
|
||||
if (gameports[port].device)
|
||||
return (device_available(gameports[port].device));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* UI */
|
||||
const device_t *
|
||||
gameports_getdevice(int port)
|
||||
{
|
||||
return (gameports[port].device);
|
||||
}
|
||||
|
||||
/* UI */
|
||||
int
|
||||
gameport_has_config(int port)
|
||||
{
|
||||
if (!gameports[port].device)
|
||||
return 0;
|
||||
|
||||
return (device_has_config(gameports[port].device) ? 1 : 0);
|
||||
}
|
||||
|
||||
/* UI */
|
||||
const char *
|
||||
gameport_get_internal_name(int port)
|
||||
{
|
||||
return device_get_internal_name(gameports[port].device);
|
||||
}
|
||||
|
||||
/* UI */
|
||||
int
|
||||
gameport_get_from_internal_name(const char *str)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (gameports[c].device != NULL) {
|
||||
if (!strcmp(gameports[c].device->internal_name, str))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
*
|
||||
* Main include file for the application.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Jasmine Iwanek, <jriwanek@gmail.com>
|
||||
*
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
* Copyright 2017-2020 Fred N. van Kempen.
|
||||
* Copyright 2021 Laci bá'
|
||||
* Copyright 2021-2025 Jasmine Iwanek.
|
||||
*/
|
||||
#ifndef EMU_86BOX_H
|
||||
#define EMU_86BOX_H
|
||||
@@ -131,6 +131,7 @@ extern int bugger_enabled; /* (C) enable ISAbugger */
|
||||
extern int novell_keycard_enabled; /* (C) enable Novell NetWare 2.x key card emulation. */
|
||||
extern int postcard_enabled; /* (C) enable POST card */
|
||||
extern int unittester_enabled; /* (C) enable unit tester device */
|
||||
extern int gameport_type[]; /* (C) enable gameports */
|
||||
extern int isamem_type[]; /* (C) enable ISA mem cards */
|
||||
extern int isartc_type; /* (C) enable ISA RTC card */
|
||||
extern int sound_is_float; /* (C) sound uses FP values */
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*
|
||||
* Definitions for the generic game port handlers.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* RichardG, <richardg867@gmail.com>
|
||||
@@ -18,11 +16,13 @@
|
||||
* Copyright 2016-2022 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2021 RichardG.
|
||||
* Copyright 2021-2024 Jasmine Iwanek.
|
||||
* Copyright 2021-2025 Jasmine Iwanek.
|
||||
*/
|
||||
#ifndef EMU_GAMEPORT_H
|
||||
#define EMU_GAMEPORT_H
|
||||
|
||||
#define GAMEPORT_MAX 2
|
||||
|
||||
#define MAX_PLAT_JOYSTICKS 8
|
||||
#define MAX_JOYSTICKS 4
|
||||
|
||||
@@ -110,10 +110,20 @@ typedef struct joystick_if_t {
|
||||
const char *pov_names[MAX_JOY_POVS];
|
||||
} joystick_if_t;
|
||||
|
||||
extern device_t game_ports[GAMEPORT_MAX];
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int gameport_available(int port);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *gameport_getdevice(int port);
|
||||
#endif
|
||||
extern int gameport_has_config(int port);
|
||||
extern const char *gameport_get_internal_name(int port);
|
||||
extern int gameport_get_from_internal_name(const char *str);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t gameport_device;
|
||||
extern const device_t gameport_201_device;
|
||||
@@ -173,6 +183,15 @@ extern const joystick_if_t joystick_ch_flightstick_pro;
|
||||
extern const joystick_if_t joystick_sw_pad;
|
||||
|
||||
extern const joystick_if_t joystick_tm_fcs;
|
||||
|
||||
extern int gameport_available(int);
|
||||
extern int gameport_has_config(int);
|
||||
extern const char *gameport_get_internal_name(int);
|
||||
extern int gampeport_get_from_internal_name(char *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t *gameport_getdevice(int);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user