Genesis-Plus-GX/source/gen_input.h

102 lines
3.9 KiB
C
Raw Normal View History

2008-08-07 14:26:07 +02:00
/***************************************************************************************
* Genesis Plus 1.2a
* Peripheral Input Support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* modified by Eke-Eke (compatibility fixes & additional code), GC/Wii port
*
* 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
*
****************************************************************************************/
2007-08-10 22:34:06 +02:00
2008-08-21 22:34:00 +02:00
#ifndef _GEN_INPUT_H_
#define _GEN_INPUT_H_
2008-08-07 14:26:07 +02:00
/* Max. number of devices */
2008-08-07 14:26:07 +02:00
#define MAX_DEVICES (8)
/* Device types */
2008-12-10 19:16:30 +01:00
#define DEVICE_3BUTTON (0x00) /* 3-button gamepad */
#define DEVICE_6BUTTON (0x01) /* 6-button gamepad */
#define DEVICE_LIGHTGUN (0x02) /* Sega Menacer or Konami Justifier */
#define DEVICE_MOUSE (0x03) /* Sega Mouse */
#define DEVICE_2BUTTON (0x04) /* 2-button gamepad (not supported) */
#define NO_DEVICE (0x0F) /* unconnected */
2007-08-10 22:34:06 +02:00
/* Input bitmasks */
#define INPUT_MODE (0x00000800)
#define INPUT_Z (0x00000400)
#define INPUT_Y (0x00000200)
#define INPUT_X (0x00000100)
#define INPUT_START (0x00000080)
#define INPUT_C (0x00000040)
#define INPUT_B (0x00000020)
#define INPUT_A (0x00000010)
#define INPUT_LEFT (0x00000008)
#define INPUT_RIGHT (0x00000004)
#define INPUT_DOWN (0x00000002)
#define INPUT_UP (0x00000001)
/* System IO ports */
2008-08-07 14:26:07 +02:00
#define NO_SYSTEM (0) /* Unconnected Port*/
#define SYSTEM_GAMEPAD (1) /* Single Gamepad */
#define SYSTEM_MOUSE (2) /* Sega Mouse */
2008-12-10 19:16:30 +01:00
#define SYSTEM_MENACER (3) /* Sega Menacer (port 2) */
#define SYSTEM_JUSTIFIER (4) /* Konami Justifier (port 2) */
#define SYSTEM_TEAMPLAYER (5) /* Sega TeamPlayer */
#define SYSTEM_WAYPLAY (6) /* EA 4-Way Play (use both ports) */
2008-08-07 14:26:07 +02:00
2007-08-10 22:34:06 +02:00
typedef struct
{
2008-08-07 14:26:07 +02:00
uint8 dev[MAX_DEVICES]; /* Can be any of the DEVICE_* values */
uint32 pad[MAX_DEVICES]; /* Can be any of the INPUT_* bitmasks */
uint8 system[2]; /* Can be any of the SYSTEM_* bitmasks */
uint8 max; /* maximum number of connected devices */
uint8 current; /* current PAD number (4WAYPLAY) */
2008-12-10 19:16:30 +01:00
int analog[3][2]; /* analog devices */
2008-08-07 14:26:07 +02:00
int x_offset;
int y_offset;
2007-08-10 22:34:06 +02:00
} t_input;
2008-08-07 14:26:07 +02:00
/* Global variables */
2007-08-10 22:34:06 +02:00
extern t_input input;
/* Function prototypes */
2008-08-07 14:26:07 +02:00
extern void input_reset (void);
2007-08-10 22:34:06 +02:00
extern void input_update(void);
extern void input_raz(void);
2008-08-07 14:26:07 +02:00
/* Peripherals specific */
2008-12-04 20:32:22 +01:00
extern void mouse_write(uint32 data);
extern uint32 mouse_read(void);
extern uint32 menacer_read (void);
extern uint32 justifier_read (void);
extern uint32 gamepad_1_read (void);
extern uint32 gamepad_2_read (void);
extern void gamepad_1_write (uint32 data);
extern void gamepad_2_write (uint32 data);
extern uint32 wayplay_1_read (void);
extern uint32 wayplay_2_read (void);
extern void wayplay_1_write (uint32 data);
extern void wayplay_2_write (uint32 data);
extern uint32 teamplayer_1_read (void);
extern uint32 teamplayer_2_read (void);
extern void teamplayer_1_write (uint32 data);
extern void teamplayer_2_write (uint32 data);
extern uint32 jcart_read(uint32 address);
extern void jcart_write(uint32 address, uint32 data);
2007-08-10 22:34:06 +02:00
#endif