diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 73357b3b3..24814f671 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -94,7 +94,7 @@ std::vector GameInfo::GetSaveDataDirectories() { getFilesInDir(memc.c_str(), &dirs); std::vector directories; - if (id.empty()) { + if (id.size() < 5) { return directories; } for (size_t i = 0; i < dirs.size(); i++) { diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index 6c9458ea0..c6fc549f1 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -83,7 +83,10 @@ void GameScreen::CreateViews() { Choice *play = new Choice(ga->T("Play")); rightColumnItems->Add(play)->OnClick.Handle(this, &GameScreen::OnPlay); rightColumnItems->Add(new Choice(ga->T("Game Settings")))->OnClick.Handle(this, &GameScreen::OnGameSettings); - rightColumnItems->Add(new Choice(ga->T("Delete Save Data")))->OnClick.Handle(this, &GameScreen::OnDeleteSaveData); + std::vector saveDirs = info->GetSaveDataDirectories(); + if (saveDirs.size()) { + rightColumnItems->Add(new Choice(ga->T("Delete Save Data")))->OnClick.Handle(this, &GameScreen::OnDeleteSaveData); + } rightColumnItems->Add(new Choice(ga->T("Delete Game")))->OnClick.Handle(this, &GameScreen::OnDeleteGame); if (host->CanCreateShortcut()) { rightColumnItems->Add(new Choice(ga->T("Create Shortcut")))->OnClick.Handle(this, &GameScreen::OnCreateShortcut); @@ -176,9 +179,13 @@ UI::EventReturn GameScreen::OnDeleteSaveData(UI::EventParams &e) { I18NCategory *ga = GetI18NCategory("Game"); GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE); if (info) { - screenManager()->push( - new PromptScreen(d->T("DeleteConfirmAll", "Do you really want to delete all\nyour save data for this game?"), ga->T("ConfirmDelete"), d->T("Cancel"), - std::bind(&GameScreen::CallbackDeleteSaveData, this, placeholder::_1))); + // Check that there's any savedata to delete + std::vector saveDirs = info->GetSaveDataDirectories(); + if (saveDirs.size()) { + screenManager()->push( + new PromptScreen(d->T("DeleteConfirmAll", "Do you really want to delete all\nyour save data for this game?"), ga->T("ConfirmDelete"), d->T("Cancel"), + std::bind(&GameScreen::CallbackDeleteSaveData, this, placeholder::_1))); + } } RecreateViews();