Add support for games in NUS format (.app)

Requires title.tmd and title.tik in same directory
This commit is contained in:
Exzap 2023-09-27 11:05:40 +02:00
parent f9f6206929
commit 5ad57bb0c9
8 changed files with 54 additions and 24 deletions

View file

@ -99,6 +99,7 @@ TitleInfo::TitleInfo(const TitleInfo::CachedInfo& cachedInfo)
if (cachedInfo.titleDataFormat != TitleDataFormat::HOST_FS &&
cachedInfo.titleDataFormat != TitleDataFormat::WIIU_ARCHIVE &&
cachedInfo.titleDataFormat != TitleDataFormat::WUD &&
cachedInfo.titleDataFormat != TitleDataFormat::NUS &&
cachedInfo.titleDataFormat != TitleDataFormat::INVALID_STRUCTURE)
return;
if (cachedInfo.path.empty())
@ -197,13 +198,19 @@ bool TitleInfo::DetectFormat(const fs::path& path, fs::path& pathOut, TitleDataF
}
}
else if (boost::iends_with(filenameStr, ".wud") ||
boost::iends_with(filenameStr, ".wux") ||
boost::iends_with(filenameStr, ".iso"))
boost::iends_with(filenameStr, ".wux") ||
boost::iends_with(filenameStr, ".iso"))
{
formatOut = TitleDataFormat::WUD;
pathOut = path;
return true;
}
else if (boost::iequals(filenameStr, "title.tmd"))
{
formatOut = TitleDataFormat::NUS;
pathOut = path;
return true;
}
else if (boost::iends_with(filenameStr, ".wua"))
{
formatOut = TitleDataFormat::WIIU_ARCHIVE;
@ -378,12 +385,15 @@ bool TitleInfo::Mount(std::string_view virtualPath, std::string_view subfolder,
return false;
}
}
else if (m_titleFormat == TitleDataFormat::WUD)
else if (m_titleFormat == TitleDataFormat::WUD || m_titleFormat == TitleDataFormat::NUS)
{
if (m_mountpoints.empty())
{
cemu_assert_debug(!m_wudVolume);
m_wudVolume = FSTVolume::OpenFromDiscImage(m_fullPath);
if(m_titleFormat == TitleDataFormat::WUD)
m_wudVolume = FSTVolume::OpenFromDiscImage(m_fullPath); // open wud/wux
else
m_wudVolume = FSTVolume::OpenFromContentFolder(m_fullPath.parent_path()); // open from .app files directory, the path points to /title.tmd
}
if (!m_wudVolume)
return false;
@ -433,7 +443,7 @@ void TitleInfo::Unmount(std::string_view virtualPath)
{
if (m_wudVolume)
{
cemu_assert_debug(m_titleFormat == TitleDataFormat::WUD);
cemu_assert_debug(m_titleFormat == TitleDataFormat::WUD || m_titleFormat == TitleDataFormat::NUS);
delete m_wudVolume;
m_wudVolume = nullptr;
}
@ -664,6 +674,9 @@ std::string TitleInfo::GetPrintPath() const
case TitleDataFormat::WUD:
tmp.append(" [WUD]");
break;
case TitleDataFormat::NUS:
tmp.append(" [NUS]");
break;
case TitleDataFormat::WIIU_ARCHIVE:
tmp.append(" [WUA]");
break;