diff --git a/input/input_driver.c b/input/input_driver.c index bbba433cae..9b9cdc832e 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -5264,3 +5264,203 @@ void input_remapping_set_defaults(bool clear_cache) * into the main config file */ input_remapping_restore_global_config(clear_cache); } + +void input_driver_collect_system_input(input_driver_state_t *input_st, + settings_t *settings, input_bits_t *current_bits) +{ + unsigned port; + rarch_joypad_info_t joypad_info; + int block_delay = settings->uints.input_hotkey_block_delay; + const input_device_driver_t *joypad = input_st->primary_joypad; +#ifdef HAVE_MFI + const input_device_driver_t + *sec_joypad = input_st->secondary_joypad; +#else + const input_device_driver_t + *sec_joypad = NULL; +#endif +#ifdef HAVE_MENU + bool display_kb = menu_input_dialog_get_display_kb(); + bool menu_input_active = menu_state_get_ptr()->alive && + !(settings->bools.menu_unified_controls && !display_kb); +#endif + input_driver_t *current_input = input_st->current_driver; + unsigned max_users = settings->uints.input_max_users; + bool all_users_control_menu = settings->bools.input_all_users_control_menu; + joypad_info.axis_threshold = settings->floats.input_axis_threshold; + + /* Gather input from each (enabled) joypad */ + for(port = 0; port < max_users; port++) + { + const struct retro_keybind *binds_norm = &input_config_binds[port][RARCH_ENABLE_HOTKEY]; + const struct retro_keybind *binds_auto = &input_autoconf_binds[port][RARCH_ENABLE_HOTKEY]; + struct retro_keybind *auto_binds = input_autoconf_binds[port]; + struct retro_keybind *general_binds = input_config_binds[port]; + joypad_info.joy_idx = settings->uints.input_joypad_index[port]; + joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx]; + input_bits_t *loop_bits = NULL; + input_bits_t tmp_bits; + unsigned i; + + if (port == 0) + loop_bits = current_bits; + else + { + loop_bits = &tmp_bits; + BIT256_CLEAR_ALL_PTR(loop_bits); + } + +#ifdef HAVE_MENU + if (menu_input_active) + { + unsigned k; + unsigned x_plus = RARCH_ANALOG_LEFT_X_PLUS; + unsigned y_plus = RARCH_ANALOG_LEFT_Y_PLUS; + unsigned x_minus = RARCH_ANALOG_LEFT_X_MINUS; + unsigned y_minus = RARCH_ANALOG_LEFT_Y_MINUS; + + /* Push analog to D-Pad mappings to binds. */ + for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) + { + (auto_binds)[k].orig_joyaxis = (auto_binds)[k].joyaxis; + (general_binds)[k].orig_joyaxis = (general_binds)[k].joyaxis; + } + + if (!INHERIT_JOYAXIS(auto_binds)) + { + unsigned j = x_plus + 3; + /* Inherit joyaxis from analogs. */ + for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) + (auto_binds)[k].joyaxis = (auto_binds)[j--].joyaxis; + } + + if (!INHERIT_JOYAXIS(general_binds)) + { + unsigned j = x_plus + 3; + /* Inherit joyaxis from analogs. */ + for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) + (general_binds)[k].joyaxis = (general_binds)[j--].joyaxis; + } + } +#endif /* HAVE_MENU */ + + input_keys_pressed(port, + menu_input_active, + block_delay, + loop_bits, + input_config_binds, + binds_norm, + binds_auto, + joypad, + sec_joypad, + &joypad_info); + +#ifdef HAVE_MENU + if (menu_input_active) + { + unsigned j; + + /* Restores analog D-pad binds temporarily overridden. */ + for (j = RETRO_DEVICE_ID_JOYPAD_UP; j <= RETRO_DEVICE_ID_JOYPAD_RIGHT; j++) + { + (auto_binds)[j].joyaxis = (auto_binds)[j].orig_joyaxis; + (general_binds)[j].joyaxis = (general_binds)[j].orig_joyaxis; + } + } +#endif /* HAVE_MENU */ + + /* we write port 0 directly to input_bits to save one iteration of this loop */ + if (port != 0) + { + /* Update compound 'current_bits' record + * Note: Only digital inputs are considered */ + for(i = 0; i < sizeof(current_bits->data) / sizeof(current_bits->data[0]); i++) + current_bits->data[i] |= loop_bits->data[i]; + } + else if (!all_users_control_menu) + break; + + } + +#ifdef HAVE_MENU + if (menu_input_active) + { + /* Gather keyboard input, if enabled + * Note: Keyboard input always read from + * port 0 */ + if ( !display_kb + && current_input->input_state) + { + unsigned i; + unsigned ids[][2] = + { + {RETROK_SPACE, RETRO_DEVICE_ID_JOYPAD_START }, + {RETROK_SLASH, RETRO_DEVICE_ID_JOYPAD_X }, + {RETROK_RSHIFT, RETRO_DEVICE_ID_JOYPAD_SELECT }, + {RETROK_RIGHT, RETRO_DEVICE_ID_JOYPAD_RIGHT }, + {RETROK_LEFT, RETRO_DEVICE_ID_JOYPAD_LEFT }, + {RETROK_DOWN, RETRO_DEVICE_ID_JOYPAD_DOWN }, + {RETROK_UP, RETRO_DEVICE_ID_JOYPAD_UP }, + {RETROK_PAGEUP, RETRO_DEVICE_ID_JOYPAD_L }, + {RETROK_PAGEDOWN, RETRO_DEVICE_ID_JOYPAD_R }, + {0, RARCH_QUIT_KEY }, + {0, RARCH_FULLSCREEN_TOGGLE_KEY }, + {RETROK_BACKSPACE, RETRO_DEVICE_ID_JOYPAD_B }, + {RETROK_RETURN, RETRO_DEVICE_ID_JOYPAD_A }, + {RETROK_DELETE, RETRO_DEVICE_ID_JOYPAD_Y }, + {0, RARCH_UI_COMPANION_TOGGLE }, + {0, RARCH_FPS_TOGGLE }, + {0, RARCH_SEND_DEBUG_INFO }, + {0, RARCH_NETPLAY_HOST_TOGGLE }, + {0, RARCH_MENU_TOGGLE }, + }; + + ids[9][0] = input_config_binds[0][RARCH_QUIT_KEY].key; + ids[10][0] = input_config_binds[0][RARCH_FULLSCREEN_TOGGLE_KEY].key; + ids[14][0] = input_config_binds[0][RARCH_UI_COMPANION_TOGGLE].key; + ids[15][0] = input_config_binds[0][RARCH_FPS_TOGGLE].key; + ids[16][0] = input_config_binds[0][RARCH_SEND_DEBUG_INFO].key; + ids[17][0] = input_config_binds[0][RARCH_NETPLAY_HOST_TOGGLE].key; + ids[18][0] = input_config_binds[0][RARCH_MENU_TOGGLE].key; + + if (settings->bools.input_menu_swap_ok_cancel_buttons) + { + ids[11][1] = RETRO_DEVICE_ID_JOYPAD_A; + ids[12][1] = RETRO_DEVICE_ID_JOYPAD_B; + } + + for (i = 0; i < ARRAY_SIZE(ids); i++) + { + if (current_input->input_state( + input_st->current_data, + joypad, + sec_joypad, + &joypad_info, input_config_binds, + input_st->keyboard_mapping_blocked, + 0, + RETRO_DEVICE_KEYBOARD, 0, ids[i][0])) + BIT256_SET_PTR(current_bits, ids[i][1]); + } + } + } + else +#endif /* HAVE_MENU */ + { +#if defined(HAVE_ACCESSIBILITY) && defined(HAVE_TRANSLATE) + if (settings->bools.ai_service_enable) + { + unsigned i; + + input_st->gamepad_input_override = 0; + + for (i = 0; i < MAX_USERS; i++) + { + /* Set gamepad input override */ + if (input_st->ai_gamepad_state[i] == 2) + input_st->gamepad_input_override |= (1 << i); + input_st->ai_gamepad_state[i] = 0; + } + } +#endif /* defined(HAVE_ACCESSIBILITY) && defined(HAVE_TRANSLATE) */ + } +} diff --git a/input/input_driver.h b/input/input_driver.h index f925b421d1..d33807b079 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -98,6 +98,8 @@ #define MAPPER_SET_KEY(state, key) (state)->keys[(key) / 32] |= 1 << ((key) % 32) #define MAPPER_UNSET_KEY(state, key) (state)->keys[(key) / 32] &= ~(1 << ((key) % 32)) +#define INHERIT_JOYAXIS(binds) (((binds)[x_plus].joyaxis == (binds)[x_minus].joyaxis) || ( (binds)[y_plus].joyaxis == (binds)[y_minus].joyaxis)) + RETRO_BEGIN_DECLS enum rarch_movie_type @@ -402,7 +404,11 @@ typedef struct input_remote_t *remote; #endif char *osk_grid[45]; /* ptr alignment */ - +#if defined(HAVE_TRANSLATE) +#if defined(HAVE_ACCESSIBILITY) + int ai_gamepad_state[MAX_USERS]; +#endif +#endif int osk_ptr; turbo_buttons_t turbo_btns; /* int32_t alignment */ @@ -1030,6 +1036,9 @@ void input_keys_pressed( const input_device_driver_t *sec_joypad, rarch_joypad_info_t *joypad_info); +void input_driver_collect_system_input(input_driver_state_t *input_st, + settings_t *settings, input_bits_t *current_bits); + extern input_device_driver_t *joypad_drivers[]; extern input_driver_t *input_drivers[]; #ifdef HAVE_HID diff --git a/retroarch.c b/retroarch.c index d5311adafb..8ade412989 100644 --- a/retroarch.c +++ b/retroarch.c @@ -4191,6 +4191,11 @@ static void handle_translation_cb( struct rarch_state *p_rarch = &rarch_st; settings_t* settings = config_get_ptr(); runloop_state_t *runloop_st = &runloop_state; +#ifdef HAVE_ACCESSIBILITY +#ifdef HAVE_TRANSLATE + input_driver_state_t *input_st = input_state_get_ptr(); +#endif +#endif bool was_paused = runloop_st->paused; video_driver_state_t *video_st = video_state_get_ptr(); @@ -4567,40 +4572,40 @@ static void handle_translation_cb( #ifdef HAVE_ACCESSIBILITY #ifdef HAVE_TRANSLATE if (string_is_equal(key, "b")) - p_rarch->ai_gamepad_state[0] = 2; + input_st->ai_gamepad_state[0] = 2; if (string_is_equal(key, "y")) - p_rarch->ai_gamepad_state[1] = 2; + input_st->ai_gamepad_state[1] = 2; if (string_is_equal(key, "select")) - p_rarch->ai_gamepad_state[2] = 2; + input_st->ai_gamepad_state[2] = 2; if (string_is_equal(key, "start")) - p_rarch->ai_gamepad_state[3] = 2; + input_st->ai_gamepad_state[3] = 2; if (string_is_equal(key, "up")) - p_rarch->ai_gamepad_state[4] = 2; + input_st->ai_gamepad_state[4] = 2; if (string_is_equal(key, "down")) - p_rarch->ai_gamepad_state[5] = 2; + input_st->ai_gamepad_state[5] = 2; if (string_is_equal(key, "left")) - p_rarch->ai_gamepad_state[6] = 2; + input_st->ai_gamepad_state[6] = 2; if (string_is_equal(key, "right")) - p_rarch->ai_gamepad_state[7] = 2; + input_st->ai_gamepad_state[7] = 2; if (string_is_equal(key, "a")) - p_rarch->ai_gamepad_state[8] = 2; + input_st->ai_gamepad_state[8] = 2; if (string_is_equal(key, "x")) - p_rarch->ai_gamepad_state[9] = 2; + input_st->ai_gamepad_state[9] = 2; if (string_is_equal(key, "l")) - p_rarch->ai_gamepad_state[10] = 2; + input_st->ai_gamepad_state[10] = 2; if (string_is_equal(key, "r")) - p_rarch->ai_gamepad_state[11] = 2; + input_st->ai_gamepad_state[11] = 2; if (string_is_equal(key, "l2")) - p_rarch->ai_gamepad_state[12] = 2; + input_st->ai_gamepad_state[12] = 2; if (string_is_equal(key, "r2")) - p_rarch->ai_gamepad_state[13] = 2; + input_st->ai_gamepad_state[13] = 2; if (string_is_equal(key, "l3")) - p_rarch->ai_gamepad_state[14] = 2; + input_st->ai_gamepad_state[14] = 2; if (string_is_equal(key, "r3")) - p_rarch->ai_gamepad_state[15] = 2; + input_st->ai_gamepad_state[15] = 2; #endif #endif @@ -4870,6 +4875,11 @@ static bool run_translation_service( *video_st = video_state_get_ptr(); const enum retro_pixel_format video_driver_pix_fmt = video_st->pix_fmt; +#ifdef HAVE_ACCESSIBILITY +#ifdef HAVE_TRANSLATE + input_driver_state_t *input_st = input_state_get_ptr(); +#endif +#endif #ifdef HAVE_GFX_WIDGETS /* For the case when ai service pause is disabled. */ @@ -5080,7 +5090,7 @@ static bool run_translation_service( rjsonwriter_add_space(jsonwriter); #ifdef HAVE_ACCESSIBILITY rjsonwriter_add_unsigned(jsonwriter, - (p_rarch->ai_gamepad_state[i] ? 1 : 0) + (input_st->ai_gamepad_state[i] ? 1 : 0) ); #else rjsonwriter_add_unsigned(jsonwriter, 0); @@ -18537,211 +18547,6 @@ static void runloop_apply_fastmotion_override(runloop_state_t *runloop_st, setti fastforward_ratio_current); } -static void collect_system_input(struct rarch_state *p_rarch, - settings_t *settings, input_bits_t *current_bits) -{ - unsigned port; - rarch_joypad_info_t joypad_info; - int block_delay = settings->uints.input_hotkey_block_delay; - input_driver_state_t *input_st = input_state_get_ptr(); - const input_device_driver_t *joypad = input_st->primary_joypad; -#ifdef HAVE_MFI - const input_device_driver_t - *sec_joypad = input_st->secondary_joypad; -#else - const input_device_driver_t - *sec_joypad = NULL; -#endif -#ifdef HAVE_MENU - bool display_kb = menu_input_dialog_get_display_kb(); - bool menu_input_active = menu_state_get_ptr()->alive && - !(settings->bools.menu_unified_controls && !display_kb); -#endif - input_driver_t *current_input = input_st->current_driver; - unsigned max_users = settings->uints.input_max_users; - bool all_users_control_menu = settings->bools.input_all_users_control_menu; - -#if !(defined(HAVE_ACCESSIBILITY) && defined(HAVE_TRANSLATE)) - (void)p_rarch; -#endif - joypad_info.axis_threshold = settings->floats.input_axis_threshold; - - /* Gather input from each (enabled) joypad */ - for(port = 0; port < max_users; port++) - { - const struct retro_keybind *binds_norm = &input_config_binds[port][RARCH_ENABLE_HOTKEY]; - const struct retro_keybind *binds_auto = &input_autoconf_binds[port][RARCH_ENABLE_HOTKEY]; - struct retro_keybind *auto_binds = input_autoconf_binds[port]; - struct retro_keybind *general_binds = input_config_binds[port]; - joypad_info.joy_idx = settings->uints.input_joypad_index[port]; - joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx]; - input_bits_t *loop_bits = NULL; - input_bits_t tmp_bits; - unsigned i; - - if (port == 0) - loop_bits = current_bits; - else - { - loop_bits = &tmp_bits; - BIT256_CLEAR_ALL_PTR(loop_bits); - } - -#ifdef HAVE_MENU - if (menu_input_active) - { - unsigned k; - unsigned x_plus = RARCH_ANALOG_LEFT_X_PLUS; - unsigned y_plus = RARCH_ANALOG_LEFT_Y_PLUS; - unsigned x_minus = RARCH_ANALOG_LEFT_X_MINUS; - unsigned y_minus = RARCH_ANALOG_LEFT_Y_MINUS; - - /* Push analog to D-Pad mappings to binds. */ - for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) - { - (auto_binds)[k].orig_joyaxis = (auto_binds)[k].joyaxis; - (general_binds)[k].orig_joyaxis = (general_binds)[k].joyaxis; - } - - if (!INHERIT_JOYAXIS(auto_binds)) - { - unsigned j = x_plus + 3; - /* Inherit joyaxis from analogs. */ - for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) - (auto_binds)[k].joyaxis = (auto_binds)[j--].joyaxis; - } - - if (!INHERIT_JOYAXIS(general_binds)) - { - unsigned j = x_plus + 3; - /* Inherit joyaxis from analogs. */ - for (k = RETRO_DEVICE_ID_JOYPAD_UP; k <= RETRO_DEVICE_ID_JOYPAD_RIGHT; k++) - (general_binds)[k].joyaxis = (general_binds)[j--].joyaxis; - } - } -#endif /* HAVE_MENU */ - - input_keys_pressed(port, - menu_input_active, - block_delay, - loop_bits, - input_config_binds, - binds_norm, - binds_auto, - joypad, - sec_joypad, - &joypad_info); - -#ifdef HAVE_MENU - if (menu_input_active) - { - unsigned j; - - /* Restores analog D-pad binds temporarily overridden. */ - for (j = RETRO_DEVICE_ID_JOYPAD_UP; j <= RETRO_DEVICE_ID_JOYPAD_RIGHT; j++) - { - (auto_binds)[j].joyaxis = (auto_binds)[j].orig_joyaxis; - (general_binds)[j].joyaxis = (general_binds)[j].orig_joyaxis; - } - } -#endif /* HAVE_MENU */ - - /* we write port 0 directly to input_bits to save one iteration of this loop */ - if (port != 0) - { - /* Update compound 'current_bits' record - * Note: Only digital inputs are considered */ - for(i = 0; i < sizeof(current_bits->data) / sizeof(current_bits->data[0]); i++) - current_bits->data[i] |= loop_bits->data[i]; - } - else if (!all_users_control_menu) - break; - - } - -#ifdef HAVE_MENU - if (menu_input_active) - { - /* Gather keyboard input, if enabled - * Note: Keyboard input always read from - * port 0 */ - if ( !display_kb - && current_input->input_state) - { - unsigned i; - unsigned ids[][2] = - { - {RETROK_SPACE, RETRO_DEVICE_ID_JOYPAD_START }, - {RETROK_SLASH, RETRO_DEVICE_ID_JOYPAD_X }, - {RETROK_RSHIFT, RETRO_DEVICE_ID_JOYPAD_SELECT }, - {RETROK_RIGHT, RETRO_DEVICE_ID_JOYPAD_RIGHT }, - {RETROK_LEFT, RETRO_DEVICE_ID_JOYPAD_LEFT }, - {RETROK_DOWN, RETRO_DEVICE_ID_JOYPAD_DOWN }, - {RETROK_UP, RETRO_DEVICE_ID_JOYPAD_UP }, - {RETROK_PAGEUP, RETRO_DEVICE_ID_JOYPAD_L }, - {RETROK_PAGEDOWN, RETRO_DEVICE_ID_JOYPAD_R }, - {0, RARCH_QUIT_KEY }, - {0, RARCH_FULLSCREEN_TOGGLE_KEY }, - {RETROK_BACKSPACE, RETRO_DEVICE_ID_JOYPAD_B }, - {RETROK_RETURN, RETRO_DEVICE_ID_JOYPAD_A }, - {RETROK_DELETE, RETRO_DEVICE_ID_JOYPAD_Y }, - {0, RARCH_UI_COMPANION_TOGGLE }, - {0, RARCH_FPS_TOGGLE }, - {0, RARCH_SEND_DEBUG_INFO }, - {0, RARCH_NETPLAY_HOST_TOGGLE }, - {0, RARCH_MENU_TOGGLE }, - }; - - ids[9][0] = input_config_binds[0][RARCH_QUIT_KEY].key; - ids[10][0] = input_config_binds[0][RARCH_FULLSCREEN_TOGGLE_KEY].key; - ids[14][0] = input_config_binds[0][RARCH_UI_COMPANION_TOGGLE].key; - ids[15][0] = input_config_binds[0][RARCH_FPS_TOGGLE].key; - ids[16][0] = input_config_binds[0][RARCH_SEND_DEBUG_INFO].key; - ids[17][0] = input_config_binds[0][RARCH_NETPLAY_HOST_TOGGLE].key; - ids[18][0] = input_config_binds[0][RARCH_MENU_TOGGLE].key; - - if (settings->bools.input_menu_swap_ok_cancel_buttons) - { - ids[11][1] = RETRO_DEVICE_ID_JOYPAD_A; - ids[12][1] = RETRO_DEVICE_ID_JOYPAD_B; - } - - for (i = 0; i < ARRAY_SIZE(ids); i++) - { - if (current_input->input_state( - input_st->current_data, - joypad, - sec_joypad, - &joypad_info, input_config_binds, - input_st->keyboard_mapping_blocked, - 0, - RETRO_DEVICE_KEYBOARD, 0, ids[i][0])) - BIT256_SET_PTR(current_bits, ids[i][1]); - } - } - } - else -#endif /* HAVE_MENU */ - { -#if defined(HAVE_ACCESSIBILITY) && defined(HAVE_TRANSLATE) - if (settings->bools.ai_service_enable) - { - unsigned i; - - input_st->gamepad_input_override = 0; - - for (i = 0; i < MAX_USERS; i++) - { - /* Set gamepad input override */ - if (p_rarch->ai_gamepad_state[i] == 2) - input_st->gamepad_input_override |= (1 << i); - p_rarch->ai_gamepad_state[i] = 0; - } - } -#endif /* defined(HAVE_ACCESSIBILITY) && defined(HAVE_TRANSLATE) */ - } -} - static enum runloop_state_enum runloop_check_state( struct rarch_state *p_rarch, settings_t *settings, @@ -18808,7 +18613,7 @@ static enum runloop_state_enum runloop_check_state( if (input_st->keyboard_mapping_blocked) input_st->block_hotkey = true; - collect_system_input(p_rarch, settings, ¤t_bits); + input_driver_collect_system_input(input_st, settings, ¤t_bits); #ifdef HAVE_MENU last_input = current_bits; @@ -19488,25 +19293,25 @@ static enum runloop_state_enum runloop_check_state( to send off if it's run. */ if (settings->bools.ai_service_enable) { - p_rarch->ai_gamepad_state[0] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_B); - p_rarch->ai_gamepad_state[1] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_Y); - p_rarch->ai_gamepad_state[2] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_SELECT); - p_rarch->ai_gamepad_state[3] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_START); + input_st->ai_gamepad_state[0] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_B); + input_st->ai_gamepad_state[1] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_Y); + input_st->ai_gamepad_state[2] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_SELECT); + input_st->ai_gamepad_state[3] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_START); - p_rarch->ai_gamepad_state[4] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_UP); - p_rarch->ai_gamepad_state[5] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_DOWN); - p_rarch->ai_gamepad_state[6] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_LEFT); - p_rarch->ai_gamepad_state[7] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_RIGHT); + input_st->ai_gamepad_state[4] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_UP); + input_st->ai_gamepad_state[5] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_DOWN); + input_st->ai_gamepad_state[6] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_LEFT); + input_st->ai_gamepad_state[7] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_RIGHT); - p_rarch->ai_gamepad_state[8] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_A); - p_rarch->ai_gamepad_state[9] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_X); - p_rarch->ai_gamepad_state[10] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_L); - p_rarch->ai_gamepad_state[11] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_R); + input_st->ai_gamepad_state[8] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_A); + input_st->ai_gamepad_state[9] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_X); + input_st->ai_gamepad_state[10] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_L); + input_st->ai_gamepad_state[11] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_R); - p_rarch->ai_gamepad_state[12] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_L2); - p_rarch->ai_gamepad_state[13] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_R2); - p_rarch->ai_gamepad_state[14] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_L3); - p_rarch->ai_gamepad_state[15] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_R3); + input_st->ai_gamepad_state[12] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_L2); + input_st->ai_gamepad_state[13] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_R2); + input_st->ai_gamepad_state[14] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_L3); + input_st->ai_gamepad_state[15] = BIT256_GET(current_bits, RETRO_DEVICE_ID_JOYPAD_R3); } #endif #endif diff --git a/retroarch_data.h b/retroarch_data.h index ef90e934cf..2d9e51b980 100644 --- a/retroarch_data.h +++ b/retroarch_data.h @@ -122,8 +122,6 @@ input_st->bsv_movie_state.eof_exit) old_pressed3 = pressed3; \ } -#define INHERIT_JOYAXIS(binds) (((binds)[x_plus].joyaxis == (binds)[x_minus].joyaxis) || ( (binds)[y_plus].joyaxis == (binds)[y_minus].joyaxis)) - #define CDN_URL "https://cdn.discordapp.com/avatars" #ifdef HAVE_DYNAMIC @@ -568,9 +566,6 @@ struct rarch_state #if defined(HAVE_TRANSLATE) int ai_service_auto; -#if defined(HAVE_ACCESSIBILITY) - int ai_gamepad_state[MAX_USERS]; -#endif #endif #ifdef HAVE_NETWORKING int reannounce;