Conflicts:
	libretro/libretro.c
This commit is contained in:
twinaphex 2014-08-10 05:45:34 +02:00
commit b7b4ce74c0
15 changed files with 323 additions and 159 deletions

View File

@ -197,7 +197,7 @@ LIBRETRO_SRC := $(GENPLUS_SRC_DIR)/genesis.c \
$(GENPLUS_SRC_DIR)/input_hw/paddle.c \
$(GENPLUS_SRC_DIR)/input_hw/sportspad.c \
$(GENPLUS_SRC_DIR)/input_hw/teamplayer.c \
$(GENPLUS_SRC_DIR)/input_hw/xe_a1p.c \
$(GENPLUS_SRC_DIR)/input_hw/xe_1ap.c \
$(GENPLUS_SRC_DIR)/input_hw/terebi_oekaki.c \
$(GENPLUS_SRC_DIR)/cd_hw/cd_cart.c \
$(GENPLUS_SRC_DIR)/cd_hw/cdc.c \

View File

@ -254,7 +254,7 @@ static const rominfo_t game_list[] =
{0xE42E4998, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Football */
{0x41C948BF, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Soccer */
/* games requiring homemade multitap */
/* games requiring Furrtek's Master Tap */
{0xFAB6F52F, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.0) */
{0x143AB50B, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.1) */

View File

@ -1,7 +1,7 @@
/***************************************************************************************
* Genesis Plus
* 2-Buttons, 3-Buttons & 6-Buttons controller support
* Additional support for J-Cart, 4-Way Play & homemade Master System multitap
* Additional support for J-Cart, 4-Way Play & Master Tap adapters
*
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
*
@ -66,7 +66,7 @@ void gamepad_reset(int port)
/* reset 4-WayPlay latch */
latch = 0;
/* reset Master System multitap flip-flop */
/* reset Master Tap flip-flop */
flipflop[port>>2].Latch = 0;
flipflop[port>>2].Counter = 0;
}
@ -250,7 +250,7 @@ void jcart_write(unsigned int address, unsigned int data)
/*--------------------------------------------------------------------------*/
/* Master System multitap ports handler (original design by Furrtek) */
/* Master Tap ports handler (unofficial, designed by Furrtek) */
/* cf. http://www.smspower.org/uploads/Homebrew/BOoM-SMS-sms4p_2.png */
/*--------------------------------------------------------------------------*/
unsigned char mastertap_1_read(void)

View File

@ -1,7 +1,7 @@
/***************************************************************************************
* Genesis Plus
* 2-Buttons, 3-Buttons & 6-Buttons controller support
* Additional support for J-Cart, 4-Way Play & homemade Master System multitap
* Additional support for J-Cart, 4-Way Play & Master Tap adapters
*
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
*

View File

@ -42,7 +42,7 @@
#include "lightgun.h"
#include "mouse.h"
#include "activator.h"
#include "xe_a1p.h"
#include "xe_1ap.h"
#include "teamplayer.h"
#include "paddle.h"
#include "sportspad.h"
@ -120,9 +120,9 @@ void input_init(void)
break;
}
case SYSTEM_XE_A1P:
case SYSTEM_XE_1AP:
{
input.dev[0] = DEVICE_XE_A1P;
input.dev[0] = DEVICE_XE_1AP;
player++;
break;
}
@ -240,9 +240,9 @@ void input_init(void)
break;
}
case SYSTEM_XE_A1P:
case SYSTEM_XE_1AP:
{
input.dev[4] = DEVICE_XE_A1P;
input.dev[4] = DEVICE_XE_1AP;
player++;
break;
}
@ -381,9 +381,9 @@ void input_reset(void)
break;
}
case DEVICE_XE_A1P:
case DEVICE_XE_1AP:
{
xe_a1p_reset(i);
xe_1ap_reset(i);
break;
}

View File

@ -46,15 +46,15 @@
/* Ports configuration */
#define NO_SYSTEM (0) /* unconnected port*/
#define SYSTEM_GAMEPAD (1) /* 2-buttons, 3-buttons or 6-buttons Control Pad */
#define SYSTEM_MOUSE (2) /* Sega Mouse */
#define SYSTEM_MENACER (3) /* Sega Menacer (port B only) */
#define SYSTEM_JUSTIFIER (4) /* Konami Justifiers (port B only) */
#define SYSTEM_XE_A1P (5) /* XE-A1P analog controller (port A only) */
#define SYSTEM_MOUSE (2) /* Sega Mouse (only supported in either port A or port B) */
#define SYSTEM_MENACER (3) /* Sega Menacer (only supported in port B) */
#define SYSTEM_JUSTIFIER (4) /* Konami Justifiers (only supported in port B) */
#define SYSTEM_XE_1AP (5) /* XE-1AP analog controller */
#define SYSTEM_ACTIVATOR (6) /* Sega Activator */
#define SYSTEM_LIGHTPHASER (7) /* Sega Light Phaser (Master System) */
#define SYSTEM_PADDLE (8) /* Sega Paddle Control (Master System) */
#define SYSTEM_SPORTSPAD (9) /* Sega Sports Pad (Master System) */
#define SYSTEM_MASTERTAP (10) /* Multi Tap -- Master System homemade */
#define SYSTEM_LIGHTPHASER (7) /* Sega Light Phaser */
#define SYSTEM_PADDLE (8) /* Sega Paddle Control */
#define SYSTEM_SPORTSPAD (9) /* Sega Sports Pad */
#define SYSTEM_MASTERTAP (10) /* Multi Tap -- Furrtek's Master Tap (unofficial) */
#define SYSTEM_TEAMPLAYER (11) /* Multi Tap -- Sega TeamPlayer */
#define SYSTEM_WAYPLAY (12) /* Multi Tap -- EA 4-Way Play (use both ports) */
@ -69,7 +69,7 @@
#define DEVICE_SPORTSPAD (0x06) /* Sega Sports Pad */
#define DEVICE_PICO (0x07) /* PICO tablet */
#define DEVICE_TEREBI (0x08) /* Terebi Oekaki tablet */
#define DEVICE_XE_A1P (0x09) /* XE-A1P analog controller */
#define DEVICE_XE_1AP (0x09) /* XE-1AP analog controller */
#define DEVICE_ACTIVATOR (0x0a) /* Activator */
/* Default Input bitmasks */

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus
* XE-A1P analog controller support
* XE-1AP analog controller support
*
* Copyright (C) 2011-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2011-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -43,20 +43,20 @@ static struct
uint8 State;
uint8 Counter;
uint8 Latency;
} xe_a1p[2];
} xe_1ap[2];
void xe_a1p_reset(int index)
void xe_1ap_reset(int index)
{
input.analog[index][0] = 128;
input.analog[index][1] = 128;
input.analog[index+1][0] = 128;
index >>= 2;
xe_a1p[index].State = 0x40;
xe_a1p[index].Counter = 0;
xe_a1p[index].Latency = 0;
xe_1ap[index].State = 0x40;
xe_1ap[index].Counter = 0;
xe_1ap[index].Latency = 0;
}
INLINE unsigned char xe_a1p_read(int index)
INLINE unsigned char xe_1ap_read(int index)
{
unsigned int temp = 0x40;
unsigned int port = index << 2;
@ -72,12 +72,12 @@ INLINE unsigned char xe_a1p_read(int index)
uint16 pad = ~input.pad[port];
/* Current internal cycle (0-7) */
unsigned int cycle = xe_a1p[index].Counter & 7;
unsigned int cycle = xe_1ap[index].Counter & 7;
/* Current 4-bit data cycle */
/* There are eight internal data cycle for each 5 acquisition sequence */
/* First 4 return the same 4-bit data, next 4 return next 4-bit data */
switch (xe_a1p[index].Counter >> 2)
switch (xe_1ap[index].Counter >> 2)
{
case 0:
temp |= ((pad >> 8) & 0x0F); /* E1 E2 Start Select */
@ -121,62 +121,62 @@ INLINE unsigned char xe_a1p_read(int index)
cycle = (cycle + 1) & 7;
/* Update internal cycle counter */
xe_a1p[index].Counter = (xe_a1p[index].Counter & ~7) | cycle;
xe_1ap[index].Counter = (xe_1ap[index].Counter & ~7) | cycle;
/* Update internal latency on each read */
xe_a1p[index].Latency++;
xe_1ap[index].Latency++;
return temp;
}
INLINE void xe_a1p_write(int index, unsigned char data, unsigned char mask)
INLINE void xe_1ap_write(int index, unsigned char data, unsigned char mask)
{
/* update bits set as output only */
data = (xe_a1p[index].State & ~mask) | (data & mask);
data = (xe_1ap[index].State & ~mask) | (data & mask);
/* look for TH 1->0 transitions */
if (!(data & 0x40) && (xe_a1p[index].State & 0x40))
if (!(data & 0x40) && (xe_1ap[index].State & 0x40))
{
/* reset acquisition cycle */
xe_a1p[index].Latency = xe_a1p[index].Counter = 0;
xe_1ap[index].Latency = xe_1ap[index].Counter = 0;
}
else
{
/* some games immediately write new data to TH */
/* so we make sure first sequence has actually been handled */
if (xe_a1p[index].Latency > 2)
if (xe_1ap[index].Latency > 2)
{
/* next acquisition sequence */
xe_a1p[index].Counter = (xe_a1p[index].Counter & ~7) + 8;
xe_1ap[index].Counter = (xe_1ap[index].Counter & ~7) + 8;
/* 5 sequence max with 8 cycles each */
if (xe_a1p[index].Counter > 32)
if (xe_1ap[index].Counter > 32)
{
xe_a1p[index].Counter = 32;
xe_1ap[index].Counter = 32;
}
}
}
/* update internal state */
xe_a1p[index].State = data;
xe_1ap[index].State = data;
}
unsigned char xe_a1p_1_read(void)
unsigned char xe_1ap_1_read(void)
{
return xe_a1p_read(0);
return xe_1ap_read(0);
}
unsigned char xe_a1p_2_read(void)
unsigned char xe_1ap_2_read(void)
{
return xe_a1p_read(1);
return xe_1ap_read(1);
}
void xe_a1p_1_write(unsigned char data, unsigned char mask)
void xe_1ap_1_write(unsigned char data, unsigned char mask)
{
xe_a1p_write(0, data, mask);
xe_1ap_write(0, data, mask);
}
void xe_a1p_2_write(unsigned char data, unsigned char mask)
void xe_1ap_2_write(unsigned char data, unsigned char mask)
{
xe_a1p_write(1, data, mask);
xe_1ap_write(1, data, mask);
}

View File

@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus
* XE-A1P analog controller support
* XE-1AP analog controller support
*
* Copyright (C) 2011-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2011-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -36,14 +36,14 @@
*
****************************************************************************************/
#ifndef _XE_A1PH_
#define _XE_A1PH_
#ifndef _XE_1APH_
#define _XE_1APH_
/* Function prototypes */
extern void xe_a1p_reset(int index);
extern unsigned char xe_a1p_1_read(void);
extern unsigned char xe_a1p_2_read(void);
extern void xe_a1p_1_write(unsigned char data, unsigned char mask);
extern void xe_a1p_2_write(unsigned char data, unsigned char mask);
extern void xe_1ap_reset(int index);
extern unsigned char xe_1ap_1_read(void);
extern unsigned char xe_1ap_2_read(void);
extern void xe_1ap_1_write(unsigned char data, unsigned char mask);
extern void xe_1ap_2_write(unsigned char data, unsigned char mask);
#endif

View File

@ -44,7 +44,7 @@
#include "lightgun.h"
#include "mouse.h"
#include "activator.h"
#include "xe_a1p.h"
#include "xe_1ap.h"
#include "teamplayer.h"
#include "paddle.h"
#include "sportspad.h"
@ -101,10 +101,10 @@ void io_init(void)
break;
}
case SYSTEM_XE_A1P:
case SYSTEM_XE_1AP:
{
port[0].data_w = xe_a1p_1_write;
port[0].data_r = xe_a1p_1_read;
port[0].data_w = xe_1ap_1_write;
port[0].data_r = xe_1ap_1_read;
break;
}
@ -174,10 +174,10 @@ void io_init(void)
break;
}
case SYSTEM_XE_A1P:
case SYSTEM_XE_1AP:
{
port[1].data_w = xe_a1p_2_write;
port[1].data_r = xe_a1p_2_read;
port[1].data_w = xe_1ap_2_write;
port[1].data_r = xe_1ap_2_read;
break;
}

