diff --git a/command.c b/command.c index dc9ffb3013..e927a745c4 100644 --- a/command.c +++ b/command.c @@ -1700,9 +1700,12 @@ void command_playlist_push_write( void command_playlist_update_write( void *data, size_t idx, - const char *core_display_name, + const char *path, const char *label, - const char *path) + const char *core_path, + const char *core_display_name, + const char *crc32, + const char *db_name) { playlist_t *plist = (playlist_t*)data; playlist_t *playlist = NULL; @@ -1719,12 +1722,12 @@ void command_playlist_update_write( playlist_update( playlist, idx, - label, - NULL, path, + label, + core_path, core_display_name, - NULL, - NULL); + crc32, + db_name); playlist_write_file(playlist); } @@ -2326,7 +2329,30 @@ TODO: Add a setting for these tweaks */ ); runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true); break; + } + case CMD_EVENT_RESET_CORE_ASSOCIATION: + { + const char *core_name = NULL; + const char *core_path = NULL; + + core_name = "DETECT"; + core_path = "DETECT"; + + command_playlist_update_write( + NULL, + (size_t)data, + NULL, + NULL, + core_path, + core_name, + NULL, + NULL); + + runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true); + break; + + } case CMD_EVENT_RESTART_RETROARCH: if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART)) return false; diff --git a/command.h b/command.h index 86efe07bb0..9cc3e3ce17 100644 --- a/command.h +++ b/command.h @@ -138,6 +138,8 @@ enum event_command CMD_EVENT_RESUME, /* Add a playlist entry to favorites. */ CMD_EVENT_ADD_TO_FAVORITES, + /* Reset playlist entry associated core to DETECT */ + CMD_EVENT_RESET_CORE_ASSOCIATION, /* Toggles pause. */ CMD_EVENT_PAUSE_TOGGLE, /* Pauses RetroArch. */ @@ -269,9 +271,12 @@ void command_playlist_push_write( void command_playlist_update_write( void *data, size_t idx, - const char *core_display_name, + const char *path, const char *label, - const char *path); + const char *core_path, + const char *core_display_name, + const char *crc32, + const char *db_name); RETRO_END_DECLS diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 7291354735..2a74959f30 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -923,6 +923,8 @@ MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES, "favorites_add") MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, "favorites_add_playlist") +MSG_HASH(MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION, + "reset_core_association") MSG_HASH(MENU_ENUM_LABEL_RUN, "collection") MSG_HASH(MENU_ENUM_LABEL_RUN_MUSIC, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 7e8004a807..d941805d66 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1373,6 +1373,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES, "Add to Favorites") MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, "Add to Favorites") +MSG_HASH(MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION, + "Reset Core Association") MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN, "Run") MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC, @@ -2009,6 +2011,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HELP_LIST, "Learn more about how the program works.") MSG_HASH(MSG_ADDED_TO_FAVORITES, "Added to favorites") +MSG_HASH(MSG_RESET_CORE_ASSOCIATION, + "Playlist entry core association has been reset.") MSG_HASH(MSG_APPENDED_DISK, "Appended disk") MSG_HASH(MSG_APPLICATION_DIR, diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index b08b9832eb..57c2ba0e10 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1445,10 +1445,13 @@ static int action_ok_playlist_entry_collection(const char *path, command_playlist_update_write(tmp_playlist, selection_ptr, + NULL, + NULL, + new_core_path, core_info.inf->display_name, NULL, - new_core_path); - } + NULL); + } else strlcpy(new_core_path, core_path, sizeof(new_core_path)); @@ -1518,9 +1521,13 @@ static int action_ok_playlist_entry(const char *path, command_playlist_update_write(NULL, selection_ptr, + NULL, + NULL, + new_core_path, core_info.inf->display_name, NULL, - new_core_path); + NULL); + } else if (!string_is_empty(core_path)) strlcpy(new_core_path, core_path, sizeof(new_core_path)); @@ -1617,9 +1624,13 @@ static int action_ok_playlist_entry_start_content(const char *path, command_playlist_update_write( tmp_playlist, selection_ptr, + NULL, + NULL, + new_core_path, core_info.inf->display_name, NULL, - new_core_path); + NULL); + } playlist_info.data = playlist; @@ -1764,9 +1775,13 @@ static void menu_input_st_string_cb_rename_entry(void *userdata, menu_input_dialog_get_kb_idx(), NULL, label, + NULL, + NULL, + NULL, NULL); } + menu_input_dialog_end(); } @@ -2163,9 +2178,16 @@ static int action_ok_core_deferred_set(const char *path, core_display_name[0] = '\0'; core_info_get_name(path, core_display_name, sizeof(core_display_name)); - command_playlist_update_write(NULL, + command_playlist_update_write( + NULL, rdb_entry_start_game_selection_ptr, - core_display_name, NULL, path); + path, + label, + NULL, + core_display_name, + NULL, + NULL); + menu_entries_pop_stack(&selection, 0, 1); menu_navigation_set_selection(selection); @@ -2838,6 +2860,26 @@ default_action_ok_cmd_func(action_ok_screenshot, CMD_EVENT_TAKE_SCREENSH default_action_ok_cmd_func(action_ok_disk_cycle_tray_status, CMD_EVENT_DISK_EJECT_TOGGLE ) default_action_ok_cmd_func(action_ok_shader_apply_changes, CMD_EVENT_SHADERS_APPLY_CHANGES ) + +static int action_ok_reset_core_association(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + const char *tmp_path = NULL; + playlist_t *tmp_playlist = NULL; + + menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist); + + if (!tmp_playlist) + return 0; + + playlist_get_index(tmp_playlist, + rpl_entry_selection_ptr, &tmp_path, NULL, NULL, NULL, NULL, NULL); + + if (!command_event(CMD_EVENT_RESET_CORE_ASSOCIATION, (void *)rpl_entry_selection_ptr)) + return menu_cbs_exit(); + return 0; +} + static int action_ok_add_to_favorites(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -2864,8 +2906,8 @@ static int action_ok_add_to_favorites_playlist(const char *path, if (!command_event(CMD_EVENT_ADD_TO_FAVORITES, (void*)tmp_path)) return menu_cbs_exit(); return 0; -} +} static int action_ok_delete_entry(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) @@ -3928,6 +3970,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST: BIND_ACTION_OK(cbs, action_ok_add_to_favorites_playlist); break; + case MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION: + BIND_ACTION_OK(cbs, action_ok_reset_core_association); + break; case MENU_ENUM_LABEL_ADD_TO_FAVORITES: BIND_ACTION_OK(cbs, action_ok_add_to_favorites); break; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index f72308b627..c265dc7b0a 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2186,6 +2186,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, case MENU_ENUM_LABEL_ADD_TO_FAVORITES: case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST: return xmb->textures.list[XMB_TEXTURE_ADD_FAVORITE]; + case MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION: + return xmb->textures.list[XMB_TEXTURE_RENAME]; case MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS: return xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS]; case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 66f3756e96..28577f4a1a 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2812,6 +2812,15 @@ static int menu_displaylist_parse_horizontal_content_actions( msg_hash_to_str(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST), MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); } + + if (settings->bools.quick_menu_show_add_to_favorites) + { + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION), + msg_hash_to_str(MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION), + MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); + } + } if (!string_is_empty(db_name) && (!content_loaded || diff --git a/msg_hash.h b/msg_hash.h index c625f33b05..964168f811 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -183,6 +183,8 @@ enum msg_hash_enums MSG_NETPLAY_PEER_PAUSED, MSG_NETPLAY_CHANGED_NICK, MSG_ADDED_TO_FAVORITES, + MSG_RESET_CORE_ASSOCIATION, + MSG_CORE_ASSOCIATION_RESET, MSG_AUTODETECT, MSG_AUDIO_VOLUME, MSG_AUDIO_MIXER_VOLUME, @@ -829,6 +831,7 @@ enum msg_hash_enums MENU_LABEL(GOTO_VIDEO), MENU_LABEL(ADD_TO_FAVORITES), MENU_LABEL(ADD_TO_FAVORITES_PLAYLIST), + MENU_LABEL(RESET_CORE_ASSOCIATION), MENU_LABEL(MENU_THROTTLE_FRAMERATE), MENU_LABEL(NO_ACHIEVEMENTS_TO_DISPLAY), MENU_LABEL(NO_ENTRIES_TO_DISPLAY),