mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
[hac|nstool] Renamed hac::PfsHeader to hac::PartitionFsHeader.
This commit is contained in:
parent
24e2fc5e77
commit
364a3880f1
|
@ -9,7 +9,7 @@ namespace nn
|
|||
{
|
||||
namespace hac
|
||||
{
|
||||
class PfsHeader :
|
||||
class PartitionFsHeader :
|
||||
public fnd::IByteModel
|
||||
{
|
||||
public:
|
||||
|
@ -62,12 +62,12 @@ namespace hac
|
|||
}
|
||||
};
|
||||
|
||||
PfsHeader();
|
||||
PfsHeader(const PfsHeader& other);
|
||||
PartitionFsHeader();
|
||||
PartitionFsHeader(const PartitionFsHeader& other);
|
||||
|
||||
void operator=(const PfsHeader& other);
|
||||
bool operator==(const PfsHeader& other) const;
|
||||
bool operator!=(const PfsHeader& other) const;
|
||||
void operator=(const PartitionFsHeader& other);
|
||||
bool operator==(const PartitionFsHeader& other) const;
|
||||
bool operator!=(const PartitionFsHeader& other) const;
|
||||
|
||||
// IByteModel
|
||||
void toBytes();
|
||||
|
@ -84,7 +84,7 @@ namespace hac
|
|||
void addFile(const std::string& name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash);
|
||||
|
||||
private:
|
||||
const std::string kModuleName = "PFS_HEADER";
|
||||
const std::string kModuleName = "PARTITIONFS_HEADER";
|
||||
|
||||
// binary blob
|
||||
fnd::Vec<byte_t> mRawBinary;
|
|
@ -74,8 +74,8 @@
|
|||
<ClInclude Include="include\nn\hac\MiscParamsHandler.h" />
|
||||
<ClInclude Include="include\nn\hac\NroHeader.h" />
|
||||
<ClInclude Include="include\nn\hac\NsoHeader.h" />
|
||||
<ClInclude Include="include\nn\hac\PartitionFsHeader.h" />
|
||||
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h" />
|
||||
<ClInclude Include="include\nn\hac\PfsHeader.h" />
|
||||
<ClInclude Include="include\nn\hac\Result.h" />
|
||||
<ClInclude Include="include\nn\hac\ServiceAccessControl.h" />
|
||||
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h" />
|
||||
|
@ -121,8 +121,8 @@
|
|||
<ClCompile Include="source\MiscParamsHandler.cpp" />
|
||||
<ClCompile Include="source\NroHeader.cpp" />
|
||||
<ClCompile Include="source\NsoHeader.cpp" />
|
||||
<ClCompile Include="source\PartitionFsHeader.cpp" />
|
||||
<ClCompile Include="source\PatchMetaExtendedHeader.cpp" />
|
||||
<ClCompile Include="source\PfsHeader.cpp" />
|
||||
<ClCompile Include="source\Result.cpp" />
|
||||
<ClCompile Include="source\ServiceAccessControl.cpp" />
|
||||
<ClCompile Include="source\ServiceAccessControlEntry.cpp" />
|
||||
|
|
|
@ -15,6 +15,57 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\nn\hac\define\aci.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\cnmt.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\delta.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\fac.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\hierarchicalintegrity.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\hierarchicalsha256.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\kc.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\macro.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\meta.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nacp.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nca.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nro.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nrr.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nso.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\pfs.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\romfs.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\xci.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\AccessControlInfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -120,10 +171,10 @@
|
|||
<ClInclude Include="include\nn\hac\NsoHeader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h">
|
||||
<ClInclude Include="include\nn\hac\PartitionFsHeader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\PfsHeader.h">
|
||||
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\Result.h">
|
||||
|
@ -153,57 +204,6 @@
|
|||
<ClInclude Include="include\nn\hac\XciUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\aci.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\cnmt.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\delta.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\fac.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\hierarchicalintegrity.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\hierarchicalsha256.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\kc.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\macro.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\meta.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nacp.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nca.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nro.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nrr.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\nso.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\pfs.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\romfs.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\define\xci.h">
|
||||
<Filter>Header Files\define</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="source\AccessControlInfo.cpp">
|
||||
|
@ -308,10 +308,10 @@
|
|||
<ClCompile Include="source\NsoHeader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\PatchMetaExtendedHeader.cpp">
|
||||
<ClCompile Include="source\PartitionFsHeader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\PfsHeader.cpp">
|
||||
<ClCompile Include="source\PatchMetaExtendedHeader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\Result.cpp">
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include <nn/hac/PfsHeader.h>
|
||||
#include <nn/hac/PartitionFsHeader.h>
|
||||
|
||||
nn::hac::PfsHeader::PfsHeader()
|
||||
nn::hac::PartitionFsHeader::PartitionFsHeader()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
nn::hac::PfsHeader::PfsHeader(const PfsHeader & other)
|
||||
nn::hac::PartitionFsHeader::PartitionFsHeader(const PartitionFsHeader & other)
|
||||
{
|
||||
*this = other;
|
||||
}
|
||||
|
||||
void nn::hac::PfsHeader::operator=(const PfsHeader & other)
|
||||
void nn::hac::PartitionFsHeader::operator=(const PartitionFsHeader & other)
|
||||
{
|
||||
if (other.getBytes().size())
|
||||
{
|
||||
|
@ -24,24 +24,24 @@ void nn::hac::PfsHeader::operator=(const PfsHeader & other)
|
|||
}
|
||||
}
|
||||
|
||||
bool nn::hac::PfsHeader::operator==(const PfsHeader & other) const
|
||||
bool nn::hac::PartitionFsHeader::operator==(const PartitionFsHeader & other) const
|
||||
{
|
||||
return (mFsType == other.mFsType) \
|
||||
&& (mFileList == other.mFileList);
|
||||
}
|
||||
|
||||
bool nn::hac::PfsHeader::operator!=(const PfsHeader & other) const
|
||||
bool nn::hac::PartitionFsHeader::operator!=(const PartitionFsHeader & other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
const fnd::Vec<byte_t>& nn::hac::PfsHeader::getBytes() const
|
||||
const fnd::Vec<byte_t>& nn::hac::PartitionFsHeader::getBytes() const
|
||||
{
|
||||
return mRawBinary;
|
||||
}
|
||||
|
||||
|
||||
void nn::hac::PfsHeader::toBytes()
|
||||
void nn::hac::PartitionFsHeader::toBytes()
|
||||
{
|
||||
// calculate name table size
|
||||
size_t name_table_size = 0;
|
||||
|
@ -113,7 +113,7 @@ void nn::hac::PfsHeader::toBytes()
|
|||
|
||||
}
|
||||
|
||||
void nn::hac::PfsHeader::fromBytes(const byte_t* data, size_t len)
|
||||
void nn::hac::PartitionFsHeader::fromBytes(const byte_t* data, size_t len)
|
||||
{
|
||||
// check input length meets minimum size
|
||||
if (len < sizeof(sPfsHeader))
|
||||
|
@ -195,39 +195,39 @@ void nn::hac::PfsHeader::fromBytes(const byte_t* data, size_t len)
|
|||
|
||||
}
|
||||
|
||||
void nn::hac::PfsHeader::clear()
|
||||
void nn::hac::PartitionFsHeader::clear()
|
||||
{
|
||||
mRawBinary.clear();
|
||||
mFsType = TYPE_PFS0;
|
||||
mFileList.clear();
|
||||
}
|
||||
|
||||
nn::hac::PfsHeader::FsType nn::hac::PfsHeader::getFsType() const
|
||||
nn::hac::PartitionFsHeader::FsType nn::hac::PartitionFsHeader::getFsType() const
|
||||
{
|
||||
return mFsType;
|
||||
}
|
||||
|
||||
void nn::hac::PfsHeader::setFsType(FsType type)
|
||||
void nn::hac::PartitionFsHeader::setFsType(FsType type)
|
||||
{
|
||||
mFsType = type;
|
||||
}
|
||||
|
||||
const fnd::List<nn::hac::PfsHeader::sFile>& nn::hac::PfsHeader::getFileList() const
|
||||
const fnd::List<nn::hac::PartitionFsHeader::sFile>& nn::hac::PartitionFsHeader::getFileList() const
|
||||
{
|
||||
return mFileList;
|
||||
}
|
||||
|
||||
void nn::hac::PfsHeader::addFile(const std::string & name, size_t size)
|
||||
void nn::hac::PartitionFsHeader::addFile(const std::string & name, size_t size)
|
||||
{
|
||||
mFileList.addElement({ name, 0, size, 0 });
|
||||
}
|
||||
|
||||
void nn::hac::PfsHeader::addFile(const std::string & name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash)
|
||||
void nn::hac::PartitionFsHeader::addFile(const std::string & name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash)
|
||||
{
|
||||
mFileList.addElement({ name, 0, size, hash_protected_size, hash });
|
||||
}
|
||||
|
||||
size_t nn::hac::PfsHeader::getFileEntrySize(FsType fs_type)
|
||||
size_t nn::hac::PartitionFsHeader::getFileEntrySize(FsType fs_type)
|
||||
{
|
||||
size_t size = 0;
|
||||
switch(fs_type)
|
||||
|
@ -244,7 +244,7 @@ size_t nn::hac::PfsHeader::getFileEntrySize(FsType fs_type)
|
|||
return size;
|
||||
}
|
||||
|
||||
void nn::hac::PfsHeader::calculateOffsets(size_t data_offset)
|
||||
void nn::hac::PartitionFsHeader::calculateOffsets(size_t data_offset)
|
||||
{
|
||||
for (size_t i = 0; i < mFileList.size(); i++)
|
||||
{
|
|
@ -410,7 +410,7 @@ void NcaProcess::validateNcaSignatures()
|
|||
// open main.npdm
|
||||
if (exefs.getPfsHeader().getFileList().hasElement(kNpdmExefsPath) == true)
|
||||
{
|
||||
const nn::hac::PfsHeader::sFile& file = exefs.getPfsHeader().getFileList().getElement(kNpdmExefsPath);
|
||||
const nn::hac::PartitionFsHeader::sFile& file = exefs.getPfsHeader().getFileList().getElement(kNpdmExefsPath);
|
||||
|
||||
MetaProcess npdm;
|
||||
npdm.setInputFile(new fnd::OffsetAdjustedIFile(mPartitions[nn::hac::nca::PARTITION_CODE].reader, file.offset, file.size));
|
||||
|
|
|
@ -63,7 +63,7 @@ void PfsProcess::setListFs(bool list_fs)
|
|||
mListFs = list_fs;
|
||||
}
|
||||
|
||||
const nn::hac::PfsHeader& PfsProcess::getPfsHeader() const
|
||||
const nn::hac::PartitionFsHeader& PfsProcess::getPfsHeader() const
|
||||
{
|
||||
return mPfs;
|
||||
}
|
||||
|
@ -110,16 +110,16 @@ void PfsProcess::displayFs()
|
|||
{
|
||||
for (size_t i = 0; i < mPfs.getFileList().size(); i++)
|
||||
{
|
||||
const nn::hac::PfsHeader::sFile& file = mPfs.getFileList()[i];
|
||||
const nn::hac::PartitionFsHeader::sFile& file = mPfs.getFileList()[i];
|
||||
std::cout << " " << file.name;
|
||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_LAYOUT))
|
||||
{
|
||||
switch (mPfs.getFsType())
|
||||
{
|
||||
case (nn::hac::PfsHeader::TYPE_PFS0):
|
||||
case (nn::hac::PartitionFsHeader::TYPE_PFS0):
|
||||
std::cout << std::hex << " (offset=0x" << file.offset << ", size=0x" << file.size << ")";
|
||||
break;
|
||||
case (nn::hac::PfsHeader::TYPE_HFS0):
|
||||
case (nn::hac::PartitionFsHeader::TYPE_HFS0):
|
||||
std::cout << std::hex << " (offset=0x" << file.offset << ", size=0x" << file.size << ", hash_protected_size=0x" << file.hash_protected_size << ")";
|
||||
break;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ bool PfsProcess::validateHeaderMagic(const nn::hac::sPfsHeader* hdr)
|
|||
void PfsProcess::validateHfs()
|
||||
{
|
||||
fnd::sha::sSha256Hash hash;
|
||||
const fnd::List<nn::hac::PfsHeader::sFile>& file = mPfs.getFileList();
|
||||
const fnd::List<nn::hac::PartitionFsHeader::sFile>& file = mPfs.getFileList();
|
||||
for (size_t i = 0; i < file.size(); i++)
|
||||
{
|
||||
mCache.alloc(file[i].hash_protected_size);
|
||||
|
@ -170,7 +170,7 @@ void PfsProcess::extractFs()
|
|||
fnd::io::makeDirectory(mExtractPath);
|
||||
|
||||
fnd::SimpleFile outFile;
|
||||
const fnd::List<nn::hac::PfsHeader::sFile>& file = mPfs.getFileList();
|
||||
const fnd::List<nn::hac::PartitionFsHeader::sFile>& file = mPfs.getFileList();
|
||||
|
||||
std::string file_path;
|
||||
for (size_t i = 0; i < file.size(); i++)
|
||||
|
@ -193,16 +193,16 @@ void PfsProcess::extractFs()
|
|||
}
|
||||
}
|
||||
|
||||
const char* PfsProcess::getFsTypeStr(nn::hac::PfsHeader::FsType type) const
|
||||
const char* PfsProcess::getFsTypeStr(nn::hac::PartitionFsHeader::FsType type) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case (nn::hac::PfsHeader::TYPE_PFS0):
|
||||
case (nn::hac::PartitionFsHeader::TYPE_PFS0):
|
||||
str = "PFS0";
|
||||
break;
|
||||
case (nn::hac::PfsHeader::TYPE_HFS0):
|
||||
case (nn::hac::PartitionFsHeader::TYPE_HFS0):
|
||||
str = "HFS0";
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <fnd/types.h>
|
||||
#include <fnd/IFile.h>
|
||||
#include <fnd/SharedPtr.h>
|
||||
#include <nn/hac/PfsHeader.h>
|
||||
#include <nn/hac/PartitionFsHeader.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
@ -24,7 +24,7 @@ public:
|
|||
void setExtractPath(const std::string& path);
|
||||
void setListFs(bool list_fs);
|
||||
|
||||
const nn::hac::PfsHeader& getPfsHeader() const;
|
||||
const nn::hac::PartitionFsHeader& getPfsHeader() const;
|
||||
|
||||
private:
|
||||
const std::string kModuleName = "PfsProcess";
|
||||
|
@ -41,7 +41,7 @@ private:
|
|||
|
||||
fnd::Vec<byte_t> mCache;
|
||||
|
||||
nn::hac::PfsHeader mPfs;
|
||||
nn::hac::PartitionFsHeader mPfs;
|
||||
|
||||
void importHeader();
|
||||
void displayHeader();
|
||||
|
@ -51,5 +51,5 @@ private:
|
|||
void validateHfs();
|
||||
void extractFs();
|
||||
|
||||
const char* getFsTypeStr(nn::hac::PfsHeader::FsType type) const;
|
||||
const char* getFsTypeStr(nn::hac::PartitionFsHeader::FsType type) const;
|
||||
};
|
|
@ -216,7 +216,7 @@ void XciProcess::processRootPfs()
|
|||
|
||||
void XciProcess::processPartitionPfs()
|
||||
{
|
||||
const fnd::List<nn::hac::PfsHeader::sFile>& rootPartitions = mRootPfs.getPfsHeader().getFileList();
|
||||
const fnd::List<nn::hac::PartitionFsHeader::sFile>& rootPartitions = mRootPfs.getPfsHeader().getFileList();
|
||||
for (size_t i = 0; i < rootPartitions.size(); i++)
|
||||
{
|
||||
// this must be validated here because only the size of the root partiton header is known at verification time
|
||||
|
|
Loading…
Reference in a new issue