From f7472d59aaade9d67eb5184c6b4408301095885b Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 12 Jul 2017 17:22:55 +0300 Subject: [PATCH] GUI: fix recent entry duplication --- rpcs3/Emu/System.h | 5 +++++ rpcs3/rpcs3qt/game_list_frame.cpp | 5 +++-- rpcs3/rpcs3qt/main_window.cpp | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 636c7cd3d3..33ae8f6057 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -210,6 +210,11 @@ public: return m_elf_path; } + const std::string& GetBoot() const + { + return m_path; + } + const std::string& GetTitleID() const { return m_title_id; diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 3494a96a45..c56fe2c829 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -376,6 +376,7 @@ void game_list_frame::Refresh(bool fromDrive) for (auto pair : YAML::Load(fs::file{fs::get_config_dir() + "/games.yml", fs::read + fs::create}.to_string())) { path_list.push_back(pair.second.Scalar()); + path_list.back().resize(path_list.back().find_last_not_of('/') + 1); } // std::set is used to remove duplicates from the list @@ -563,7 +564,7 @@ void game_list_frame::doubleClickedSlot(const QModelIndex& index) else { LOG_SUCCESS(LOADER, "Boot from gamelist per doubleclick: done"); - RequestAddRecentGame(q_string_pair(qstr(m_game_data[i].info.path), qstr("[" + m_game_data[i].info.serial + "] " + m_game_data[i].info.name))); + RequestAddRecentGame(q_string_pair(qstr(Emu.GetBoot()), qstr("[" + m_game_data[i].info.serial + "] " + m_game_data[i].info.name))); } } else @@ -696,7 +697,7 @@ void game_list_frame::Boot(int row) else { LOG_SUCCESS(LOADER, "Boot from gamelist per Boot: done"); - RequestAddRecentGame(q_string_pair(qstr(m_game_data[row].info.path), qstr("[" + m_game_data[row].info.serial + "] " + m_game_data[row].info.name))); + RequestAddRecentGame(q_string_pair(qstr(Emu.GetBoot()), qstr("[" + m_game_data[row].info.serial + "] " + m_game_data[row].info.name))); } } diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index eeb4cd6957..51f783199a 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -239,7 +239,7 @@ void main_window::BootElf() LOG_SUCCESS(LOADER, "(S)ELF: boot done."); const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] "; - AddRecentAction(q_string_pair(qstr(path), qstr(serial + Emu.GetTitle()))); + AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle()))); } } @@ -275,7 +275,7 @@ void main_window::BootGame() LOG_SUCCESS(LOADER, "Boot Game: boot done."); const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] "; - AddRecentAction(q_string_pair(qstr(path), qstr(serial + Emu.GetTitle()))); + AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle()))); } } @@ -790,7 +790,7 @@ void main_window::BootRecentAction(const QAction* act) else { LOG_SUCCESS(LOADER, "Boot from Recent List: done"); - AddRecentAction(q_string_pair(pth, nam)); + AddRecentAction(q_string_pair(qstr(Emu.GetBoot()), nam)); } };