Merge pull request #6423 from markwkidd/playlist-core-reset

"reset associated core" feature for playlists
This commit is contained in:
Twinaphex 2018-03-22 21:40:19 +01:00 committed by GitHub
commit 5c82ef3ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 111 additions and 15 deletions

View File

@ -1700,9 +1700,12 @@ void command_playlist_push_write(
void command_playlist_update_write( void command_playlist_update_write(
void *data, void *data,
size_t idx, size_t idx,
const char *core_display_name, const char *path,
const char *label, 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 *plist = (playlist_t*)data;
playlist_t *playlist = NULL; playlist_t *playlist = NULL;
@ -1719,12 +1722,12 @@ void command_playlist_update_write(
playlist_update( playlist_update(
playlist, playlist,
idx, idx,
label,
NULL,
path, path,
label,
core_path,
core_display_name, core_display_name,
NULL, crc32,
NULL); db_name);
playlist_write_file(playlist); 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); runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true);
break; 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: case CMD_EVENT_RESTART_RETROARCH:
if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART)) if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART))
return false; return false;

View File

@ -138,6 +138,8 @@ enum event_command
CMD_EVENT_RESUME, CMD_EVENT_RESUME,
/* Add a playlist entry to favorites. */ /* Add a playlist entry to favorites. */
CMD_EVENT_ADD_TO_FAVORITES, CMD_EVENT_ADD_TO_FAVORITES,
/* Reset playlist entry associated core to DETECT */
CMD_EVENT_RESET_CORE_ASSOCIATION,
/* Toggles pause. */ /* Toggles pause. */
CMD_EVENT_PAUSE_TOGGLE, CMD_EVENT_PAUSE_TOGGLE,
/* Pauses RetroArch. */ /* Pauses RetroArch. */
@ -269,9 +271,12 @@ void command_playlist_push_write(
void command_playlist_update_write( void command_playlist_update_write(
void *data, void *data,
size_t idx, size_t idx,
const char *core_display_name, const char *path,
const char *label, 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 RETRO_END_DECLS

View File

@ -923,6 +923,8 @@ MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES,
"favorites_add") "favorites_add")
MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, MSG_HASH(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST,
"favorites_add_playlist") "favorites_add_playlist")
MSG_HASH(MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION,
"reset_core_association")
MSG_HASH(MENU_ENUM_LABEL_RUN, MSG_HASH(MENU_ENUM_LABEL_RUN,
"collection") "collection")
MSG_HASH(MENU_ENUM_LABEL_RUN_MUSIC, MSG_HASH(MENU_ENUM_LABEL_RUN_MUSIC,

View File

@ -1373,6 +1373,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES,
"Add to Favorites") "Add to Favorites")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST, MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_FAVORITES_PLAYLIST,
"Add to Favorites") "Add to Favorites")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RESET_CORE_ASSOCIATION,
"Reset Core Association")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN, MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN,
"Run") "Run")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC, 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.") "Learn more about how the program works.")
MSG_HASH(MSG_ADDED_TO_FAVORITES, MSG_HASH(MSG_ADDED_TO_FAVORITES,
"Added to favorites") "Added to favorites")
MSG_HASH(MSG_RESET_CORE_ASSOCIATION,
"Playlist entry core association has been reset.")
MSG_HASH(MSG_APPENDED_DISK, MSG_HASH(MSG_APPENDED_DISK,
"Appended disk") "Appended disk")
MSG_HASH(MSG_APPLICATION_DIR, MSG_HASH(MSG_APPLICATION_DIR,

View File

@ -1445,10 +1445,13 @@ static int action_ok_playlist_entry_collection(const char *path,
command_playlist_update_write(tmp_playlist, command_playlist_update_write(tmp_playlist,
selection_ptr, selection_ptr,
NULL,
NULL,
new_core_path,
core_info.inf->display_name, core_info.inf->display_name,
NULL, NULL,
new_core_path); NULL);
} }
else else
strlcpy(new_core_path, core_path, sizeof(new_core_path)); 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, command_playlist_update_write(NULL,
selection_ptr, selection_ptr,
NULL,
NULL,
new_core_path,
core_info.inf->display_name, core_info.inf->display_name,
NULL, NULL,
new_core_path); NULL);
} }
else if (!string_is_empty(core_path)) else if (!string_is_empty(core_path))
strlcpy(new_core_path, core_path, sizeof(new_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( command_playlist_update_write(
tmp_playlist, tmp_playlist,
selection_ptr, selection_ptr,
NULL,
NULL,
new_core_path,
core_info.inf->display_name, core_info.inf->display_name,
NULL, NULL,
new_core_path); NULL);
} }
playlist_info.data = playlist; 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(), menu_input_dialog_get_kb_idx(),
NULL, NULL,
label, label,
NULL,
NULL,
NULL,
NULL); NULL);
} }
menu_input_dialog_end(); menu_input_dialog_end();
} }
@ -2163,9 +2178,16 @@ static int action_ok_core_deferred_set(const char *path,
core_display_name[0] = '\0'; core_display_name[0] = '\0';
core_info_get_name(path, core_display_name, sizeof(core_display_name)); 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, 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_entries_pop_stack(&selection, 0, 1);
menu_navigation_set_selection(selection); 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_disk_cycle_tray_status, CMD_EVENT_DISK_EJECT_TOGGLE )
default_action_ok_cmd_func(action_ok_shader_apply_changes, CMD_EVENT_SHADERS_APPLY_CHANGES ) 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, static int action_ok_add_to_favorites(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) 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)) if (!command_event(CMD_EVENT_ADD_TO_FAVORITES, (void*)tmp_path))
return menu_cbs_exit(); return menu_cbs_exit();
return 0; return 0;
}
}
static int action_ok_delete_entry(const char *path, static int action_ok_delete_entry(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) 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: case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST:
BIND_ACTION_OK(cbs, action_ok_add_to_favorites_playlist); BIND_ACTION_OK(cbs, action_ok_add_to_favorites_playlist);
break; 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: case MENU_ENUM_LABEL_ADD_TO_FAVORITES:
BIND_ACTION_OK(cbs, action_ok_add_to_favorites); BIND_ACTION_OK(cbs, action_ok_add_to_favorites);
break; break;

View File

@ -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:
case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST: case MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST:
return xmb->textures.list[XMB_TEXTURE_ADD_FAVORITE]; 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: case MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS:
return xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS]; return xmb->textures.list[XMB_TEXTURE_INPUT_REMAPPING_OPTIONS];
case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS: case MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS:

