When NAND is damaged, show title names from save files
The earlier code always tried to use TitleDatabase for getting title names, but that didn't work for disc-based games, because there was no way to get the maker ID.
This commit is contained in:
parent
5a6d90900e
commit
6902bbb696
|
@ -582,6 +582,6 @@ std::string UTF16BEToUTF8(const char16_t* str, size_t max_size)
|
||||||
{
|
{
|
||||||
const char16_t* str_end = std::find(str, str + max_size, '\0');
|
const char16_t* str_end = std::find(str, str + max_size, '\0');
|
||||||
std::wstring result(static_cast<size_t>(str_end - str), '\0');
|
std::wstring result(static_cast<size_t>(str_end - str), '\0');
|
||||||
std::transform(str, str_end, result.begin(), static_cast<u16(&)(u16)>(Common::swap16));
|
std::transform(str, str_end, result.begin(), static_cast<u16 (&)(u16)>(Common::swap16));
|
||||||
return UTF16ToUTF8(result);
|
return UTF16ToUTF8(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,12 +166,12 @@ std::string TitleDatabase::GetTitleName(const std::string& game_id, TitleType ty
|
||||||
return iterator != map.end() ? iterator->second : "";
|
return iterator != map.end() ? iterator->second : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TitleDatabase::GetTitleName(u64 title_id) const
|
std::string TitleDatabase::GetChannelName(u64 title_id) const
|
||||||
{
|
{
|
||||||
const std::string id{
|
const std::string id{
|
||||||
{static_cast<char>((title_id >> 24) & 0xff), static_cast<char>((title_id >> 16) & 0xff),
|
{static_cast<char>((title_id >> 24) & 0xff), static_cast<char>((title_id >> 16) & 0xff),
|
||||||
static_cast<char>((title_id >> 8) & 0xff), static_cast<char>(title_id & 0xff)}};
|
static_cast<char>((title_id >> 8) & 0xff), static_cast<char>(title_id & 0xff)}};
|
||||||
return GetTitleName(id, IOS::ES::IsChannel(title_id) ? TitleType::Channel : TitleType::Other);
|
return GetTitleName(id, TitleType::Channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TitleDatabase::Describe(const std::string& game_id, TitleType type) const
|
std::string TitleDatabase::Describe(const std::string& game_id, TitleType type) const
|
||||||
|
|
|
@ -27,7 +27,9 @@ public:
|
||||||
// Get a user friendly title name for a game ID.
|
// Get a user friendly title name for a game ID.
|
||||||
// This falls back to returning an empty string if none could be found.
|
// This falls back to returning an empty string if none could be found.
|
||||||
std::string GetTitleName(const std::string& game_id, TitleType = TitleType::Other) const;
|
std::string GetTitleName(const std::string& game_id, TitleType = TitleType::Other) const;
|
||||||
std::string GetTitleName(u64 title_id) const;
|
|
||||||
|
// Same as above, but takes a title ID instead of a game ID, and can only find names of channels.
|
||||||
|
std::string GetChannelName(u64 title_id) const;
|
||||||
|
|
||||||
// Get a description for a game ID (title name if available + game ID).
|
// Get a description for a game ID (title name if available + game ID).
|
||||||
std::string Describe(const std::string& game_id, TitleType = TitleType::Other) const;
|
std::string Describe(const std::string& game_id, TitleType = TitleType::Other) const;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "Common/CommonPaths.h"
|
#include "Common/CommonPaths.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
#include "Core/CommonTitles.h"
|
#include "Core/CommonTitles.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
@ -27,7 +28,10 @@
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
#include "Core/TitleDatabase.h"
|
#include "Core/TitleDatabase.h"
|
||||||
#include "Core/WiiUtils.h"
|
#include "Core/WiiUtils.h"
|
||||||
|
|
||||||
#include "DiscIO/NANDImporter.h"
|
#include "DiscIO/NANDImporter.h"
|
||||||
|
#include "DiscIO/WiiSaveBanner.h"
|
||||||
|
|
||||||
#include "DolphinQt2/AboutDialog.h"
|
#include "DolphinQt2/AboutDialog.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "DolphinQt2/GameList/GameFile.h"
|
||||||
#include "DolphinQt2/QtUtils/ActionHelper.h"
|
#include "DolphinQt2/QtUtils/ActionHelper.h"
|
||||||
|
@ -557,10 +561,25 @@ void MenuBar::CheckNAND()
|
||||||
Core::TitleDatabase title_db;
|
Core::TitleDatabase title_db;
|
||||||
for (const u64 title_id : result.titles_to_remove)
|
for (const u64 title_id : result.titles_to_remove)
|
||||||
{
|
{
|
||||||
const std::string name = title_db.GetTitleName(title_id);
|
title_listings += StringFromFormat("%016" PRIx64, title_id);
|
||||||
title_listings += !name.empty() ?
|
|
||||||
StringFromFormat("%s (%016" PRIx64 ")", name.c_str(), title_id) :
|
const std::string database_name = title_db.GetChannelName(title_id);
|
||||||
StringFromFormat("%016" PRIx64, 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";
|
title_listings += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,11 +57,13 @@
|
||||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/State.h"
|
#include "Core/State.h"
|
||||||
|
#include "Core/TitleDatabase.h"
|
||||||
#include "Core/WiiUtils.h"
|
#include "Core/WiiUtils.h"
|
||||||
|
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
#include "DiscIO/NANDImporter.h"
|
#include "DiscIO/NANDImporter.h"
|
||||||
#include "DiscIO/VolumeWad.h"
|
#include "DiscIO/VolumeWad.h"
|
||||||
|
#include "DiscIO/WiiSaveBanner.h"
|
||||||
|
|
||||||
#include "DolphinWX/AboutDolphin.h"
|
#include "DolphinWX/AboutDolphin.h"
|
||||||
#include "DolphinWX/Cheats/CheatsWindow.h"
|
#include "DolphinWX/Cheats/CheatsWindow.h"
|
||||||
|
@ -1331,10 +1333,25 @@ void CFrame::OnCheckNAND(wxCommandEvent&)
|
||||||
Core::TitleDatabase title_db;
|
Core::TitleDatabase title_db;
|
||||||
for (const u64 title_id : result.titles_to_remove)
|
for (const u64 title_id : result.titles_to_remove)
|
||||||
{
|
{
|
||||||
const std::string name = title_db.GetTitleName(title_id);
|
title_listings += StringFromFormat("%016" PRIx64, title_id);
|
||||||
title_listings += !name.empty() ?
|
|
||||||
StringFromFormat("%s (%016" PRIx64 ")", name.c_str(), title_id) :
|
const std::string database_name = title_db.GetChannelName(title_id);
|
||||||
StringFromFormat("%016" PRIx64, 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";
|
title_listings += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,7 +1361,7 @@ void CFrame::OnCheckNAND(wxCommandEvent&)
|
||||||
"By continuing, the following title(s) will be removed:\n\n"
|
"By continuing, the following title(s) will be removed:\n\n"
|
||||||
"%s"
|
"%s"
|
||||||
"\nLaunching these titles may also fix the issues."),
|
"\nLaunching these titles may also fix the issues."),
|
||||||
title_listings.c_str());
|
StrToWxStr(title_listings));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wxMessageBox(message, _("NAND Check"), wxYES_NO) != wxYES)
|
if (wxMessageBox(message, _("NAND Check"), wxYES_NO) != wxYES)
|
||||||
|
|
Loading…
Reference in New Issue