mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
Catch when NCA partitions fail to be processed due to apparent corruption.
This commit is contained in:
parent
4145ad10db
commit
24306d80ee
1 changed files with 37 additions and 33 deletions
|
@ -570,43 +570,47 @@ void NcaProcess::processPartitions()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (partition.format_type == nn::hac::nca::FormatType::PartitionFs)
|
try {
|
||||||
{
|
if (partition.format_type == nn::hac::nca::FormatType::PartitionFs)
|
||||||
PfsProcess pfs;
|
|
||||||
pfs.setInputFile(partition.reader);
|
|
||||||
pfs.setCliOutputMode(mCliOutputMode);
|
|
||||||
pfs.setListFs(mListFs);
|
|
||||||
if (mHdr.getContentType() == nn::hac::nca::ContentType::Program)
|
|
||||||
{
|
{
|
||||||
pfs.setMountPointName(std::string(getContentTypeForMountStr(mHdr.getContentType())) + ":/" + nn::hac::ContentArchiveUtil::getProgramContentParititionIndexAsString((nn::hac::nca::ProgramContentPartitionIndex)index));
|
PfsProcess pfs;
|
||||||
|
pfs.setInputFile(partition.reader);
|
||||||
|
pfs.setCliOutputMode(mCliOutputMode);
|
||||||
|
pfs.setListFs(mListFs);
|
||||||
|
if (mHdr.getContentType() == nn::hac::nca::ContentType::Program)
|
||||||
|
{
|
||||||
|
pfs.setMountPointName(std::string(getContentTypeForMountStr(mHdr.getContentType())) + ":/" + nn::hac::ContentArchiveUtil::getProgramContentParititionIndexAsString((nn::hac::nca::ProgramContentPartitionIndex)index));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pfs.setMountPointName(std::string(getContentTypeForMountStr(mHdr.getContentType())) + ":/");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mPartitionPath[index].doExtract)
|
||||||
|
pfs.setExtractPath(mPartitionPath[index].path);
|
||||||
|
pfs.process();
|
||||||
}
|
}
|
||||||
else
|
else if (partition.format_type == nn::hac::nca::FormatType::RomFs)
|
||||||
{
|
{
|
||||||
pfs.setMountPointName(std::string(getContentTypeForMountStr(mHdr.getContentType())) + ":/");
|
RomfsProcess romfs;
|
||||||
}
|
romfs.setInputFile(partition.reader);
|
||||||
|
romfs.setCliOutputMode(mCliOutputMode);
|
||||||
if (mPartitionPath[index].doExtract)
|
romfs.setListFs(mListFs);
|
||||||
pfs.setExtractPath(mPartitionPath[index].path);
|
if (mHdr.getContentType() == nn::hac::nca::ContentType::Program)
|
||||||
pfs.process();
|
{
|
||||||
}
|
romfs.setMountPointName(std::string(getContentTypeForMountStr(mHdr.getContentType())) + ":/" + nn::hac::ContentArchiveUtil::getProgramContentParititionIndexAsString((nn::hac::nca::ProgramContentPartitionIndex)index));
|
||||||
else if (partition.format_type == nn::hac::nca::FormatType::RomFs)
|
}
|
||||||
{
|
else
|
||||||
RomfsProcess romfs;
|
{
|
||||||
romfs.setInputFile(partition.reader);
|
romfs.setMountPointName(std::string(getContentTypeForMountStr(mHdr.getContentType())) + ":/");
|
||||||
romfs.setCliOutputMode(mCliOutputMode);
|
}
|
||||||
romfs.setListFs(mListFs);
|
|
||||||
if (mHdr.getContentType() == nn::hac::nca::ContentType::Program)
|
|
||||||
{
|
|
||||||
romfs.setMountPointName(std::string(getContentTypeForMountStr(mHdr.getContentType())) + ":/" + nn::hac::ContentArchiveUtil::getProgramContentParititionIndexAsString((nn::hac::nca::ProgramContentPartitionIndex)index));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
romfs.setMountPointName(std::string(getContentTypeForMountStr(mHdr.getContentType())) + ":/");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mPartitionPath[index].doExtract)
|
if (mPartitionPath[index].doExtract)
|
||||||
romfs.setExtractPath(mPartitionPath[index].path);
|
romfs.setExtractPath(mPartitionPath[index].path);
|
||||||
romfs.process();
|
romfs.process();
|
||||||
|
}
|
||||||
|
} catch (const fnd::Exception& e) {
|
||||||
|
std::cout << "[WARNING] NCA Partition " << std::dec << index << " not readable (" << e.error() << ")." << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue