static int menu_input_key_bind_set_mode_common( enum menu_input_binds_ctl_state state, rarch_setting_t *setting) { unsigned bind_type = 0; menu_displaylist_info_t info = {0}; struct retro_keybind *keybind = NULL; unsigned index_offset = setting->index_offset; file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); size_t selection = menu_navigation_get_selection(); switch (state) { case MENU_INPUT_BINDS_CTL_BIND_SINGLE: keybind = (struct retro_keybind*)setting_get_ptr(setting); if (!keybind) return -1; bind_type = setting_get_bind_type(setting); menu_input_binds.begin = bind_type; menu_input_binds.last = bind_type; menu_input_binds.target = keybind; menu_input_binds.user = index_offset; info.list = menu_stack; info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD; info.directory_ptr = selection; info.enum_idx = MENU_ENUM_LABEL_CUSTOM_BIND; strlcpy(info.label, msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND), sizeof(info.label)); if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info)) menu_displaylist_process(&info); break; case MENU_INPUT_BINDS_CTL_BIND_ALL: menu_input_binds.target = &input_config_binds[index_offset][0]; menu_input_binds.begin = MENU_SETTINGS_BIND_BEGIN; menu_input_binds.last = MENU_SETTINGS_BIND_LAST; info.list = menu_stack; info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD; info.directory_ptr = selection; info.enum_idx = MENU_ENUM_LABEL_CUSTOM_BIND_ALL; strlcpy(info.label, msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND_ALL), sizeof(info.label)); if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info)) menu_displaylist_process(&info); break; default: case MENU_INPUT_BINDS_CTL_BIND_NONE: break; } return 0; }
void menu_entry_bind_joyaxis_set(uint32_t i, int32_t value) { rarch_setting_t *setting = menu_entries_get_setting(i); struct retro_keybind *keybind = (struct retro_keybind*) setting_get_ptr(setting); if (keybind) keybind->joyaxis = value; }
uint32_t menu_entry_get_bool_value(uint32_t i) { rarch_setting_t *setting = menu_entries_get_setting(i); bool *ptr = (bool*)setting_get_ptr(setting); if (!ptr) return 0; return *ptr; }
void menu_input_st_hex_callback(void *userdata, const char *str) { if (str && *str) { rarch_setting_t *setting = NULL; const char *label = NULL; menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL_SETTING, &label); setting = menu_setting_find(label); if (setting) { unsigned *ptr = (unsigned*)setting_get_ptr(setting); if (str[0] == '#') str++; *ptr = strtoul(str, NULL, 16); } } menu_input_key_end_line(); }
static int menu_input_key_bind_set_mode_common(rarch_setting_t *setting, enum menu_input_bind_mode type) { size_t selection; unsigned index_offset, bind_type; menu_displaylist_info_t info = {0}; struct retro_keybind *keybind = NULL; file_list_t *menu_stack = NULL; settings_t *settings = config_get_ptr(); menu_input_t *menu_input = menu_input_get_ptr(); if (!setting) return -1; index_offset = menu_setting_get_index_offset(setting); menu_stack = menu_entries_get_menu_stack_ptr(0); menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); switch (type) { case MENU_INPUT_BIND_NONE: return -1; case MENU_INPUT_BIND_SINGLE: keybind = (struct retro_keybind*)setting_get_ptr(setting); if (!keybind) return -1; bind_type = menu_setting_get_bind_type(setting); menu_input->binds.begin = bind_type; menu_input->binds.last = bind_type; menu_input->binds.target = keybind; menu_input->binds.user = index_offset; info.list = menu_stack; info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD; info.directory_ptr = selection; strlcpy(info.label, menu_hash_to_str(MENU_LABEL_CUSTOM_BIND), sizeof(info.label)); if (menu_displaylist_push_list(&info, DISPLAYLIST_INFO) == 0) menu_displaylist_push_list_process(&info); break; case MENU_INPUT_BIND_ALL: menu_input->binds.target = &settings->input.binds [index_offset][0]; menu_input->binds.begin = MENU_SETTINGS_BIND_BEGIN; menu_input->binds.last = MENU_SETTINGS_BIND_LAST; info.list = menu_stack; info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD; info.directory_ptr = selection; strlcpy(info.label, menu_hash_to_str(MENU_LABEL_CUSTOM_BIND_ALL), sizeof(info.label)); if (menu_displaylist_push_list(&info, DISPLAYLIST_INFO) == 0) menu_displaylist_push_list_process(&info); break; } return 0; }