(iOS) Add Small Keyboard/iCade Enable options

This commit is contained in:
twinaphex 2015-11-12 06:28:05 +01:00
parent 08a343fbd0
commit 6ea11afe28
7 changed files with 69 additions and 7 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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);

View File

@ -4931,6 +4931,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,

View File

@ -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);
}