diff --git a/src/game/gameport.c b/src/game/gameport.c index 8c312a1..df93e79 100644 --- a/src/game/gameport.c +++ b/src/game/gameport.c @@ -8,7 +8,7 @@ * * Implementation of a generic Game Port. * - * Version: @(#)gameport.c 1.0.5 2018/03/27 + * Version: @(#)gameport.c 1.0.6 2018/03/28 * * Authors: Miran Grca, * Sarah Walker, @@ -173,7 +173,6 @@ gameport_write(uint16_t addr, uint8_t val, void *priv) timer_clock(); p->state |= 0x0f; - pclog("gameport_write : joysticks_present=%i\n", joysticks_present); p->axis[0].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 0)); p->axis[1].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 1)); diff --git a/src/game/gameport.h b/src/game/gameport.h index 4d40576..207d6ce 100644 --- a/src/game/gameport.h +++ b/src/game/gameport.h @@ -1,148 +1,148 @@ -/* - * VARCem Virtual ARchaeological Computer EMulator. - * An emulator of (mostly) x86-based PC systems and devices, - * using the ISA,EISA,VLB,MCA and PCI system buses, roughly - * spanning the era between 1981 and 1995. - * - * This file is part of the VARCem Project. - * - * Definitions for the generic game port handlers. - * - * NOTE: This module needs a good cleanup someday. - * - * Version: @(#)gameport.h 1.0.4 2018/03/19 - * - * Authors: Miran Grca, - * Sarah Walker, - * - * Copyright 2016-2018 Miran Grca. - * Copyright 2008-2017 Sarah Walker. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the: - * - * Free Software Foundation, Inc. - * 59 Temple Place - Suite 330 - * Boston, MA 02111-1307 - * USA. - */ -#ifndef EMU_GAMEPORT_H -# define EMU_GAMEPORT_H - - -#define JOYSTICK_TYPE_NONE 0 /* no joystick defined */ - -#define MAX_PLAT_JOYSTICKS 8 -#define MAX_JOYSTICKS 4 - -#define POV_X 0x80000000 -#define POV_Y 0x40000000 - -#define AXIS_NOT_PRESENT -99999 - -#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0) - - -typedef struct { - char name[64]; - - int a[8]; - int b[32]; - int p[4]; - - struct { - char name[32]; - int id; - } axis[8]; - - struct { - char name[32]; - int id; - } button[32]; - - struct { - char name[32]; - int id; - } pov[4]; - - int nr_axes; - int nr_buttons; - int nr_povs; -} plat_joystick_t; - -typedef struct { - int axis[8]; - int button[32]; - int pov[4]; - - int plat_joystick_nr; - int axis_mapping[8]; - int button_mapping[32]; - int pov_mapping[4][2]; -} joystick_t; - -typedef struct { - const char *name; - - void *(*init)(void); - void (*close)(void *p); - uint8_t (*read)(void *p); - void (*write)(void *p); - int (*read_axis)(void *p, int axis); - void (*a0_over)(void *p); - - int axis_count, - button_count, - pov_count; - int max_joysticks; - const char *axis_names[8]; - const char *button_names[32]; - const char *pov_names[4]; -} joystick_if_t; - - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef EMU_DEVICE_H -extern const device_t gameport_device; -extern const device_t gameport_201_device; -#endif - -extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS]; -extern joystick_t joystick_state[MAX_JOYSTICKS]; -extern int joysticks_present; - - -extern void joystick_init(void); -extern void joystick_close(void); -extern void joystick_process(void); - -extern char *joystick_get_name(int js); -extern int joystick_get_max_joysticks(int js); -extern int joystick_get_axis_count(int js); -extern int joystick_get_button_count(int js); -extern int joystick_get_pov_count(int js); -extern char *joystick_get_axis_name(int js, int id); -extern char *joystick_get_button_name(int js, int id); -extern char *joystick_get_pov_name(int js, int id); - -extern void gameport_update_joystick_type(void); - -#ifdef __cplusplus -} -#endif - - -#endif /*EMU_GAMEPORT_H*/ +/* + * VARCem Virtual ARchaeological Computer EMulator. + * An emulator of (mostly) x86-based PC systems and devices, + * using the ISA,EISA,VLB,MCA and PCI system buses, roughly + * spanning the era between 1981 and 1995. + * + * This file is part of the VARCem Project. + * + * Definitions for the generic game port handlers. + * + * NOTE: This module needs a good cleanup someday. + * + * Version: @(#)gameport.h 1.0.5 2018/03/28 + * + * Authors: Miran Grca, + * Sarah Walker, + * + * Copyright 2016-2018 Miran Grca. + * Copyright 2008-2017 Sarah Walker. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the: + * + * Free Software Foundation, Inc. + * 59 Temple Place - Suite 330 + * Boston, MA 02111-1307 + * USA. + */ +#ifndef EMU_GAMEPORT_H +# define EMU_GAMEPORT_H + + +#define JOYSTICK_TYPE_NONE 0 /* no joystick defined */ + +#define MAX_PLAT_JOYSTICKS 8 +#define MAX_JOYSTICKS 4 + +#define POV_X 0x80000000 +#define POV_Y 0x40000000 + +#define AXIS_NOT_PRESENT -99999 + +#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0) + + +typedef struct { + char name[64]; + + int a[8]; + int b[32]; + int p[4]; + + struct { + char name[32]; + int id; + } axis[8]; + + struct { + char name[32]; + int id; + } button[32]; + + struct { + char name[32]; + int id; + } pov[4]; + + int nr_axes; + int nr_buttons; + int nr_povs; +} plat_joystick_t; + +typedef struct { + int axis[8]; + int button[32]; + int pov[4]; + + int plat_joystick_nr; + int axis_mapping[8]; + int button_mapping[32]; + int pov_mapping[4][2]; +} joystick_t; + +typedef struct { + const char *name; + + void *(*init)(void); + void (*close)(void *p); + uint8_t (*read)(void *p); + void (*write)(void *p); + int (*read_axis)(void *p, int axis); + void (*a0_over)(void *p); + + int axis_count, + button_count, + pov_count; + int max_joysticks; + const char *axis_names[8]; + const char *button_names[32]; + const char *pov_names[4]; +} joystick_if_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef EMU_DEVICE_H +extern const device_t gameport_device; +extern const device_t gameport_201_device; +#endif + +extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS]; +extern joystick_t joystick_state[MAX_JOYSTICKS]; +extern int joysticks_present; + + +extern void joystick_init(void); +extern void joystick_close(void); +extern void joystick_process(void); + +extern char *joystick_get_name(int js); +extern int joystick_get_max_joysticks(int js); +extern int joystick_get_axis_count(int js); +extern int joystick_get_button_count(int js); +extern int joystick_get_pov_count(int js); +extern char *joystick_get_axis_name(int js, int id); +extern char *joystick_get_button_name(int js, int id); +extern char *joystick_get_pov_name(int js, int id); + +extern void gameport_update_joystick_type(void); + +#ifdef __cplusplus +} +#endif + + +#endif /*EMU_GAMEPORT_H*/ diff --git a/src/lang/language.h b/src/lang/language.h index 5255fa2..0716614 100644 --- a/src/lang/language.h +++ b/src/lang/language.h @@ -10,7 +10,7 @@ * * NOTE: FIXME: Strings 2176 and 2193 are same. * - * Version: @(#)language.h 1.0.4 2018/03/08 + * Version: @(#)language.h 1.0.5 2018/03/28 * * Author: Fred N. van Kempen, * @@ -147,14 +147,14 @@ #define IDS_2141 2141 // "Invalid PCap device" #define IDS_2142 2142 // "&Notify disk change" #define IDS_2143 2143 // "Type" -#define IDS_2144 2144 // "Standard 2-button joystick(s)" -#define IDS_2145 2145 // "Standard 4-button joystick" -#define IDS_2146 2146 // "Standard 6-button joystick" -#define IDS_2147 2147 // "Standard 8-button joystick" -#define IDS_2148 2148 // "CH Flightstick Pro" -#define IDS_2149 2149 // "Microsoft SideWinder Pad" -#define IDS_2150 2150 // "Thrustmaster Flight Cont.." -#define IDS_2151 2151 // "Disabled" +#define IDS_2144 2144 // "Disabled" +#define IDS_2145 2145 // "Standard 2-button joystick(s)" +#define IDS_2146 2146 // "Standard 4-button joystick" +#define IDS_2147 2147 // "Standard 6-button joystick" +#define IDS_2148 2148 // "Standard 8-button joystick" +#define IDS_2149 2149 // "CH Flightstick Pro" +#define IDS_2150 2150 // "Microsoft SideWinder Pad" +#define IDS_2151 2151 // "Thrustmaster Flight Cont.." #define IDS_2152 2152 // "None" #define IDS_2153 2153 // "Unable to load Accelerators" #define IDS_2154 2154 // "Unable to register Raw Input" diff --git a/src/video/video.h b/src/video/video.h index 6b9da8f..6a65114 100644 --- a/src/video/video.h +++ b/src/video/video.h @@ -160,7 +160,7 @@ typedef struct { typedef struct { int w, h; uint8_t *dat; - uint8_t **line; + uint8_t *line[]; } bitmap_t; typedef struct { diff --git a/src/win/VARCem.rc b/src/win/VARCem.rc index 822a969..95af334 100644 --- a/src/win/VARCem.rc +++ b/src/win/VARCem.rc @@ -8,7 +8,7 @@ * * Application resource script for Windows. * - * Version: @(#)VARCem.rc 1.0.8 2018/03/25 + * Version: @(#)VARCem.rc 1.0.9 2018/03/28 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -953,14 +953,14 @@ BEGIN IDS_2141 "Invalid PCap device" IDS_2142 "&Notify disk change" IDS_2143 "Type" - IDS_2144 "Standard 2-button joystick(s)" - IDS_2145 "Standard 4-button joystick" - IDS_2146 "Standard 6-button joystick" - IDS_2147 "Standard 8-button joystick" - IDS_2148 "CH Flightstick Pro" - IDS_2149 "Microsoft SideWinder Pad" - IDS_2150 "Thrustmaster Flight Control System" - IDS_2151 "Disabled" + IDS_2144 "Disabled" + IDS_2145 "Standard 2-button joystick(s)" + IDS_2146 "Standard 4-button joystick" + IDS_2147 "Standard 6-button joystick" + IDS_2148 "Standard 8-button joystick" + IDS_2149 "CH Flightstick Pro" + IDS_2150 "Microsoft SideWinder Pad" + IDS_2151 "Thrustmaster Flight Control System" IDS_2152 "None" IDS_2153 "Unable to load Keyboard Accelerators!" IDS_2154 "Unable to register Raw Input!" diff --git a/src/win/win_joystick.cpp b/src/win/win_joystick.cpp index da927f7..b3b67f2 100644 --- a/src/win/win_joystick.cpp +++ b/src/win/win_joystick.cpp @@ -11,7 +11,7 @@ * NOTE: Hacks currently needed to compile with MSVC; DX needs to * be updated to 11 or 12 or so. --FvK * - * Version: @(#)win_joystick.cpp 1.0.7 2018/03/26 + * Version: @(#)win_joystick.cpp 1.0.8 2018/03/28 * * Authors: Fred N. van Kempen, * Miran Grca, @@ -125,11 +125,11 @@ BOOL CALLBACK DIEnumDeviceObjectsCallback( return DIENUM_CONTINUE; } -void joystick_init() +void joystick_init(void) { int c; - if (joystick_type == 7) return; + if (joystick_type == JOYSTICK_TYPE_NONE) return; atexit(joystick_close); @@ -203,7 +203,7 @@ void joystick_init() } } -void joystick_close() +void joystick_close(void) { if (lpdi_joystick[1]) { @@ -245,7 +245,7 @@ void joystick_process(void) { int c, d; - if (joystick_type == 7) return; + if (joystick_type == JOYSTICK_TYPE_NONE) return; for (c = 0; c < joysticks_present; c++) { @@ -318,4 +318,3 @@ void joystick_process(void) } } } -