From cc97df732cc60271ca0cac996950101ee56eb376 Mon Sep 17 00:00:00 2001 From: neil4 Date: Sat, 16 Mar 2024 03:56:30 -0500 Subject: [PATCH] Add Overlay Mouse, Lightgun, and Pointer (#16343) - When enabled, any touch inputs not in a hitbox are used to create pointing device input for the core. - Mouse: 1-, 2-, 3-touch inputs are LMB, RMB, and MMB - Lightgun: allows input from overlay buttons or multi-touch mappings --- config.def.h | 18 + configuration.c | 20 + configuration.h | 17 + input/input_driver.c | 589 ++++++++++++++++++++++++++++-- input/input_overlay.h | 59 +++ intl/msg_hash_lbl.h | 72 ++++ intl/msg_hash_us.h | 138 +++++++ menu/cbs/menu_cbs_deferred_push.c | 10 + menu/cbs/menu_cbs_ok.c | 10 + menu/cbs/menu_cbs_sublabel.c | 64 ++++ menu/cbs/menu_cbs_title.c | 10 + menu/drivers/materialui.c | 2 + menu/drivers/ozone.c | 2 + menu/drivers/xmb.c | 2 + menu/menu_cbs.h | 2 + menu/menu_displaylist.c | 68 ++++ menu/menu_displaylist.h | 2 + menu/menu_setting.c | 349 ++++++++++++++++++ msg_hash.h | 19 + 19 files changed, 1427 insertions(+), 26 deletions(-) diff --git a/config.def.h b/config.def.h index 17f948b80dba..3f43614efc4b 100644 --- a/config.def.h +++ b/config.def.h @@ -602,6 +602,24 @@ #define DEFAULT_INPUT_OVERLAY_AUTO_SCALE false #endif +#if defined(RARCH_MOBILE) +#define DEFAULT_INPUT_OVERLAY_POINTER_ENABLE true +#else +#define DEFAULT_INPUT_OVERLAY_POINTER_ENABLE false +#endif + +#define DEFAULT_INPUT_OVERLAY_LIGHTGUN_PORT -1 +#define DEFAULT_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH true +#define DEFAULT_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY 1 +#define DEFAULT_INPUT_OVERLAY_LIGHTGUN_MULTI_TOUCH_INPUT 0 +#define DEFAULT_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN true +#define DEFAULT_INPUT_OVERLAY_MOUSE_SPEED 1.0f +#define DEFAULT_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG true +#define DEFAULT_INPUT_OVERLAY_MOUSE_HOLD_MSEC 200 +#define DEFAULT_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG false +#define DEFAULT_INPUT_OVERLAY_MOUSE_DTAP_MSEC 200 +#define DEFAULT_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD 1.0f + #ifdef UDEV_TOUCH_SUPPORT #define DEFAULT_INPUT_TOUCH_VMOUSE_POINTER true #define DEFAULT_INPUT_TOUCH_VMOUSE_MOUSE true diff --git a/configuration.c b/configuration.c index 96d90bfc570e..8a5e272926a6 100644 --- a/configuration.c +++ b/configuration.c @@ -2059,6 +2059,11 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("input_overlay_auto_rotate", &settings->bools.input_overlay_auto_rotate, true, DEFAULT_OVERLAY_AUTO_ROTATE, false); SETTING_BOOL("input_overlay_auto_scale", &settings->bools.input_overlay_auto_scale, true, DEFAULT_INPUT_OVERLAY_AUTO_SCALE, false); SETTING_BOOL("input_osk_overlay_auto_scale", &settings->bools.input_osk_overlay_auto_scale, true, DEFAULT_INPUT_OVERLAY_AUTO_SCALE, false); + SETTING_BOOL("input_overlay_pointer_enable", &settings->bools.input_overlay_pointer_enable, true, DEFAULT_INPUT_OVERLAY_POINTER_ENABLE, false); + SETTING_BOOL("input_overlay_lightgun_trigger_on_touch", &settings->bools.input_overlay_lightgun_trigger_on_touch, true, DEFAULT_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH, false); + SETTING_BOOL("input_overlay_lightgun_allow_offscreen", &settings->bools.input_overlay_lightgun_allow_offscreen, true, DEFAULT_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN, false); + SETTING_BOOL("input_overlay_mouse_hold_to_drag", &settings->bools.input_overlay_mouse_hold_to_drag, true, DEFAULT_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG, false); + SETTING_BOOL("input_overlay_mouse_dtap_to_drag", &settings->bools.input_overlay_mouse_dtap_to_drag, true, DEFAULT_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG, false); #endif #ifdef UDEV_TOUCH_SUPPORT SETTING_BOOL("input_touch_vmouse_pointer", &settings->bools.input_touch_vmouse_pointer, true, DEFAULT_INPUT_TOUCH_VMOUSE_POINTER, false); @@ -2249,6 +2254,8 @@ static struct config_float_setting *populate_settings_float( SETTING_FLOAT("input_overlay_y_separation_portrait", &settings->floats.input_overlay_y_separation_portrait, true, DEFAULT_INPUT_OVERLAY_Y_SEPARATION_PORTRAIT, false); SETTING_FLOAT("input_overlay_x_offset_portrait", &settings->floats.input_overlay_x_offset_portrait, true, DEFAULT_INPUT_OVERLAY_X_OFFSET_PORTRAIT, false); SETTING_FLOAT("input_overlay_y_offset_portrait", &settings->floats.input_overlay_y_offset_portrait, true, DEFAULT_INPUT_OVERLAY_Y_OFFSET_PORTRAIT, false); + SETTING_FLOAT("input_overlay_mouse_speed", &settings->floats.input_overlay_mouse_speed, true, DEFAULT_INPUT_OVERLAY_MOUSE_SPEED, false); + SETTING_FLOAT("input_overlay_mouse_swipe_threshold", &settings->floats.input_overlay_mouse_swipe_threshold, true, DEFAULT_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD, false); #endif #ifdef _3DS @@ -2528,6 +2535,15 @@ static struct config_uint_setting *populate_settings_uint( SETTING_UINT("steam_rich_presence_format", &settings->uints.steam_rich_presence_format, true, DEFAULT_STEAM_RICH_PRESENCE_FORMAT, false); #endif +#ifdef HAVE_OVERLAY + SETTING_UINT("input_overlay_lightgun_trigger_delay", &settings->uints.input_overlay_lightgun_trigger_delay, true, DEFAULT_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY, false); + SETTING_UINT("input_overlay_lightgun_two_touch_input", &settings->uints.input_overlay_lightgun_two_touch_input, true, DEFAULT_INPUT_OVERLAY_LIGHTGUN_MULTI_TOUCH_INPUT, false); + SETTING_UINT("input_overlay_lightgun_three_touch_input", &settings->uints.input_overlay_lightgun_three_touch_input, true, DEFAULT_INPUT_OVERLAY_LIGHTGUN_MULTI_TOUCH_INPUT, false); + SETTING_UINT("input_overlay_lightgun_four_touch_input", &settings->uints.input_overlay_lightgun_four_touch_input, true, DEFAULT_INPUT_OVERLAY_LIGHTGUN_MULTI_TOUCH_INPUT, false); + SETTING_UINT("input_overlay_mouse_hold_msec", &settings->uints.input_overlay_mouse_hold_msec, true, DEFAULT_INPUT_OVERLAY_MOUSE_HOLD_MSEC, false); + SETTING_UINT("input_overlay_mouse_dtap_msec", &settings->uints.input_overlay_mouse_dtap_msec, true, DEFAULT_INPUT_OVERLAY_MOUSE_DTAP_MSEC, false); +#endif + *size = count; return tmp; @@ -2599,6 +2615,10 @@ static struct config_int_setting *populate_settings_int( SETTING_INT("bottom_font_color_opacity", &settings->ints.bottom_font_color_opacity, true, DEFAULT_BOTTOM_FONT_COLOR, false); #endif +#ifdef HAVE_OVERLAY + SETTING_INT("input_overlay_lightgun_port", &settings->ints.input_overlay_lightgun_port, true, DEFAULT_INPUT_OVERLAY_LIGHTGUN_PORT, false); +#endif + *size = count; return tmp; diff --git a/configuration.h b/configuration.h index 391201de2e50..ce7a5a42d7f3 100644 --- a/configuration.h +++ b/configuration.h @@ -134,6 +134,9 @@ typedef struct settings #ifdef HAVE_XMB int menu_xmb_title_margin; int menu_xmb_title_margin_horizontal_offset; +#endif +#ifdef HAVE_OVERLAY + int input_overlay_lightgun_port; #endif } ints; @@ -319,6 +322,12 @@ typedef struct settings unsigned input_overlay_show_inputs_port; unsigned input_overlay_dpad_diagonal_sensitivity; unsigned input_overlay_abxy_diagonal_sensitivity; + unsigned input_overlay_lightgun_trigger_delay; + unsigned input_overlay_lightgun_two_touch_input; + unsigned input_overlay_lightgun_three_touch_input; + unsigned input_overlay_lightgun_four_touch_input; + unsigned input_overlay_mouse_hold_msec; + unsigned input_overlay_mouse_dtap_msec; #endif unsigned run_ahead_frames; @@ -418,6 +427,9 @@ typedef struct settings float input_overlay_x_offset_portrait; float input_overlay_y_offset_portrait; + float input_overlay_mouse_speed; + float input_overlay_mouse_swipe_threshold; + float slowmotion_ratio; float fastforward_ratio; float input_analog_deadzone; @@ -664,6 +676,11 @@ typedef struct settings bool input_overlay_auto_rotate; bool input_overlay_auto_scale; bool input_osk_overlay_auto_scale; + bool input_overlay_pointer_enable; + bool input_overlay_lightgun_trigger_on_touch; + bool input_overlay_lightgun_allow_offscreen; + bool input_overlay_mouse_hold_to_drag; + bool input_overlay_mouse_dtap_to_drag; bool input_descriptor_label_show; bool input_descriptor_hide_unbound; bool input_all_users_control_menu; diff --git a/input/input_driver.c b/input/input_driver.c index 33b89be5134e..a644e35704bc 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -1093,6 +1093,168 @@ const char **input_keyboard_start_line( return (const char**)&keyboard_line->buffer; } +#ifdef HAVE_OVERLAY +static int16_t input_overlay_mouse_state(input_overlay_t *ol, unsigned id) +{ + input_overlay_pointer_state_t *ptr_st = &ol->pointer_state; + int16_t res; + + switch(id) + { + case RETRO_DEVICE_ID_MOUSE_X: + ptr_st->device_mask |= (1 << RETRO_DEVICE_MOUSE); + + res = ptr_st->mouse.scale_x + * (ptr_st->screen_x - ptr_st->mouse.prev_screen_x); + ptr_st->mouse.prev_screen_x = ptr_st->screen_x; + return res; + case RETRO_DEVICE_ID_MOUSE_Y: + res = ptr_st->mouse.scale_y + * (ptr_st->screen_y - ptr_st->mouse.prev_screen_y); + ptr_st->mouse.prev_screen_y = ptr_st->screen_y; + return res; + case RETRO_DEVICE_ID_MOUSE_LEFT: + return (ptr_st->mouse.click & 0x1) || + (ptr_st->mouse.hold & 0x1); + case RETRO_DEVICE_ID_MOUSE_RIGHT: + return (ptr_st->mouse.click & 0x2) || + (ptr_st->mouse.hold & 0x2); + case RETRO_DEVICE_ID_MOUSE_MIDDLE: + return (ptr_st->mouse.click & 0x4) || + (ptr_st->mouse.hold & 0x4); + default: + break; + } + + return 0; +} + +static int16_t input_overlay_lightgun_state(settings_t *settings, + input_overlay_t *ol, unsigned id) +{ + struct video_viewport vp; + input_overlay_pointer_state_t *ptr_st = &ol->pointer_state; + unsigned rarch_id; + int16_t edge; + + switch(id) + { + case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X: + ptr_st->device_mask |= (1 << RETRO_DEVICE_LIGHTGUN); + + if ( ptr_st->ptr[0].x != -0x8000 + || settings->bools.input_overlay_lightgun_allow_offscreen) + return ptr_st->ptr[0].x; + else if (video_driver_get_viewport_info(&vp)) + { + edge = ((2 * vp.x * 0x7fff) / (int)vp.full_width) - 0x7fff; + return ((ptr_st->screen_x > edge) ? 0x7fff : -0x7fff); + } + return -0x8000; + case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y: + if ( ptr_st->ptr[0].y != -0x8000 + || settings->bools.input_overlay_lightgun_allow_offscreen) + return ptr_st->ptr[0].y; + else if (video_driver_get_viewport_info(&vp)) + { + edge = ((2 * vp.y * 0x7fff) / (int)vp.full_height) - 0x7fff; + return ((ptr_st->screen_y > edge) ? 0x7fff : -0x7fff); + } + return -0x8000; + case RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN: + return ( settings->bools.input_overlay_lightgun_allow_offscreen + && (ptr_st->ptr[0].x == -0x8000 || ptr_st->ptr[0].y == -0x8000)); + case RETRO_DEVICE_ID_LIGHTGUN_AUX_A: + rarch_id = RARCH_LIGHTGUN_AUX_A; + break; + case RETRO_DEVICE_ID_LIGHTGUN_AUX_B: + rarch_id = RARCH_LIGHTGUN_AUX_B; + break; + case RETRO_DEVICE_ID_LIGHTGUN_AUX_C: + rarch_id = RARCH_LIGHTGUN_AUX_C; + break; + case RETRO_DEVICE_ID_LIGHTGUN_TRIGGER: + rarch_id = RARCH_LIGHTGUN_TRIGGER; + break; + case RETRO_DEVICE_ID_LIGHTGUN_START: + case RETRO_DEVICE_ID_LIGHTGUN_PAUSE: + rarch_id = RARCH_LIGHTGUN_START; + break; + case RETRO_DEVICE_ID_LIGHTGUN_SELECT: + rarch_id = RARCH_LIGHTGUN_SELECT; + break; + case RETRO_DEVICE_ID_LIGHTGUN_RELOAD: + rarch_id = RARCH_LIGHTGUN_RELOAD; + break; + case RETRO_DEVICE_ID_LIGHTGUN_DPAD_UP: + rarch_id = RARCH_LIGHTGUN_DPAD_UP; + break; + case RETRO_DEVICE_ID_LIGHTGUN_DPAD_DOWN: + rarch_id = RARCH_LIGHTGUN_DPAD_DOWN; + break; + case RETRO_DEVICE_ID_LIGHTGUN_DPAD_LEFT: + rarch_id = RARCH_LIGHTGUN_DPAD_LEFT; + break; + case RETRO_DEVICE_ID_LIGHTGUN_DPAD_RIGHT: + rarch_id = RARCH_LIGHTGUN_DPAD_RIGHT; + break; + default: + rarch_id = RARCH_BIND_LIST_END; + break; + } + + return ( rarch_id < RARCH_BIND_LIST_END + && ( ptr_st->lightgun.multitouch_id == rarch_id + || BIT256_GET(ol->overlay_state.buttons, rarch_id))); +} + +static int16_t input_overlay_pointer_state(input_overlay_t *ol, + unsigned idx, unsigned id) +{ + input_overlay_pointer_state_t *ptr_st = &ol->pointer_state; + + ptr_st->device_mask |= (1 << RETRO_DEVICE_POINTER); + + switch (id) + { + case RETRO_DEVICE_ID_POINTER_X: + return ptr_st->ptr[idx].x; + case RETRO_DEVICE_ID_POINTER_Y: + return ptr_st->ptr[idx].y; + case RETRO_DEVICE_ID_POINTER_PRESSED: + return (idx < ptr_st->count) + && ptr_st->ptr[idx].x != -0x8000 + && ptr_st->ptr[idx].y != -0x8000; + case RETRO_DEVICE_ID_POINTER_COUNT: + return ptr_st->count; + } + + return 0; +} + +static int16_t input_overlay_pointing_device_state(settings_t *settings, + input_overlay_t *ol, unsigned port, unsigned device, + unsigned idx, unsigned id) +{ + switch (device) + { + case RETRO_DEVICE_MOUSE: + return input_overlay_mouse_state(ol, id); + case RETRO_DEVICE_LIGHTGUN: + if ( settings->ints.input_overlay_lightgun_port == -1 + || settings->ints.input_overlay_lightgun_port == (int)port) + return input_overlay_lightgun_state(settings, ol, id); + break; + case RETRO_DEVICE_POINTER: + return input_overlay_pointer_state(ol, idx, id); + default: + break; + } + + return 0; +} +#endif + #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) static bool input_remote_init_network(input_remote_t *handle, uint16_t port, unsigned user) @@ -1538,6 +1700,14 @@ static int16_t input_state_device( case RETRO_DEVICE_LIGHTGUN: case RETRO_DEVICE_POINTER: +#ifdef HAVE_OVERLAY + if ( (input_st->overlay_ptr) + && (input_st->overlay_ptr->flags & INPUT_OVERLAY_ENABLE) + && (settings->bools.input_overlay_pointer_enable)) + res = input_overlay_pointing_device_state(settings, + input_st->overlay_ptr, port, device, idx, id); +#endif + if (input_st->flags & INP_FLAG_BLOCK_POINTER_INPUT) break; @@ -2087,8 +2257,10 @@ static bool input_overlay_coords_inside_hitbox(const struct overlay_desc *desc, * * @norm_x and @norm_y are the result of * video_driver_translate_coord_viewport(). + * + * @return true if touch pointer is inside any hitbox **/ -static void input_overlay_poll( +static bool input_overlay_poll( input_overlay_t *ol, input_overlay_state_t *out, int touch_idx, int16_t norm_x, int16_t norm_y, float touch_scale) @@ -2097,6 +2269,7 @@ static void input_overlay_poll( struct overlay_desc *descs = ol->active->descs; unsigned int highest_prio = 0; int old_touch_idx = input_driver_st.old_touch_index_lut[touch_idx]; + bool any_hitbox_pressed = false; bool use_range_mod; /* norm_x and norm_y is in [-0x7fff, 0x7fff] range, @@ -2193,10 +2366,14 @@ static void input_overlay_poll( desc->delta_y = clamp_float(y_dist, -desc->range_y, desc->range_y) * ol->active->mod_h; } + + any_hitbox_pressed = true; } if (ol->flags & INPUT_OVERLAY_BLOCKED) memset(out, 0, sizeof(*out)); + + return any_hitbox_pressed; } /** @@ -2716,6 +2893,285 @@ void input_overlay_auto_rotate_( } } +/** + * input_overlay_poll_lightgun + * @settings: pointer to settings + * @ol : overlay handle + * @old_ptr_count : previous poll's non-hitbox pointer count + * + * Updates multi-touch button state of the overlay lightgun. + */ +static void input_overlay_poll_lightgun(settings_t *settings, + input_overlay_t *ol, const int old_ptr_count) +{ + input_overlay_state_t *ol_state = &ol->overlay_state; + input_overlay_pointer_state_t *ptr_st = &ol->pointer_state; + const int ptr_count = ptr_st->count; + unsigned action = OVERLAY_LIGHTGUN_ACTION_NONE; + int8_t trig_delay = + settings->uints.input_overlay_lightgun_trigger_delay; + int8_t delay_idx; + + static uint16_t trig_buf; + static uint8_t now_idx; + static uint8_t peak_ptr_count; + static const unsigned action_to_id[OVERLAY_LIGHTGUN_ACTION_END] = { + RARCH_BIND_LIST_END, + RARCH_LIGHTGUN_TRIGGER, + RARCH_LIGHTGUN_RELOAD, + RARCH_LIGHTGUN_AUX_A, + RARCH_LIGHTGUN_AUX_B, + RARCH_LIGHTGUN_AUX_C, + RARCH_LIGHTGUN_START, + RARCH_LIGHTGUN_SELECT, + RARCH_LIGHTGUN_DPAD_UP, + RARCH_LIGHTGUN_DPAD_DOWN, + RARCH_LIGHTGUN_DPAD_LEFT, + RARCH_LIGHTGUN_DPAD_RIGHT + }; + + /* Update peak pointer count */ + if (!old_ptr_count && ptr_count) + peak_ptr_count = ptr_count; + else + peak_ptr_count = MAX(ptr_count, peak_ptr_count); + + /* Apply trigger delay */ + now_idx = (now_idx + 1) % (OVERLAY_LIGHTGUN_TRIG_MAX_DELAY + 1); + delay_idx = (now_idx + trig_delay) % (OVERLAY_LIGHTGUN_TRIG_MAX_DELAY + 1); + + if (ptr_count > 0) + BIT16_SET(trig_buf, delay_idx); + else + BIT16_CLEAR(trig_buf, delay_idx); + + /* Create button input if we're past the trigger delay */ + if (BIT16_GET(trig_buf, now_idx)) + { + switch (peak_ptr_count) + { + case 1: + if (settings->bools.input_overlay_lightgun_trigger_on_touch) + action = OVERLAY_LIGHTGUN_ACTION_TRIGGER; + break; + case 2: + action = settings->uints.input_overlay_lightgun_two_touch_input; + break; + case 3: + action = settings->uints.input_overlay_lightgun_three_touch_input; + break; + case 4: + action = settings->uints.input_overlay_lightgun_four_touch_input; + break; + default: + break; + } + } + + ptr_st->lightgun.multitouch_id = action_to_id[action]; +} + +static void input_overlay_get_mouse_scale(settings_t *settings, + float *scale_x, float *scale_y, + int *swipe_thres_x, int *swipe_thres_y) +{ + video_driver_state_t *video_st = video_state_get_ptr(); + struct retro_game_geometry *geom = &video_st->av_info.geometry; + float swipe_thres; + float adj_x, adj_y; + float display_aspect, core_aspect; + float speed; + + if (geom->base_height) + { + speed = settings->floats.input_overlay_mouse_speed; + swipe_thres = + 655.35f * settings->floats.input_overlay_mouse_swipe_threshold; + display_aspect = (float)video_st->width / video_st->height; + core_aspect = (float)geom->base_width / geom->base_height; + + if (display_aspect > core_aspect) + { + adj_x = speed * (display_aspect / core_aspect); + adj_y = speed; + } + else + { + adj_y = speed * (core_aspect / display_aspect); + adj_x = speed; + } + + *scale_x = (adj_x * geom->base_width) / (float)0x7fff; + *scale_y = (adj_y * geom->base_height) / (float)0x7fff; + + if (display_aspect > 1.0f) + { + *swipe_thres_x = (int)(swipe_thres / display_aspect); + *swipe_thres_y = (int)swipe_thres; + } + else + { + *swipe_thres_x = (int)swipe_thres; + *swipe_thres_y = (int)(swipe_thres / display_aspect); + } + } +} + +/** + * input_overlay_poll_mouse + * @settings: pointer to settings + * @ol : overlay handle + * @old_ptr_count : previous poll's non-hitbox pointer count + * + * Updates button state of the overlay mouse. + */ +static void input_overlay_poll_mouse(settings_t *settings, + input_overlay_t *ol, const int old_ptr_count) +{ + input_overlay_pointer_state_t *ptr_st = &ol->pointer_state; + struct input_overlay_mouse_state *mouse_st = &ptr_st->mouse; + const retro_time_t now_usec = cpu_features_get_time_usec(); + const retro_time_t hold_usec = settings->uints.input_overlay_mouse_hold_msec * 1000; + const retro_time_t dtap_usec = settings->uints.input_overlay_mouse_dtap_msec * 1000; + const int ptr_count = ptr_st->count; + int swipe_thres_x = 0; + int swipe_thres_y = 0; + const bool hold_to_drag = settings->bools.input_overlay_mouse_hold_to_drag; + const bool dtap_to_drag = settings->bools.input_overlay_mouse_dtap_to_drag; + bool want_feedback = false; + bool is_swipe, is_brief, is_long; + + static retro_time_t start_usec; + static retro_time_t last_down_usec; + static retro_time_t last_up_usec; + static retro_time_t pending_click_usec; + static retro_time_t click_dur_usec; + static retro_time_t click_end_usec; + static int x_start; + static int y_start; + static int peak_ptr_count; + static int old_peak_ptr_count; + static bool skip_buttons; + static bool pending_click; + + input_overlay_get_mouse_scale(settings, + &mouse_st->scale_x, &mouse_st->scale_y, + &swipe_thres_x, &swipe_thres_y); + + /* Check for pointer count changes */ + if (ptr_count != old_ptr_count) + { + mouse_st->click = 0; + pending_click = false; + + if (ptr_count) + { + /* Assume main pointer changed. Reset deltas */ + mouse_st->prev_screen_x = x_start = ptr_st->screen_x; + mouse_st->prev_screen_y = y_start = ptr_st->screen_y; + } + else + old_peak_ptr_count = peak_ptr_count; + + if (ptr_count > old_ptr_count) + { + /* Pointer added */ + peak_ptr_count = ptr_count; + start_usec = now_usec; + } + else + /* Pointer removed */ + mouse_st->hold = 0; + } + + /* Action type */ + is_swipe = abs(ptr_st->screen_x - x_start) > swipe_thres_x || + abs(ptr_st->screen_y - y_start) > swipe_thres_y; + is_brief = (now_usec - start_usec) < 200000; + is_long = (now_usec - start_usec) > (hold_to_drag ? hold_usec : 250000); + + /* Check if new button input should be created */ + if (!skip_buttons) + { + if (!is_swipe) + { + if ( hold_to_drag + && is_long && ptr_count && !mouse_st->hold) + { + /* Long press */ + mouse_st->hold = (1 << (ptr_count - 1)); + want_feedback = true; + } + else if (is_brief) + { + if (ptr_count && !old_ptr_count) + { + /* New input. Check for double tap */ + if ( dtap_to_drag + && now_usec - last_up_usec < dtap_usec) + mouse_st->hold = (1 << (old_peak_ptr_count - 1)); + + last_down_usec = now_usec; + } + else if (!ptr_count && old_ptr_count) + { + /* Finished a tap. Send click */ + click_dur_usec = (now_usec - last_down_usec) + 5000; + + if (dtap_to_drag) + { + pending_click = true; + pending_click_usec = now_usec + dtap_usec; + } + else + { + mouse_st->click = (1 << (peak_ptr_count - 1)); + click_end_usec = now_usec + click_dur_usec; + } + + last_up_usec = now_usec; + } + } + } + else + { + /* If dragging 2+ fingers, hold RMB or MMB */ + if (ptr_count > 1) + { + mouse_st->hold = (1 << (ptr_count - 1)); + if (hold_to_drag) + want_feedback = true; + } + skip_buttons = true; + } + } + + /* Check for pending click */ + if (pending_click && now_usec >= pending_click_usec) + { + mouse_st->click = (1 << (old_peak_ptr_count - 1)); + click_end_usec = now_usec + click_dur_usec; + pending_click = false; + } + + if (!ptr_count) + skip_buttons = false; /* Reset button checks */ + else if (is_long) + skip_buttons = true; /* End of button checks */ + + /* Remove stale clicks */ + if (mouse_st->click && now_usec > click_end_usec) + mouse_st->click = 0; + + if (want_feedback && settings->bools.vibrate_on_keypress) + { + input_driver_t *current_input = input_driver_st.current_driver; + + if (current_input && current_input->keypress_vibrate) + current_input->keypress_vibrate(); + } +} + /** * input_overlay_track_touch_inputs * @state : Overlay input state for this poll @@ -2772,6 +3228,54 @@ static void input_overlay_track_touch_inputs( } } +static void input_overlay_update_pointer_coords( + input_overlay_pointer_state_t *ptr_st, int touch_idx) +{ + void *input_data = input_driver_st.current_data; + input_driver_t *current_input = input_driver_st.current_driver; + + /* Need multi-touch coordinates for pointer only */ + if ( ptr_st->count + && !(ptr_st->device_mask & (1 << RETRO_DEVICE_POINTER))) + goto finish; + + /* Need viewport pointers for pointer and lightgun */ + if (ptr_st->device_mask & + ((1 << RETRO_DEVICE_LIGHTGUN) | (1 << RETRO_DEVICE_POINTER))) + { + ptr_st->ptr[ptr_st->count].x = current_input->input_state( + input_data, NULL, NULL, NULL, NULL, true, 0, + RETRO_DEVICE_POINTER, + touch_idx, + RETRO_DEVICE_ID_POINTER_X); + ptr_st->ptr[ptr_st->count].y = current_input->input_state( + input_data, NULL, NULL, NULL, NULL, true, 0, + RETRO_DEVICE_POINTER, + touch_idx, + RETRO_DEVICE_ID_POINTER_Y); + } + + /* Need fullscreen pointer for mouse and lightgun */ + if ( !ptr_st->count + && (ptr_st->device_mask & + ((1 << RETRO_DEVICE_MOUSE) | (1 << RETRO_DEVICE_LIGHTGUN)))) + { + ptr_st->screen_x = current_input->input_state( + input_data, NULL, NULL, NULL, NULL, true, 0, + RARCH_DEVICE_POINTER_SCREEN, + touch_idx, + RETRO_DEVICE_ID_POINTER_X); + ptr_st->screen_y = current_input->input_state( + input_data, NULL, NULL, NULL, NULL, true, 0, + RARCH_DEVICE_POINTER_SCREEN, + touch_idx, + RETRO_DEVICE_ID_POINTER_Y); + } + +finish: + ptr_st->count++; +} + /* * input_poll_overlay: * @@ -2788,19 +3292,23 @@ static void input_poll_overlay( { input_overlay_state_t old_ol_state; int i, j; - input_overlay_t *ol = (input_overlay_t*)ol_data; - uint16_t key_mod = 0; - bool button_pressed = false; - input_driver_state_t *input_st = &input_driver_st; - void *input_data = input_st->current_data; - input_overlay_state_t *ol_state = &ol->overlay_state; - input_driver_t *current_input = input_st->current_driver; + input_overlay_t *ol = (input_overlay_t*)ol_data; + uint16_t key_mod = 0; + bool button_pressed = false; + input_driver_state_t *input_st = &input_driver_st; + void *input_data = input_st->current_data; + input_overlay_state_t *ol_state = &ol->overlay_state; + input_overlay_pointer_state_t *ptr_state = &ol->pointer_state; + input_driver_t *current_input = input_st->current_driver; enum overlay_show_input_type - input_overlay_show_inputs = (enum overlay_show_input_type) + input_overlay_show_inputs = (enum overlay_show_input_type) settings->uints.input_overlay_show_inputs; - unsigned input_overlay_show_inputs_port = settings->uints.input_overlay_show_inputs_port; - float touch_scale = (float)settings->uints.input_touch_scale; - bool osk_state_changed = false; + unsigned input_overlay_show_inputs_port = settings->uints.input_overlay_show_inputs_port; + float touch_scale = (float)settings->uints.input_touch_scale; + bool ol_ptr_enable = settings->bools.input_overlay_pointer_enable; + bool osk_state_changed = false; + + static int old_ptr_count; if (!ol_state) return; @@ -2809,6 +3317,12 @@ static void input_poll_overlay( sizeof(old_ol_state)); memset(ol_state, 0, sizeof(*ol_state)); + if (ol_ptr_enable) + { + old_ptr_count = ptr_state->count; + ptr_state->count = 0; + } + if (current_input->input_state) { rarch_joypad_info_t joypad_info; @@ -2877,27 +3391,46 @@ static void input_poll_overlay( for (i = 0; i < ol_state->touch_count; i++) { input_overlay_state_t polled_data; + bool hitbox_pressed = false; + memset(&polled_data, 0, sizeof(struct input_overlay_state)); if (ol->flags & INPUT_OVERLAY_ENABLE) - input_overlay_poll(ol, &polled_data, i, + hitbox_pressed = input_overlay_poll(ol, &polled_data, i, ol_state->touch[i].x, ol_state->touch[i].y, touch_scale); else ol->flags &= ~INPUT_OVERLAY_BLOCKED; - bits_or_bits(ol_state->buttons.data, - polled_data.buttons.data, - ARRAY_SIZE(polled_data.buttons.data)); + if (hitbox_pressed) + { + bits_or_bits(ol_state->buttons.data, + polled_data.buttons.data, + ARRAY_SIZE(polled_data.buttons.data)); + + for (j = 0; j < (int)ARRAY_SIZE(ol_state->keys); j++) + ol_state->keys[j] |= polled_data.keys[j]; + + /* Fingers pressed later take priority and matched up + * with overlay poll priorities. */ + for (j = 0; j < 4; j++) + if (polled_data.analog[j]) + ol_state->analog[j] = polled_data.analog[j]; + } + else if (ol_ptr_enable + && ptr_state->device_mask + && !(ol->flags & INPUT_OVERLAY_BLOCKED)) + input_overlay_update_pointer_coords(ptr_state, i); + } + } - for (j = 0; j < (int)ARRAY_SIZE(ol_state->keys); j++) - ol_state->keys[j] |= polled_data.keys[j]; + if (ol_ptr_enable) + { + if (ptr_state->device_mask & (1 << RETRO_DEVICE_LIGHTGUN)) + input_overlay_poll_lightgun(settings, ol, old_ptr_count); + if (ptr_state->device_mask & (1 << RETRO_DEVICE_MOUSE)) + input_overlay_poll_mouse(settings, ol, old_ptr_count); - /* Fingers pressed later take priority and matched up - * with overlay poll priorities. */ - for (j = 0; j < 4; j++) - if (polled_data.analog[j]) - ol_state->analog[j] = polled_data.analog[j]; - } + ptr_state->device_mask = 0; } if ( OVERLAY_GET_KEY(ol_state, RETROK_LSHIFT) || @@ -2987,7 +3520,7 @@ static void input_poll_overlay( (input_overlay_show_inputs == OVERLAY_SHOW_INPUT_TOUCHED), input_overlay_show_inputs_port); - if (button_pressed) + if (button_pressed || ol_ptr_enable) input_st->flags |= INP_FLAG_BLOCK_POINTER_INPUT; else input_st->flags &= ~INP_FLAG_BLOCK_POINTER_INPUT; @@ -4463,13 +4996,15 @@ static void input_overlay_enable_(bool enable) else { /* Disable and clear input state */ - ol->flags &= ~INPUT_OVERLAY_ENABLE; + ol->flags &= ~INPUT_OVERLAY_ENABLE; + input_st->flags &= ~INP_FLAG_BLOCK_POINTER_INPUT; if (ol->iface && ol->iface->enable) ol->iface->enable(ol->iface_data, false); ol->iface = NULL; memset(&ol->overlay_state, 0, sizeof(input_overlay_state_t)); + memset(&ol->pointer_state, 0, sizeof(input_overlay_pointer_state_t)); } } @@ -4480,6 +5015,8 @@ static void input_overlay_deinit(void) input_overlay_free(input_driver_st.overlay_cache_ptr); input_driver_st.overlay_cache_ptr = NULL; + + input_driver_st.flags &= ~INP_FLAG_BLOCK_POINTER_INPUT; } static void input_overlay_move_to_cache(void) diff --git a/input/input_overlay.h b/input/input_overlay.h index 85243f8e8479..b6a6083f57cc 100644 --- a/input/input_overlay.h +++ b/input/input_overlay.h @@ -35,6 +35,7 @@ #define CUSTOM_BINDS_U32_COUNT ((RARCH_CUSTOM_BIND_LIST_END - 1) / 32 + 1) #define OVERLAY_MAX_TOUCH 16 +#define OVERLAY_LIGHTGUN_TRIG_MAX_DELAY 15 RETRO_BEGIN_DECLS @@ -140,6 +141,24 @@ enum OVERLAY_DESC_FLAGS OVERLAY_DESC_RANGE_MOD_EXCLUSIVE = (1 << 2) }; +enum overlay_lightgun_action +{ + OVERLAY_LIGHTGUN_ACTION_NONE = 0, + OVERLAY_LIGHTGUN_ACTION_TRIGGER, + OVERLAY_LIGHTGUN_ACTION_RELOAD, + OVERLAY_LIGHTGUN_ACTION_AUX_A, + OVERLAY_LIGHTGUN_ACTION_AUX_B, + OVERLAY_LIGHTGUN_ACTION_AUX_C, + OVERLAY_LIGHTGUN_ACTION_START, + OVERLAY_LIGHTGUN_ACTION_SELECT, + OVERLAY_LIGHTGUN_ACTION_DPAD_UP, + OVERLAY_LIGHTGUN_ACTION_DPAD_DOWN, + OVERLAY_LIGHTGUN_ACTION_DPAD_LEFT, + OVERLAY_LIGHTGUN_ACTION_DPAD_RIGHT, + + OVERLAY_LIGHTGUN_ACTION_END +}; + /* Overlay driver acts as a medium between input drivers * and video driver. * @@ -304,6 +323,45 @@ typedef struct input_overlay_state int touch_count; } input_overlay_state_t; +/* Non-hitbox input state for pointer, mouse, and lightgun */ +typedef struct input_overlay_pointer_state +{ + /* Input pointers that missed every hitbox */ + struct + { + int16_t x; + int16_t y; + } ptr[OVERLAY_MAX_TOUCH]; + unsigned count; + + /* Main pointer, full screen */ + int16_t screen_x; + int16_t screen_y; + + struct input_overlay_lightgun_state + { + /* Input ID based on pointer count */ + unsigned multitouch_id; + } lightgun; + + struct input_overlay_mouse_state + { + float scale_x; + float scale_y; + + int16_t prev_screen_x; + int16_t prev_screen_y; + + /* Bits 0-2 used for LMB, RMB, MMB */ + uint8_t click; + uint8_t hold; + } mouse; + + /* Mask of requested devices + * to avoid unnecessary polling */ + uint8_t device_mask; +} input_overlay_pointer_state_t; + struct input_overlay { struct overlay *overlays; @@ -312,6 +370,7 @@ struct input_overlay void *iface_data; const video_overlay_interface_t *iface; input_overlay_state_t overlay_state; + input_overlay_pointer_state_t pointer_state; size_t index; size_t size; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index ea5442a3bb1b..a5aa881bc6cb 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1346,6 +1346,14 @@ MSG_HASH( MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST, "deferred_osk_overlay_settings_list" ) +MSG_HASH( + MENU_ENUM_LABEL_DEFERRED_OVERLAY_LIGHTGUN_SETTINGS_LIST, + "deferred_overlay_lightgun_settings_list" + ) +MSG_HASH( + MENU_ENUM_LABEL_DEFERRED_OVERLAY_MOUSE_SETTINGS_LIST, + "deferred_overlay_mouse_settings_list" + ) MSG_HASH( MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST, "deferred_onscreen_video_layout_settings_list" @@ -2051,6 +2059,62 @@ MSG_HASH( MENU_ENUM_LABEL_INPUT_OSK_OVERLAY_AUTO_SCALE, "input_osk_overlay_auto_scale" ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_POINTER_ENABLE, + "input_overlay_pointer_enable" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_PORT, + "input_overlay_lightgun_port" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH, + "input_overlay_lightgun_trigger_on_touch" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY, + "input_overlay_lightgun_trigger_delay" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN, + "input_overlay_lightgun_allow_offscreen" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT, + "input_overlay_lightgun_two_touch_input" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT, + "input_overlay_lightgun_three_touch_input" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT, + "input_overlay_lightgun_four_touch_input" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_SPEED, + "input_overlay_mouse_speed" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG, + "input_overlay_mouse_hold_to_drag" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_HOLD_MSEC, + "input_overlay_mouse_hold_msec" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG, + "input_overlay_mouse_dtap_to_drag" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_DTAP_MSEC, + "input_overlay_mouse_dtap_msec" + ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD, + "input_overlay_mouse_swipe_threshold" + ) MSG_HASH( MENU_ENUM_LABEL_INPUT_OVERLAY_DPAD_DIAGONAL_SENSITIVITY, "input_overlay_dpad_diagonal_sensitivity" @@ -2655,6 +2719,14 @@ MSG_HASH( MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS, "onscreen_overlay_settings" ) +MSG_HASH( + MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS, + "overlay_lightgun_settings" + ) +MSG_HASH( + MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS, + "overlay_mouse_settings" + ) MSG_HASH( MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS, "osk_overlay_settings" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 8e544bf26885..6a42eba06994 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -5398,6 +5398,30 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OSK_OVERLAY_SETTINGS, "Select and adjust a keyboard overlay." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_POINTER_ENABLE, + "Enable Overlay Lightgun, Mouse, and Pointer" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_POINTER_ENABLE, + "Use any touch inputs not pressing overlay controls to create pointing device input for the core." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_LIGHTGUN_SETTINGS, + "Overlay Lightgun" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_LIGHTGUN_SETTINGS, + "Configure lightgun input sent from the overlay." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OVERLAY_MOUSE_SETTINGS, + "Overlay Mouse" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OVERLAY_MOUSE_SETTINGS, + "Configure mouse input sent from the overlay." + ) /* Settings > On-Screen Display > On-Screen Overlay > Keyboard Overlay */ @@ -5426,6 +5450,120 @@ MSG_HASH( "Opacity of all UI elements of the keyboard overlay." ) +/* Settings > On-Screen Display > On-Screen Overlay > Overlay Lightgun */ + +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_PORT, + "Lightgun Port" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_PORT, + "Set the core port to receive input from the overlay lightgun." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_PORT_ANY, + "Any" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH, + "Trigger on Touch" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH, + "Send trigger input with pointer input." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY, + "Trigger Delay (frames)" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY, + "Delay trigger input to allow the cursor time to move. This delay is also used to wait for the correct multi-touch count." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT, + "2-Touch Input" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT, + "Select input to send when two pointers are on screen. Trigger Delay should be nonzero to distinguish from other input." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT, + "3-Touch Input" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT, + "Select input to send when three pointers are on screen. Trigger Delay should be nonzero to distinguish from other input." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT, + "4-Touch Input" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT, + "Select input to send when four pointers are on screen. Trigger Delay should be nonzero to distinguish from other input." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN, + "Allow Off-Screen" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN, + "Allow out-of-bounds aiming. Disable to clamp off-screen aim to the in-bounds edge." + ) + +/* Settings > On-Screen Display > On-Screen Overlay > Overlay Mouse */ + +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_SPEED, + "Mouse Speed" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_SPEED, + "Adjust cursor movement speed." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG, + "Long Press to Drag" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG, + "Long press the screen to begin holding a button." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_HOLD_MSEC, + "Long Press Threshold (ms)" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_HOLD_MSEC, + "Adjust the hold time required for a long press." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG, + "Double Tap to Drag" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG, + "Double tap the screen to begin holding a button on the second tap. Adds latency to mouse clicks." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_DTAP_MSEC, + "Double Tap Threshold (ms)" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_DTAP_MSEC, + "Adjust the allowable time between taps when detecting a double tap." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD, + "Swipe Threshold" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD, + "Adjust the allowable drift range when detecting a long press or tap. Expressed as a percentage of the smaller screen dimension." + ) + /* Settings > On-Screen Display > Video Layout */ MSG_HASH( diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 426205b5722c..76ea8d1b157f 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -190,6 +190,8 @@ GENERIC_DEFERRED_PUSH(deferred_push_onscreen_notifications_views_settings_list, #if defined(HAVE_OVERLAY) GENERIC_DEFERRED_PUSH(deferred_push_onscreen_overlay_settings_list, DISPLAYLIST_ONSCREEN_OVERLAY_SETTINGS_LIST) GENERIC_DEFERRED_PUSH(deferred_push_osk_overlay_settings_list, DISPLAYLIST_OSK_OVERLAY_SETTINGS_LIST) +GENERIC_DEFERRED_PUSH(deferred_push_overlay_lightgun_settings_list, DISPLAYLIST_OVERLAY_LIGHTGUN_SETTINGS_LIST) +GENERIC_DEFERRED_PUSH(deferred_push_overlay_mouse_settings_list, DISPLAYLIST_OVERLAY_MOUSE_SETTINGS_LIST) #endif GENERIC_DEFERRED_PUSH(deferred_push_menu_file_browser_settings_list,DISPLAYLIST_MENU_FILE_BROWSER_SETTINGS_LIST) GENERIC_DEFERRED_PUSH(deferred_push_menu_views_settings_list, DISPLAYLIST_MENU_VIEWS_SETTINGS_LIST) @@ -735,6 +737,8 @@ static int menu_cbs_init_bind_deferred_push_compare_label( #if defined(HAVE_OVERLAY) {MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST, deferred_push_onscreen_overlay_settings_list}, {MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST, deferred_push_osk_overlay_settings_list}, + {MENU_ENUM_LABEL_DEFERRED_OVERLAY_LIGHTGUN_SETTINGS_LIST, deferred_push_overlay_lightgun_settings_list}, + {MENU_ENUM_LABEL_DEFERRED_OVERLAY_MOUSE_SETTINGS_LIST, deferred_push_overlay_mouse_settings_list}, #endif {MENU_ENUM_LABEL_DEFERRED_MENU_FILE_BROWSER_SETTINGS_LIST, deferred_push_menu_file_browser_settings_list}, {MENU_ENUM_LABEL_DEFERRED_MENU_VIEWS_SETTINGS_LIST, deferred_push_menu_views_settings_list}, @@ -1319,6 +1323,12 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_osk_overlay_settings_list); break; + case MENU_ENUM_LABEL_DEFERRED_OVERLAY_LIGHTGUN_SETTINGS_LIST: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_overlay_lightgun_settings_list); + break; + case MENU_ENUM_LABEL_DEFERRED_OVERLAY_MOUSE_SETTINGS_LIST: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_overlay_mouse_settings_list); + break; #endif case MENU_ENUM_LABEL_DEFERRED_AUDIO_SETTINGS_LIST: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_audio_settings_list); diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 58b2426e316c..80375b9f6f92 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -395,6 +395,10 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl) return MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST; case ACTION_OK_DL_OSK_OVERLAY_SETTINGS_LIST: return MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST; + case ACTION_OK_DL_OVERLAY_LIGHTGUN_SETTINGS_LIST: + return MENU_ENUM_LABEL_DEFERRED_OVERLAY_LIGHTGUN_SETTINGS_LIST; + case ACTION_OK_DL_OVERLAY_MOUSE_SETTINGS_LIST: + return MENU_ENUM_LABEL_DEFERRED_OVERLAY_MOUSE_SETTINGS_LIST; case ACTION_OK_DL_MENU_SETTINGS_LIST: return MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST; #ifdef _3DS @@ -1696,6 +1700,8 @@ int generic_action_ok_displaylist_push( case ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST: case ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST: case ACTION_OK_DL_OSK_OVERLAY_SETTINGS_LIST: + case ACTION_OK_DL_OVERLAY_LIGHTGUN_SETTINGS_LIST: + case ACTION_OK_DL_OVERLAY_MOUSE_SETTINGS_LIST: case ACTION_OK_DL_MENU_SETTINGS_LIST: #ifdef _3DS case ACTION_OK_DL_MENU_BOTTOM_SETTINGS_LIST: @@ -6068,6 +6074,8 @@ STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_onscreen_display_list, ACTION_OK_DL_ONSC STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_onscreen_notifications_list, ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_onscreen_notifications_views_list, ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_onscreen_overlay_list, ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST) +STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_overlay_lightgun_settings_list, ACTION_OK_DL_OVERLAY_LIGHTGUN_SETTINGS_LIST) +STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_overlay_mouse_settings_list, ACTION_OK_DL_OVERLAY_MOUSE_SETTINGS_LIST) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_osk_overlay_list, ACTION_OK_DL_OSK_OVERLAY_SETTINGS_LIST) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_menu_list, ACTION_OK_DL_MENU_SETTINGS_LIST) #ifdef _3DS @@ -8715,6 +8723,8 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, {MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_SETTINGS, action_ok_onscreen_notifications_list}, {MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS,action_ok_onscreen_notifications_views_list}, {MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS, action_ok_onscreen_overlay_list}, + {MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS, action_ok_overlay_lightgun_settings_list}, + {MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS, action_ok_overlay_mouse_settings_list}, {MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS, action_ok_osk_overlay_list}, {MENU_ENUM_LABEL_MENU_SETTINGS, action_ok_menu_list}, #ifdef _3DS diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index ae9f252e7910..494cb59a446c 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -873,6 +873,20 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_y_offset_portrait, MEN DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_enable, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ENABLE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_preset, MENU_ENUM_SUBLABEL_OVERLAY_PRESET) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_osk_overlay_preset, MENU_ENUM_SUBLABEL_OSK_OVERLAY_PRESET) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_pointer_enable, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_POINTER_ENABLE) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_lightgun_port, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_PORT) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_lightgun_trigger_on_touch, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_lightgun_trigger_delay, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_lightgun_allow_offscreen, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_lightgun_two_touch_input, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_lightgun_three_touch_input, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_lightgun_four_touch_input, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_mouse_speed, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_SPEED) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_mouse_hold_to_drag, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_mouse_hold_msec, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_HOLD_MSEC) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_mouse_dtap_to_drag, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_mouse_dtap_msec, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_DTAP_MSEC) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_mouse_swipe_threshold, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_public_announce, MENU_ENUM_SUBLABEL_NETPLAY_PUBLIC_ANNOUNCE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_ip_address, MENU_ENUM_SUBLABEL_NETPLAY_IP_ADDRESS) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_netplay_tcp_udp_port, MENU_ENUM_SUBLABEL_NETPLAY_TCP_UDP_PORT) @@ -1246,6 +1260,8 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_midi_output, DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_midi_volume, MENU_ENUM_SUBLABEL_MIDI_VOLUME) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_onscreen_overlay_settings_list, MENU_ENUM_SUBLABEL_ONSCREEN_OVERLAY_SETTINGS) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_osk_overlay_settings_list, MENU_ENUM_SUBLABEL_OSK_OVERLAY_SETTINGS) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_lightgun_settings_list, MENU_ENUM_SUBLABEL_OVERLAY_LIGHTGUN_SETTINGS) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_mouse_settings_list, MENU_ENUM_SUBLABEL_OVERLAY_MOUSE_SETTINGS) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_onscreen_notifications_settings_list, MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_SETTINGS) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_onscreen_notifications_views_settings_list, MENU_ENUM_SUBLABEL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS) #ifdef HAVE_QT @@ -3733,6 +3749,48 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_OVERLAY_Y_OFFSET_PORTRAIT: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_y_offset_portrait); break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_POINTER_ENABLE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_pointer_enable); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_PORT: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_lightgun_port); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_lightgun_trigger_on_touch); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_lightgun_trigger_delay); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_lightgun_allow_offscreen); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_lightgun_two_touch_input); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_lightgun_three_touch_input); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_lightgun_four_touch_input); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_SPEED: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_mouse_speed); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_mouse_hold_to_drag); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_HOLD_MSEC: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_mouse_hold_msec); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_mouse_dtap_to_drag); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_DTAP_MSEC: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_mouse_dtap_msec); + break; + case MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_mouse_swipe_threshold); + break; case MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_dsp_plugin); break; @@ -5269,6 +5327,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_osk_overlay_settings_list); break; + case MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_lightgun_settings_list); + break; + case MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_mouse_settings_list); + break; case MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_onscreen_notifications_settings_list); break; diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 94bb78cb8c0c..52a0976f4450 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -644,6 +644,8 @@ DEFAULT_TITLE_MACRO(action_get_onscreen_notifications_settings_list, MENU_ENUM_L DEFAULT_TITLE_MACRO(action_get_onscreen_notifications_views_settings_list, MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS) DEFAULT_TITLE_MACRO(action_get_onscreen_overlay_settings_list, MENU_ENUM_LABEL_VALUE_ONSCREEN_OVERLAY_SETTINGS) DEFAULT_TITLE_MACRO(action_get_osk_overlay_settings_list, MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_SETTINGS) +DEFAULT_TITLE_MACRO(action_get_overlay_lightgun_settings_list, MENU_ENUM_LABEL_VALUE_OVERLAY_LIGHTGUN_SETTINGS) +DEFAULT_TITLE_MACRO(action_get_overlay_mouse_settings_list, MENU_ENUM_LABEL_VALUE_OVERLAY_MOUSE_SETTINGS) DEFAULT_TITLE_MACRO(action_get_menu_views_settings_list, MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS) DEFAULT_TITLE_MACRO(action_get_settings_views_settings_list, MENU_ENUM_LABEL_VALUE_SETTINGS_VIEWS_SETTINGS) DEFAULT_TITLE_MACRO(action_get_quick_menu_views_settings_list, MENU_ENUM_LABEL_VALUE_QUICK_MENU_VIEWS_SETTINGS) @@ -1003,6 +1005,8 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, {MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST, action_get_onscreen_notifications_views_settings_list}, {MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST, action_get_onscreen_overlay_settings_list}, {MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST, action_get_osk_overlay_settings_list}, + {MENU_ENUM_LABEL_DEFERRED_OVERLAY_LIGHTGUN_SETTINGS_LIST, action_get_overlay_lightgun_settings_list}, + {MENU_ENUM_LABEL_DEFERRED_OVERLAY_MOUSE_SETTINGS_LIST, action_get_overlay_mouse_settings_list}, {MENU_ENUM_LABEL_DEFERRED_MENU_VIEWS_SETTINGS_LIST, action_get_menu_views_settings_list}, {MENU_ENUM_LABEL_DEFERRED_SETTINGS_VIEWS_SETTINGS_LIST, action_get_settings_views_settings_list}, {MENU_ENUM_LABEL_DEFERRED_QUICK_MENU_VIEWS_SETTINGS_LIST, action_get_quick_menu_views_settings_list}, @@ -1624,6 +1628,12 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST: BIND_ACTION_GET_TITLE(cbs, action_get_osk_overlay_settings_list); break; + case MENU_ENUM_LABEL_DEFERRED_OVERLAY_LIGHTGUN_SETTINGS_LIST: + BIND_ACTION_GET_TITLE(cbs, action_get_overlay_lightgun_settings_list); + break; + case MENU_ENUM_LABEL_DEFERRED_OVERLAY_MOUSE_SETTINGS_LIST: + BIND_ACTION_GET_TITLE(cbs, action_get_overlay_mouse_settings_list); + break; case MENU_ENUM_LABEL_DEFERRED_CORE_SETTINGS_LIST: BIND_ACTION_GET_TITLE(cbs, action_get_core_settings_list); break; diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 2c321b6fcb63..015d95dba4e5 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -10925,6 +10925,8 @@ static void materialui_list_insert( || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_MENU_SETTINGS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS)) + || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_SETTINGS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ACCOUNTS_LIST)) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index d04d4775a5e5..1cdf1b18cd92 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -1898,6 +1898,8 @@ static uintptr_t ozone_entries_icon_get_texture( case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS: case MENU_ENUM_LABEL_CONTENT_SHOW_OVERLAYS: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_OVERLAY]; + case MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS: + case MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS: case MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS: return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SETTING]; case MENU_ENUM_LABEL_UPDATE_CG_SHADERS: diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 2a0e09669a07..ea1ce9d13235 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -3082,6 +3082,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS: case MENU_ENUM_LABEL_CONTENT_SHOW_OVERLAYS: return xmb->textures.list[XMB_TEXTURE_OVERLAY]; + case MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS: + case MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS: case MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS: return xmb->textures.list[XMB_TEXTURE_SETTING]; case MENU_ENUM_LABEL_UPDATE_CG_SHADERS: diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 7828e987a63d..424c47d291fa 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -189,6 +189,8 @@ enum ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST, ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST, ACTION_OK_DL_OSK_OVERLAY_SETTINGS_LIST, + ACTION_OK_DL_OVERLAY_LIGHTGUN_SETTINGS_LIST, + ACTION_OK_DL_OVERLAY_MOUSE_SETTINGS_LIST, ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST, ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST, ACTION_OK_DL_MENU_VIEWS_SETTINGS_LIST, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 30132109261f..56f80125178b 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -9789,6 +9789,7 @@ unsigned menu_displaylist_build_list( { struct menu_state *menu_st = menu_state_get_ptr(); bool input_overlay_enable = settings->bools.input_overlay_enable; + bool input_overlay_ptr_enable = settings->bools.input_overlay_pointer_enable; bool input_overlay_auto_scale = settings->bools.input_overlay_auto_scale; enum overlay_show_input_type input_overlay_show_inputs = (enum overlay_show_input_type) @@ -9820,6 +9821,9 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_OVERLAY_Y_SEPARATION_PORTRAIT, PARSE_ONLY_FLOAT, false }, {MENU_ENUM_LABEL_OVERLAY_X_OFFSET_PORTRAIT, PARSE_ONLY_FLOAT, false }, {MENU_ENUM_LABEL_OVERLAY_Y_OFFSET_PORTRAIT, PARSE_ONLY_FLOAT, false }, + {MENU_ENUM_LABEL_INPUT_OVERLAY_POINTER_ENABLE, PARSE_ONLY_BOOL, false }, + {MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS, PARSE_ACTION, false }, + {MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS, PARSE_ACTION, false }, {MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS, PARSE_ACTION, false }, }; @@ -9836,6 +9840,7 @@ unsigned menu_displaylist_build_list( case MENU_ENUM_LABEL_INPUT_OVERLAY_AUTO_SCALE: case MENU_ENUM_LABEL_OVERLAY_PRESET: case MENU_ENUM_LABEL_OVERLAY_OPACITY: + case MENU_ENUM_LABEL_INPUT_OVERLAY_POINTER_ENABLE: if (input_overlay_enable) build_list[i].checked = true; break; @@ -9870,6 +9875,11 @@ unsigned menu_displaylist_build_list( BIT16_GET(menu_st->overlay_types, OVERLAY_TYPE_ABXY_AREA)) build_list[i].checked = true; break; + case MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS: + case MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS: + if (input_overlay_enable && input_overlay_ptr_enable) + build_list[i].checked = true; + break; case MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS: /* Show keyboard menu if the main overlay has * an osk_toggle or if the OSK hotkey is set */ @@ -9912,6 +9922,62 @@ unsigned menu_displaylist_build_list( PARSE_ONLY_FLOAT, false) == 0) count++; break; + case DISPLAYLIST_OVERLAY_LIGHTGUN_SETTINGS_LIST: + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_PORT, + PARSE_ONLY_INT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH, + PARSE_ONLY_BOOL, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY, + PARSE_ONLY_UINT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT, + PARSE_ONLY_UINT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT, + PARSE_ONLY_UINT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT, + PARSE_ONLY_UINT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN, + PARSE_ONLY_BOOL, false) == 0) + count++; + break; + case DISPLAYLIST_OVERLAY_MOUSE_SETTINGS_LIST: + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_SPEED, + PARSE_ONLY_FLOAT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG, + PARSE_ONLY_BOOL, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_HOLD_MSEC, + PARSE_ONLY_UINT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG, + PARSE_ONLY_BOOL, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_DTAP_MSEC, + PARSE_ONLY_UINT, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD, + PARSE_ONLY_FLOAT, false) == 0) + count++; + break; #endif case DISPLAYLIST_LATENCY_SETTINGS_LIST: { @@ -13856,6 +13922,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, #if defined(HAVE_OVERLAY) case DISPLAYLIST_ONSCREEN_OVERLAY_SETTINGS_LIST: case DISPLAYLIST_OSK_OVERLAY_SETTINGS_LIST: + case DISPLAYLIST_OVERLAY_LIGHTGUN_SETTINGS_LIST: + case DISPLAYLIST_OVERLAY_MOUSE_SETTINGS_LIST: #endif case DISPLAYLIST_ACCOUNTS_CHEEVOS_LIST: case DISPLAYLIST_ACCOUNTS_LIST: diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 3269926ff806..88cc0cb6e6b9 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -209,6 +209,8 @@ enum menu_displaylist_ctl_state #if defined(HAVE_OVERLAY) DISPLAYLIST_ONSCREEN_OVERLAY_SETTINGS_LIST, DISPLAYLIST_OSK_OVERLAY_SETTINGS_LIST, + DISPLAYLIST_OVERLAY_LIGHTGUN_SETTINGS_LIST, + DISPLAYLIST_OVERLAY_MOUSE_SETTINGS_LIST, #endif DISPLAYLIST_AI_SERVICE_SETTINGS_LIST, DISPLAYLIST_ACCESSIBILITY_SETTINGS_LIST, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 82569bdf01a2..2915ae4eb605 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -303,6 +303,8 @@ enum settings_list_type SETTINGS_LIST_ONSCREEN_NOTIFICATIONS, SETTINGS_LIST_OVERLAY, SETTINGS_LIST_OSK_OVERLAY, + SETTINGS_LIST_OVERLAY_MOUSE, + SETTINGS_LIST_OVERLAY_LIGHTGUN, SETTINGS_LIST_MENU, SETTINGS_LIST_MENU_FILE_BROWSER, SETTINGS_LIST_MULTIMEDIA, @@ -5460,6 +5462,79 @@ static void setting_get_string_representation_uint_input_overlay_show_inputs_por snprintf(s, len, "%u", *setting->value.target.unsigned_integer + 1); } + +static void setting_get_string_representation_overlay_lightgun_port( + rarch_setting_t *setting, char *s, size_t len) +{ + if (setting) + { + if (*setting->value.target.integer < 0) + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_PORT_ANY), len); + else + snprintf(s, len, "%d", *setting->value.target.integer + 1); + } +} + +static void setting_get_string_representation_overlay_lightgun_action( + rarch_setting_t *setting, + char *s, size_t len) +{ + if (!setting) + return; + + switch (*setting->value.target.unsigned_integer) + { + case OVERLAY_LIGHTGUN_ACTION_NONE: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_NONE), len); + break; + case OVERLAY_LIGHTGUN_ACTION_TRIGGER: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_TRIGGER), len); + break; + case OVERLAY_LIGHTGUN_ACTION_RELOAD: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_RELOAD), len); + break; + case OVERLAY_LIGHTGUN_ACTION_AUX_A: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_A), len); + break; + case OVERLAY_LIGHTGUN_ACTION_AUX_B: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_B), len); + break; + case OVERLAY_LIGHTGUN_ACTION_AUX_C: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_AUX_C), len); + break; + case OVERLAY_LIGHTGUN_ACTION_SELECT: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_SELECT), len); + break; + case OVERLAY_LIGHTGUN_ACTION_START: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_START), len); + break; + case OVERLAY_LIGHTGUN_ACTION_DPAD_UP: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_UP), len); + break; + case OVERLAY_LIGHTGUN_ACTION_DPAD_DOWN: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_DOWN), len); + break; + case OVERLAY_LIGHTGUN_ACTION_DPAD_LEFT: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_LEFT), len); + break; + case OVERLAY_LIGHTGUN_ACTION_DPAD_RIGHT: + strlcpy(s, msg_hash_to_str( + MENU_ENUM_LABEL_VALUE_INPUT_LIGHTGUN_DPAD_RIGHT), len); + break; + } +} #endif /* A protected driver is such that the user cannot set to "null" using the UI. @@ -10352,6 +10427,24 @@ static bool setting_append_list( parent_group); SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED); + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_OVERLAY_LIGHTGUN_SETTINGS, + MENU_ENUM_LABEL_VALUE_OVERLAY_LIGHTGUN_SETTINGS, + &group_info, + &subgroup_info, + parent_group); + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED); + + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_OVERLAY_MOUSE_SETTINGS, + MENU_ENUM_LABEL_VALUE_OVERLAY_MOUSE_SETTINGS, + &group_info, + &subgroup_info, + parent_group); + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED); + CONFIG_ACTION( list, list_info, MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS, @@ -17174,6 +17267,25 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, -1.0f, 1.0f, 0.005f, true, true); SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_CMD_APPLY_AUTO); + CONFIG_BOOL( + list, list_info, + &settings->bools.input_overlay_pointer_enable, + MENU_ENUM_LABEL_INPUT_OVERLAY_POINTER_ENABLE, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_POINTER_ENABLE, + DEFAULT_INPUT_OVERLAY_POINTER_ENABLE, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + (*list)[list_info->index - 1].action_ok = &setting_bool_action_left_with_refresh; + (*list)[list_info->index - 1].action_left = &setting_bool_action_left_with_refresh; + (*list)[list_info->index - 1].action_right = &setting_bool_action_right_with_refresh; + END_SUB_GROUP(list, list_info, parent_group); END_GROUP(list, list_info, parent_group); @@ -17244,6 +17356,241 @@ static bool setting_append_list( END_SUB_GROUP(list, list_info, parent_group); + END_GROUP(list, list_info, parent_group); +#endif + break; + case SETTINGS_LIST_OVERLAY_LIGHTGUN: +#ifdef HAVE_OVERLAY + START_GROUP(list, list_info, &group_info, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_LIGHTGUN_SETTINGS), + parent_group); + + parent_group = msg_hash_to_str(MENU_ENUM_LABEL_OVERLAY_SETTINGS); + + START_SUB_GROUP(list, list_info, "State", &group_info, &subgroup_info, parent_group); + + CONFIG_INT( + list, list_info, + &settings->ints.input_overlay_lightgun_port, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_PORT, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_PORT, + DEFAULT_INPUT_OVERLAY_LIGHTGUN_PORT, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].offset_by = -1; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_overlay_lightgun_port; + menu_settings_list_current_add_range(list, list_info, -1, MAX_USERS - 1, 1, true, true); + + CONFIG_BOOL( + list, list_info, + &settings->bools.input_overlay_lightgun_trigger_on_touch, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH, + DEFAULT_INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + + CONFIG_UINT( + list, list_info, + &settings->uints.input_overlay_lightgun_trigger_delay, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY, + DEFAULT_INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + menu_settings_list_current_add_range(list, list_info, 0, + OVERLAY_LIGHTGUN_TRIG_MAX_DELAY, 1, true, true); + + CONFIG_UINT( + list, list_info, + &settings->uints.input_overlay_lightgun_two_touch_input, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT, + DEFAULT_INPUT_OVERLAY_LIGHTGUN_MULTI_TOUCH_INPUT, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_overlay_lightgun_action; + menu_settings_list_current_add_range(list, list_info, + OVERLAY_LIGHTGUN_ACTION_NONE, OVERLAY_LIGHTGUN_ACTION_END - 1, 1, true, true); + + CONFIG_UINT( + list, list_info, + &settings->uints.input_overlay_lightgun_three_touch_input, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT, + DEFAULT_INPUT_OVERLAY_LIGHTGUN_MULTI_TOUCH_INPUT, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_overlay_lightgun_action; + menu_settings_list_current_add_range(list, list_info, + OVERLAY_LIGHTGUN_ACTION_NONE, OVERLAY_LIGHTGUN_ACTION_END - 1, 1, true, true); + + CONFIG_UINT( + list, list_info, + &settings->uints.input_overlay_lightgun_four_touch_input, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT, + DEFAULT_INPUT_OVERLAY_LIGHTGUN_MULTI_TOUCH_INPUT, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_overlay_lightgun_action; + menu_settings_list_current_add_range(list, list_info, + OVERLAY_LIGHTGUN_ACTION_NONE, OVERLAY_LIGHTGUN_ACTION_END - 1, 1, true, true); + + CONFIG_BOOL( + list, list_info, + &settings->bools.input_overlay_lightgun_allow_offscreen, + MENU_ENUM_LABEL_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN, + DEFAULT_INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + + END_SUB_GROUP(list, list_info, parent_group); + + END_GROUP(list, list_info, parent_group); +#endif + break; + case SETTINGS_LIST_OVERLAY_MOUSE: +#ifdef HAVE_OVERLAY + START_GROUP(list, list_info, &group_info, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OVERLAY_MOUSE_SETTINGS), + parent_group); + + parent_group = msg_hash_to_str(MENU_ENUM_LABEL_OVERLAY_SETTINGS); + + START_SUB_GROUP(list, list_info, "State", &group_info, &subgroup_info, parent_group); + + CONFIG_FLOAT( + list, list_info, + &settings->floats.input_overlay_mouse_speed, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_SPEED, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_SPEED, + DEFAULT_INPUT_OVERLAY_MOUSE_SPEED, + "%.1fx", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + menu_settings_list_current_add_range(list, list_info, 0.1, 5.0, 0.1, true, true); + + CONFIG_BOOL( + list, list_info, + &settings->bools.input_overlay_mouse_hold_to_drag, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG, + DEFAULT_INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + + CONFIG_UINT( + list, list_info, + &settings->uints.input_overlay_mouse_hold_msec, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_HOLD_MSEC, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_HOLD_MSEC, + DEFAULT_INPUT_OVERLAY_MOUSE_HOLD_MSEC, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + menu_settings_list_current_add_range(list, list_info, 0, 1000, 1, true, true); + + CONFIG_BOOL( + list, list_info, + &settings->bools.input_overlay_mouse_dtap_to_drag, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG, + DEFAULT_INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + + CONFIG_UINT( + list, list_info, + &settings->uints.input_overlay_mouse_dtap_msec, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_DTAP_MSEC, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_DTAP_MSEC, + DEFAULT_INPUT_OVERLAY_MOUSE_DTAP_MSEC, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + menu_settings_list_current_add_range(list, list_info, 0, 500, 1, true, true); + + CONFIG_FLOAT( + list, list_info, + &settings->floats.input_overlay_mouse_swipe_threshold, + MENU_ENUM_LABEL_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD, + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD, + DEFAULT_INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD, + "%.1f%%", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + menu_settings_list_current_add_range(list, list_info, 0.0, 10.0, 0.1, true, true); + + END_SUB_GROUP(list, list_info, parent_group); + END_GROUP(list, list_info, parent_group); #endif break; @@ -23753,6 +24100,8 @@ static rarch_setting_t *menu_setting_new_internal(rarch_setting_info_t *list_inf SETTINGS_LIST_ONSCREEN_NOTIFICATIONS, SETTINGS_LIST_OVERLAY, SETTINGS_LIST_OSK_OVERLAY, + SETTINGS_LIST_OVERLAY_MOUSE, + SETTINGS_LIST_OVERLAY_LIGHTGUN, SETTINGS_LIST_MENU, SETTINGS_LIST_MENU_FILE_BROWSER, SETTINGS_LIST_MULTIMEDIA, diff --git a/msg_hash.h b/msg_hash.h index 4f095ec2e339..bbb71f1f2a46 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1311,6 +1311,21 @@ enum msg_hash_enums MENU_LABEL(INPUT_OSK_OVERLAY_AUTO_SCALE), MENU_LABEL(INPUT_OVERLAY_DPAD_DIAGONAL_SENSITIVITY), MENU_LABEL(INPUT_OVERLAY_ABXY_DIAGONAL_SENSITIVITY), + MENU_LABEL(INPUT_OVERLAY_POINTER_ENABLE), + MENU_LABEL(INPUT_OVERLAY_LIGHTGUN_PORT), + MENU_LABEL(INPUT_OVERLAY_LIGHTGUN_TRIGGER_ON_TOUCH), + MENU_ENUM_LABEL_VALUE_INPUT_OVERLAY_LIGHTGUN_PORT_ANY, + MENU_LABEL(INPUT_OVERLAY_LIGHTGUN_TRIGGER_DELAY), + MENU_LABEL(INPUT_OVERLAY_LIGHTGUN_ALLOW_OFFSCREEN), + MENU_LABEL(INPUT_OVERLAY_LIGHTGUN_TWO_TOUCH_INPUT), + MENU_LABEL(INPUT_OVERLAY_LIGHTGUN_THREE_TOUCH_INPUT), + MENU_LABEL(INPUT_OVERLAY_LIGHTGUN_FOUR_TOUCH_INPUT), + MENU_LABEL(INPUT_OVERLAY_MOUSE_SPEED), + MENU_LABEL(INPUT_OVERLAY_MOUSE_HOLD_TO_DRAG), + MENU_LABEL(INPUT_OVERLAY_MOUSE_HOLD_MSEC), + MENU_LABEL(INPUT_OVERLAY_MOUSE_DTAP_TO_DRAG), + MENU_LABEL(INPUT_OVERLAY_MOUSE_DTAP_MSEC), + MENU_LABEL(INPUT_OVERLAY_MOUSE_SWIPE_THRESHOLD), MENU_LABEL(INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE), MENU_LABEL(INPUT_SMALL_KEYBOARD_ENABLE), MENU_LABEL(INPUT_TOUCH_ENABLE), @@ -2044,6 +2059,8 @@ enum msg_hash_enums MENU_ENUM_LABEL_DEFERRED_ONSCREEN_DISPLAY_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST, + MENU_ENUM_LABEL_DEFERRED_OVERLAY_LIGHTGUN_SETTINGS_LIST, + MENU_ENUM_LABEL_DEFERRED_OVERLAY_MOUSE_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST, @@ -3280,6 +3297,8 @@ enum msg_hash_enums MENU_LABEL(SAVE_NEW_CONFIG), MENU_LABEL(ONSCREEN_DISPLAY_SETTINGS), MENU_LABEL(ONSCREEN_OVERLAY_SETTINGS), + MENU_LABEL(OVERLAY_LIGHTGUN_SETTINGS), + MENU_LABEL(OVERLAY_MOUSE_SETTINGS), MENU_LABEL(OSK_OVERLAY_SETTINGS), MENU_LABEL(ONSCREEN_VIDEO_LAYOUT_SETTINGS), MENU_LABEL(ONSCREEN_NOTIFICATIONS_SETTINGS),