static int action_iterate_help(char *s, size_t len, const char *label) { unsigned i; static const unsigned binds[] = { RETRO_DEVICE_ID_JOYPAD_UP, RETRO_DEVICE_ID_JOYPAD_DOWN, RETRO_DEVICE_ID_JOYPAD_A, RETRO_DEVICE_ID_JOYPAD_B, RETRO_DEVICE_ID_JOYPAD_SELECT, RARCH_MENU_TOGGLE, RARCH_QUIT_KEY, RETRO_DEVICE_ID_JOYPAD_X, RETRO_DEVICE_ID_JOYPAD_Y, }; char desc[ARRAY_SIZE(binds)][64] = {{0}}; settings_t *settings = config_get_ptr(); menu_driver_render(); for (i = 0; i < ARRAY_SIZE(binds); i++) { const struct retro_keybind *keybind = (const struct retro_keybind*) &settings->input.binds[0][binds[i]]; const struct retro_keybind *auto_bind = (const struct retro_keybind*) input_get_auto_bind(0, binds[i]); input_get_bind_string(desc[i], keybind, auto_bind, sizeof(desc[i])); } snprintf(s, len, "Welcome to RetroArch\n" " \n" /* strtok_r doesn't split empty strings. */ "Basic Menu controls:\n" " Scroll (Up): %-20s\n" " Scroll (Down): %-20s\n" " Accept/OK: %-20s\n" " Back: %-20s\n" " Info: %-20s\n" "Enter/Exit Menu: %-20s\n" " Exit RetroArch: %-20s\n" "Toggle Keyboard: %-20s\n" " \n" "To run content:\n" "Load a libretro core (Core).\n" "Load a content file (Load Content). \n" " \n" "See Path Settings to set directories \n" "for faster access to files.\n" " \n" "Press Accept/OK to continue.", desc[0], desc[1], desc[2], desc[3], desc[4], desc[5], desc[6], desc[7]); return 0; }
static void menu_action_setting_disp_set_label_input_desc( 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) { char descriptor[PATH_MAX_LENGTH]; const struct retro_keybind *auto_bind = NULL; const struct retro_keybind *keybind = NULL; settings_t *settings = config_get_ptr(); unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN; unsigned inp_desc_user = inp_desc_index_offset / (RARCH_FIRST_CUSTOM_BIND + 4); unsigned inp_desc_button_index_offset = inp_desc_index_offset - (inp_desc_user * (RARCH_FIRST_CUSTOM_BIND + 4)); unsigned remap_id = 0; if (!settings) return; remap_id = settings->input.remap_ids [inp_desc_user][inp_desc_button_index_offset]; keybind = (const struct retro_keybind*) &settings->input.binds[inp_desc_user][remap_id]; auto_bind = (const struct retro_keybind*) input_get_auto_bind(inp_desc_user, remap_id); input_config_get_bind_string(descriptor, keybind, auto_bind, sizeof(descriptor)); if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND) { if(strstr(descriptor,"Auto") && !strstr(descriptor,"(N/A)")) strlcpy(s, descriptor, len); else strlcpy(s, settings->input.binds[inp_desc_user][remap_id].desc, len); } else strlcpy(s, axis_labels[remap_id], len); *w = 19; strlcpy(s2, path, len2); }
static int action_iterate_help(char *s, size_t len, const char *label) { unsigned i; menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); switch (menu->help_screen_type) { case MENU_HELP_WELCOME: { static int64_t timeout_end; int64_t timeout; static bool timer_begin = false; static bool timer_end = false; int64_t current = retro_get_time_usec(); if (!timer_begin) { timeout_end = retro_get_time_usec() + 3 /* seconds */ * 1000000; timer_begin = true; timer_end = false; } timeout = (timeout_end - current) / 1000000; menu_hash_get_help(MENU_LABEL_WELCOME_TO_RETROARCH, s, len); if (!timer_end && timeout <= 0) { timer_end = true; timer_begin = false; timeout_end = 0; menu->help_screen_type = MENU_HELP_NONE; return 1; } } break; case MENU_HELP_CONTROLS: { char s2[PATH_MAX_LENGTH]; const unsigned binds[] = { RETRO_DEVICE_ID_JOYPAD_UP, RETRO_DEVICE_ID_JOYPAD_DOWN, RETRO_DEVICE_ID_JOYPAD_A, RETRO_DEVICE_ID_JOYPAD_B, RETRO_DEVICE_ID_JOYPAD_SELECT, RETRO_DEVICE_ID_JOYPAD_START, RARCH_MENU_TOGGLE, RARCH_QUIT_KEY, RETRO_DEVICE_ID_JOYPAD_X, RETRO_DEVICE_ID_JOYPAD_Y, }; char desc[ARRAY_SIZE(binds)][64] = {{0}}; for (i = 0; i < ARRAY_SIZE(binds); i++) { const struct retro_keybind *keybind = (const struct retro_keybind*) &settings->input.binds[0][binds[i]]; const struct retro_keybind *auto_bind = (const struct retro_keybind*) input_get_auto_bind(0, binds[i]); input_get_bind_string(desc[i], keybind, auto_bind, sizeof(desc[i])); } menu_hash_get_help(MENU_LABEL_VALUE_MENU_CONTROLS_PROLOG, s2, sizeof(s2)); snprintf(s, len, "%s" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n", s2, menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP), desc[0], menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN), desc[1], menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM), desc[2], menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK), desc[3], menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO), desc[4], menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_START), desc[5], menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU), desc[6], menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT), desc[7], menu_hash_to_str(MENU_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD), desc[8] ); } break; case MENU_HELP_WHAT_IS_A_CORE: menu_hash_get_help(MENU_LABEL_VALUE_WHAT_IS_A_CORE_DESC, s, len); break; case MENU_HELP_LOADING_CONTENT: menu_hash_get_help(MENU_LABEL_LOAD_CONTENT, s, len); break; case MENU_HELP_CHANGE_VIRTUAL_GAMEPAD: menu_hash_get_help(MENU_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC, s, len); break; case MENU_HELP_AUDIO_VIDEO_TROUBLESHOOTING: menu_hash_get_help(MENU_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC, s, len); break; case MENU_HELP_SCANNING_CONTENT: menu_hash_get_help(MENU_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC, s, len); break; case MENU_HELP_EXTRACT: menu_hash_get_help(MENU_LABEL_VALUE_EXTRACTING_PLEASE_WAIT, s, len); break; case MENU_HELP_NONE: default: break; } return 0; }
static int action_iterate_help(const char *label, unsigned action) { unsigned i; static const unsigned binds[] = { RETRO_DEVICE_ID_JOYPAD_UP, RETRO_DEVICE_ID_JOYPAD_DOWN, RETRO_DEVICE_ID_JOYPAD_A, RETRO_DEVICE_ID_JOYPAD_B, RETRO_DEVICE_ID_JOYPAD_SELECT, RARCH_MENU_TOGGLE, RARCH_QUIT_KEY, RETRO_DEVICE_ID_JOYPAD_X, }; char desc[ARRAY_SIZE(binds)][64]; char msg[PATH_MAX_LENGTH]; menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr(); if (!menu) return 0; menu_driver_render(); for (i = 0; i < ARRAY_SIZE(binds); i++) { const struct retro_keybind *keybind = (const struct retro_keybind*) &settings->input.binds[0][binds[i]]; const struct retro_keybind *auto_bind = (const struct retro_keybind*) input_get_auto_bind(0, binds[i]); input_get_bind_string(desc[i], keybind, auto_bind, sizeof(desc[i])); } snprintf(msg, sizeof(msg), "-- Welcome to RetroArch --\n" " \n" // strtok_r doesn't split empty strings. "Basic Menu controls:\n" " Scroll (Up): %-20s\n" " Scroll (Down): %-20s\n" " Accept/OK: %-20s\n" " Back: %-20s\n" " Info: %-20s\n" "Enter/Exit Menu: %-20s\n" " Exit RetroArch: %-20s\n" "Toggle Keyboard: %-20s\n" " \n" "To run content:\n" "Load a libretro core (Core).\n" "Load a content file (Load Content). \n" " \n" "See Path Settings to set directories for faster access to files.\n" " \n" "Press Accept/OK to continue.", desc[0], desc[1], desc[2], desc[3], desc[4], desc[5], desc[6], desc[7]); menu_driver_render_messagebox(msg); if (action == MENU_ACTION_OK) menu_list_pop(menu->menu_list->menu_stack, NULL); return 0; }
int menu_popup_iterate(char *s, size_t len, const char *label) { #ifdef HAVE_CHEEVOS cheevos_ctx_desc_t desc_info; #endif bool do_exit = false; settings_t *settings = config_get_ptr(); switch (menu_popup_current_type) { case MENU_POPUP_WELCOME: { static int64_t timeout_end; int64_t timeout; static bool timer_begin = false; static bool timer_end = false; int64_t current = cpu_features_get_time_usec(); if (!timer_begin) { timeout_end = cpu_features_get_time_usec() + 3 /* seconds */ * 1000000; timer_begin = true; timer_end = false; } timeout = (timeout_end - current) / 1000000; menu_hash_get_help_enum( MENU_ENUM_LABEL_WELCOME_TO_RETROARCH, s, len); if (!timer_end && timeout <= 0) { timer_end = true; timer_begin = false; timeout_end = 0; do_exit = true; } } break; case MENU_POPUP_HELP_CONTROLS: { unsigned i; char s2[PATH_MAX_LENGTH] = {0}; const unsigned binds[] = { RETRO_DEVICE_ID_JOYPAD_UP, RETRO_DEVICE_ID_JOYPAD_DOWN, RETRO_DEVICE_ID_JOYPAD_A, RETRO_DEVICE_ID_JOYPAD_B, RETRO_DEVICE_ID_JOYPAD_SELECT, RETRO_DEVICE_ID_JOYPAD_START, RARCH_MENU_TOGGLE, RARCH_QUIT_KEY, RETRO_DEVICE_ID_JOYPAD_X, RETRO_DEVICE_ID_JOYPAD_Y, }; char desc[ARRAY_SIZE(binds)][64] = {{0}}; for (i = 0; i < ARRAY_SIZE(binds); i++) { const struct retro_keybind *keybind = (const struct retro_keybind*) &settings->input.binds[0][binds[i]]; const struct retro_keybind *auto_bind = (const struct retro_keybind*) input_get_auto_bind(0, binds[i]); input_config_get_bind_string(desc[i], keybind, auto_bind, sizeof(desc[i])); } menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_MENU_ENUM_CONTROLS_PROLOG, s2, sizeof(s2)); snprintf(s, len, "%s" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n" "[%s]: " "%-20s\n", s2, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_UP), desc[0], msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_SCROLL_DOWN), desc[1], msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_CONFIRM), desc[2], msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_BACK), desc[3], msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_INFO), desc[4], msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_START), desc[5], msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_MENU), desc[6], msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_QUIT), desc[7], msg_hash_to_str( MENU_ENUM_LABEL_VALUE_BASIC_MENU_CONTROLS_TOGGLE_KEYBOARD), desc[8] ); } break; #ifdef HAVE_CHEEVOS case MENU_POPUP_HELP_CHEEVOS_DESCRIPTION: desc_info.idx = menu_popup_current_id; desc_info.s = s; desc_info.len = len; cheevos_get_description(&desc_info); break; #endif case MENU_POPUP_HELP_WHAT_IS_A_CORE: menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_WHAT_IS_A_CORE_DESC, s, len); break; case MENU_POPUP_HELP_LOADING_CONTENT: menu_hash_get_help_enum(MENU_ENUM_LABEL_LOAD_CONTENT_LIST, s, len); break; case MENU_POPUP_HELP_CHANGE_VIRTUAL_GAMEPAD: menu_hash_get_help_enum( MENU_ENUM_LABEL_VALUE_HELP_CHANGE_VIRTUAL_GAMEPAD_DESC, s, len); break; case MENU_POPUP_HELP_AUDIO_VIDEO_TROUBLESHOOTING: menu_hash_get_help_enum( MENU_ENUM_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC, s, len); break; case MENU_POPUP_HELP_SCANNING_CONTENT: menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC, s, len); break; case MENU_POPUP_HELP_EXTRACT: menu_hash_get_help_enum(MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT, s, len); if (settings->bundle_finished) { settings->bundle_finished = false; do_exit = true; } break; case MENU_POPUP_QUIT_CONFIRM: case MENU_POPUP_INFORMATION: case MENU_POPUP_QUESTION: case MENU_POPUP_WARNING: case MENU_POPUP_ERROR: menu_hash_get_help_enum(menu_popup_current_msg, s, len); break; case MENU_POPUP_NONE: default: break; } if (do_exit) { menu_popup_current_type = MENU_POPUP_NONE; return 1; } return 0; }
static int menu_start_screen_iterate(unsigned action) { unsigned i; char msg[1024]; if (!driver.menu) return 0; if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render) driver.menu_ctx->render(); static const unsigned binds[] = { RETRO_DEVICE_ID_JOYPAD_UP, RETRO_DEVICE_ID_JOYPAD_DOWN, RETRO_DEVICE_ID_JOYPAD_A, RETRO_DEVICE_ID_JOYPAD_B, RETRO_DEVICE_ID_JOYPAD_SELECT, RARCH_MENU_TOGGLE, RARCH_QUIT_KEY, }; char desc[ARRAY_SIZE(binds)][64]; for (i = 0; i < ARRAY_SIZE(binds); i++) { const struct retro_keybind *bind = (const struct retro_keybind*) &g_settings.input.binds[0][binds[i]]; const struct retro_keybind *auto_bind = (const struct retro_keybind*) input_get_auto_bind(0, binds[i]); input_get_bind_string(desc[i], bind, auto_bind, sizeof(desc[i])); } snprintf(msg, sizeof(msg), "-- Welcome to RetroArch --\n" " \n" // strtok_r doesn't split empty strings. "Basic Menu controls:\n" " Scroll (Up): %-20s\n" " Scroll (Down): %-20s\n" " Accept/OK: %-20s\n" " Back: %-20s\n" " Info: %-20s\n" "Enter/Exit Menu: %-20s\n" " Exit RetroArch: %-20s\n" " \n" "To run content:\n" "Load a libretro core (Core).\n" "Load a content file (Load Content). \n" " \n" "See Path Options to set directories\n" "for faster access to files.\n" " \n" "Press Accept/OK to continue.", desc[0], desc[1], desc[2], desc[3], desc[4], desc[5], desc[6]); if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render_messagebox) driver.menu_ctx->render_messagebox(msg); if (action == MENU_ACTION_OK) menu_entries_pop(driver.menu->menu_stack); return 0; }