mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
core, linux+libretro, multiplayer adaptor support
This commit is contained in:
parent
a833e78c98
commit
1d5885dd84
9 changed files with 104 additions and 49 deletions
|
@ -85,6 +85,19 @@ static void keys_write(FILE *fn, int dev_id, const int *binds)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; me_ctrl_actions[i].name != NULL; i++) {
|
||||
mask = me_ctrl_actions[i].mask;
|
||||
if (mask & binds[IN_BIND_OFFS(k, IN_BINDTYPE_PLAYER34)]) {
|
||||
strncpy(act, me_ctrl_actions[i].name, 31);
|
||||
fprintf(fn, "bind %s = player3 %s" NL, name, mystrip(act));
|
||||
}
|
||||
mask = me_ctrl_actions[i].mask << 16;
|
||||
if (mask & binds[IN_BIND_OFFS(k, IN_BINDTYPE_PLAYER34)]) {
|
||||
strncpy(act, me_ctrl_actions[i].name, 31);
|
||||
fprintf(fn, "bind %s = player4 %s" NL, name, mystrip(act));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; emuctrl_actions[i].name != NULL; i++) {
|
||||
mask = emuctrl_actions[i].mask;
|
||||
if (mask & binds[IN_BIND_OFFS(k, IN_BINDTYPE_EMU)]) {
|
||||
|
@ -371,12 +384,12 @@ static int parse_bind_val(const char *val, int *type)
|
|||
int player, shift = 0;
|
||||
player = atoi(val + 6) - 1;
|
||||
|
||||
if (player > 1)
|
||||
if (player > 3)
|
||||
return -1;
|
||||
if (player == 1)
|
||||
if (player & 1)
|
||||
shift = 16;
|
||||
|
||||
*type = IN_BINDTYPE_PLAYER12;
|
||||
*type = IN_BINDTYPE_PLAYER12 + (player >> 1);
|
||||
for (i = 0; me_ctrl_actions[i].name != NULL; i++) {
|
||||
if (strncasecmp(me_ctrl_actions[i].name, val + 8, strlen(val + 8)) == 0)
|
||||
return me_ctrl_actions[i].mask << shift;
|
||||
|
|
|
@ -1180,21 +1180,29 @@ void emu_update_input(void)
|
|||
{
|
||||
static int prev_events = 0;
|
||||
int actions[IN_BINDTYPE_COUNT] = { 0, };
|
||||
int pl_actions[2];
|
||||
int pl_actions[4];
|
||||
int events;
|
||||
|
||||
in_update(actions);
|
||||
|
||||
pl_actions[0] = actions[IN_BINDTYPE_PLAYER12];
|
||||
pl_actions[1] = actions[IN_BINDTYPE_PLAYER12] >> 16;
|
||||
pl_actions[2] = actions[IN_BINDTYPE_PLAYER34];
|
||||
pl_actions[3] = actions[IN_BINDTYPE_PLAYER34] >> 16;
|
||||
|
||||
PicoIn.pad[0] = pl_actions[0] & 0xfff;
|
||||
PicoIn.pad[1] = pl_actions[1] & 0xfff;
|
||||
PicoIn.pad[2] = pl_actions[2] & 0xfff;
|
||||
PicoIn.pad[3] = pl_actions[3] & 0xfff;
|
||||
|
||||
if (pl_actions[0] & 0x7000)
|
||||
do_turbo(&PicoIn.pad[0], pl_actions[0]);
|
||||
if (pl_actions[1] & 0x7000)
|
||||
do_turbo(&PicoIn.pad[1], pl_actions[1]);
|
||||
if (pl_actions[2] & 0x7000)
|
||||
do_turbo(&PicoIn.pad[2], pl_actions[2]);
|
||||
if (pl_actions[3] & 0x7000)
|
||||
do_turbo(&PicoIn.pad[3], pl_actions[3]);
|
||||
|
||||
events = actions[IN_BINDTYPE_EMU] & PEV_MASK;
|
||||
|
||||
|
|
|
@ -366,6 +366,12 @@ static int key_config_loop_wrap(int id, int keys)
|
|||
case MA_CTRL_PLAYER2:
|
||||
key_config_loop(me_ctrl_actions, array_size(me_ctrl_actions) - 1, 1);
|
||||
break;
|
||||
case MA_CTRL_PLAYER3:
|
||||
key_config_loop(me_ctrl_actions, array_size(me_ctrl_actions) - 1, 2);
|
||||
break;
|
||||
case MA_CTRL_PLAYER4:
|
||||
key_config_loop(me_ctrl_actions, array_size(me_ctrl_actions) - 1, 3);
|
||||
break;
|
||||
case MA_CTRL_EMU:
|
||||
key_config_loop(emuctrl_actions, array_size(emuctrl_actions) - 1, -1);
|
||||
break;
|
||||
|
@ -396,15 +402,18 @@ static const char *mgn_dev_name(int id, int *offs)
|
|||
static int mh_saveloadcfg(int id, int keys);
|
||||
static const char *mgn_saveloadcfg(int id, int *offs);
|
||||
|
||||
const char *indev_names[] = { "none", "3 button pad", "6 button pad", NULL };
|
||||
const char *indev0_names[] = { "none", "3 button pad", "6 button pad", "Team player", "4 way play", NULL };
|
||||
const char *indev1_names[] = { "none", "3 button pad", "6 button pad", NULL };
|
||||
|
||||
static menu_entry e_menu_keyconfig[] =
|
||||
{
|
||||
mee_handler_id("Player 1", MA_CTRL_PLAYER1, key_config_loop_wrap),
|
||||
mee_handler_id("Player 2", MA_CTRL_PLAYER2, key_config_loop_wrap),
|
||||
mee_handler_id("Player 3", MA_CTRL_PLAYER3, key_config_loop_wrap),
|
||||
mee_handler_id("Player 4", MA_CTRL_PLAYER4, key_config_loop_wrap),
|
||||
mee_handler_id("Emulator controls", MA_CTRL_EMU, key_config_loop_wrap),
|
||||
mee_enum ("Input device 1", MA_OPT_INPUT_DEV0, currentConfig.input_dev0, indev_names),
|
||||
mee_enum ("Input device 2", MA_OPT_INPUT_DEV1, currentConfig.input_dev1, indev_names),
|
||||
mee_enum ("Input device 1", MA_OPT_INPUT_DEV0, currentConfig.input_dev0, indev0_names),
|
||||
mee_enum ("Input device 2", MA_OPT_INPUT_DEV1, currentConfig.input_dev1, indev1_names),
|
||||
mee_range ("Turbo rate", MA_CTRL_TURBO_RATE, currentConfig.turbo_rate, 1, 30),
|
||||
mee_range ("Analog deadzone", MA_CTRL_DEADZONE, currentConfig.analog_deadzone, 1, 99),
|
||||
mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg),
|
||||
|
|
|
@ -93,6 +93,8 @@ typedef enum
|
|||
MA_SMSOPT_GHOSTING,
|
||||
MA_CTRL_PLAYER1,
|
||||
MA_CTRL_PLAYER2,
|
||||
MA_CTRL_PLAYER3,
|
||||
MA_CTRL_PLAYER4,
|
||||
MA_CTRL_EMU,
|
||||
MA_CTRL_TURBO_RATE,
|
||||
MA_CTRL_DEADZONE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue