Update to libtoolchain v0.5

This commit is contained in:
jakcron 2022-03-12 13:30:43 +08:00
parent 31bf7e68d8
commit cfbe3331e3
17 changed files with 47 additions and 44 deletions

2
deps/libnintendo-es vendored

@ -1 +1 @@
Subproject commit 984c7e6d80729eb59035932815c00e1ad614ef77
Subproject commit 4c230fc27636940e58f2790ad9de1abbe849f22c

@ -1 +1 @@
Subproject commit 64adf7e5ee46355270e370231ea933ed82509915
Subproject commit 1ceb8e2a147db1cd3084fda4cd1a686c6afa0c4b

@ -1 +1 @@
Subproject commit 0635b0c532f4ef152506775c930b3d45f575a14c
Subproject commit c21987316da2d0497f58823898b9295cf7d75ed5

@ -1 +1 @@
Subproject commit 87fdd1be853013a95116c107520078ece7869881
Subproject commit c75a7df0aeef430e47e1e3693eb131b705cc4bd1

2
deps/libtoolchain vendored

@ -1 +1 @@
Subproject commit ec4144330589b96c53adc10dac36f654821327a0
Subproject commit 4beacd6ece086b2c930367cfbe241abcc6170c39

View file

@ -49,7 +49,7 @@ void nstool::FsProcess::process()
}
}
void nstool::FsProcess::setInputFileSystem(const std::shared_ptr<tc::io::IStorage>& input_fs)
void nstool::FsProcess::setInputFileSystem(const std::shared_ptr<tc::io::IFileSystem>& input_fs)
{
mInputFs = input_fs;
}
@ -227,7 +227,7 @@ void nstool::FsProcess::extractFs()
//fmt::print("Valid File Path: \"{:s}\"\n", path_str);
// the output path for this file will depend on the user specified extract path
std::shared_ptr<tc::io::IStorage> local_fs = std::make_shared<tc::io::LocalStorage>(tc::io::LocalStorage());
std::shared_ptr<tc::io::IFileSystem> local_fs = std::make_shared<tc::io::LocalFileSystem>(tc::io::LocalFileSystem());
// case: the extract_path is a valid path to an existing directory
// behaviour: extract the file, preserving the original filename, to the specified directory
@ -317,7 +317,7 @@ void nstool::FsProcess::extractFs()
void nstool::FsProcess::visitDir(const tc::io::Path& v_path, const tc::io::Path& l_path, bool extract_fs, bool print_fs)
{
tc::io::LocalStorage local_fs;
tc::io::LocalFileSystem local_fs;
// get listing for directory
tc::io::sDirectoryListing info;

View file

@ -14,7 +14,7 @@ public:
void process();
void setInputFileSystem(const std::shared_ptr<tc::io::IStorage>& input_fs);
void setInputFileSystem(const std::shared_ptr<tc::io::IFileSystem>& input_fs);
void setFsFormatName(const std::string& fs_format_name);
void setFsProperties(const std::vector<std::string>& properties);
void setShowFsInfo(bool show_fs_info);
@ -25,7 +25,7 @@ public:
private:
std::string mModuleLabel;
std::shared_ptr<tc::io::IStorage> mInputFs;
std::shared_ptr<tc::io::IFileSystem> mInputFs;
// fs info
tc::Optional<std::string> mFsFormatName;

View file

@ -7,7 +7,7 @@
#include <nn/hac/ContentMetaUtil.h>
#include <nn/hac/ContentArchiveUtil.h>
#include <nn/hac/GameCardFsMetaGenerator.h>
#include <nn/hac/GameCardFsSnapshotGenerator.h>
#include "FsProcess.h"
@ -272,15 +272,15 @@ void nstool::GameCardProcess::processRootPfs()
std::shared_ptr<tc::io::IStream> gc_fs_raw = std::make_shared<tc::io::SubStream>(tc::io::SubStream(mFile, mHdr.getPartitionFsAddress(), nn::hac::GameCardUtil::blockToAddr(mHdr.getValidDataEndPage()+1) - mHdr.getPartitionFsAddress()));
auto gc_vfs_meta = nn::hac::GameCardFsMetaGenerator(gc_fs_raw, mHdr.getPartitionFsSize(), mVerify ? nn::hac::GameCardFsMetaGenerator::ValidationMode_Warn : nn::hac::GameCardFsMetaGenerator::ValidationMode_None);
mFileSystem = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(gc_vfs_meta) );
auto gc_vfs_snapshot = nn::hac::GameCardFsSnapshotGenerator(gc_fs_raw, mHdr.getPartitionFsSize(), mVerify ? nn::hac::GameCardFsSnapshotGenerator::ValidationMode_Warn : nn::hac::GameCardFsSnapshotGenerator::ValidationMode_None);
mFileSystem = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(gc_vfs_snapshot) );
mFsProcess.setInputFileSystem(mFileSystem);
mFsProcess.setFsFormatName("PartitionFs");
mFsProcess.setFsProperties({
fmt::format("Type: Nested HFS0"),
fmt::format("DirNum: {:d}", gc_vfs_meta.dir_entries.empty() ? 0 : gc_vfs_meta.dir_entries.size() - 1), // -1 to not include root directory
fmt::format("FileNum: {:d}", gc_vfs_meta.file_entries.size())
fmt::format("DirNum: {:d}", gc_vfs_snapshot.dir_entries.empty() ? 0 : gc_vfs_snapshot.dir_entries.size() - 1), // -1 to not include root directory
fmt::format("FileNum: {:d}", gc_vfs_snapshot.file_entries.size())
});
mFsProcess.setShowFsInfo(mCliOutputMode.show_basic_info);
mFsProcess.setFsRootLabel(kXciMountPointName);

