diff --git a/configuration.c b/configuration.c index 1a0c50dbd8..327a1f1a3d 100644 --- a/configuration.c +++ b/configuration.c @@ -460,6 +460,10 @@ static void config_set_defaults(void) settings->history_list_enable = def_history_list_enable; settings->load_dummy_on_core_shutdown = load_dummy_on_core_shutdown; +#if TARGET_OS_IPHONE + settings->input.icade_enable = true; + settings->input.small_keyboard_enable = false; +#endif #ifdef HAVE_FFMPEG settings->multimedia.builtin_mediaplayer_enable = true; #else @@ -1571,6 +1575,11 @@ static bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_BOOL_BASE(conf, global, perfcnt_enable, "perfcnt_enable"); +#if TARGET_OS_IPHONE + CONFIG_GET_BOOL_BASE(conf, settings, input.small_keyboard_enable, "small_keyboard_enable"); + CONFIG_GET_BOOL_BASE(conf, settings, input.icade_enable, "icade_enable"); +#endif + config_get_path(conf, "recording_output_directory", global->record.output_dir, sizeof(global->record.output_dir)); config_get_path(conf, "recording_config_directory", global->record.config_dir, @@ -2780,6 +2789,11 @@ bool config_save_file(const char *path) config_set_bool(conf, "log_verbosity", global->verbosity); config_set_bool(conf, "perfcnt_enable", global->perfcnt_enable); +#if TARGET_OS_IPHONE + config_set_bool(conf, "small_keyboard_enable", settings->input.small_keyboard_enable); + config_set_bool(conf, "icade_enable", settings->input.icade_enable); +#endif + config_set_bool(conf, "core_set_supports_no_game_enable", settings->core.set_supports_no_game_enable); diff --git a/configuration.h b/configuration.h index a1026560ce..40946f11ac 100644 --- a/configuration.h +++ b/configuration.h @@ -250,6 +250,11 @@ typedef struct settings unsigned menu_toggle_gamepad_combo; bool back_as_menu_toggle_enable; + +#if TARGET_OS_IPHONE + bool icade_enable; + bool small_keyboard_enable; +#endif } input; struct diff --git a/input/drivers_keyboard/keyboard_event_apple.c b/input/drivers_keyboard/keyboard_event_apple.c index 1f4d28e4d3..e75545d7ed 100644 --- a/input/drivers_keyboard/keyboard_event_apple.c +++ b/input/drivers_keyboard/keyboard_event_apple.c @@ -151,9 +151,11 @@ void cocoa_input_keyboard_event(bool down, #if TARGET_OS_IPHONE if (apple->icade_enabled) + { handle_icade_event(code); - - if (apple->small_keyboard_enabled && + return; + } + else if (apple->small_keyboard_enabled && handle_small_keyboard(&code, down)) character = 0; #endif diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index 744fd063e5..f84aff0183 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -26,6 +26,10 @@ static const char *menu_hash_to_str_us_label(uint32_t hash) { switch (hash) { + case MENU_LABEL_INPUT_ICADE_ENABLE: + return "input_icade_enable"; + case MENU_LABEL_INPUT_SMALL_KEYBOARD_ENABLE: + return "input_small_keyboard_enable"; case MENU_LABEL_SAVE_CURRENT_CONFIG: return "save_current_config"; case MENU_LABEL_STATE_SLOT: @@ -690,6 +694,10 @@ const char *menu_hash_to_str_us(uint32_t hash) switch (hash) { + case MENU_LABEL_VALUE_INPUT_ICADE_ENABLE: + return "iCade Enable"; + case MENU_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE: + return "Small Keyboard Enable"; case MENU_LABEL_VALUE_SAVE_CURRENT_CONFIG: return "Save Current Config"; case MENU_LABEL_VALUE_STATE_SLOT: diff --git a/menu/menu_hash.h b/menu/menu_hash.h index 400b027eb2..ea27bd774a 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -1077,6 +1077,12 @@ extern "C" { #define MENU_LABEL_SAVE_CURRENT_CONFIG 0x8840ba8bU #define MENU_LABEL_VALUE_SAVE_CURRENT_CONFIG 0x9a1eb42dU +#define MENU_LABEL_INPUT_SMALL_KEYBOARD_ENABLE 0xe6736fc3U +#define MENU_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE 0xc5eefd76U + +#define MENU_LABEL_INPUT_ICADE_ENABLE 0xcd534dd0U +#define MENU_LABEL_VALUE_INPUT_ICADE_ENABLE 0x67b18ee2U + const char *menu_hash_to_str_de(uint32_t hash); int menu_hash_get_help_de(uint32_t hash, char *s, size_t len); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a4db56e43d..e3117c9668 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4929,6 +4929,34 @@ static bool setting_append_list_input_options( general_read_handler); menu_settings_list_current_add_range(list, list_info, 1, MAX_USERS, 1, true, true); +#if TARGET_OS_IPHONE + CONFIG_BOOL( + settings->input.icade_enable, + menu_hash_to_str(MENU_LABEL_INPUT_ICADE_ENABLE), + menu_hash_to_str(MENU_LABEL_VALUE_INPUT_ICADE_ENABLE), + true, + menu_hash_to_str(MENU_VALUE_OFF), + menu_hash_to_str(MENU_VALUE_ON), + group_info.name, + subgroup_info.name, + parent_group, + general_write_handler, + general_read_handler); + + CONFIG_BOOL( + settings->input.small_keyboard_enable, + menu_hash_to_str(MENU_LABEL_INPUT_SMALL_KEYBOARD_ENABLE), + menu_hash_to_str(MENU_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE), + false, + menu_hash_to_str(MENU_VALUE_OFF), + menu_hash_to_str(MENU_VALUE_ON), + group_info.name, + subgroup_info.name, + parent_group, + general_write_handler, + general_read_handler); +#endif + #ifdef ANDROID CONFIG_BOOL( settings->input.back_as_menu_toggle_enable, diff --git a/ui/drivers/ui_cocoatouch.m b/ui/drivers/ui_cocoatouch.m index 368db72df8..1fefa43c43 100644 --- a/ui/drivers/ui_cocoatouch.m +++ b/ui/drivers/ui_cocoatouch.m @@ -390,7 +390,8 @@ enum - (void)refreshSystemConfig { - bool small_keyboard, is_icade, is_btstack; + settings_t *settings = config_get_ptr(); + bool is_btstack; /* Get enabled orientations */ apple_frontend_settings.orientation_flags = UIInterfaceOrientationMaskAll; @@ -401,12 +402,10 @@ enum apple_frontend_settings.orientation_flags = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown; /* Set bluetooth mode */ - small_keyboard = !(strcmp(apple_frontend_settings.bluetooth_mode, "small_keyboard")); - is_icade = !(strcmp(apple_frontend_settings.bluetooth_mode, "icade")); is_btstack = !(strcmp(apple_frontend_settings.bluetooth_mode, "btstack")); - cocoa_input_enable_small_keyboard(small_keyboard); - cocoa_input_enable_icade(is_icade); + cocoa_input_enable_small_keyboard(settings->input.small_keyboard_enable); + cocoa_input_enable_icade(settings->input.icade_enable); btstack_set_poweron(is_btstack); }