input: merge jammasd and jpac/ipac into a common option.
This commit is contained in:
12
MiSTer.ini
12
MiSTer.ini
@@ -101,17 +101,13 @@ refresh_max=0
|
||||
; 0 - disable
|
||||
controller_info=6
|
||||
|
||||
; JammaSD keys to joysticks translation
|
||||
; JammaSD/J-PAC/I-PAC keys to joysticks translation
|
||||
; You have to provide correct VID and PID of your input device
|
||||
jammasd_vid=0x04D8
|
||||
jammasd_pid=0xF3AD
|
||||
|
||||
; J-PAC keys to joysticks translation
|
||||
; Provide the VID and PID for your J-PAC/I-PAC
|
||||
; Examples: Legacy J-PAC with Mini-USB or USB capable I-PAC with PS/2 connectors VID=0xD209/PID=0x0301
|
||||
; USB Capable J-PAC with only PS/2 connectors VID=0x04B4/PID=0x0101
|
||||
jpac_vid=0xD209
|
||||
jpac_pid=0x0301
|
||||
; JammaSD: VID=0x04D8/PID=0xF3AD
|
||||
jamma_vid=0x04D8
|
||||
jamma_pid=0xF3AD
|
||||
|
||||
; Speeds in sniper/non-sniper modes of mouse emulation by joystick
|
||||
; 0 - (default) - faster move in non-sniper mode, slower move in sniper mode.
|
||||
|
||||
6
cfg.cpp
6
cfg.cpp
@@ -66,10 +66,8 @@ static const ini_var_t ini_vars[] =
|
||||
{ "CONTROLLER_INFO", (void*)(&(cfg.controller_info)), UINT8, 0, 10 },
|
||||
{ "REFRESH_MIN", (void*)(&(cfg.refresh_min)), UINT8, 0, 150 },
|
||||
{ "REFRESH_MAX", (void*)(&(cfg.refresh_max)), UINT8, 0, 150 },
|
||||
{ "JAMMASD_VID", (void*)(&(cfg.jammasd_vid)), UINT16, 0, 0xFFFF },
|
||||
{ "JAMMASD_PID", (void*)(&(cfg.jammasd_pid)), UINT16, 0, 0xFFFF },
|
||||
{ "JPAC_VID", (void*)(&(cfg.jpac_vid)), UINT16, 0, 0xFFFF },
|
||||
{ "JPAC_PID", (void*)(&(cfg.jpac_pid)), UINT16, 0, 0xFFFF },
|
||||
{ "JAMMA_VID", (void*)(&(cfg.jamma_vid)), UINT16, 0, 0xFFFF },
|
||||
{ "JAMMA_PID", (void*)(&(cfg.jamma_pid)), UINT16, 0, 0xFFFF },
|
||||
{ "SNIPER_MODE", (void*)(&(cfg.sniper_mode)), UINT8, 0, 1 },
|
||||
{ "BROWSE_EXPAND", (void*)(&(cfg.browse_expand)), UINT8, 0, 1 },
|
||||
};
|
||||
|
||||
6
cfg.h
6
cfg.h
@@ -40,10 +40,8 @@ typedef struct {
|
||||
uint16_t osd_timeout;
|
||||
uint8_t gamepad_defaults;
|
||||
uint8_t recents;
|
||||
uint16_t jammasd_vid;
|
||||
uint16_t jammasd_pid;
|
||||
uint16_t jpac_vid;
|
||||
uint16_t jpac_pid;
|
||||
uint16_t jamma_vid;
|
||||
uint16_t jamma_pid;
|
||||
uint8_t sniper_mode;
|
||||
uint8_t browse_expand;
|
||||
char bootcore[256];
|
||||
|
||||
90
input.cpp
90
input.cpp
@@ -852,8 +852,7 @@ enum QUIRK
|
||||
QUIRK_MADCATZ360,
|
||||
QUIRK_PDSP,
|
||||
QUIRK_PDSP_ARCADE,
|
||||
QUIRK_JAMMASD,
|
||||
QUIRK_JPAC,
|
||||
QUIRK_JAMMA,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@@ -2637,7 +2636,7 @@ void mergedevs()
|
||||
}
|
||||
}
|
||||
|
||||
// jammasd have shifted keys: when 1P start is kept pressed, it acts as a shift key,
|
||||
// Jammasd/J-PAC/I-PAC have shifted keys: when 1P start is kept pressed, it acts as a shift key,
|
||||
// outputting other key signals. Example: 1P start + 2P start = KEY_ESC
|
||||
// Shifted keys are passed as normal keyboard keys.
|
||||
static struct
|
||||
@@ -2645,7 +2644,7 @@ static struct
|
||||
uint16_t key;
|
||||
uint16_t player;
|
||||
uint16_t btn;
|
||||
} jammasd2joy[] =
|
||||
} jamma2joy[] =
|
||||
{
|
||||
{KEY_5, 1, 0x120}, // 1P coin
|
||||
{KEY_1, 1, 0x121}, // 1P start (shift key)
|
||||
@@ -2661,51 +2660,10 @@ static struct
|
||||
{KEY_X, 1, 0x12B}, // 1P 6
|
||||
{KEY_C, 1, 0x12C}, // 1P 7
|
||||
{KEY_V, 1, 0x12D}, // 1P 8
|
||||
|
||||
{KEY_9, 1, 0x12E}, // Test
|
||||
{KEY_F2, 1, 0x12F}, // service
|
||||
|
||||
{KEY_6, 2, 0x120}, // 2P coin
|
||||
{KEY_2, 2, 0x121}, // 2P start
|
||||
{KEY_R, 2, 0x122}, // 2P up
|
||||
{KEY_F, 2, 0x123}, // 2P down
|
||||
{KEY_D, 2, 0x124}, // 2P left
|
||||
{KEY_G, 2, 0x125}, // 2P right
|
||||
{KEY_A, 2, 0x126}, // 2P 1
|
||||
{KEY_S, 2, 0x127}, // 2P 2
|
||||
{KEY_Q, 2, 0x128}, // 2P 3
|
||||
{KEY_W, 2, 0x129}, // 2P 4
|
||||
{KEY_I, 2, 0x12A}, // 2P 5
|
||||
{KEY_K, 2, 0x12B}, // 2P 6
|
||||
{KEY_J, 2, 0x12C}, // 2P 7
|
||||
{KEY_L, 2, 0x12D}, // 2P 8
|
||||
};
|
||||
|
||||
// J-PAC/I-PAC has shifted keys: when 1P start is kept pressed, it acts as a shift key,
|
||||
// outputting other key signals. Example: 1P start + 2P start = KEY_ESC
|
||||
// Shifted keys are passed as normal keyboard keys.
|
||||
static struct
|
||||
{
|
||||
uint16_t key;
|
||||
uint16_t player;
|
||||
uint16_t btn;
|
||||
} jpac2joy[] =
|
||||
{
|
||||
{KEY_5, 1, 0x120}, // 1P coin (shift + 1P 1)
|
||||
{KEY_1, 1, 0x121}, // 1P start (shift key)
|
||||
{KEY_UP, 1, 0x122}, // 1P up
|
||||
{KEY_DOWN, 1, 0x123}, // 1P down
|
||||
{KEY_LEFT, 1, 0x124}, // 1P left
|
||||
{KEY_RIGHT, 1, 0x125}, // 1P right
|
||||
{KEY_LEFTCTRL, 1, 0x126}, // 1P 1
|
||||
{KEY_LEFTALT, 1, 0x127}, // 1P 2
|
||||
{KEY_SPACE, 1, 0x128}, // 1P 3
|
||||
{KEY_LEFTSHIFT, 1, 0x129}, // 1P 4
|
||||
{KEY_Z, 1, 0x12A}, // 1P 5
|
||||
{KEY_X, 1, 0x12B}, // 1P 6
|
||||
{KEY_C, 1, 0x12C}, // 1P 7
|
||||
{KEY_V, 1, 0x12D}, // 1P 8
|
||||
{KEY_TAB, 1, 0x12E}, // Tab (shift + 1P right)
|
||||
{KEY_ENTER, 1, 0x12F}, // Enter (shift + 1P left)
|
||||
{KEY_TAB, 1, 0x12F}, // Tab (shift + 1P right)
|
||||
{KEY_ENTER, 1, 0x130}, // Enter (shift + 1P left)
|
||||
// ~ Tidle supportted?
|
||||
{KEY_P, 1, 0x131}, // P (pause) (shift + 1P down)
|
||||
{KEY_F1, 1, 0x132}, // Service
|
||||
@@ -2898,16 +2856,10 @@ int input_test(int getchar)
|
||||
// Includes other buttons and axes, works as a full featured gamepad.
|
||||
if (strstr(uniq, "MiSTer-A1")) input[n].quirk = QUIRK_PDSP_ARCADE;
|
||||
|
||||
//JammaSD
|
||||
if (cfg.jammasd_vid && cfg.jammasd_pid && input[n].vid == cfg.jammasd_vid && input[n].pid == cfg.jammasd_pid)
|
||||
//Jamma
|
||||
if (cfg.jamma_vid && cfg.jamma_pid && input[n].vid == cfg.jamma_vid && input[n].pid == cfg.jamma_pid)
|
||||
{
|
||||
input[n].quirk = QUIRK_JAMMASD;
|
||||
}
|
||||
|
||||
//J-PAC/I-PAC
|
||||
if (cfg.jpac_vid && cfg.jpac_pid && input[n].vid == cfg.jpac_vid && input[n].pid == cfg.jpac_pid)
|
||||
{
|
||||
input[n].quirk = QUIRK_JPAC;
|
||||
input[n].quirk = QUIRK_JAMMA;
|
||||
}
|
||||
|
||||
//Arduino and Teensy devices may share the same VID:PID, so additional field UNIQ is used to differentiate them
|
||||
@@ -3136,29 +3088,15 @@ int input_test(int getchar)
|
||||
}
|
||||
}
|
||||
|
||||
if (input[dev].quirk == QUIRK_JAMMASD && ev.type == EV_KEY)
|
||||
if (input[dev].quirk == QUIRK_JAMMA && ev.type == EV_KEY)
|
||||
{
|
||||
input[dev].num = 0;
|
||||
for (uint32_t i = 0; i <= sizeof(jammasd2joy) / sizeof(jammasd2joy[0]); i++)
|
||||
for (uint32_t i = 0; i <= sizeof(jamma2joy) / sizeof(jamma2joy[0]); i++)
|
||||
{
|
||||
if (jammasd2joy[i].key == ev.code)
|
||||
if (jamma2joy[i].key == ev.code)
|
||||
{
|
||||
ev.code = jammasd2joy[i].btn;
|
||||
input[dev].num = jammasd2joy[i].player;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (input[dev].quirk == QUIRK_JPAC && ev.type == EV_KEY)
|
||||
{
|
||||
input[dev].num = 0;
|
||||
for (uint32_t i = 0; i <= sizeof(jpac2joy) / sizeof(jpac2joy[0]); i++)
|
||||
{
|
||||
if (jpac2joy[i].key == ev.code)
|
||||
{
|
||||
ev.code = jpac2joy[i].btn;
|
||||
input[dev].num = jpac2joy[i].player;
|
||||
ev.code = jamma2joy[i].btn;
|
||||
input[dev].num = jamma2joy[i].player;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user