View file

@ -43,7 +43,7 @@ private:
nn::hac::GameCardHeader mHdr;
// fs processing
std::shared_ptr<tc::io::IStorage> mFileSystem;
std::shared_ptr<tc::io::IFileSystem> mFileSystem;
FsProcess mFsProcess;
void importHeader();

View file

@ -121,7 +121,7 @@ void nstool::IniProcess::extractKipList()
tc::ByteData cache = tc::ByteData(kCacheSize);
// make extract dir
tc::io::LocalStorage local_fs;
tc::io::LocalFileSystem local_fs;
local_fs.createDirectory(mKipExtractPath.get());
// out path for extracted KIP

View file

@ -8,9 +8,9 @@
#include <nn/hac/AesKeygen.h>
#include <nn/hac/HierarchicalSha256Stream.h>
#include <nn/hac/HierarchicalIntegrityStream.h>
#include <nn/hac/PartitionFsMetaGenerator.h>
#include <nn/hac/RomFsMetaGenerator.h>
#include <nn/hac/CombinedFsMetaGenerator.h>
#include <nn/hac/PartitionFsSnapshotGenerator.h>
#include <nn/hac/RomFsSnapshotGenerator.h>
#include <nn/hac/CombinedFsSnapshotGenerator.h>
#include <nn/hac/BucketTree.h>
#include <nn/hac/define/indirectstorage.h>
@ -89,7 +89,7 @@ void nstool::NcaProcess::setExtractJobs(const std::vector<nstool::ExtractJob>& e
mFsProcess.setExtractJobs(extract_jobs);
}
const std::shared_ptr<tc::io::IStorage>& nstool::NcaProcess::getFileSystem() const
const std::shared_ptr<tc::io::IFileSystem>& nstool::NcaProcess::getFileSystem() const
{
return mFileSystem;
}
@ -270,6 +270,8 @@ void nstool::NcaProcess::generatePartitionConfiguration()
// handle partition encryption and partition compaction (sparse layer)
if (fs_header.sparse_info.generation.unwrap() != 0)
{
fmt::print("Sparsy\n");
#if 0
if (fs_header.sparse_info.bucket.header.st_magic.unwrap() != nn::hac::bktr::kBktrStructMagic)
{
throw tc::Exception(mModuleName, fmt::format("SparseInfo BucketTree header had invalid magic ID."));
@ -454,6 +456,7 @@ void nstool::NcaProcess::generatePartitionConfiguration()
// create logical partition
//info.reader = std::make_shared<nn::hac::SparseStorageStream>(nn::hac::SparseStorageStream(data_stream, info.size, bucket_tree));
}
#endif
}
else
{
@ -511,12 +514,12 @@ void nstool::NcaProcess::generatePartitionConfiguration()
switch (info.format_type)
{
case (nn::hac::nca::FormatType::PartitionFs):
info.fs_meta = nn::hac::PartitionFsMetaGenerator(info.reader);
info.fs_reader = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(info.fs_meta));
info.fs_snapshot = nn::hac::PartitionFsSnapshotGenerator(info.reader);
info.fs_reader = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(info.fs_snapshot));
break;
case (nn::hac::nca::FormatType::RomFs):
info.fs_meta = nn::hac::RomFsMetaGenerator(info.reader);
info.fs_reader = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(info.fs_meta));
info.fs_snapshot = nn::hac::RomFsSnapshotGenerator(info.reader);
info.fs_reader = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(info.fs_snapshot));
break;
default:
throw tc::Exception(mModuleName, fmt::format("FormatType({:s}): UNKNOWN", nn::hac::ContentArchiveUtil::getFormatTypeAsString(info.format_type)));
@ -705,7 +708,7 @@ void nstool::NcaProcess::displayHeader()
void nstool::NcaProcess::processPartitions()
{
std::vector<nn::hac::CombinedFsMetaGenerator::MountPointInfo> mount_points;
std::vector<nn::hac::CombinedFsSnapshotGenerator::MountPointInfo> mount_points;
for (size_t i = 0; i < mHdr.getPartitionEntryList().size(); i++)
{
@ -736,12 +739,12 @@ void nstool::NcaProcess::processPartitions()
mount_point_name = fmt::format("{:d}", index);
}
mount_points.push_back( { mount_point_name, partition.fs_meta } );
mount_points.push_back( { mount_point_name, partition.fs_snapshot } );
}
tc::io::VirtualFileSystem::FileSystemMeta fs_meta = nn::hac::CombinedFsMetaGenerator(mount_points);
tc::io::VirtualFileSystem::FileSystemSnapshot fs_snapshot = nn::hac::CombinedFsSnapshotGenerator(mount_points);
std::shared_ptr<tc::io::IStorage> nca_fs = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(fs_meta));
std::shared_ptr<tc::io::IFileSystem> nca_fs = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(fs_snapshot));
mFsProcess.setInputFileSystem(nca_fs);
mFsProcess.setFsFormatName("ContentArchive");

