Fix game list update for auto-detection VFS games folder (#17051)
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run

This commit is contained in:
Antonino Di Guardo 2025-04-17 12:14:54 +02:00 committed by GitHub
parent 8b2b74c34b
commit b8d1d7cdf1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 16 deletions

View file

@ -4139,6 +4139,31 @@ game_boot_result Emulator::AddGameToYml(const std::string& path)
return game_boot_result::invalid_file_or_folder;
}
u32 Emulator::RemoveGamesFromDir(const std::string& games_dir, const std::vector<std::string>& serials_to_remove_from_yml, bool save_on_disk)
{
// List of serials (title id) to remove in "games.yml" file (if any)
std::vector<std::string> serials_to_remove = serials_to_remove_from_yml; // Initialize the list with the specified serials (if any)
if (!games_dir.empty()) // Skip an empty folder, otherwise we'll remove all games (which is not the intention)
{
// Scan game list to detect the titles belonging to auto-detection "games_dir" folder
for (const auto& [serial, path] : Emu.GetGamesConfig().get_games()) // Loop on game list file
{
// NOTE: Used starts_with(games_dir) instead of Emu.IsPathInsideDir(path, games_dir) due the latter would check
// also the existence of the paths
//
if (path.starts_with(games_dir)) // If game path belongs to auto-detection "games_dir" folder, add the serial to the removal list
{
serials_to_remove.push_back(serial);
}
}
}
// Remove the specified and detected serials (title id) belonging to "games_dir" from the game list in memory
// or also in "games.yml" file according to the value of "save_on_disk"
return RemoveGames(serials_to_remove, save_on_disk);
}
u32 Emulator::RemoveGames(const std::vector<std::string>& title_id_list, bool save_on_disk)
{
if (title_id_list.empty())