From b5c4b2d6187bfaeca03f714e029f2eab3f56e623 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Jul 2019 18:16:11 +0200 Subject: [PATCH] Fix --disable-menu --- retroarch.c | 103 ++++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/retroarch.c b/retroarch.c index 12f6afd42d..a9df03a5a9 100644 --- a/retroarch.c +++ b/retroarch.c @@ -5107,6 +5107,58 @@ static int16_t input_joypad_axis(const input_device_driver_t *drv, return val; } +#define inherit_joyaxis(binds) (((binds)[x_plus].joyaxis == (binds)[x_minus].joyaxis) || ( (binds)[y_plus].joyaxis == (binds)[y_minus].joyaxis)) + +/** + * input_pop_analog_dpad: + * @binds : Binds to modify. + * + * Restores binds temporarily overridden by input_push_analog_dpad(). + **/ +#define input_pop_analog_dpad(binds) \ +{ \ + unsigned j; \ + for (j = RETRO_DEVICE_ID_JOYPAD_UP; j <= RETRO_DEVICE_ID_JOYPAD_RIGHT; j++) \ + (binds)[j].joyaxis = (binds)[j].orig_joyaxis; \ +} + +/** + * input_push_analog_dpad: + * @binds : Binds to modify. + * @mode : Which analog stick to bind D-Pad to. + * E.g: + * ANALOG_DPAD_LSTICK + * ANALOG_DPAD_RSTICK + * + * Push analog to D-Pad mappings to binds. + **/ +#define input_push_analog_dpad(binds, mode) \ +{ \ + unsigned k; \ + unsigned x_plus = RARCH_ANALOG_RIGHT_X_PLUS; \ + unsigned y_plus = RARCH_ANALOG_RIGHT_Y_PLUS; \ + unsigned x_minus = RARCH_ANALOG_RIGHT_X_MINUS; \ + unsigned y_minus = RARCH_ANALOG_RIGHT_Y_MINUS; \ + if ((mode) == ANALOG_DPAD_LSTICK) \ + { \ + x_plus = RARCH_ANALOG_LEFT_X_PLUS; \ + y_plus = RARCH_ANALOG_LEFT_Y_PLUS; \ + x_minus = RARCH_ANALOG_LEFT_X_MINUS; \ + y_minus = RARCH_ANALOG_LEFT_Y_MINUS; \ + } \ + for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) \ + (binds)[k].orig_joyaxis = (binds)[k].joyaxis; \ + if (!inherit_joyaxis(binds)) \ + { \ + unsigned j = x_plus + 3; \ + /* Inherit joyaxis from analogs. */ \ + for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) \ + (binds)[k].joyaxis = (binds)[j--].joyaxis; \ + } \ +} + + + #ifdef HAVE_MENU enum menu_mouse_action { @@ -5992,57 +6044,6 @@ void menu_input_post_iterate(int *ret, unsigned action) } \ } -#define inherit_joyaxis(binds) (((binds)[x_plus].joyaxis == (binds)[x_minus].joyaxis) || ( (binds)[y_plus].joyaxis == (binds)[y_minus].joyaxis)) - -/** - * input_pop_analog_dpad: - * @binds : Binds to modify. - * - * Restores binds temporarily overridden by input_push_analog_dpad(). - **/ -#define input_pop_analog_dpad(binds) \ -{ \ - unsigned j; \ - for (j = RETRO_DEVICE_ID_JOYPAD_UP; j <= RETRO_DEVICE_ID_JOYPAD_RIGHT; j++) \ - (binds)[j].joyaxis = (binds)[j].orig_joyaxis; \ -} - -/** - * input_push_analog_dpad: - * @binds : Binds to modify. - * @mode : Which analog stick to bind D-Pad to. - * E.g: - * ANALOG_DPAD_LSTICK - * ANALOG_DPAD_RSTICK - * - * Push analog to D-Pad mappings to binds. - **/ -#define input_push_analog_dpad(binds, mode) \ -{ \ - unsigned k; \ - unsigned x_plus = RARCH_ANALOG_RIGHT_X_PLUS; \ - unsigned y_plus = RARCH_ANALOG_RIGHT_Y_PLUS; \ - unsigned x_minus = RARCH_ANALOG_RIGHT_X_MINUS; \ - unsigned y_minus = RARCH_ANALOG_RIGHT_Y_MINUS; \ - if ((mode) == ANALOG_DPAD_LSTICK) \ - { \ - x_plus = RARCH_ANALOG_LEFT_X_PLUS; \ - y_plus = RARCH_ANALOG_LEFT_Y_PLUS; \ - x_minus = RARCH_ANALOG_LEFT_X_MINUS; \ - y_minus = RARCH_ANALOG_LEFT_Y_MINUS; \ - } \ - for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) \ - (binds)[k].orig_joyaxis = (binds)[k].joyaxis; \ - if (!inherit_joyaxis(binds)) \ - { \ - unsigned j = x_plus + 3; \ - /* Inherit joyaxis from analogs. */ \ - for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) \ - (binds)[k].joyaxis = (binds)[j--].joyaxis; \ - } \ -} - - /** * input_menu_keys_pressed: *