From eac899f573476f3320287d2d8b8ffaca383e726a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 2 May 2018 13:52:27 +0200 Subject: [PATCH] Try to fix build for targets that don't have HAvE_OVERLAY defined --- input/input_driver.c | 7 +++++++ input/input_mapper.c | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index 0e011eedc6..36386576dc 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -34,6 +34,10 @@ #include "input_remote.h" #endif +#ifdef HAVE_OVERLAY +#include "input_overlay.h" +#endif + #include "input_mapper.h" #include "input_driver.h" @@ -715,8 +719,11 @@ int16_t input_state(unsigned port, unsigned device, { res = current_input->input_state( current_input_data, joypad_info, libretro_input_binds, port, device, idx, id); + +#ifdef HAVE_OVERLAY if (input_overlay_is_alive(overlay_ptr) && port == 0) res |= input_overlay_key_pressed(overlay_ptr, id); +#endif } else res = 0; diff --git a/input/input_mapper.c b/input/input_mapper.c index 5d7cbd0b1b..1a1f613b18 100644 --- a/input/input_mapper.c +++ b/input/input_mapper.c @@ -41,6 +41,10 @@ #include "input_mapper.h" +#ifdef HAVE_OVERLAY +#include "input_overlay.h" +#endif + #include "../configuration.h" #include "../msg_hash.h" #include "../verbosity.h" @@ -89,11 +93,9 @@ void input_mapper_poll(input_mapper_t *handle) unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS)); bool key_event[RARCH_CUSTOM_BIND_LIST_END] = { false }; - bool poll_overlay = false; - - if (input_overlay_is_alive(overlay_ptr)) - poll_overlay = true; - +#ifdef HAVE_OVERLAY + bool poll_overlay = input_overlay_is_alive(overlay_ptr) ? true : false; +#endif #ifdef HAVE_MENU if (menu_driver_is_alive()) @@ -162,13 +164,17 @@ void input_mapper_poll(input_mapper_t *handle) for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++) { + bool remap_valid; + unsigned remap_button; unsigned current_button_value = BIT256_GET(current_input, j); +#ifdef HAVE_OVERLAY if (poll_overlay && i == 0) current_button_value |= input_overlay_key_pressed(overlay_ptr, j); +#endif - unsigned remap_button = + remap_button = settings->uints.input_remap_ids[i][j]; - bool remap_valid = (current_button_value == 1) && + remap_valid = (current_button_value == 1) && (j != remap_button) && (remap_button != RARCH_UNMAPPED); if (remap_valid)