diff options
author | Michael Pavone <pavone@retrodev.com> | 2018-08-14 00:07:21 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2018-08-14 00:07:21 -0700 |
commit | 7f914285b17c1b010c5a3f007f13e587126f6f4d (patch) | |
tree | c7caf557adee57425f19c5f70356fe79eed45924 /io.c | |
parent | 04063013139898718b3775dc10123a400b2c9173 (diff) |
Added J-Cart support
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -114,15 +114,29 @@ static io_port *find_keyboard(sega_io *io) return NULL; } +void io_port_gamepad_down(io_port *port, uint8_t button) +{ + gp_button_def *def = button_defs + button; + port->input[def->states[0]] |= def->value; + if (def->states[1] != GAMEPAD_NONE) { + port->input[def->states[1]] |= def->value; + } +} + +void io_port_gamepad_up(io_port *port, uint8_t button) +{ + gp_button_def *def = button_defs + button; + port->input[def->states[0]] &= ~def->value; + if (def->states[1] != GAMEPAD_NONE) { + port->input[def->states[1]] &= ~def->value; + } +} + void io_gamepad_down(sega_io *io, uint8_t gamepad_num, uint8_t button) { io_port *port = find_gamepad(io, gamepad_num); if (port) { - gp_button_def *def = button_defs + button; - port->input[def->states[0]] |= def->value; - if (def->states[1] != GAMEPAD_NONE) { - port->input[def->states[1]] |= def->value; - } + io_port_gamepad_down(port, button); } } @@ -130,11 +144,7 @@ void io_gamepad_up(sega_io *io, uint8_t gamepad_num, uint8_t button) { io_port *port = find_gamepad(io, gamepad_num); if (port) { - gp_button_def *def = button_defs + button; - port->input[def->states[0]] &= ~def->value; - if (def->states[1] != GAMEPAD_NONE) { - port->input[def->states[1]] &= ~def->value; - } + io_port_gamepad_up(port, button); } } |