View File

@ -101,7 +101,7 @@ extern const u8 Ctrl_gamepad_png[];
extern const u8 Ctrl_justifiers_png[];
extern const u8 Ctrl_menacer_png[];
extern const u8 Ctrl_mouse_png[];
extern const u8 Ctrl_xe_a1p_png[];
extern const u8 Ctrl_xe_1ap_png[];
extern const u8 Ctrl_activator_png[];
extern const u8 Ctrl_lightphaser_png[];
extern const u8 Ctrl_paddle_png[];
@ -2057,7 +2057,7 @@ static void ctrlmenu(void)
{NULL,Ctrl_mouse_png ,"","Select Port 1 device", 97,113,64,88},
{NULL,Ctrl_menacer_png ,"","Select Port 1 device", 94,113,80,88},
{NULL,Ctrl_justifiers_png ,"","Select Port 1 device", 88,117,80,84},
{NULL,Ctrl_xe_a1p_png ,"","Select Port 1 device", 98,118,72,84},
{NULL,Ctrl_xe_1ap_png ,"","Select Port 1 device", 98,118,72,84},
{NULL,Ctrl_activator_png ,"","Select Port 1 device", 94,121,72,80},
{NULL,Ctrl_lightphaser_png,"","Select Port 1 device", 89,109,88,92},
{NULL,Ctrl_paddle_png ,"","Select Port 1 device", 86,117,96,84},
@ -2072,7 +2072,7 @@ static void ctrlmenu(void)
{NULL,Ctrl_mouse_png ,"","Select Port 2 device", 97,283,64,88},
{NULL,Ctrl_menacer_png ,"","Select Port 2 device", 94,283,80,88},
{NULL,Ctrl_justifiers_png ,"","Select Port 2 device", 88,287,80,84},
{NULL,Ctrl_xe_a1p_png ,"","Select Port 2 device", 98,288,72,84},
{NULL,Ctrl_xe_1ap_png ,"","Select Port 2 device", 98,288,72,84},
{NULL,Ctrl_activator_png ,"","Select Port 2 device", 94,291,72,80},
{NULL,Ctrl_lightphaser_png,"","Select Port 2 device", 89,279,88,92},
{NULL,Ctrl_paddle_png ,"","Select Port 2 device", 86,287,96,84},
@ -2502,7 +2502,7 @@ static void ctrlmenu(void)
GUI_DrawMenuFX(m, 20, 0);
/* some devices require analog sticks */
if ((input.dev[index] == DEVICE_XE_A1P) && ((config.input[player].device == -1) || (config.input[player].device == 1)))
if ((input.dev[index] == DEVICE_XE_1AP) && ((config.input[player].device == -1) || (config.input[player].device == 1)))
{
GUI_WaitPrompt("Warning","One Analog Stick required !");
}