View file

@ -29,7 +29,7 @@ public:
void setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs);
// post process() get FS out
const std::shared_ptr<tc::io::IStorage>& getFileSystem() const;
const std::shared_ptr<tc::io::IFileSystem>& getFileSystem() const;
private:
const std::string kNpdmExefsPath = "/main.npdm";
@ -42,7 +42,7 @@ private:
bool mVerify;
// fs processing
std::shared_ptr<tc::io::IStorage> mFileSystem;
std::shared_ptr<tc::io::IFileSystem> mFileSystem;
FsProcess mFsProcess;
// nca data
@ -95,8 +95,8 @@ private:
struct sPartitionInfo
{
std::shared_ptr<tc::io::IStream> reader;
tc::io::VirtualFileSystem::FileSystemMeta fs_meta;
std::shared_ptr<tc::io::IStorage> fs_reader;
tc::io::VirtualFileSystem::FileSystemSnapshot fs_snapshot;
std::shared_ptr<tc::io::IFileSystem> fs_reader;
std::string fail_reason;
int64_t offset;
int64_t size;

View file

@ -2,10 +2,10 @@
#include "util.h"
#include <nn/hac/PartitionFsUtil.h>
#include <tc/io/LocalStorage.h>
#include <tc/io/LocalFileSystem.h>
#include <tc/io/VirtualFileSystem.h>
#include <nn/hac/PartitionFsMetaGenerator.h>
#include <nn/hac/PartitionFsSnapshotGenerator.h>
nstool::PfsProcess::PfsProcess() :
@ -62,7 +62,7 @@ void nstool::PfsProcess::process()
mPfs.fromBytes(scratch.data(), scratch.size());
// create virtual filesystem
mFileSystem = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(nn::hac::PartitionFsMetaGenerator(mFile, mVerify ? nn::hac::PartitionFsMetaGenerator::ValidationMode_Warn : nn::hac::PartitionFsMetaGenerator::ValidationMode_None)));
mFileSystem = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(nn::hac::PartitionFsSnapshotGenerator(mFile, mVerify ? nn::hac::PartitionFsSnapshotGenerator::ValidationMode_Warn : nn::hac::PartitionFsSnapshotGenerator::ValidationMode_None)));
mFsProcess.setInputFileSystem(mFileSystem);
// set properties for FsProcess
@ -115,7 +115,7 @@ const nn::hac::PartitionFsHeader& nstool::PfsProcess::getPfsHeader() const
return mPfs;
}
const std::shared_ptr<tc::io::IStorage>& nstool::PfsProcess::getFileSystem() const
const std::shared_ptr<tc::io::IFileSystem>& nstool::PfsProcess::getFileSystem() const
{
return mFileSystem;
}

