summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2019-01-20 19:52:54 -0800
committerMike Pavone <pavone@retrodev.com>2019-01-20 19:52:54 -0800
commite1c9e57b47c8e374ef7b806c04e412fb6c0b8efa (patch)
tree5ab7c4da647fef99a3724805c769bea2175a763c
parent27404027deee4f439a7c053bb9eb8425e995cb4c (diff)
Have a suitable default IO port configuration when nonIO is present from the config file. Fixed off by one in processing gamepad button events in libretro build
-rw-r--r--io.c6
-rw-r--r--libblastem.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/io.c b/io.c
index ffbda59..ac30c56 100644
--- a/io.c
+++ b/io.c
@@ -301,9 +301,9 @@ void setup_io_devices(tern_node * config, rom_info *rom, sega_io *io)
{
io_port * ports = io->ports;
tern_node *io_nodes = tern_find_path(config, "io\0devices\0", TVAL_NODE).ptrval;
- char * io_1 = rom->port1_override ? rom->port1_override : io_nodes ? tern_find_ptr(io_nodes, "1") : NULL;
- char * io_2 = rom->port2_override ? rom->port2_override : io_nodes ? tern_find_ptr(io_nodes, "2") : NULL;
- char * io_ext = rom->ext_override ? rom->ext_override : io_nodes ? tern_find_ptr(io_nodes, "ext") : NULL;
+ char * io_1 = rom->port1_override ? rom->port1_override : tern_find_ptr_default(io_nodes, "1", "gamepad6.1");
+ char * io_2 = rom->port2_override ? rom->port2_override : tern_find_ptr_default(io_nodes, "2", "gamepad6.2");
+ char * io_ext = rom->ext_override ? rom->ext_override : tern_find_ptr(io_nodes, "ext");
process_device(io_1, ports);
process_device(io_2, ports+1);
diff --git a/libblastem.c b/libblastem.c
index 6e64c78..2312593 100644
--- a/libblastem.c
+++ b/libblastem.c
@@ -254,9 +254,9 @@ void process_events()
int16_t new_state = retro_input_state(port, RETRO_DEVICE_JOYPAD, 0, id);
if (new_state != prev_state[port][id]) {
if (new_state) {
- current_system->gamepad_down(current_system, port, map[id]);
+ current_system->gamepad_down(current_system, port + 1, map[id]);
} else {
- current_system->gamepad_up(current_system, port, map[id]);
+ current_system->gamepad_up(current_system, port + 1, map[id]);
}
prev_state[port][id] = new_state;
}