diff --git a/menu/menu_input.c b/menu/menu_input.c index 6b17fa2ec8..016329a52c 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -40,6 +40,102 @@ #include "../input/input_remapping.h" #include "../input/input_common.h" +struct menu_bind_state_port +{ + bool buttons[MENU_MAX_BUTTONS]; + int16_t axes[MENU_MAX_AXES]; + uint16_t hats[MENU_MAX_HATS]; +}; + +struct menu_bind_axis_state +{ + /* Default axis state. */ + int16_t rested_axes[MENU_MAX_AXES]; + /* Locked axis state. If we configured an axis, + * avoid having the same axis state trigger something again right away. */ + int16_t locked_axes[MENU_MAX_AXES]; +}; + +struct menu_bind_state +{ + struct retro_keybind *target; + /* For keyboard binding. */ + int64_t timeout_end; + unsigned begin; + unsigned last; + unsigned user; + struct menu_bind_state_port state[MAX_USERS]; + struct menu_bind_axis_state axis_state[MAX_USERS]; + bool skip; +}; + +typedef struct menu_input_mouse +{ + int16_t x; + int16_t y; + bool left; + bool right; + bool oldleft; + bool oldright; + bool wheelup; + bool wheeldown; + bool hwheelup; + bool hwheeldown; + bool scrollup; + bool scrolldown; + unsigned ptr; + uint64_t state; +} menu_input_mouse_t; + +typedef struct menu_input +{ + struct menu_bind_state binds; + + bool bind_mode_keyboard; + + uint64_t devices_mask; + + menu_input_mouse_t mouse; + + struct + { + int16_t x; + int16_t y; + int16_t dx; + int16_t dy; + int16_t old_x; + int16_t old_y; + int16_t start_x; + int16_t start_y; + float accel; + float accel0; + float accel1; + bool pressed[2]; + bool oldpressed[2]; + bool dragging; + bool back; + bool oldback; + unsigned ptr; + } pointer; + + struct + { + const char **buffer; + const char *label; + const char *label_setting; + bool display; + unsigned type; + unsigned idx; + } keyboard; + + /* Used for key repeat */ + struct + { + float timer; + float count; + } delay; +} menu_input_t; + static menu_input_t menu_input_state; void menu_input_free(void) diff --git a/menu/menu_input.h b/menu/menu_input.h index 5202b91497..e30a30ab2d 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -97,7 +97,6 @@ enum menu_input_ctl_state MENU_INPUT_CTL_SEARCH_START }; - enum menu_input_bind_mode { MENU_INPUT_BIND_NONE, @@ -111,102 +110,6 @@ enum menu_input_bind_mode unsigned bind_port; -struct menu_bind_state_port -{ - bool buttons[MENU_MAX_BUTTONS]; - int16_t axes[MENU_MAX_AXES]; - uint16_t hats[MENU_MAX_HATS]; -}; - -struct menu_bind_axis_state -{ - /* Default axis state. */ - int16_t rested_axes[MENU_MAX_AXES]; - /* Locked axis state. If we configured an axis, - * avoid having the same axis state trigger something again right away. */ - int16_t locked_axes[MENU_MAX_AXES]; -}; - -struct menu_bind_state -{ - struct retro_keybind *target; - /* For keyboard binding. */ - int64_t timeout_end; - unsigned begin; - unsigned last; - unsigned user; - struct menu_bind_state_port state[MAX_USERS]; - struct menu_bind_axis_state axis_state[MAX_USERS]; - bool skip; -}; - -typedef struct menu_input_mouse -{ - int16_t x; - int16_t y; - bool left; - bool right; - bool oldleft; - bool oldright; - bool wheelup; - bool wheeldown; - bool hwheelup; - bool hwheeldown; - bool scrollup; - bool scrolldown; - unsigned ptr; - uint64_t state; -} menu_input_mouse_t; - -typedef struct menu_input -{ - struct menu_bind_state binds; - - bool bind_mode_keyboard; - - uint64_t devices_mask; - - menu_input_mouse_t mouse; - - struct - { - int16_t x; - int16_t y; - int16_t dx; - int16_t dy; - int16_t old_x; - int16_t old_y; - int16_t start_x; - int16_t start_y; - float accel; - float accel0; - float accel1; - bool pressed[2]; - bool oldpressed[2]; - bool dragging; - bool back; - bool oldback; - unsigned ptr; - } pointer; - - struct - { - const char **buffer; - const char *label; - const char *label_setting; - bool display; - unsigned type; - unsigned idx; - } keyboard; - - /* Used for key repeat */ - struct - { - float timer; - float count; - } delay; -} menu_input_t; - void menu_input_key_event(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers);