Skip to content

Commit

Permalink
Game list: improve deduplication logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekotekina committed Feb 8, 2018
1 parent b103039 commit c339318
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rpcs3/rpcs3qt/game_list_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,10 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
path_list.back().resize(path_list.back().find_last_not_of('/') + 1);
}

// std::set is used to remove duplicates from the list
for (const auto& dir : std::set<std::string>(std::make_move_iterator(path_list.begin()), std::make_move_iterator(path_list.end()))) { try
// Used to remove duplications from the list (serial -> set of cats)
std::map<std::string, std::set<std::string>> serial_cat;

for (const auto& dir : path_list) { try
{
const std::string sfb = dir + "/PS3_DISC.SFB";
const std::string sfo = dir + (fs::is_file(sfb) ? "/PS3_GAME/PARAM.SFO" : "/PARAM.SFO");
Expand All @@ -448,6 +450,12 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
game.resolution = psf::get_integer(psf, "RESOLUTION");
game.sound_format = psf::get_integer(psf, "SOUND_FORMAT");

// Detect duplication
if (!serial_cat[game.serial].emplace(game.category).second)
{
continue;
}

bool bootable = false;
auto cat = category::cat_boot.find(game.category);
if (cat != category::cat_boot.end())
Expand Down

0 comments on commit c339318

Please sign in to comment.