diff --git a/configuration.c b/configuration.c index 327a1f1a3d..f466ef3b27 100644 --- a/configuration.c +++ b/configuration.c @@ -461,9 +461,10 @@ static void config_set_defaults(void) 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; + settings->input.small_keyboard_enable = false; #endif + settings->input.keyboard_gamepad_enable = true; + settings->input.keyboard_gamepad_mapping_type = 1; #ifdef HAVE_FFMPEG settings->multimedia.builtin_mediaplayer_enable = true; #else @@ -1576,9 +1577,10 @@ 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"); + CONFIG_GET_BOOL_BASE(conf, settings, input.small_keyboard_enable, "small_keyboard_enable"); #endif + CONFIG_GET_BOOL_BASE(conf, settings, input.keyboard_gamepad_enable, "keyboard_gamepad_enable"); + CONFIG_GET_INT_BASE(conf, settings, input.keyboard_gamepad_mapping_type, "keyboard_gamepad_mapping_type"); config_get_path(conf, "recording_output_directory", global->record.output_dir, sizeof(global->record.output_dir)); @@ -2790,9 +2792,10 @@ bool config_save_file(const char *path) 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); + config_set_bool(conf, "small_keyboard_enable", settings->input.small_keyboard_enable); #endif + config_set_bool(conf, "keyboard_gamepad_enable", settings->input.keyboard_gamepad_enable); + config_set_int(conf, "keyboard_gamepad_mapping_type", settings->input.keyboard_gamepad_mapping_type); 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 40946f11ac..25c824c1c4 100644 --- a/configuration.h +++ b/configuration.h @@ -252,9 +252,10 @@ typedef struct settings bool back_as_menu_toggle_enable; #if TARGET_OS_IPHONE - bool icade_enable; bool small_keyboard_enable; #endif + bool keyboard_gamepad_enable; + unsigned keyboard_gamepad_mapping_type; } input; struct diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 2288dcfc87..7c1cdd5826 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -605,6 +605,40 @@ static void menu_action_setting_disp_set_label_menu_disk_index( snprintf(s, len, "%u", current + 1); } +static void menu_action_setting_disp_set_label_menu_input_keyboard_gamepad_mapping_type( + file_list_t* list, + unsigned *w, unsigned type, unsigned i, + const char *label, + char *s, size_t len, + const char *entry_label, + const char *path, + char *s2, size_t len2) +{ + settings_t *settings = config_get_ptr(); + unsigned width = 0, height = 0; + + *w = 19; + *s = '\0'; + + (void)width; + (void)height; + + strlcpy(s2, path, len2); + + switch (settings->input.keyboard_gamepad_mapping_type) + { + case 0: + strlcpy(s, "None", len); + break; + case 1: + strlcpy(s, "iPega PG-9017", len); + break; + case 2: + strlcpy(s, "8-bitty", len); + break; + } +} + static void menu_action_setting_disp_set_label_menu_video_resolution( file_list_t* list, unsigned *w, unsigned type, unsigned i, @@ -1052,6 +1086,10 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_menu_video_resolution); break; + case MENU_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE: + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_menu_input_keyboard_gamepad_mapping_type); + break; case MENU_LABEL_CONTENT_COLLECTION_LIST: case MENU_LABEL_LOAD_CONTENT_HISTORY: case MENU_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST: diff --git a/menu/intl/menu_hash_us.c b/menu/intl/menu_hash_us.c index f84aff0183..aaa4fd6eca 100644 --- a/menu/intl/menu_hash_us.c +++ b/menu/intl/menu_hash_us.c @@ -28,6 +28,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash) { case MENU_LABEL_INPUT_ICADE_ENABLE: return "input_icade_enable"; + case MENU_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE: + return "keyboard_gamepad_mapping_type"; case MENU_LABEL_INPUT_SMALL_KEYBOARD_ENABLE: return "input_small_keyboard_enable"; case MENU_LABEL_SAVE_CURRENT_CONFIG: @@ -695,7 +697,9 @@ const char *menu_hash_to_str_us(uint32_t hash) switch (hash) { case MENU_LABEL_VALUE_INPUT_ICADE_ENABLE: - return "iCade Enable"; + return "Keyboard Gamepad Mapping Enable"; + case MENU_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE: + return "Keyboard Gamepad Mapping Type"; case MENU_LABEL_VALUE_INPUT_SMALL_KEYBOARD_ENABLE: return "Small Keyboard Enable"; case MENU_LABEL_VALUE_SAVE_CURRENT_CONFIG: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index ff4988689c..f3de686515 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2608,11 +2608,13 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) ret = menu_displaylist_parse_settings(menu, info, menu_hash_to_str(MENU_LABEL_INPUT_MAX_USERS), PARSE_ONLY_UINT, false); #if TARGET_OS_IPHONE - ret = menu_displaylist_parse_settings(menu, info, - menu_hash_to_str(MENU_LABEL_INPUT_ICADE_ENABLE), PARSE_ONLY_BOOL, false); ret = menu_displaylist_parse_settings(menu, info, menu_hash_to_str(MENU_LABEL_INPUT_SMALL_KEYBOARD_ENABLE), PARSE_ONLY_BOOL, false); #endif + ret = menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_INPUT_ICADE_ENABLE), PARSE_ONLY_BOOL, false); + ret = menu_displaylist_parse_settings(menu, info, + menu_hash_to_str(MENU_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE), PARSE_ONLY_UINT, false); #ifdef ANDROID ret = menu_displaylist_parse_settings(menu, info, menu_hash_to_str(MENU_LABEL_INPUT_BACK_AS_MENU_TOGGLE_ENABLE), PARSE_ONLY_BOOL, false); diff --git a/menu/menu_hash.h b/menu/menu_hash.h index ea27bd774a..eb32a6fc06 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -22,6 +22,9 @@ extern "C" { #endif +#define MENU_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE 0x507c52f3U +#define MENU_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE 0x3665cbb0U + #define MENU_LABEL_CHEEVOS_DESCRIPTION 0x7e00e0f5U #define MENU_LABEL_VALUE_CHEEVOS_DESCRIPTION 0xab3975d6U diff --git a/menu/menu_setting.c b/menu/menu_setting.c index e3117c9668..e0338ca1d3 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4929,12 +4929,11 @@ 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, + settings->input.keyboard_gamepad_enable, menu_hash_to_str(MENU_LABEL_INPUT_ICADE_ENABLE), menu_hash_to_str(MENU_LABEL_VALUE_INPUT_ICADE_ENABLE), - true, + false, menu_hash_to_str(MENU_VALUE_OFF), menu_hash_to_str(MENU_VALUE_ON), group_info.name, @@ -4943,6 +4942,19 @@ static bool setting_append_list_input_options( general_write_handler, general_read_handler); + CONFIG_UINT( + settings->input.keyboard_gamepad_mapping_type, + menu_hash_to_str(MENU_LABEL_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE), + menu_hash_to_str(MENU_LABEL_VALUE_INPUT_KEYBOARD_GAMEPAD_MAPPING_TYPE), + 1, + group_info.name, + subgroup_info.name, + parent_group, + general_write_handler, + general_read_handler); + menu_settings_list_current_add_range(list, list_info, 0, 2, 1, true, true); + +#if TARGET_OS_IPHONE CONFIG_BOOL( settings->input.small_keyboard_enable, menu_hash_to_str(MENU_LABEL_INPUT_SMALL_KEYBOARD_ENABLE),