View File

@ -2812,6 +2812,15 @@ static int menu_displaylist_parse_horizontal_content_actions(
msg_hash_to_str(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST), msg_hash_to_str(MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST),
MENU_ENUM_LABEL_ADD_TO_FAVORITES_PLAYLIST, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); 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 || if (!string_is_empty(db_name) && (!content_loaded ||

View File

@ -183,6 +183,8 @@ enum msg_hash_enums
MSG_NETPLAY_PEER_PAUSED, MSG_NETPLAY_PEER_PAUSED,
MSG_NETPLAY_CHANGED_NICK, MSG_NETPLAY_CHANGED_NICK,
MSG_ADDED_TO_FAVORITES, MSG_ADDED_TO_FAVORITES,
MSG_RESET_CORE_ASSOCIATION,
MSG_CORE_ASSOCIATION_RESET,
MSG_AUTODETECT, MSG_AUTODETECT,
MSG_AUDIO_VOLUME, MSG_AUDIO_VOLUME,
MSG_AUDIO_MIXER_VOLUME, MSG_AUDIO_MIXER_VOLUME,
@ -829,6 +831,7 @@ enum msg_hash_enums
MENU_LABEL(GOTO_VIDEO), MENU_LABEL(GOTO_VIDEO),
MENU_LABEL(ADD_TO_FAVORITES), MENU_LABEL(ADD_TO_FAVORITES),
MENU_LABEL(ADD_TO_FAVORITES_PLAYLIST), MENU_LABEL(ADD_TO_FAVORITES_PLAYLIST),
MENU_LABEL(RESET_CORE_ASSOCIATION),
MENU_LABEL(MENU_THROTTLE_FRAMERATE), MENU_LABEL(MENU_THROTTLE_FRAMERATE),
MENU_LABEL(NO_ACHIEVEMENTS_TO_DISPLAY), MENU_LABEL(NO_ACHIEVEMENTS_TO_DISPLAY),
MENU_LABEL(NO_ENTRIES_TO_DISPLAY), MENU_LABEL(NO_ENTRIES_TO_DISPLAY),