View File

@ -234,7 +234,7 @@ static void pad_update(s8 chan, u8 i)
}
/* Default menu key (right analog stick if not needed by emulated device) */
if ((input.dev[i] < DEVICE_XE_A1P) && (PAD_SubStickX(chan) > ANALOG_SENSITIVITY))
if ((input.dev[i] < DEVICE_XE_1AP) && (PAD_SubStickX(chan) > ANALOG_SENSITIVITY))
{
ConfigRequested = 1;
return;
@ -274,7 +274,7 @@ static void pad_update(s8 chan, u8 i)
break;
}
case DEVICE_XE_A1P:
case DEVICE_XE_1AP:
{
/* Left Stick analog position [0-255] */
input.analog[i][0] = (x + 128);
@ -747,7 +747,7 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
break;
}
case DEVICE_XE_A1P:
case DEVICE_XE_1AP:
{
/* Left Stick analog position [0-255] */
input.analog[i][0] = (x + 128);
@ -1324,7 +1324,7 @@ void gx_input_Config(u8 chan, u8 device, u8 type)
break;
}
case DEVICE_XE_A1P:
case DEVICE_XE_1AP:
{
first_key = KEY_BUTTONA;
last_key = KEY_MODE;

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -31,7 +31,7 @@ LOCAL_SRC_FILES := $(GENPLUS_SRC_DIR)/genesis.c \
$(GENPLUS_SRC_DIR)/input_hw/paddle.c \
$(GENPLUS_SRC_DIR)/input_hw/sportspad.c \
$(GENPLUS_SRC_DIR)/input_hw/teamplayer.c \
$(GENPLUS_SRC_DIR)/input_hw/xe_a1p.c \
$(GENPLUS_SRC_DIR)/input_hw/xe_1ap.c \
$(GENPLUS_SRC_DIR)/input_hw/terebi_oekaki.c \
$(GENPLUS_SRC_DIR)/cd_hw/cd_cart.c \
$(GENPLUS_SRC_DIR)/cd_hw/cdc.c \

View File

@ -21,12 +21,16 @@
#define RETRO_DEVICE_MDPAD_3B_TEAMPLAYER RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 5)
#define RETRO_DEVICE_MDPAD_6B_TEAMPLAYER RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 6)
#define RETRO_DEVICE_MSPAD_2B_MASTERTAP RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 7)
#define RETRO_DEVICE_MDPAD_6B_ALT RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 8)
#define RETRO_DEVICE_PADDLE RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_ANALOG, 0)
#define RETRO_DEVICE_SPORTSPAD RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_ANALOG, 1)
#define RETRO_DEVICE_XE_1AP RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_ANALOG, 2)
#define RETRO_DEVICE_PHASER RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_LIGHTGUN, 0)
#define RETRO_DEVICE_MENACER RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_LIGHTGUN, 1)
#define RETRO_DEVICE_JUSTIFIERS RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_LIGHTGUN, 2)
#include "shared.h"
#include "libretro.h"
#include "state.h"
#include "genesis.h"
#include "md_ntsc.h"
#include "sms_ntsc.h"
@ -51,7 +55,6 @@ char CART_BRAM[256];
static int vwidth;
static int vheight;
static bool md6_alt = false;
static uint32_t brm_crc[2];
static uint8_t brm_format[0x40] =
@ -167,7 +170,7 @@ int load_archive(char *filename, unsigned char *buffer, int maxsize, char *exten
void osd_input_update(void)
{
int i, padnum = 0;
int i, player = 0;
unsigned int temp;
input_poll_cb();
@ -175,81 +178,216 @@ void osd_input_update(void)
for (i = 0; i < MAX_INPUTS; i++)
{
temp = 0;
if(md6_alt)
switch (input.dev[i])
{
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
temp |= INPUT_A;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A))
temp |= INPUT_B;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R))
temp |= INPUT_C;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y))
case DEVICE_PAD6B:
{
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L))
temp |= INPUT_X;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X))
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X))
temp |= INPUT_Y;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L))
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R))
temp |= INPUT_Z;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START))
temp |= INPUT_START;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))
temp |= INPUT_UP;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))
temp |= INPUT_DOWN;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))
temp |= INPUT_LEFT;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))
temp |= INPUT_RIGHT;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT))
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT))
temp |= INPUT_MODE;
padnum++;
}
else
{
switch (input.dev[i])
{
case DEVICE_PAD6B:
{
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L))
temp |= INPUT_X;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X))
temp |= INPUT_Y;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R))
temp |= INPUT_Z;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT))
temp |= INPUT_MODE;
}
}
case DEVICE_PAD3B:
{
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y))
temp |= INPUT_A;
}
case DEVICE_PAD3B:
{
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y))
temp |= INPUT_A;
}
case DEVICE_PAD2B:
{
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
temp |= INPUT_B;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A))
temp |= INPUT_C;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START))
temp |= INPUT_START;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))
temp |= INPUT_UP;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))
temp |= INPUT_DOWN;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))
temp |= INPUT_LEFT;
if (input_state_cb(padnum, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))
temp |= INPUT_RIGHT;
case DEVICE_PAD2B:
{
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
temp |= INPUT_B;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A))
temp |= INPUT_C;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START))
temp |= INPUT_START;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))
temp |= INPUT_UP;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))
temp |= INPUT_DOWN;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))
temp |= INPUT_LEFT;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))
temp |= INPUT_RIGHT;
padnum++;
break;
}
player++;
break;
}
default:
break;
}
case DEVICE_MOUSE:
{
input.analog[i][0] = input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
input.analog[i][1] = input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
if (input.analog[i][0] < -255)
input.analog[i][0] = -255;
else if (input.analog[i][0] > 255)
input.analog[i][0] = 255;
if (input.analog[i][1] < -255)
input.analog[i][1] = -255;
else if (input.analog[i][1] > 255)
input.analog[i][1] = 255;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT))
temp |= INPUT_MOUSE_LEFT;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT))
temp |= INPUT_MOUSE_RIGHT;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELDOWN))
temp |= INPUT_MOUSE_CENTER;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_MIDDLE))
temp |= INPUT_START;
player++;
break;
}
case DEVICE_LIGHTGUN:
{
input.analog[i][0] += (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_X) / 2);
input.analog[i][1] += (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_Y) / 2);
if (input.analog[i][0] < 0)
input.analog[i][0] = 0;
else if (input.analog[i][0] > bitmap.viewport.w)
input.analog[i][0] = bitmap.viewport.w;
if (input.analog[i][1] < 0)
input.analog[i][1] = 0;
else if (input.analog[i][1] > bitmap.viewport.h)
input.analog[i][1] = bitmap.viewport.h;
if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER))
temp |= INPUT_A;
if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TURBO))
temp |= INPUT_B;
if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_PAUSE))
temp |= INPUT_C;
if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_START))
temp |= INPUT_START;
player++;
break;
}
case DEVICE_PADDLE:
{
input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
temp |= INPUT_BUTTON1;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START))
temp |= INPUT_START;
player++;
break;
}
case DEVICE_SPORTSPAD:
{
input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8;
input.analog[i][1] = (input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) + 0x8000) >> 8;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
temp |= INPUT_BUTTON1;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A))
temp |= INPUT_BUTTON2;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START))
temp |= INPUT_START;
player++;
break;
}
case DEVICE_PICO:
{
input.analog[i][0] + input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
input.analog[i][1] += input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
if (input.analog[0][0] < 0x17c)
input.analog[0][0] = 0x17c;
else if (input.analog[0][0] > 0x3c)
input.analog[0][0] = 0x3c;
if (input.analog[0][1] < 0x1fc)
input.analog[0][1] = 0x1fc;
else if (input.analog[0][1] > 0x3f3)
input.analog[0][1] = 0x3f3;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT))
temp |= INPUT_PICO_PEN;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT))
temp |= INPUT_PICO_RED;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELUP))
pico_current = (pico_current - 1) & 7;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELDOWN))
pico_current = (pico_current + 1) & 7;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))
temp |= INPUT_UP;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))
temp |= INPUT_DOWN;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))
temp |= INPUT_LEFT;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))
temp |= INPUT_RIGHT;
player++;
break;
}
case DEVICE_TEREBI:
{
input.analog[i][0] + input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
input.analog[i][1] += input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
if (input.analog[0][0] < 0)
input.analog[0][0] = 0;
else if (input.analog[0][0] > 250)
input.analog[0][0] = 250;
if (input.analog[0][1] < 0)
input.analog[0][1] = 0;
else if (input.analog[0][1] > 250)
input.analog[0][1] = 250;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT))
temp |= INPUT_BUTTON1;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_MIDDLE))
temp |= INPUT_START;
player++;
break;
}
case DEVICE_XE_1AP:
{
input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8;
input.analog[i][1] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_Y) + 0x8000) >> 8;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R))
temp |= INPUT_XE_A;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2))
temp |= INPUT_XE_B;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L))
temp |= INPUT_XE_C;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2))
temp |= INPUT_XE_D;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y))
temp |= INPUT_XE_E1;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
temp |= INPUT_XE_E2;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT))
temp |= INPUT_XE_SELECT;
if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START))
temp |= INPUT_XE_START;
player++;
break;
}
default:
break;
}
input.pad[i] = temp;
@ -791,13 +929,17 @@ void retro_set_environment(retro_environment_t cb)
{ "Joypad Port Empty", RETRO_DEVICE_NONE },
{ "MD Joypad 3 Button", RETRO_DEVICE_MDPAD_3B },
{ "MD Joypad 6 Button", RETRO_DEVICE_MDPAD_6B },
{ "MD Joypad 6 Alternate", RETRO_DEVICE_MDPAD_6B_ALT },
{ "MS Joypad 2 Button", RETRO_DEVICE_MSPAD_2B },
{ "MD Joypad 3 Button + 4-WayPlay", RETRO_DEVICE_MDPAD_3B_WAYPLAY },
{ "MD Joypad 6 Button + 4-WayPlay", RETRO_DEVICE_MDPAD_6B_WAYPLAY },
{ "MD Joypad 3 Button + Teamplayer", RETRO_DEVICE_MDPAD_3B_TEAMPLAYER },
{ "MD Joypad 6 Button + Teamplayer", RETRO_DEVICE_MDPAD_6B_TEAMPLAYER },
{ "MS Joypad 2 Button + Master Tap", RETRO_DEVICE_MSPAD_2B_MASTERTAP },
{ "MS Light Phaser", RETRO_DEVICE_PHASER },
{ "MS Paddle Control", RETRO_DEVICE_PADDLE },
{ "MS Sports Pad", RETRO_DEVICE_SPORTSPAD },
{ "MD XE-1AP", RETRO_DEVICE_XE_1AP },
{ "MD Mouse", RETRO_DEVICE_MOUSE },
};
static const struct retro_controller_description port_2[] = {
@ -805,18 +947,24 @@ void retro_set_environment(retro_environment_t cb)
{ "Joypad Port Empty", RETRO_DEVICE_NONE },
{ "MD Joypad 3 Button", RETRO_DEVICE_MDPAD_3B },
{ "MD Joypad 6 Button", RETRO_DEVICE_MDPAD_6B },
{ "MD Joypad 6 Alternate", RETRO_DEVICE_MDPAD_6B_ALT },
{ "MS Joypad 2 Button", RETRO_DEVICE_MSPAD_2B },
{ "MD Joypad 3 Button + 4-WayPlay", RETRO_DEVICE_MDPAD_3B_WAYPLAY },
{ "MD Joypad 6 Button + 4-WayPlay", RETRO_DEVICE_MDPAD_6B_WAYPLAY },
{ "MD Joypad 3 Button + Teamplayer", RETRO_DEVICE_MDPAD_3B_TEAMPLAYER },
{ "MD Joypad 6 Button + Teamplayer", RETRO_DEVICE_MDPAD_6B_TEAMPLAYER },
{ "MS Joypad 2 Button + Master Tap", RETRO_DEVICE_MSPAD_2B_MASTERTAP },
};
{ "MD Menacer", RETRO_DEVICE_MENACER },
{ "MD Justifiers", RETRO_DEVICE_JUSTIFIERS },
{ "MS Light Phaser", RETRO_DEVICE_PHASER },
{ "MS Paddle Control", RETRO_DEVICE_PADDLE },
{ "MS Sports Pad", RETRO_DEVICE_SPORTSPAD },
{ "MD XE-1AP", RETRO_DEVICE_XE_1AP },
{ "MD Mouse", RETRO_DEVICE_MOUSE },
};
static const struct retro_controller_info ports[] = {
{ port_1, 10 },
{ port_2, 10 },
{ port_1, 15 },
{ port_2, 17 },
{ 0 },
};
@ -866,11 +1014,6 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
config.input[port*4].padtype = DEVICE_PAD6B;
input.system[port] = SYSTEM_GAMEPAD;
break;
case RETRO_DEVICE_MDPAD_6B_ALT:
config.input[port*4].padtype = DEVICE_PAD6B;
input.system[port] = SYSTEM_GAMEPAD;
md6_alt = true;
break;
case RETRO_DEVICE_MSPAD_2B:
config.input[port*4].padtype = DEVICE_PAD2B;
input.system[port] = SYSTEM_GAMEPAD;
@ -880,7 +1023,7 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
int i;
for (i=0; i<4; i++)
{
config.input[port*4 + i].padtype = DEVICE_PAD3B;
config.input[i].padtype = DEVICE_PAD3B;
}
input.system[0] = input.system[1] = SYSTEM_WAYPLAY;
break;
@ -890,7 +1033,7 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
int i;
for (i=0; i<4; i++)
{
config.input[port*4 + i].padtype = DEVICE_PAD6B;
config.input[i].padtype = DEVICE_PAD6B;
}
input.system[0] = input.system[1] = SYSTEM_WAYPLAY;
break;
@ -925,6 +1068,27 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
input.system[port] = SYSTEM_MASTERTAP;
break;
}
case RETRO_DEVICE_MENACER:
input.system[1] = SYSTEM_MENACER;
break;
case RETRO_DEVICE_JUSTIFIERS:
input.system[1] = SYSTEM_JUSTIFIER;
break;
case RETRO_DEVICE_PHASER:
input.system[port] = SYSTEM_LIGHTPHASER;
break;
case RETRO_DEVICE_PADDLE:
input.system[port] = SYSTEM_PADDLE;
break;
case RETRO_DEVICE_SPORTSPAD:
input.system[port] = SYSTEM_SPORTSPAD;
break;
case RETRO_DEVICE_XE_1AP:
input.system[port] = SYSTEM_XE_1AP;
break;
case RETRO_DEVICE_MOUSE:
input.system[port] = SYSTEM_MOUSE;
break;
case RETRO_DEVICE_JOYPAD:
default:
config.input[port*4].padtype = DEVICE_PAD2B | DEVICE_PAD6B | DEVICE_PAD3B;

View File

@ -575,7 +575,7 @@ int sdl_input_update(void)
break;
}
case DEVICE_XE_A1P:
case DEVICE_XE_1AP:
{
/* A,B,C,D,Select,START,E1,E2 buttons -> E1(?) E2(?) START SELECT(?) A B C D */
if(keystate[SDLK_a]) input.pad[joynum] |= INPUT_START;