[TESTERS NEEDED] Improved contextual menu (#16038)

This commit is contained in:
Antonino Di Guardo 2024-09-14 21:51:42 +02:00 committed by GitHub
parent 7f2534819e
commit d1648dd707
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 528 additions and 133 deletions

View file

@ -1757,7 +1757,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
// Booting disc game from wrong location
sys_log.error("Disc game %s found at invalid location /dev_hdd0/game/", m_title_id);
const std::string games_common = g_cfg_vfs.get(g_cfg_vfs.games_dir, rpcs3::utils::get_emu_dir());
const std::string games_common = rpcs3::utils::get_games_dir();
const std::string dst_dir = games_common + sfb_dir.substr(hdd0_game.size());
// Move and retry from correct location
@ -4082,6 +4082,56 @@ game_boot_result Emulator::AddGameToYml(const std::string& path)
return game_boot_result::invalid_file_or_folder;
}
u32 Emulator::RemoveGames(const std::vector<std::string>& title_id_list)
{
if (title_id_list.empty())
{
return 0;
}
u32 games_removed = 0;
m_games_config.set_save_on_dirty(false);
for (const std::string& title_id : title_id_list)
{
if (RemoveGameFromYml(title_id) == game_boot_result::no_errors)
{
games_removed++;
}
}
m_games_config.set_save_on_dirty(true);
if (m_games_config.is_dirty() && !m_games_config.save())
{
sys_log.error("Failed to save games.yml after removing games");
}
return games_removed;
}
game_boot_result Emulator::RemoveGameFromYml(const std::string& title_id)
{
// Remove title from games.yml
switch (m_games_config.remove_game(title_id))
{
case games_config::result::failure:
{
sys_log.error("Failed to remove title '%s' (error=%s)", title_id, fs::g_tls_error);
return game_boot_result::generic_error;
}
case games_config::result::success:
case games_config::result::exists: // not applicable for m_games_config.remove_game(). Added just to avoid compilation warnings!
{
sys_log.notice("Removed title '%s'", title_id);
return game_boot_result::no_errors;
}
}
return game_boot_result::generic_error;
}
bool Emulator::IsPathInsideDir(std::string_view path, std::string_view dir) const
{
const std::string dir_path = GetCallbacks().resolve_path(dir);