View file

@ -26,7 +26,7 @@ public:
// post process() get PFS/FS out
const nn::hac::PartitionFsHeader& getPfsHeader() const;
const std::shared_ptr<tc::io::IStorage>& getFileSystem() const;
const std::shared_ptr<tc::io::IFileSystem>& getFileSystem() const;
private:
static const size_t kCacheSize = 0x10000;
@ -39,7 +39,7 @@ private:
nn::hac::PartitionFsHeader mPfs;
std::shared_ptr<tc::io::IStorage> mFileSystem;
std::shared_ptr<tc::io::IFileSystem> mFileSystem;
FsProcess mFsProcess;
size_t determineHeaderSize(const nn::hac::sPfsHeader* hdr);

View file

@ -2,7 +2,7 @@
#include "util.h"
#include <tc/io/VirtualFileSystem.h>
#include <nn/hac/RomFsMetaGenerator.h>
#include <nn/hac/RomFsSnapshotGenerator.h>
nstool::RomfsProcess::RomfsProcess() :
@ -83,7 +83,7 @@ void nstool::RomfsProcess::process()
}
// create virtual filesystem
mFileSystem = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(nn::hac::RomFsMetaGenerator(mFile)));
mFileSystem = std::make_shared<tc::io::VirtualFileSystem>(tc::io::VirtualFileSystem(nn::hac::RomFsSnapshotGenerator(mFile)));
mFsProcess.setInputFileSystem(mFileSystem);
// set properties for FsProcess

View file

@ -36,7 +36,7 @@ private:
size_t mDirNum;
size_t mFileNum;
std::shared_ptr<tc::io::IStorage> mFileSystem;
std::shared_ptr<tc::io::IFileSystem> mFileSystem;
FsProcess mFsProcess;
};

View file

@ -1176,8 +1176,8 @@ bool nstool::SettingsInitializer::determineValidEsTikFromSample(const tc::ByteDa
const nn::es::sTicketBody_v2* body = (const nn::es::sTicketBody_v2*)(sample.data() + sign.getBytes().size());
if ((body->issuer.str().substr(0, 5) == "Root-"
&& body->issuer.str().substr(16, 2) == "XS") == false)
if ((body->issuer.decode().substr(0, 5) == "Root-"
&& body->issuer.decode().substr(16, 2) == "XS") == false)
return false;
return true;