From f4c5852cfaba16d8c594d7b6c879d0b78a108952 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Nov 2021 06:27:43 +0100 Subject: [PATCH] Move state from global_t to input_state_t --- input/input_driver.c | 40 ++++++++++++++++++++-------------------- input/input_driver.h | 5 +++++ retroarch_types.h | 5 ----- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index b50d19704e..749b913701 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -5113,57 +5113,57 @@ const hid_driver_t *input_hid_init_first(void) void input_remapping_cache_global_config(void) { unsigned i; - settings_t *settings = config_get_ptr(); - global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + input_driver_state_t *input_st = &input_driver_st; for (i = 0; i < MAX_USERS; i++) { - global->old_analog_dpad_mode[i] = settings->uints.input_analog_dpad_mode[i]; - global->old_libretro_device[i] = settings->uints.input_libretro_device[i]; + input_st->old_analog_dpad_mode[i] = settings->uints.input_analog_dpad_mode[i]; + input_st->old_libretro_device[i] = settings->uints.input_libretro_device[i]; } - global->old_analog_dpad_mode_set = true; - global->old_libretro_device_set = true; + input_st->old_analog_dpad_mode_set = true; + input_st->old_libretro_device_set = true; } void input_remapping_enable_global_config_restore(void) { - global_t *global = global_get_ptr(); - global->remapping_cache_active = true; + input_driver_state_t *input_st = &input_driver_st; + input_st->remapping_cache_active = true; } void input_remapping_restore_global_config(bool clear_cache) { unsigned i; - settings_t *settings = config_get_ptr(); - global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + input_driver_state_t *input_st = &input_driver_st; - if (!global->remapping_cache_active) + if (!input_st->remapping_cache_active) goto end; for (i = 0; i < MAX_USERS; i++) { - if (global->old_analog_dpad_mode_set && + if (input_st->old_analog_dpad_mode_set && (settings->uints.input_analog_dpad_mode[i] != - global->old_analog_dpad_mode[i])) + input_st->old_analog_dpad_mode[i])) configuration_set_uint(settings, settings->uints.input_analog_dpad_mode[i], - global->old_analog_dpad_mode[i]); + input_st->old_analog_dpad_mode[i]); - if (global->old_libretro_device_set && + if (input_st->old_libretro_device_set && (settings->uints.input_libretro_device[i] != - global->old_libretro_device[i])) + input_st->old_libretro_device[i])) configuration_set_uint(settings, settings->uints.input_libretro_device[i], - global->old_libretro_device[i]); + input_st->old_libretro_device[i]); } end: if (clear_cache) { - global->old_analog_dpad_mode_set = false; - global->old_libretro_device_set = false; - global->remapping_cache_active = false; + input_st->old_analog_dpad_mode_set = false; + input_st->old_libretro_device_set = false; + input_st->remapping_cache_active = false; } } diff --git a/input/input_driver.h b/input/input_driver.h index 7471ff7fbe..fed67d30bd 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -415,6 +415,8 @@ typedef struct input_mapper_t mapper; /* uint32_t alignment */ input_device_info_t input_device_info[MAX_INPUT_DEVICES]; /* unsigned alignment */ input_mouse_info_t input_mouse_info[MAX_INPUT_DEVICES]; + unsigned old_analog_dpad_mode[MAX_USERS]; + unsigned old_libretro_device[MAX_USERS]; unsigned osk_last_codepoint; unsigned osk_last_codepoint_len; unsigned input_hotkey_block_counter; @@ -437,6 +439,9 @@ typedef struct bool grab_mouse_state; bool analog_requested[MAX_USERS]; bool keyboard_mapping_blocked; + bool old_analog_dpad_mode_set; + bool old_libretro_device_set; + bool remapping_cache_active; retro_bits_512_t keyboard_mapping_bits; /* bool alignment */ input_game_focus_state_t game_focus_state; /* bool alignment */ } input_driver_state_t; diff --git a/retroarch_types.h b/retroarch_types.h index 6ac94a0349..17764d9012 100644 --- a/retroarch_types.h +++ b/retroarch_types.h @@ -371,11 +371,6 @@ typedef struct global bool softfilter_enable; } console; - unsigned old_analog_dpad_mode[MAX_USERS]; - unsigned old_libretro_device[MAX_USERS]; - bool old_analog_dpad_mode_set; - bool old_libretro_device_set; - bool remapping_cache_active; /* Settings and/or global states specific to menus */ bool launched_from_cli; bool cli_load_menu_on_error;