mirror of
https://github.com/MiSTer-devel/Main_MiSTer.git
synced 2026-04-19 03:04:28 +00:00
input: merge jammasd and jpac/ipac into a common option.
This commit is contained in:
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