From 4312c11d312bad99759d1ef44376a0d00a793d93 Mon Sep 17 00:00:00 2001 From: markwkidd Date: Sun, 18 Mar 2018 16:34:57 -0400 Subject: [PATCH] demonstration of core association reset fix .cfg: tweak --- command.c | 38 ++++++++++++++++++++++----- command.h | 9 +++++-- intl/msg_hash_us.h | 2 ++ menu/cbs/menu_cbs_ok.c | 59 ++++++++++++++++++++++++++++++++++++------ msg_hash.h | 2 ++ retroarch.cfg | 2 +- 6 files changed, 95 insertions(+), 17 deletions(-) diff --git a/command.c b/command.c index ae286eab21..8f55ebc915 100644 --- a/command.c +++ b/command.c @@ -1702,9 +1702,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; @@ -1721,12 +1724,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); } @@ -2328,7 +2331,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_us.h b/intl/msg_hash_us.h index 82f554fb25..9b61d1bbd6 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2009,6 +2009,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 e73fbad759..e6c62716b8 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1439,10 +1439,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)); @@ -1512,9 +1515,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)); @@ -1611,9 +1618,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; @@ -1758,9 +1769,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(); } @@ -2157,9 +2172,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); @@ -2832,6 +2854,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) { @@ -2854,13 +2896,14 @@ static int action_ok_add_to_favorites_playlist(const char *path, playlist_get_index(tmp_playlist, rpl_entry_selection_ptr, &tmp_path, NULL, NULL, NULL, NULL, NULL); - +/* if (!command_event(CMD_EVENT_ADD_TO_FAVORITES, (void*)tmp_path)) return menu_cbs_exit(); return 0; +*/ + return action_ok_reset_core_association(path, label, type, idx, entry_idx); } - static int action_ok_delete_entry(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { diff --git a/msg_hash.h b/msg_hash.h index c625f33b05..92319d874d 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, diff --git a/retroarch.cfg b/retroarch.cfg index f4639e8031..ac5b61e040 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -845,4 +845,4 @@ video_message_bgcolor_opacity = 1.0 # Enable stdin/network command interface. # network_cmd_enable = false # network_cmd_port = 55355 -# stdin_cmd_enable = false +# stdin_cmd_enable = false \ No newline at end of file