From 9ca5c5e62346a5630634281bd95e429cc0a66b2a Mon Sep 17 00:00:00 2001 From: nfore Date: Sat, 8 Jul 2023 12:45:13 -0500 Subject: [PATCH] Revive/rewrite Keyboard Overlay and OSK Toggle Add keyboard overlay preset, keyboard submenu, and osk_toggle hotkey. Use overlay caching for osk_toggle. For now, keyboard menu has only preset path, auto-scale toggle, and opacity. Related fixes: - input_keyboard_event: Don't check hotkey binds when device is RETRO_DEVICE_POINTER - Add input_keymaps_translate_rk_to_ascii() for correct character input to input_keyboard_event - input_overlay_poll: Delay clearing INPUT_OVERLAY_BLOCKED flag until there is no overlay input (Avoids stray input after osk_toggle) - Send keyboard events for modifiers before other keys (for correct modifier+key input if hitboxes overlap) --- configuration.c | 14 ++++ configuration.h | 4 + defaults.h | 1 + frontend/drivers/platform_emscripten.c | 2 + frontend/drivers/platform_gx.c | 3 + frontend/drivers/platform_orbis.c | 2 + frontend/drivers/platform_ps3.c | 3 + frontend/drivers/platform_qnx.c | 2 + frontend/drivers/platform_switch.c | 5 +- frontend/drivers/platform_unix.c | 6 +- frontend/drivers/platform_uwp.c | 2 + frontend/drivers/platform_win32.c | 2 + frontend/drivers/platform_xdk.c | 4 + input/input_driver.c | 76 +++++++++-------- input/input_keymaps.c | 103 +++++++++++++++++++++++ input/input_keymaps.h | 9 ++ input/input_overlay.h | 15 +++- intl/msg_hash_lbl.h | 28 +++++++ intl/msg_hash_us.h | 51 +++++++++++- menu/cbs/menu_cbs_deferred_push.c | 10 +++ menu/cbs/menu_cbs_get_value.c | 1 + menu/cbs/menu_cbs_left.c | 1 + menu/cbs/menu_cbs_ok.c | 31 +++++++ menu/cbs/menu_cbs_right.c | 1 + menu/cbs/menu_cbs_sublabel.c | 24 ++++++ menu/cbs/menu_cbs_title.c | 5 ++ menu/drivers/materialui.c | 1 + menu/drivers/ozone.c | 2 + menu/drivers/xmb.c | 2 + menu/menu_cbs.h | 2 + menu/menu_displaylist.c | 36 +++++++- menu/menu_displaylist.h | 2 + menu/menu_setting.c | 93 ++++++++++++++++++++- msg_hash.h | 12 ++- retroarch.c | 109 +++++++++++++++++-------- runloop.c | 10 --- tasks/task_overlay.c | 5 ++ tasks/tasks_internal.h | 1 + 38 files changed, 593 insertions(+), 87 deletions(-) diff --git a/configuration.c b/configuration.c index 3ebe4921a1..84c99b1c9a 100644 --- a/configuration.c +++ b/configuration.c @@ -388,6 +388,7 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = { /* Hidden in displaylist */ DECLARE_META_BIND(2, overlay_next, RARCH_OVERLAY_NEXT, MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT), + DECLARE_META_BIND(2, osk_toggle, RARCH_OSK, MENU_ENUM_LABEL_VALUE_INPUT_META_OSK), #if 0 /* Deprecated */ @@ -1589,6 +1590,8 @@ static struct config_path_setting *populate_settings_path( #ifdef HAVE_OVERLAY SETTING_PATH("input_overlay", settings->paths.path_overlay, false, NULL, true); + SETTING_PATH("input_osk_overlay", + settings->paths.path_osk_overlay, false, NULL, true); #endif SETTING_PATH("video_record_config", settings->paths.path_record_config, false, NULL, true); @@ -1651,6 +1654,8 @@ static struct config_path_setting *populate_settings_path( #ifdef HAVE_OVERLAY SETTING_PATH("overlay_directory", settings->paths.directory_overlay, true, NULL, true); + SETTING_PATH("osk_overlay_directory", + settings->paths.directory_osk_overlay, true, NULL, true); #endif SETTING_PATH( "screenshot_directory", @@ -2041,6 +2046,7 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("input_overlay_show_mouse_cursor", &settings->bools.input_overlay_show_mouse_cursor, true, DEFAULT_OVERLAY_SHOW_MOUSE_CURSOR, false); 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); #endif #ifdef UDEV_TOUCH_SUPPORT SETTING_BOOL("input_touch_vmouse_pointer", &settings->bools.input_touch_vmouse_pointer, true, DEFAULT_INPUT_TOUCH_VMOUSE_POINTER, false); @@ -2190,6 +2196,7 @@ static struct config_float_setting *populate_settings_float( #endif #ifdef HAVE_OVERLAY SETTING_FLOAT("input_overlay_opacity", &settings->floats.input_overlay_opacity, true, DEFAULT_INPUT_OVERLAY_OPACITY, false); + SETTING_FLOAT("input_osk_overlay_opacity", &settings->floats.input_osk_overlay_opacity, true, DEFAULT_INPUT_OVERLAY_OPACITY, false); SETTING_FLOAT("input_overlay_scale_landscape", &settings->floats.input_overlay_scale_landscape, true, DEFAULT_INPUT_OVERLAY_SCALE_LANDSCAPE, false); SETTING_FLOAT("input_overlay_aspect_adjust_landscape", &settings->floats.input_overlay_aspect_adjust_landscape, true, DEFAULT_INPUT_OVERLAY_ASPECT_ADJUST_LANDSCAPE, false); SETTING_FLOAT("input_overlay_x_separation_landscape", &settings->floats.input_overlay_x_separation_landscape, true, DEFAULT_INPUT_OVERLAY_X_SEPARATION_LANDSCAPE, false); @@ -2921,6 +2928,7 @@ void config_set_defaults(void *data) *settings->paths.path_rgui_theme_preset = '\0'; *settings->paths.path_content_database = '\0'; *settings->paths.path_overlay = '\0'; + *settings->paths.path_osk_overlay = '\0'; *settings->paths.path_record_config = '\0'; *settings->paths.path_stream_config = '\0'; *settings->paths.path_stream_url = '\0'; @@ -3027,6 +3035,10 @@ void config_set_defaults(void *data) sizeof(settings->paths.path_overlay)); #endif } + if (!string_is_empty(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])) + fill_pathname_expand_special(settings->paths.directory_osk_overlay, + g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], + sizeof(settings->paths.directory_osk_overlay)); #endif #ifdef HAVE_MENU @@ -3913,6 +3925,8 @@ static bool config_load_file(global_t *global, #ifdef HAVE_OVERLAY if (string_is_equal(settings->paths.directory_overlay, "default")) *settings->paths.directory_overlay = '\0'; + if (string_is_equal(settings->paths.directory_osk_overlay, "default")) + *settings->paths.directory_osk_overlay = '\0'; #endif if (string_is_equal(settings->paths.directory_system, "default")) *settings->paths.directory_system = '\0'; diff --git a/configuration.h b/configuration.h index 829c914d5e..cc7f9def38 100644 --- a/configuration.h +++ b/configuration.h @@ -390,6 +390,7 @@ typedef struct settings float audio_mixer_volume; /* dB scale. */ float input_overlay_opacity; + float input_osk_overlay_opacity; float input_overlay_scale_landscape; float input_overlay_aspect_adjust_landscape; @@ -500,6 +501,7 @@ typedef struct settings char path_cheat_database[PATH_MAX_LENGTH]; char path_content_database[PATH_MAX_LENGTH]; char path_overlay[PATH_MAX_LENGTH]; + char path_osk_overlay[PATH_MAX_LENGTH]; char path_record_config[PATH_MAX_LENGTH]; char path_stream_config[PATH_MAX_LENGTH]; char path_menu_wallpaper[PATH_MAX_LENGTH]; @@ -523,6 +525,7 @@ typedef struct settings char directory_libretro[PATH_MAX_LENGTH]; char directory_input_remapping[PATH_MAX_LENGTH]; char directory_overlay[PATH_MAX_LENGTH]; + char directory_osk_overlay[PATH_MAX_LENGTH]; char directory_resampler[PATH_MAX_LENGTH]; char directory_screenshot[PATH_MAX_LENGTH]; char directory_system[PATH_MAX_LENGTH]; @@ -635,6 +638,7 @@ typedef struct settings bool input_overlay_show_mouse_cursor; bool input_overlay_auto_rotate; bool input_overlay_auto_scale; + bool input_osk_overlay_auto_scale; bool input_descriptor_label_show; bool input_descriptor_hide_unbound; bool input_all_users_control_menu; diff --git a/defaults.h b/defaults.h index 6d2330158d..919577cec3 100644 --- a/defaults.h +++ b/defaults.h @@ -41,6 +41,7 @@ enum default_dirs DEFAULT_DIR_CORE, DEFAULT_DIR_CORE_INFO, DEFAULT_DIR_OVERLAY, + DEFAULT_DIR_OSK_OVERLAY, DEFAULT_DIR_PORT, DEFAULT_DIR_SHADER, DEFAULT_DIR_SAVESTATE, diff --git a/frontend/drivers/platform_emscripten.c b/frontend/drivers/platform_emscripten.c index 93d296707d..c842a49854 100644 --- a/frontend/drivers/platform_emscripten.c +++ b/frontend/drivers/platform_emscripten.c @@ -106,6 +106,8 @@ static void frontend_emscripten_get_env(int *argc, char *argv[], "bundle/info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], base_path, "bundle/overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], base_path, + "bundle/overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], base_path, "bundle/shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], base_path, diff --git a/frontend/drivers/platform_gx.c b/frontend/drivers/platform_gx.c index 9f4ce5a60d..16fe75d3f3 100644 --- a/frontend/drivers/platform_gx.c +++ b/frontend/drivers/platform_gx.c @@ -282,6 +282,9 @@ static void frontend_gx_get_env(int *argc, char *argv[], fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], g_defaults.dirs[DEFAULT_DIR_CORE], "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], + g_defaults.dirs[DEFAULT_DIR_CORE], "overlays/keyboards", + sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], g_defaults.dirs[DEFAULT_DIR_CORE], "filters/video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); diff --git a/frontend/drivers/platform_orbis.c b/frontend/drivers/platform_orbis.c index b111a6bb51..19571dfdd5 100644 --- a/frontend/drivers/platform_orbis.c +++ b/frontend/drivers/platform_orbis.c @@ -143,6 +143,8 @@ static void frontend_orbis_get_env(int *argc, char *argv[], "temp", sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], user_path, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], user_path, + "overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS], user_path, "thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_LOGS], user_path, diff --git a/frontend/drivers/platform_ps3.c b/frontend/drivers/platform_ps3.c index 40bd88a64c..c197379868 100644 --- a/frontend/drivers/platform_ps3.c +++ b/frontend/drivers/platform_ps3.c @@ -162,6 +162,9 @@ static void fill_derived_paths(void) fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], g_defaults.dirs[DEFAULT_DIR_PORT], "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], + g_defaults.dirs[DEFAULT_DIR_PORT], + "overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT], "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); diff --git a/frontend/drivers/platform_qnx.c b/frontend/drivers/platform_qnx.c index c26600aa24..a27aec3f0e 100644 --- a/frontend/drivers/platform_qnx.c +++ b/frontend/drivers/platform_qnx.c @@ -99,6 +99,8 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[], "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], data_path, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], data_path, + "overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); /* user data */ fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], user_path, "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index afd907a477..6ca3accde5 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -247,7 +247,10 @@ static void frontend_switch_get_env( "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], g_defaults.dirs[DEFAULT_DIR_PORT], - "overlay", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], g_defaults.dirs[DEFAULT_DIR_PORT], + "overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT], "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS])); diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c index 4ab6e45385..0b90c0f47e 100644 --- a/frontend/drivers/platform_unix.c +++ b/frontend/drivers/platform_unix.c @@ -1555,6 +1555,8 @@ static void frontend_unix_get_env(int *argc, "shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], app_dir, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], app_dir, + "overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], app_dir, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); @@ -1858,7 +1860,9 @@ static void frontend_unix_get_env(int *argc, fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], base_path, "cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], base_path, - "overlay", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], base_path, + "overlays/keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], base_path, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], base_path, diff --git a/frontend/drivers/platform_uwp.c b/frontend/drivers/platform_uwp.c index 32715c0448..662281427d 100644 --- a/frontend/drivers/platform_uwp.c +++ b/frontend/drivers/platform_uwp.c @@ -304,6 +304,8 @@ static void frontend_uwp_env_get(int *argc, char *argv[], "~\\thumbnails\\", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS])); fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OVERLAY], "~\\overlays\\", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], + "~\\overlays\\keyboards\\", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); /* This one is an exception: cores have to be loaded from * the install directory, * since this is the only place UWP apps can take .dlls from */ diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index d4921321d6..2a50e52800 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -597,6 +597,8 @@ static void frontend_win32_env_get(int *argc, char *argv[], ":\\thumbnails", sizeof(g_defaults.dirs[DEFAULT_DIR_THUMBNAILS])); fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OVERLAY], ":\\overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], + ":\\overlays\\keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); if (!string_is_empty(libretro_directory)) strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE], libretro_directory, sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); diff --git a/frontend/drivers/platform_xdk.c b/frontend/drivers/platform_xdk.c index 72399031f9..fbe04b3b3e 100644 --- a/frontend/drivers/platform_xdk.c +++ b/frontend/drivers/platform_xdk.c @@ -122,6 +122,10 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[], g_defaults.dirs[DEFAULT_DIR_CORE], "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY])); + fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], + g_defaults.dirs[DEFAULT_DIR_CORE], + "overlays\\keyboards", + sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], g_defaults.dirs[DEFAULT_DIR_CORE], "media", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS])); diff --git a/input/input_driver.c b/input/input_driver.c index 89d4a5c6f2..d6d277c5af 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -2120,9 +2120,7 @@ static void input_overlay_poll( } } - if (!bits_any_set(out->buttons.data, ARRAY_SIZE(out->buttons.data))) - ol->flags &= ~INPUT_OVERLAY_BLOCKED; - else if (ol->flags & INPUT_OVERLAY_BLOCKED) + if (ol->flags & INPUT_OVERLAY_BLOCKED) memset(out, 0, sizeof(*out)); } @@ -2792,7 +2790,7 @@ static void input_poll_overlay( key_mod |= RETROKMOD_META; /* CAPSLOCK SCROLLOCK NUMLOCK */ - for (i = 0; i < (int)ARRAY_SIZE(ol_state->keys); i++) + for (i = (int)ARRAY_SIZE(ol_state->keys); i-- > 0;) { if (ol_state->keys[i] != old_ol_state.keys[i]) { @@ -2802,9 +2800,13 @@ static void input_poll_overlay( for (j = 0; j < 32; j++) if ((orig_bits & (1 << j)) != (new_bits & (1 << j))) + { + unsigned rk = i * 32 + j; + uint32_t c = input_keymaps_translate_rk_to_ascii(rk, key_mod); input_keyboard_event(new_bits & (1 << j), - i * 32 + j, 0, key_mod, RETRO_DEVICE_POINTER); - } + rk, c, key_mod, RETRO_DEVICE_POINTER); + } + } } /* Map "analog" buttons to analog axes like regular input drivers do. */ @@ -4341,7 +4343,9 @@ static void input_overlay_enable_(bool enable) video_driver_state_t *video_st = video_state_get_ptr(); input_driver_state_t *input_st = &input_driver_st; input_overlay_t *ol = input_st->overlay_ptr; - float opacity = settings->floats.input_overlay_opacity; + float opacity = (ol && (ol->flags & INPUT_OVERLAY_IS_OSK)) + ? settings->floats.input_osk_overlay_opacity + : settings->floats.input_overlay_opacity; bool auto_rotate = settings->bools.input_overlay_auto_rotate; bool hide_mouse_cursor = !settings->bools.input_overlay_show_mouse_cursor && (input_st->flags & INP_FLAG_GRAB_MOUSE_STATE); @@ -4519,9 +4523,6 @@ static void input_overlay_loaded(retro_task_t *task, overlay_task_data_t *data = (overlay_task_data_t*)task_data; input_overlay_t *ol = NULL; input_driver_state_t *input_st = &input_driver_st; -#ifdef HAVE_MENU - struct menu_state *menu_st = menu_state_get_ptr(); -#endif bool enable_overlay = !input_overlay_want_hidden() && settings->bools.input_overlay_enable; uint16_t overlay_types; @@ -4536,6 +4537,8 @@ static void input_overlay_loaded(retro_task_t *task, ol->path = data->overlay_path; ol->next_index = (unsigned)((ol->index + 1) % ol->size); ol->flags |= INPUT_OVERLAY_ALIVE; + if (data->flags & OVERLAY_LOADER_IS_OSK) + ol->flags |= INPUT_OVERLAY_IS_OSK; overlay_types = data->overlay_types; free(data); @@ -4565,11 +4568,16 @@ static void input_overlay_loaded(retro_task_t *task, input_overlay_set_eightway_diagonal_sensitivity(); #ifdef HAVE_MENU - /* Update menu entries */ - if (menu_st->overlay_types != overlay_types) + /* Update menu entries if this is the main overlay */ + if (!(ol->flags & INPUT_OVERLAY_IS_OSK)) { - menu_st->overlay_types = overlay_types; - menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; + struct menu_state *menu_st = menu_state_get_ptr(); + + if (menu_st->overlay_types != overlay_types) + { + menu_st->overlay_types = overlay_types; + menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH; + } } #endif } @@ -4580,7 +4588,12 @@ void input_overlay_init(void) input_driver_state_t *input_st = &input_driver_st; input_overlay_t *ol = input_st->overlay_ptr; input_overlay_t *ol_cache = input_st->overlay_cache_ptr; - const char *path_overlay = settings->paths.path_overlay; + bool want_osk = + (input_st->flags & INP_FLAG_KB_LINEFEED_ENABLE) + && !string_is_empty(settings->paths.path_osk_overlay); + const char *path_overlay = want_osk + ? settings->paths.path_osk_overlay + : settings->paths.path_overlay; bool want_hidden = input_overlay_want_hidden(); bool overlay_shown = ol && (ol->flags & INPUT_OVERLAY_ENABLE) @@ -4609,11 +4622,15 @@ void input_overlay_init(void) return; } - input_overlay_deinit(); + /* Cache current overlay when loading a different type */ + if (want_osk != (ol && (ol->flags & INPUT_OVERLAY_IS_OSK))) + input_overlay_unload(); + else + input_overlay_deinit(); /* Start task */ task_push_overlay_load_default( - input_overlay_loaded, path_overlay, NULL); + input_overlay_loaded, path_overlay, want_osk, NULL); } #endif @@ -5336,9 +5353,6 @@ void input_driver_poll(void) #else const input_device_driver_t *sec_joypad = NULL; -#endif -#ifdef HAVE_OVERLAY - float input_overlay_opacity = settings->floats.input_overlay_opacity; #endif bool input_remap_binds_enable = settings->bools.input_remap_binds_enable; uint8_t max_users = (uint8_t)settings->uints.input_max_users; @@ -5389,6 +5403,9 @@ void input_driver_poll(void) (input_st->overlay_ptr->flags & INPUT_OVERLAY_ALIVE)) { unsigned input_analog_dpad_mode = settings->uints.input_analog_dpad_mode[0]; + float input_overlay_opacity = (input_st->overlay_ptr->flags & INPUT_OVERLAY_IS_OSK) + ? settings->floats.input_osk_overlay_opacity + : settings->floats.input_overlay_opacity; switch (input_analog_dpad_mode) { @@ -6507,18 +6524,9 @@ void input_keyboard_event(bool down, unsigned code, if (!down) return; - switch (device) - { - case RETRO_DEVICE_POINTER: - if (code != 0x12d) - character = (char)code; - /* fall-through */ - default: - if (!input_keyboard_line_event(input_st, - &input_st->keyboard_line, character)) - return; - break; - } + if (!input_keyboard_line_event(input_st, + &input_st->keyboard_line, character)) + return; /* Line is complete, can free it now. */ if (input_st->keyboard_line.buffer) @@ -6542,9 +6550,11 @@ void input_keyboard_event(bool down, unsigned code, * pressing hotkeys and RetroPad binds, but * - not with Game Focus * - not from keyboard device type mappings + * - not from overlay keyboard input * - with 'enable_hotkey' modifier set and unpressed. */ if ( !input_st->game_focus_state.enabled - && BIT512_GET(input_st->keyboard_mapping_bits, code)) + && BIT512_GET(input_st->keyboard_mapping_bits, code) + && device != RETRO_DEVICE_POINTER) { settings_t *settings = config_get_ptr(); unsigned max_users = settings->uints.input_max_users; diff --git a/input/input_keymaps.c b/input/input_keymaps.c index 5b1a8b305a..758de553c6 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -2061,3 +2061,106 @@ void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t siz break; } } + +/** + * input_translate_rk_to_ascii: + * @key : Retro key identifier + * @mod : retro_mod mask + * + * Translates a retro key identifier with mod mask to ASCII. + */ +uint8_t input_keymaps_translate_rk_to_ascii(enum retro_key key, enum retro_mod mod) +{ + if ( key > RETROK_KP_EQUALS + || (mod & (RETROKMOD_ALT | RETROKMOD_CTRL | RETROKMOD_META))) + return 0; + + /* keypad */ + if (key >= RETROK_KP0) + { + if (key == RETROK_KP_ENTER) + return 10; /* \n */ + + if (mod & RETROKMOD_NUMLOCK) + { + switch (key) + { + case RETROK_KP_PERIOD: + return 46; /* . */ + case RETROK_KP_DIVIDE: + return 47; /* / */ + case RETROK_KP_MULTIPLY: + return 42; /* * */ + case RETROK_KP_MINUS: + return 45; /* - */ + case RETROK_KP_PLUS: + return 43; /* + */ + case RETROK_KP_EQUALS: + return 61; /* = */ + default: /* KP 0 - 9 */ + return key - 208; + } + } + + return 0; + } + + /* symbols */ + if (mod & RETROKMOD_SHIFT) + { + switch (key) + { + case RETROK_BACKQUOTE: + return 126; /* ~ */ + case RETROK_1: + return 33; /* ! */ + case RETROK_2: + return 64; /* @ */ + case RETROK_3: + return 35; /* # */ + case RETROK_4: + return 36; /* $ */ + case RETROK_5: + return 37; /* % */ + case RETROK_6: + return 94; /* ^ */ + case RETROK_7: + return 38; /* & */ + case RETROK_8: + return 42; /* * */ + case RETROK_9: + return 40; /* ( */ + case RETROK_0: + return 41; /* ) */ + case RETROK_MINUS: + return 95; /* _ */ + case RETROK_EQUALS: + return 43; /* + */ + case RETROK_LEFTBRACKET: + return 123; /* { */ + case RETROK_RIGHTBRACKET: + return 125; /* } */ + case RETROK_BACKSLASH: + return 124; /* | */ + case RETROK_SEMICOLON: + return 58; /* : */ + case RETROK_QUOTE: + return 34; /* " */ + case RETROK_COMMA: + return 60; /* < */ + case RETROK_PERIOD: + return 62; /* > */ + case RETROK_SLASH: + return 63; /* ? */ + default: + break; + } + } + + /* shift & capslock */ + if ( key >= RETROK_a && key <= RETROK_z + && ((mod & RETROKMOD_SHIFT) ^ ((mod & RETROKMOD_CAPSLOCK) >> 5))) + return key - 32; + + return key; +} diff --git a/input/input_keymaps.h b/input/input_keymaps.h index e9a2e1be0a..2ffee2b67f 100644 --- a/input/input_keymaps.h +++ b/input/input_keymaps.h @@ -231,6 +231,15 @@ enum retro_key input_keymaps_translate_keysym_to_rk(unsigned sym); **/ void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t size); +/** + * input_translate_rk_to_ascii: + * @key : Retro key identifier + * @mod : retro_mod mask + * + * Translates a retro key identifier with mod mask to ASCII. + */ +uint8_t input_keymaps_translate_rk_to_ascii(enum retro_key key, enum retro_mod mod); + extern enum retro_key rarch_keysym_lut[RETROK_LAST]; extern const struct input_key_map input_config_key_map[]; diff --git a/input/input_overlay.h b/input/input_overlay.h index 4dd7b2b927..4562c03787 100644 --- a/input/input_overlay.h +++ b/input/input_overlay.h @@ -50,7 +50,14 @@ enum overlay_type OVERLAY_TYPE_ANALOG_RIGHT, OVERLAY_TYPE_DPAD_AREA, OVERLAY_TYPE_ABXY_AREA, - OVERLAY_TYPE_KEYBOARD + OVERLAY_TYPE_KEYBOARD, + OVERLAY_TYPE_LAST +}; + +/* Superset of overlay_type for menu entries */ +enum overlay_menu_type +{ + OVERLAY_TYPE_OSK_TOGGLE = OVERLAY_TYPE_LAST }; enum overlay_status @@ -100,14 +107,16 @@ enum overlay_show_input_type enum OVERLAY_LOADER_FLAGS { - OVERLAY_LOADER_RGBA_SUPPORT = (1 << 0) + OVERLAY_LOADER_RGBA_SUPPORT = (1 << 0), + OVERLAY_LOADER_IS_OSK = (1 << 1) }; enum INPUT_OVERLAY_FLAGS { INPUT_OVERLAY_ENABLE = (1 << 0), INPUT_OVERLAY_ALIVE = (1 << 1), - INPUT_OVERLAY_BLOCKED = (1 << 2) + INPUT_OVERLAY_BLOCKED = (1 << 2), + INPUT_OVERLAY_IS_OSK = (1 << 3) }; enum OVERLAY_FLAGS diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 1142b599a0..9580da2b4a 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1337,6 +1337,10 @@ MSG_HASH( MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST, "deferred_onscreen_overlay_settings_list" ) +MSG_HASH( + MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST, + "deferred_osk_overlay_settings_list" + ) MSG_HASH( MENU_ENUM_LABEL_DEFERRED_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST, "deferred_onscreen_video_layout_settings_list" @@ -1975,6 +1979,10 @@ MSG_HASH( MENU_ENUM_LABEL_INPUT_OVERLAY, "input_overlay" ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OSK_OVERLAY, + "input_osk_overlay" + ) MSG_HASH( MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE, "input_overlay_enable" @@ -2011,6 +2019,10 @@ MSG_HASH( MENU_ENUM_LABEL_INPUT_OVERLAY_AUTO_SCALE, "input_overlay_auto_scale" ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_OSK_OVERLAY_AUTO_SCALE, + "input_osk_overlay_auto_scale" + ) MSG_HASH( MENU_ENUM_LABEL_INPUT_OVERLAY_DPAD_DIAGONAL_SENSITIVITY, "input_overlay_dpad_diagonal_sensitivity" @@ -2619,6 +2631,10 @@ MSG_HASH( MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS, "onscreen_overlay_settings" ) +MSG_HASH( + MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS, + "osk_overlay_settings" + ) MSG_HASH( MENU_ENUM_LABEL_ONSCREEN_VIDEO_LAYOUT_SETTINGS, "onscreen_video_layout_settings" @@ -2647,6 +2663,10 @@ MSG_HASH( MENU_ENUM_LABEL_OVERLAY_DIRECTORY, "overlay_directory" ) +MSG_HASH( + MENU_ENUM_LABEL_OSK_OVERLAY_DIRECTORY, + "osk_overlay_directory" + ) MSG_HASH( MENU_ENUM_LABEL_VIDEO_LAYOUT_DIRECTORY, "video_layout_directory" @@ -2655,10 +2675,18 @@ MSG_HASH( MENU_ENUM_LABEL_OVERLAY_OPACITY, "input_overlay_opacity" ) +MSG_HASH( + MENU_ENUM_LABEL_OSK_OVERLAY_OPACITY, + "input_osk_overlay_opacity" + ) MSG_HASH( MENU_ENUM_LABEL_OVERLAY_PRESET, "input_overlay" ) +MSG_HASH( + MENU_ENUM_LABEL_OSK_OVERLAY_PRESET, + "input_osk_overlay" + ) MSG_HASH( MENU_ENUM_LABEL_OVERLAY_SCALE_LANDSCAPE, "input_overlay_scale_landscape" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 0f84bad1de..e57fe159f6 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3701,11 +3701,11 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, - "On-Screen Keyboard (Toggle)" + "Keyboard Overlay (Toggle)" ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_META_OSK, - "Switches on-screen keyboard on/off." + "Switches keyboard overlay on/off." ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, @@ -5033,6 +5033,41 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_Y_OFFSET_PORTRAIT, "Vertical overlay offset when using portrait display orientations. Positive values shift overlay upwards; negative values downwards." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_SETTINGS, + "Keyboard Overlay" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OSK_OVERLAY_SETTINGS, + "Select and adjust a keyboard overlay." + ) + +/* Settings > On-Screen Display > On-Screen Overlay > Keyboard Overlay */ + +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_PRESET, + "Keyboard Overlay Preset" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OSK_OVERLAY_PRESET, + "Select a keyboard overlay from the file browser." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_OSK_OVERLAY_AUTO_SCALE, + "Auto-Scale Keyboard Overlay" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_OSK_OVERLAY_AUTO_SCALE, + "Adjust keyboard overlay to its original aspect ratio. Disable to stretch to screen." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_OPACITY, + "Keyboard Overlay Opacity" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OSK_OVERLAY_OPACITY, + "Opacity of all UI elements of the keyboard overlay." + ) /* Settings > On-Screen Display > Video Layout */ @@ -7596,6 +7631,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY, "Overlays are stored in this directory." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY, + "Keyboard Overlays" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_OSK_OVERLAY_DIRECTORY, + "Keyboard Overlays are stored in this directory." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_LAYOUT_DIRECTORY, "Video Layouts" @@ -13673,6 +13716,10 @@ MSG_HASH( MSG_FAILED_TO_LOAD_OVERLAY, "Failed to load overlay." ) +MSG_HASH( + MSG_OSK_OVERLAY_NOT_SET, + "Keyboard overlay is not set." + ) MSG_HASH( MSG_FAILED_TO_LOAD_STATE, "Failed to load state from" diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index c7292809dd..417b8228e8 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -149,6 +149,7 @@ GENERIC_DEFERRED_PUSH(deferred_push_override_file_load, DISPLAYLIST_ GENERIC_DEFERRED_PUSH(deferred_push_record_configfile, DISPLAYLIST_RECORD_CONFIG_FILES) GENERIC_DEFERRED_PUSH(deferred_push_stream_configfile, DISPLAYLIST_STREAM_CONFIG_FILES) GENERIC_DEFERRED_PUSH(deferred_push_input_overlay, DISPLAYLIST_OVERLAYS) +GENERIC_DEFERRED_PUSH(deferred_push_input_osk_overlay, DISPLAYLIST_OSK_OVERLAYS) GENERIC_DEFERRED_PUSH(deferred_push_video_font_path, DISPLAYLIST_VIDEO_FONTS) GENERIC_DEFERRED_PUSH(deferred_push_xmb_font_path, DISPLAYLIST_FONTS) GENERIC_DEFERRED_PUSH(deferred_push_content_history_path, DISPLAYLIST_CONTENT_HISTORY) @@ -187,6 +188,7 @@ GENERIC_DEFERRED_PUSH(deferred_push_onscreen_notifications_settings_list, DISPLA GENERIC_DEFERRED_PUSH(deferred_push_onscreen_notifications_views_settings_list, DISPLAYLIST_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) #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) @@ -712,6 +714,7 @@ static int menu_cbs_init_bind_deferred_push_compare_label( {MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST, deferred_push_onscreen_notifications_views_settings_list}, #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}, #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}, @@ -866,6 +869,7 @@ static int menu_cbs_init_bind_deferred_push_compare_label( {MENU_ENUM_LABEL_MENU_WALLPAPER, deferred_push_images}, {MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN, deferred_push_audio_dsp_plugin}, {MENU_ENUM_LABEL_INPUT_OVERLAY, deferred_push_input_overlay}, + {MENU_ENUM_LABEL_INPUT_OSK_OVERLAY, deferred_push_input_osk_overlay}, {MENU_ENUM_LABEL_VIDEO_FONT_PATH, deferred_push_video_font_path}, {MENU_ENUM_LABEL_XMB_FONT, deferred_push_xmb_font_path}, {MENU_ENUM_LABEL_CHEAT_FILE_LOAD, deferred_push_cheat_file_load}, @@ -1216,6 +1220,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_ENUM_LABEL_INPUT_OVERLAY: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_input_overlay); break; + case MENU_ENUM_LABEL_INPUT_OSK_OVERLAY: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_input_osk_overlay); + break; case MENU_ENUM_LABEL_VIDEO_FONT_PATH: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_video_font_path); break; @@ -1280,6 +1287,9 @@ static int menu_cbs_init_bind_deferred_push_compare_label( case MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST: BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_onscreen_overlay_settings_list); break; + case MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST: + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_osk_overlay_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_get_value.c b/menu/cbs/menu_cbs_get_value.c index 161be155a9..c18e6cf398 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -2170,6 +2170,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_type( menu_action_setting_disp_set_label_menu_file_carchive); break; case FILE_TYPE_OVERLAY: + case FILE_TYPE_OSK_OVERLAY: BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_menu_file_overlay); break; diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 6dafb6ff65..cbd075d8db 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -1230,6 +1230,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, case FILE_TYPE_SHADER_PRESET: case FILE_TYPE_IMAGE: case FILE_TYPE_OVERLAY: + case FILE_TYPE_OSK_OVERLAY: case FILE_TYPE_VIDEOFILTER: case FILE_TYPE_AUDIOFILTER: case FILE_TYPE_CONFIG: diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index fd1e10ca8b..2de8752c5d 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -123,6 +123,7 @@ enum ACTION_OK_SET_PATH_AUDIO_FILTER, ACTION_OK_SET_PATH_VIDEO_FILTER, ACTION_OK_SET_PATH_OVERLAY, + ACTION_OK_SET_PATH_OSK_OVERLAY, ACTION_OK_SET_PATH_VIDEO_FONT, ACTION_OK_SET_DIRECTORY, ACTION_OK_SHOW_WIMP, @@ -385,6 +386,8 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl) return MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST; case ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST: 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_MENU_SETTINGS_LIST: return MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST; #ifdef _3DS @@ -1022,6 +1025,20 @@ int generic_action_ok_displaylist_push(const char *path, info_path = parent_dir; break; + case ACTION_OK_DL_OSK_OVERLAY_PRESET: + filebrowser_clear_type(); + info.directory_ptr = idx; + info_label = msg_hash_to_str(MENU_ENUM_LABEL_OSK_OVERLAY_PRESET); + info.enum_idx = MENU_ENUM_LABEL_OSK_OVERLAY_PRESET; + dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; + + action_ok_get_file_browser_start_path( + settings->paths.path_osk_overlay, + settings->paths.directory_osk_overlay, + parent_dir, sizeof(parent_dir), true); + + info_path = parent_dir; + break; case ACTION_OK_DL_VIDEO_FONT: filebrowser_set_type(FILEBROWSER_SELECT_VIDEO_FONT); info.directory_ptr = idx; @@ -1663,6 +1680,7 @@ int generic_action_ok_displaylist_push(const char *path, case ACTION_OK_DL_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST: 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_MENU_SETTINGS_LIST: #ifdef _3DS case ACTION_OK_DL_MENU_BOTTOM_SETTINGS_LIST: @@ -2329,6 +2347,10 @@ static int generic_action_ok(const char *path, flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST); ret = set_path_generic(menu_label, action_path); break; + case ACTION_OK_SET_PATH_OSK_OVERLAY: + flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_OSK_OVERLAY_SETTINGS_LIST); + ret = set_path_generic(menu_label, action_path); + break; case ACTION_OK_SET_PATH_VIDEO_FONT: flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST); ret = set_path_generic(menu_label, action_path); @@ -2386,6 +2408,7 @@ static int default_action_ok_load_content_from_playlist_from_menu(const char *_p DEFAULT_ACTION_OK_SET(action_ok_set_path_audiofilter, ACTION_OK_SET_PATH_AUDIO_FILTER, MSG_UNKNOWN) DEFAULT_ACTION_OK_SET(action_ok_set_path_videofilter, ACTION_OK_SET_PATH_VIDEO_FILTER, MSG_UNKNOWN) DEFAULT_ACTION_OK_SET(action_ok_set_path_overlay, ACTION_OK_SET_PATH_OVERLAY, MSG_UNKNOWN) +DEFAULT_ACTION_OK_SET(action_ok_set_path_osk_overlay, ACTION_OK_SET_PATH_OSK_OVERLAY, MSG_UNKNOWN) DEFAULT_ACTION_OK_SET(action_ok_set_path_video_font, ACTION_OK_SET_PATH_VIDEO_FONT, MSG_UNKNOWN) DEFAULT_ACTION_OK_SET(action_ok_set_path, ACTION_OK_SET_PATH, MSG_UNKNOWN) DEFAULT_ACTION_OK_SET(action_ok_load_core, ACTION_OK_LOAD_CORE, MSG_UNKNOWN) @@ -5899,6 +5922,7 @@ 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_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 STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_menu_bottom_list, ACTION_OK_DL_MENU_BOTTOM_SETTINGS_LIST) @@ -5949,6 +5973,7 @@ STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_push_generic_list, ACTION_OK_DL_GENERIC) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_audio_dsp_plugin, ACTION_OK_DL_AUDIO_DSP_PLUGIN) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_video_filter, ACTION_OK_DL_VIDEO_FILTER) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_overlay_preset, ACTION_OK_DL_OVERLAY_PRESET) +STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_osk_overlay_preset, ACTION_OK_DL_OSK_OVERLAY_PRESET) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_video_font, ACTION_OK_DL_VIDEO_FONT) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_rpl_entry, ACTION_OK_DL_RPL_ENTRY) STATIC_DEFAULT_ACTION_OK_FUNC(action_ok_open_archive_detect_core, ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE) @@ -8344,6 +8369,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, {MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN, action_ok_audio_dsp_plugin}, {MENU_ENUM_LABEL_VIDEO_FILTER, action_ok_video_filter}, {MENU_ENUM_LABEL_OVERLAY_PRESET, action_ok_overlay_preset}, + {MENU_ENUM_LABEL_OSK_OVERLAY_PRESET, action_ok_osk_overlay_preset}, {MENU_ENUM_LABEL_RECORD_CONFIG, action_ok_record_configfile}, {MENU_ENUM_LABEL_STREAM_CONFIG, action_ok_stream_configfile}, #ifdef HAVE_RGUI @@ -8496,6 +8522,7 @@ 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_OSK_OVERLAY_SETTINGS, action_ok_osk_overlay_list}, {MENU_ENUM_LABEL_MENU_SETTINGS, action_ok_menu_list}, #ifdef _3DS {MENU_ENUM_LABEL_MENU_BOTTOM_SETTINGS, action_ok_menu_bottom_list}, @@ -8581,6 +8608,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, {MENU_ENUM_LABEL_AUDIO_DSP_PLUGIN, action_ok_audio_dsp_plugin}, {MENU_ENUM_LABEL_VIDEO_FILTER, action_ok_video_filter}, {MENU_ENUM_LABEL_OVERLAY_PRESET, action_ok_overlay_preset}, + {MENU_ENUM_LABEL_OSK_OVERLAY_PRESET, action_ok_osk_overlay_preset}, {MENU_ENUM_LABEL_REMAP_FILE_LOAD, action_ok_remap_file}, {MENU_ENUM_LABEL_OVERRIDE_FILE_LOAD, action_ok_override_file}, {MENU_ENUM_LABEL_RECORD_CONFIG, action_ok_record_configfile}, @@ -9061,6 +9089,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, case FILE_TYPE_OVERLAY: BIND_ACTION_OK(cbs, action_ok_set_path_overlay); break; + case FILE_TYPE_OSK_OVERLAY: + BIND_ACTION_OK(cbs, action_ok_set_path_osk_overlay); + break; case FILE_TYPE_AUDIOFILTER: BIND_ACTION_OK(cbs, action_ok_set_path_audiofilter); break; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 9c874ce26e..b6c0bf6751 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -1066,6 +1066,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs, case FILE_TYPE_SHADER_PRESET: case FILE_TYPE_IMAGE: case FILE_TYPE_OVERLAY: + case FILE_TYPE_OSK_OVERLAY: case FILE_TYPE_VIDEOFILTER: case FILE_TYPE_AUDIOFILTER: case FILE_TYPE_CONFIG: diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 5153784591..53d6b74782 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -413,6 +413,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_pause_toggle, ME DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_frameadvance, MENU_ENUM_SUBLABEL_INPUT_META_FRAMEADVANCE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_mute, MENU_ENUM_SUBLABEL_INPUT_META_MUTE) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_osk, MENU_ENUM_SUBLABEL_INPUT_META_OSK) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_volume_up, MENU_ENUM_SUBLABEL_INPUT_META_VOLUME_UP) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_volume_down, MENU_ENUM_SUBLABEL_INPUT_META_VOLUME_DOWN) @@ -664,6 +665,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_hide_when_gamepad_conn DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_show_mouse_cursor, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_SHOW_MOUSE_CURSOR) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_auto_rotate, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_AUTO_ROTATE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_auto_scale, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_AUTO_SCALE) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_osk_overlay_auto_scale, MENU_ENUM_SUBLABEL_INPUT_OSK_OVERLAY_AUTO_SCALE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_dpad_diag_sens, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_DPAD_DIAGONAL_SENSITIVITY) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_abxy_diag_sens, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_ABXY_DIAGONAL_SENSITIVITY) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_content_collection_list, MENU_ENUM_SUBLABEL_PLAYLISTS_TAB) @@ -811,6 +813,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_microphone_wasapi_sh_buffer_length, #endif DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_opacity, MENU_ENUM_SUBLABEL_OVERLAY_OPACITY) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_osk_overlay_opacity, MENU_ENUM_SUBLABEL_OSK_OVERLAY_OPACITY) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_scale_landscape, MENU_ENUM_SUBLABEL_OVERLAY_SCALE_LANDSCAPE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_aspect_adjust_landscape, MENU_ENUM_SUBLABEL_OVERLAY_ASPECT_ADJUST_LANDSCAPE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_x_separation_landscape, MENU_ENUM_SUBLABEL_OVERLAY_X_SEPARATION_LANDSCAPE) @@ -825,6 +828,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_x_offset_portrait, MEN DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_y_offset_portrait, MENU_ENUM_SUBLABEL_OVERLAY_Y_OFFSET_PORTRAIT) 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_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) @@ -1115,6 +1119,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_savefile_directory, DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_savestate_directory, MENU_ENUM_SUBLABEL_SAVESTATE_DIRECTORY) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_screenshot_directory, MENU_ENUM_SUBLABEL_SCREENSHOT_DIRECTORY) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_overlay_directory, MENU_ENUM_SUBLABEL_OVERLAY_DIRECTORY) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_osk_overlay_directory, MENU_ENUM_SUBLABEL_OSK_OVERLAY_DIRECTORY) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_audio_filter_directory, MENU_ENUM_SUBLABEL_AUDIO_FILTER_DIR) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_filter_directory, MENU_ENUM_SUBLABEL_VIDEO_FILTER_DIR) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_shader_directory, MENU_ENUM_SUBLABEL_VIDEO_SHADER_DIR) @@ -1176,6 +1181,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_midi_input, DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_midi_output, MENU_ENUM_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_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 @@ -2350,6 +2356,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case RARCH_NETPLAY_FADE_CHAT_TOGGLE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_meta_netplay_fade_chat_toggle); return 0; + case RARCH_OSK: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_meta_osk); + return 0; default: break; } @@ -2633,6 +2642,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_OVERLAY_DIRECTORY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_directory); break; + case MENU_ENUM_LABEL_OSK_OVERLAY_DIRECTORY: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_osk_overlay_directory); + break; case MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_screenshot_directory); break; @@ -3566,12 +3578,18 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_OVERLAY_PRESET: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_preset); break; + case MENU_ENUM_LABEL_OSK_OVERLAY_PRESET: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_osk_overlay_preset); + break; case MENU_ENUM_LABEL_INPUT_OVERLAY_ENABLE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_enable); break; case MENU_ENUM_LABEL_OVERLAY_OPACITY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_opacity); break; + case MENU_ENUM_LABEL_OSK_OVERLAY_OPACITY: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_osk_overlay_opacity); + break; case MENU_ENUM_LABEL_OVERLAY_SCALE_LANDSCAPE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_overlay_scale_landscape); break; @@ -4046,6 +4064,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_INPUT_OVERLAY_AUTO_SCALE: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_auto_scale); break; + case MENU_ENUM_LABEL_INPUT_OSK_OVERLAY_AUTO_SCALE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_osk_overlay_auto_scale); + break; case MENU_ENUM_LABEL_INPUT_OVERLAY_DPAD_DIAGONAL_SENSITIVITY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_overlay_dpad_diag_sens); break; @@ -5052,6 +5073,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_ONSCREEN_OVERLAY_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_onscreen_overlay_settings_list); break; + case MENU_ENUM_LABEL_OSK_OVERLAY_SETTINGS: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_osk_overlay_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 56986eb582..cea98e59d9 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -639,6 +639,7 @@ DEFAULT_TITLE_MACRO(action_get_onscreen_display_settings_list, MENU_ENUM_LABEL_ DEFAULT_TITLE_MACRO(action_get_onscreen_notifications_settings_list, MENU_ENUM_LABEL_VALUE_ONSCREEN_NOTIFICATIONS_SETTINGS) 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_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) @@ -998,6 +999,7 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, {MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST, action_get_onscreen_notifications_settings_list}, {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_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}, @@ -1613,6 +1615,9 @@ static int menu_cbs_init_bind_title_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_DEFERRED_ONSCREEN_OVERLAY_SETTINGS_LIST: BIND_ACTION_GET_TITLE(cbs, action_get_onscreen_overlay_settings_list); break; + 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_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 de280f0faf..32f13a2603 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -10882,6 +10882,7 @@ static void materialui_list_insert( || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS_VIEWS_SETTINGS)) || 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_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 f6a73b8999..7bf846acf3 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -1893,6 +1893,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_OSK_OVERLAY_SETTINGS: + return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_SETTING]; case MENU_ENUM_LABEL_UPDATE_CG_SHADERS: case MENU_ENUM_LABEL_UPDATE_GLSL_SHADERS: case MENU_ENUM_LABEL_UPDATE_SLANG_SHADERS: diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 39f120fa0b..20f352b879 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -3047,6 +3047,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_OSK_OVERLAY_SETTINGS: + return xmb->textures.list[XMB_TEXTURE_SETTING]; case MENU_ENUM_LABEL_UPDATE_CG_SHADERS: case MENU_ENUM_LABEL_UPDATE_GLSL_SHADERS: case MENU_ENUM_LABEL_UPDATE_SLANG_SHADERS: diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 0537b12a55..e8fd0a4249 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -77,6 +77,7 @@ enum ACTION_OK_DL_AUDIO_DSP_PLUGIN, ACTION_OK_DL_VIDEO_FILTER, ACTION_OK_DL_OVERLAY_PRESET, + ACTION_OK_DL_OSK_OVERLAY_PRESET, ACTION_OK_DL_VIDEO_FONT, ACTION_OK_DL_SHADER_PASS, ACTION_OK_DL_FAVORITES_LIST, @@ -183,6 +184,7 @@ enum ACTION_OK_DL_MIXER_STREAM_SETTINGS_LIST, ACTION_OK_DL_ONSCREEN_DISPLAY_SETTINGS_LIST, ACTION_OK_DL_ONSCREEN_OVERLAY_SETTINGS_LIST, + ACTION_OK_DL_OSK_OVERLAY_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 e9e46b743e..b68ad9b694 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -6802,8 +6802,7 @@ unsigned menu_displaylist_build_list( if (i == RARCH_FIRST_META_KEY) continue; /* Hidden items */ - else if ((key == RARCH_OVERLAY_NEXT) - || (key == RARCH_OSK)) + else if (key == RARCH_OVERLAY_NEXT) continue; /* Show combo entries before normal binds */ else if (key == RARCH_MENU_TOGGLE) @@ -9651,6 +9650,7 @@ 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_OSK_OVERLAY_SETTINGS, PARSE_ACTION, false }, }; for (i = 0; i < ARRAY_SIZE(build_list); i++) @@ -9700,6 +9700,17 @@ 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_OSK_OVERLAY_SETTINGS: + /* Show keyboard menu if the main overlay has + * an osk_toggle or if the OSK hotkey is set */ + if (input_overlay_enable && + (BIT16_GET(menu_st->overlay_types, OVERLAY_TYPE_OSK_TOGGLE) + || input_config_binds[0][RARCH_OSK].joykey != NO_BTN + || input_config_binds[0][RARCH_OSK].joyaxis != AXIS_NONE + || input_config_binds[0][RARCH_OSK].key != RETROK_UNKNOWN + || input_config_binds[0][RARCH_OSK].mbutton != NO_BTN)) + build_list[i].checked = true; + break; default: break; } @@ -9717,6 +9728,20 @@ unsigned menu_displaylist_build_list( } } break; + case DISPLAYLIST_OSK_OVERLAY_SETTINGS_LIST: + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_OSK_OVERLAY_PRESET, + PARSE_ONLY_PATH, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_OSK_OVERLAY_AUTO_SCALE, + PARSE_ONLY_BOOL, false) == 0) + count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_OSK_OVERLAY_OPACITY, + PARSE_ONLY_FLOAT, false) == 0) + count++; + break; #endif case DISPLAYLIST_LATENCY_SETTINGS_LIST: { @@ -10623,6 +10648,7 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_RECORDING_OUTPUT_DIRECTORY, PARSE_ONLY_DIR}, {MENU_ENUM_LABEL_RECORDING_CONFIG_DIRECTORY, PARSE_ONLY_DIR}, {MENU_ENUM_LABEL_OVERLAY_DIRECTORY, PARSE_ONLY_DIR}, + {MENU_ENUM_LABEL_OSK_OVERLAY_DIRECTORY, PARSE_ONLY_DIR}, #ifdef HAVE_SCREENSHOTS {MENU_ENUM_LABEL_SCREENSHOT_DIRECTORY, PARSE_ONLY_DIR}, #endif @@ -13592,6 +13618,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, case DISPLAYLIST_LATENCY_SETTINGS_LIST: #if defined(HAVE_OVERLAY) case DISPLAYLIST_ONSCREEN_OVERLAY_SETTINGS_LIST: + case DISPLAYLIST_OSK_OVERLAY_SETTINGS_LIST: #endif case DISPLAYLIST_ACCOUNTS_CHEEVOS_LIST: case DISPLAYLIST_ACCOUNTS_LIST: @@ -14479,6 +14506,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, case DISPLAYLIST_STREAM_CONFIG_FILES: case DISPLAYLIST_RECORD_CONFIG_FILES: case DISPLAYLIST_OVERLAYS: + case DISPLAYLIST_OSK_OVERLAYS: case DISPLAYLIST_FONTS: case DISPLAYLIST_VIDEO_FONTS: case DISPLAYLIST_AUDIO_FILTERS: @@ -14519,6 +14547,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, info->type_default = FILE_TYPE_OVERLAY; info->exts = strldup("cfg", sizeof("cfg")); break; + case DISPLAYLIST_OSK_OVERLAYS: + info->type_default = FILE_TYPE_OSK_OVERLAY; + info->exts = strldup("cfg", sizeof("cfg")); + break; case DISPLAYLIST_FONTS: info->type_default = FILE_TYPE_FONT; info->exts = strldup("ttf", sizeof("ttf")); diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 50dbd307a5..27881f9c25 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -157,6 +157,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_EJECT_DISC, #endif DISPLAYLIST_OVERLAYS, + DISPLAYLIST_OSK_OVERLAYS, DISPLAYLIST_SHADER_PARAMETERS, DISPLAYLIST_SHADER_PARAMETERS_PRESET, DISPLAYLIST_SHADER_PRESET_SAVE, @@ -203,6 +204,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_INPUT_HOTKEY_BINDS_LIST, #if defined(HAVE_OVERLAY) DISPLAYLIST_ONSCREEN_OVERLAY_SETTINGS_LIST, + DISPLAYLIST_OSK_OVERLAY_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 bebf9213dd..19809605d3 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -294,6 +294,7 @@ enum settings_list_type SETTINGS_LIST_FRAME_TIME_COUNTER, SETTINGS_LIST_ONSCREEN_NOTIFICATIONS, SETTINGS_LIST_OVERLAY, + SETTINGS_LIST_OSK_OVERLAY, SETTINGS_LIST_MENU, SETTINGS_LIST_MENU_FILE_BROWSER, SETTINGS_LIST_MULTIMEDIA, @@ -9997,6 +9998,15 @@ static bool setting_append_list( &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, + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_SETTINGS, + &group_info, + &subgroup_info, + parent_group); + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED); #endif CONFIG_ACTION( @@ -16499,9 +16509,74 @@ static bool setting_append_list( END_SUB_GROUP(list, list_info, parent_group); - START_SUB_GROUP(list, list_info, "Onscreen Keyboard Overlay", &group_info, &subgroup_info, parent_group); + END_GROUP(list, list_info, parent_group); +#endif + break; + case SETTINGS_LIST_OSK_OVERLAY: +#ifdef HAVE_OVERLAY + START_GROUP(list, list_info, &group_info, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_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_PATH( + list, list_info, + settings->paths.path_osk_overlay, + sizeof(settings->paths.path_osk_overlay), + MENU_ENUM_LABEL_OSK_OVERLAY_PRESET, + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_PRESET, + settings->paths.directory_osk_overlay, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + MENU_SETTINGS_LIST_CURRENT_ADD_VALUES(list, list_info, "cfg"); + MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_OVERLAY_INIT); + + CONFIG_BOOL( + list, list_info, + &settings->bools.input_osk_overlay_auto_scale, + MENU_ENUM_LABEL_INPUT_OSK_OVERLAY_AUTO_SCALE, + MENU_ENUM_LABEL_VALUE_INPUT_OSK_OVERLAY_AUTO_SCALE, + DEFAULT_INPUT_OVERLAY_AUTO_SCALE, + 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; + MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_OVERLAY_SET_SCALE_FACTOR); + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_CMD_APPLY_AUTO); + + CONFIG_FLOAT( + list, list_info, + &settings->floats.input_osk_overlay_opacity, + MENU_ENUM_LABEL_OSK_OVERLAY_OPACITY, + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_OPACITY, + DEFAULT_INPUT_OVERLAY_OPACITY, + "%.2f", + &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_CMD(list, list_info, CMD_EVENT_OVERLAY_SET_ALPHA_MOD); + menu_settings_list_current_add_range(list, list_info, 0, 1, 0.01, true, true); + SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_CMD_APPLY_AUTO); END_SUB_GROUP(list, list_info, parent_group); + END_GROUP(list, list_info, parent_group); #endif break; @@ -22192,6 +22267,21 @@ static bool setting_append_list( general_write_handler, general_read_handler); (*list)[list_info->index - 1].action_start = directory_action_start_generic; + + CONFIG_DIR( + list, list_info, + settings->paths.directory_osk_overlay, + sizeof(settings->paths.directory_osk_overlay), + MENU_ENUM_LABEL_OSK_OVERLAY_DIRECTORY, + MENU_ENUM_LABEL_VALUE_OSK_OVERLAY_DIRECTORY, + g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY], + MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_start = directory_action_start_generic; #endif CONFIG_DIR( @@ -22836,6 +22926,7 @@ static rarch_setting_t *menu_setting_new_internal(rarch_setting_info_t *list_inf SETTINGS_LIST_FRAME_TIME_COUNTER, SETTINGS_LIST_ONSCREEN_NOTIFICATIONS, SETTINGS_LIST_OVERLAY, + SETTINGS_LIST_OSK_OVERLAY, SETTINGS_LIST_MENU, SETTINGS_LIST_MENU_FILE_BROWSER, SETTINGS_LIST_MULTIMEDIA, diff --git a/msg_hash.h b/msg_hash.h index 2125633a81..0dd12b0764 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -170,6 +170,8 @@ enum msg_file_type FILE_TYPE_DOWNLOAD_CORE_SYSTEM_FILES, + FILE_TYPE_OSK_OVERLAY, + FILE_TYPE_LAST }; @@ -499,6 +501,7 @@ enum msg_hash_enums MSG_AUDIO_UNMUTED, MSG_FAILED_TO_UNMUTE_AUDIO, MSG_FAILED_TO_LOAD_OVERLAY, + MSG_OSK_OVERLAY_NOT_SET, MSG_PAUSED, MSG_UNPAUSED, MSG_CORE_DOES_NOT_SUPPORT_DISK_OPTIONS, @@ -1077,7 +1080,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_INPUT_META_NETPLAY_FADE_CHAT_TOGGLE, MENU_ENUM_LABEL_VALUE_INPUT_META_OVERLAY_NEXT, /* Hidden */ - MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, /* Hidden */ + MENU_ENUM_LABEL_VALUE_INPUT_META_OSK, MENU_ENUM_LABEL_VALUE_INPUT_META_SEND_DEBUG_INFO, /* Deprecated */ MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX, @@ -1159,7 +1162,7 @@ enum msg_hash_enums MENU_ENUM_SUBLABEL_INPUT_META_NETPLAY_FADE_CHAT_TOGGLE, MENU_ENUM_SUBLABEL_INPUT_META_OVERLAY_NEXT, /* Hidden */ - MENU_ENUM_SUBLABEL_INPUT_META_OSK, /* Hidden */ + MENU_ENUM_SUBLABEL_INPUT_META_OSK, MENU_ENUM_SUBLABEL_INPUT_META_SEND_DEBUG_INFO, /* Deprecated */ MENU_ENUM_LABEL_INPUT_DESCRIPTION, @@ -1232,6 +1235,7 @@ enum msg_hash_enums MENU_LABEL(INPUT_OVERLAY_SHOW_MOUSE_CURSOR), MENU_LABEL(INPUT_OVERLAY_AUTO_ROTATE), MENU_LABEL(INPUT_OVERLAY_AUTO_SCALE), + MENU_LABEL(INPUT_OSK_OVERLAY_AUTO_SCALE), MENU_LABEL(INPUT_OVERLAY_DPAD_DIAGONAL_SENSITIVITY), MENU_LABEL(INPUT_OVERLAY_ABXY_DIAGONAL_SENSITIVITY), MENU_LABEL(INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE), @@ -1923,6 +1927,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_DEFERRED_CHEAT_SEARCH_SETTINGS_LIST, 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_ONSCREEN_VIDEO_LAYOUT_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST, @@ -2369,7 +2374,9 @@ enum msg_hash_enums MENU_LABEL(OVERLAY_X_OFFSET_PORTRAIT), MENU_LABEL(OVERLAY_Y_OFFSET_PORTRAIT), MENU_LABEL(OVERLAY_PRESET), + MENU_LABEL(OSK_OVERLAY_PRESET), MENU_LABEL(OVERLAY_OPACITY), + MENU_LABEL(OSK_OVERLAY_OPACITY), /* TODO/FIXME: These legacy enums are no longer * required, but we cannot delete them until the @@ -3130,6 +3137,7 @@ enum msg_hash_enums MENU_LABEL(SAVE_NEW_CONFIG), MENU_LABEL(ONSCREEN_DISPLAY_SETTINGS), MENU_LABEL(ONSCREEN_OVERLAY_SETTINGS), + MENU_LABEL(OSK_OVERLAY_SETTINGS), MENU_LABEL(ONSCREEN_VIDEO_LAYOUT_SETTINGS), MENU_LABEL(ONSCREEN_NOTIFICATIONS_SETTINGS), MENU_LABEL(ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS), diff --git a/retroarch.c b/retroarch.c index 586728c93a..1ae702a22b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3039,19 +3039,24 @@ bool command_event(enum event_command cmd, void *data) *video_st = video_state_get_ptr(); input_driver_state_t *input_st = input_state_get_ptr(); bool inp_overlay_auto_rotate = settings->bools.input_overlay_auto_rotate; - float input_overlay_opacity = settings->floats.input_overlay_opacity; - if (!input_st->overlay_ptr) + input_overlay_t *ol = input_st->overlay_ptr; + float input_overlay_opacity; + if (!ol) return false; - input_st->overlay_ptr->index = input_st->overlay_ptr->next_index; - input_st->overlay_ptr->active = &input_st->overlay_ptr->overlays[ - input_st->overlay_ptr->index]; + ol->index = ol->next_index; + ol->active = &ol->overlays[ol->index]; + + input_overlay_opacity = (ol->flags & INPUT_OVERLAY_IS_OSK) + ? settings->floats.input_osk_overlay_opacity + : settings->floats.input_overlay_opacity; input_overlay_load_active(input_st->overlay_visibility, - input_st->overlay_ptr, input_overlay_opacity); + ol, input_overlay_opacity); - input_st->overlay_ptr->flags |= INPUT_OVERLAY_BLOCKED; - input_st->overlay_ptr->next_index = (unsigned)((input_st->overlay_ptr->index + 1) % input_st->overlay_ptr->size); + ol->flags |= INPUT_OVERLAY_BLOCKED; + ol->next_index = + (unsigned)((ol->index + 1) % ol->size); /* Check orientation, if required */ if (inp_overlay_auto_rotate) @@ -3061,18 +3066,37 @@ bool command_event(enum event_command cmd, void *data) video_st->width, video_st->height, settings->bools.input_overlay_enable, - input_st->overlay_ptr); + ol); } #endif break; case CMD_EVENT_OSK_TOGGLE: +#ifdef HAVE_OVERLAY { - input_driver_state_t *input_st = input_state_get_ptr(); + settings_t *settings = config_get_ptr(); + input_driver_state_t *input_st = input_state_get_ptr(); + if (input_st->flags & INP_FLAG_KB_LINEFEED_ENABLE) input_st->flags &= ~INP_FLAG_KB_LINEFEED_ENABLE; - else + else if (!string_is_empty(settings->paths.path_osk_overlay)) input_st->flags |= INP_FLAG_KB_LINEFEED_ENABLE; + else + runloop_msg_queue_push( + msg_hash_to_str(MSG_OSK_OVERLAY_NOT_SET), 1, 100, false, + NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); + + command_event(CMD_EVENT_OVERLAY_INIT, NULL); + +#ifdef HAVE_MENU + /* Avoid stray menu input during transition */ + if (menu_st->flags & MENU_ST_FLAG_ALIVE) + { + menu_st->input_state.select_inhibit = true; + menu_st->input_state.cancel_inhibit = true; + } +#endif } +#endif break; case CMD_EVENT_DSP_FILTER_INIT: #ifdef HAVE_DSP_FILTER @@ -3342,26 +3366,40 @@ bool command_event(enum event_command cmd, void *data) #ifdef HAVE_OVERLAY { overlay_layout_desc_t layout_desc; - video_driver_state_t - *video_st = video_state_get_ptr(); - input_driver_state_t *input_st = input_state_get_ptr(); + video_driver_state_t *video_st = video_state_get_ptr(); + input_driver_state_t *input_st = input_state_get_ptr(); + input_overlay_t *ol = input_st->overlay_ptr; - layout_desc.scale_landscape = settings->floats.input_overlay_scale_landscape; - layout_desc.aspect_adjust_landscape = settings->floats.input_overlay_aspect_adjust_landscape; - layout_desc.x_separation_landscape = settings->floats.input_overlay_x_separation_landscape; - layout_desc.y_separation_landscape = settings->floats.input_overlay_y_separation_landscape; - layout_desc.x_offset_landscape = settings->floats.input_overlay_x_offset_landscape; - layout_desc.y_offset_landscape = settings->floats.input_overlay_y_offset_landscape; - layout_desc.scale_portrait = settings->floats.input_overlay_scale_portrait; - layout_desc.aspect_adjust_portrait = settings->floats.input_overlay_aspect_adjust_portrait; - layout_desc.x_separation_portrait = settings->floats.input_overlay_x_separation_portrait; - layout_desc.y_separation_portrait = settings->floats.input_overlay_y_separation_portrait; - layout_desc.x_offset_portrait = settings->floats.input_overlay_x_offset_portrait; - layout_desc.y_offset_portrait = settings->floats.input_overlay_y_offset_portrait; - layout_desc.touch_scale = (float)settings->uints.input_touch_scale; - layout_desc.auto_scale = settings->bools.input_overlay_auto_scale; + if (!ol) + break; - input_overlay_set_scale_factor(input_st->overlay_ptr, + if (ol->flags & INPUT_OVERLAY_IS_OSK) + { + memset(&layout_desc, 0, sizeof(overlay_layout_desc_t)); + layout_desc.scale_landscape = 1.0f; + layout_desc.scale_portrait = 1.0f; + layout_desc.touch_scale = 1.0f; + layout_desc.auto_scale = settings->bools.input_osk_overlay_auto_scale; + } + else + { + layout_desc.scale_landscape = settings->floats.input_overlay_scale_landscape; + layout_desc.aspect_adjust_landscape = settings->floats.input_overlay_aspect_adjust_landscape; + layout_desc.x_separation_landscape = settings->floats.input_overlay_x_separation_landscape; + layout_desc.y_separation_landscape = settings->floats.input_overlay_y_separation_landscape; + layout_desc.x_offset_landscape = settings->floats.input_overlay_x_offset_landscape; + layout_desc.y_offset_landscape = settings->floats.input_overlay_y_offset_landscape; + layout_desc.scale_portrait = settings->floats.input_overlay_scale_portrait; + layout_desc.aspect_adjust_portrait = settings->floats.input_overlay_aspect_adjust_portrait; + layout_desc.x_separation_portrait = settings->floats.input_overlay_x_separation_portrait; + layout_desc.y_separation_portrait = settings->floats.input_overlay_y_separation_portrait; + layout_desc.x_offset_portrait = settings->floats.input_overlay_x_offset_portrait; + layout_desc.y_offset_portrait = settings->floats.input_overlay_y_offset_portrait; + layout_desc.touch_scale = (float)settings->uints.input_touch_scale; + layout_desc.auto_scale = settings->bools.input_overlay_auto_scale; + } + + input_overlay_set_scale_factor(ol, &layout_desc, video_st->width, video_st->height); @@ -3373,11 +3411,18 @@ bool command_event(enum event_command cmd, void *data) * The alpha factor is applied for all overlays. */ #ifdef HAVE_OVERLAY { - float input_overlay_opacity = settings->floats.input_overlay_opacity; input_driver_state_t *input_st = input_state_get_ptr(); + input_overlay_t *ol = input_st->overlay_ptr; - input_overlay_set_alpha_mod(input_st->overlay_visibility, - input_st->overlay_ptr, input_overlay_opacity); + if (ol) + { + float input_overlay_opacity = (ol->flags & INPUT_OVERLAY_IS_OSK) + ? settings->floats.input_osk_overlay_opacity + : settings->floats.input_overlay_opacity; + + input_overlay_set_alpha_mod(input_st->overlay_visibility, + ol, input_overlay_opacity); + } } #endif break; diff --git a/runloop.c b/runloop.c index 9538f94c7d..1c4f34ddf7 100644 --- a/runloop.c +++ b/runloop.c @@ -5483,7 +5483,6 @@ static enum runloop_state_enum runloop_check_state( #ifdef HAVE_OVERLAY if (settings->bools.input_overlay_enable) { - static char prev_overlay_restore = false; static unsigned last_width = 0; static unsigned last_height = 0; unsigned video_driver_width = video_st->width; @@ -5513,15 +5512,6 @@ static enum runloop_state_enum runloop_check_state( /* Check next overlay hotkey */ HOTKEY_CHECK(RARCH_OVERLAY_NEXT, CMD_EVENT_OVERLAY_NEXT, true, &check_next_rotation); - /* Ensure overlay is restored after displaying OSK */ - if (input_st->flags & INP_FLAG_KB_LINEFEED_ENABLE) - prev_overlay_restore = true; - else if (prev_overlay_restore) - { - input_overlay_init(); - prev_overlay_restore = false; - } - /* Check whether video aspect has changed */ if ((video_driver_width != last_width) || (video_driver_height != last_height)) diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index 993b43cdb9..7cbe720a8e 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -329,6 +329,8 @@ static bool task_overlay_load_desc( config_get_array(conf, overlay_key, desc->next_index_name, sizeof(desc->next_index_name)); } + else if (BIT256_GET(desc->button_mask, RARCH_OSK)) + BIT16_SET(loader->overlay_types, OVERLAY_TYPE_OSK_TOGGLE); } BIT16_SET(loader->overlay_types, desc->type); @@ -962,6 +964,7 @@ static bool task_overlay_finder(retro_task_t *task, void *user_data) bool task_push_overlay_load_default( retro_task_callback_t cb, const char *overlay_path, + bool is_osk, void *user_data) { task_finder_data_t find_data; @@ -1012,6 +1015,8 @@ bool task_push_overlay_load_default( loader->state = OVERLAY_STATUS_DEFERRED_LOAD; loader->pos_increment = (loader->size / 4) ? (loader->size / 4) : 4; + if (is_osk) + loader->flags |= OVERLAY_LOADER_IS_OSK; #ifdef RARCH_INTERNAL if (video_driver_supports_rgba()) loader->flags |= OVERLAY_LOADER_RGBA_SUPPORT; diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index 6a592f49a4..80f01834ab 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -219,6 +219,7 @@ bool task_push_manual_content_scan( bool task_push_overlay_load_default( retro_task_callback_t cb, const char *overlay_path, + bool is_osk, void *user_data); #endif