Merge pull request #6162 from JosJuice/nand-check-save-game-name

When NAND is damaged, show title names from save files
This commit is contained in:
Anthony
2017-11-06 23:11:34 -08:00
committed by GitHub
16 changed files with 213 additions and 77 deletions

View File

@ -57,11 +57,13 @@
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
#include "Core/State.h"
#include "Core/TitleDatabase.h"
#include "Core/WiiUtils.h"
#include "DiscIO/Enums.h"
#include "DiscIO/NANDImporter.h"
#include "DiscIO/VolumeWad.h"
#include "DiscIO/WiiSaveBanner.h"
#include "DolphinWX/AboutDolphin.h"
#include "DolphinWX/Cheats/CheatsWindow.h"
@ -1331,10 +1333,25 @@ void CFrame::OnCheckNAND(wxCommandEvent&)
Core::TitleDatabase title_db;
for (const u64 title_id : result.titles_to_remove)
{
const std::string name = title_db.GetTitleName(title_id);
title_listings += !name.empty() ?
StringFromFormat("%s (%016" PRIx64 ")", name.c_str(), title_id) :
StringFromFormat("%016" PRIx64, title_id);
title_listings += StringFromFormat("%016" PRIx64, title_id);
const std::string database_name = title_db.GetChannelName(title_id);
if (!database_name.empty())
{
title_listings += " - " + database_name;
}
else
{
DiscIO::WiiSaveBanner banner(title_id);
if (banner.IsValid())
{
title_listings += " - " + banner.GetName();
const std::string description = banner.GetDescription();
if (!StripSpaces(description).empty())
title_listings += " - " + description;
}
}
title_listings += "\n";
}
@ -1344,7 +1361,7 @@ void CFrame::OnCheckNAND(wxCommandEvent&)
"By continuing, the following title(s) will be removed:\n\n"
"%s"
"\nLaunching these titles may also fix the issues."),
title_listings.c_str());
StrToWxStr(title_listings));
}
if (wxMessageBox(message, _("NAND Check"), wxYES_NO) != wxYES)

View File

@ -34,6 +34,7 @@
#include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
#include "DiscIO/WiiSaveBanner.h"
#include "DolphinWX/ISOFile.h"
#include "DolphinWX/WxUtils.h"
@ -263,8 +264,9 @@ bool GameListItem::BannerChanged()
return false;
auto& banner = m_pending.volume_banner;
std::vector<u32> buffer = DiscIO::Volume::GetWiiBanner(&banner.width, &banner.height, m_title_id);
if (!buffer.size())
std::vector<u32> buffer =
DiscIO::WiiSaveBanner(m_title_id).GetBanner(&banner.width, &banner.height);
if (buffer.empty())
return false;
ReadVolumeBanner(&banner.buffer, buffer, banner.width, banner.height);