mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 18:55:29 +00:00
[nx|nstool] Renamed struct member "signature" to "st_magic".
This commit is contained in:
parent
19bd03630d
commit
28f92b78c8
|
@ -6,7 +6,7 @@ namespace nx
|
|||
{
|
||||
namespace aset
|
||||
{
|
||||
static const uint32_t kAssetSig = _MAKE_STRUCT_SIGNATURE("ASET");
|
||||
static const uint32_t kAssetStructMagic = _MAKE_STRUCT_MAGIC("ASET");
|
||||
|
||||
static const uint32_t kDefaultAssetFormatVersion = 0;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace nx
|
|||
|
||||
struct sAssetHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
le_uint32_t format_version;
|
||||
sAssetSection icon;
|
||||
sAssetSection nacp;
|
||||
|
|
|
@ -6,6 +6,6 @@ namespace nx
|
|||
{
|
||||
namespace nro
|
||||
{
|
||||
static const uint64_t kNroHomebrewSig = _MAKE_STRUCT_SIGNATURE_U64("HOMEBREW");
|
||||
static const uint64_t kNroHomebrewStMagic = _MAKE_STRUCT_MAGIC_U64("HOMEBREW");
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ void nx::AssetHeader::toBytes()
|
|||
nx::sAssetHeader* hdr = (nx::sAssetHeader*)mRawBinary.data();
|
||||
|
||||
// set header identifers
|
||||
hdr->signature = aset::kAssetSig;
|
||||
hdr->st_magic = aset::kAssetStructMagic;
|
||||
hdr->format_version = aset::kDefaultAssetFormatVersion;
|
||||
|
||||
// set icon section
|
||||
|
@ -71,7 +71,7 @@ void nx::AssetHeader::fromBytes(const byte_t* bytes, size_t len)
|
|||
const nx::sAssetHeader* hdr = (const nx::sAssetHeader*)mRawBinary.data();
|
||||
|
||||
// check NRO signature
|
||||
if (hdr->signature.get() != aset::kAssetSig)
|
||||
if (hdr->st_magic.get() != aset::kAssetStructMagic)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "ASET header corrupt (unrecognised header signature)");
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ namespace nx
|
|||
{
|
||||
namespace aci
|
||||
{
|
||||
static const uint32_t kAciStructSig = _MAKE_STRUCT_SIGNATURE("ACI0");
|
||||
static const uint32_t kAciDescStructSig = _MAKE_STRUCT_SIGNATURE("ACID");
|
||||
static const uint32_t kAciStructMagic = _MAKE_STRUCT_MAGIC("ACI0");
|
||||
static const uint32_t kAciDescStructMagic = _MAKE_STRUCT_MAGIC("ACID");
|
||||
static const size_t kAciAlignSize = 0x10;
|
||||
|
||||
enum Flags
|
||||
|
@ -19,7 +19,7 @@ namespace nx
|
|||
#pragma pack(push,1)
|
||||
struct sAciHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
le_uint32_t size; // includes prefacing signature, set only in ACID made by SDK (it enables easy resigning)
|
||||
byte_t reserved_0[4];
|
||||
le_uint32_t flags; // set in ACID only
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
namespace nx
|
||||
{
|
||||
// Also known to the public as IVFC
|
||||
namespace hierarchicalintegrity
|
||||
{
|
||||
static const uint32_t kStructSig = _MAKE_STRUCT_SIGNATURE("IVFC");
|
||||
static const uint32_t kStructMagic = _MAKE_STRUCT_MAGIC("IVFC");
|
||||
static const uint32_t kRomfsTypeId = 0x20000;
|
||||
static const size_t kDefaultLayerNum = 6;
|
||||
static const size_t kHeaderAlignLen = 0x20;
|
||||
|
@ -16,7 +15,7 @@ namespace nx
|
|||
#pragma pack(push,1)
|
||||
struct sHierarchicalIntegrityHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
le_uint32_t type_id;
|
||||
le_uint32_t master_hash_size;
|
||||
le_uint32_t layer_num;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
#define _MAKE_STRUCT_SIGNATURE(x) ((uint32_t)(x[3]) << 24 | (uint32_t)(x[2]) << 16 | (uint32_t)(x[1]) << 8 | (uint32_t)(x[0]))
|
||||
#define _MAKE_STRUCT_SIGNATURE_U64(x) ((uint64_t)(x[7]) << 56 | (uint64_t)(x[6]) << 48 | (uint64_t)(x[5]) << 40 | (uint64_t)(x[4]) << 32 | (uint64_t)(x[3]) << 24 | (uint64_t)(x[2]) << 16 | (uint64_t)(x[1]) << 8 | (uint64_t)(x[0]))
|
||||
#define _MAKE_STRUCT_MAGIC(x) ((uint32_t)(x[3]) << 24 | (uint32_t)(x[2]) << 16 | (uint32_t)(x[1]) << 8 | (uint32_t)(x[0]))
|
||||
#define _MAKE_STRUCT_MAGIC_U64(x) ((uint64_t)(x[7]) << 56 | (uint64_t)(x[6]) << 48 | (uint64_t)(x[5]) << 40 | (uint64_t)(x[4]) << 32 | (uint64_t)(x[3]) << 24 | (uint64_t)(x[2]) << 16 | (uint64_t)(x[1]) << 8 | (uint64_t)(x[0]))
|
||||
|
|
|
@ -9,8 +9,8 @@ namespace nx
|
|||
{
|
||||
namespace nca
|
||||
{
|
||||
static const uint32_t kNca2Sig = _MAKE_STRUCT_SIGNATURE("NCA2");
|
||||
static const uint32_t kNca3Sig = _MAKE_STRUCT_SIGNATURE("NCA3");
|
||||
static const uint32_t kNca2StructMagic = _MAKE_STRUCT_MAGIC("NCA2");
|
||||
static const uint32_t kNca3StructMagic = _MAKE_STRUCT_MAGIC("NCA3");
|
||||
static const size_t kSectorSize = 0x200;
|
||||
static const size_t kPartitionNum = 4;
|
||||
static const size_t kHeaderSectorNum = 6;
|
||||
|
@ -87,7 +87,7 @@ namespace nx
|
|||
#pragma pack(push,1)
|
||||
struct sNcaHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
byte_t distribution_type;
|
||||
byte_t content_type;
|
||||
byte_t key_generation;
|
||||
|
|
|
@ -6,10 +6,10 @@ namespace nx
|
|||
{
|
||||
namespace npdm
|
||||
{
|
||||
static const uint32_t kNpdmStructSig = _MAKE_STRUCT_SIGNATURE("META");
|
||||
static const uint32_t kNpdmStructMagic = _MAKE_STRUCT_MAGIC("META");
|
||||
static const size_t kNameMaxLen = 0x10;
|
||||
static const size_t kProductCodeMaxLen = 0x10;
|
||||
static const uint32_t kMaxPriority = BIT(6) -1 ;
|
||||
static const uint32_t kMaxPriority = BIT(6) -1;
|
||||
static const size_t kNpdmAlignSize = 0x10;
|
||||
static const uint32_t kDefaultMainThreadStackSize = 4096;
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace nx
|
|||
|
||||
struct sNpdmHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
byte_t reserved_0[8];
|
||||
byte_t flags;
|
||||
byte_t reserved_1;
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace nx
|
|||
{
|
||||
namespace nro
|
||||
{
|
||||
static const uint32_t kNroSig = _MAKE_STRUCT_SIGNATURE("NRO0");
|
||||
static const uint32_t kNroStructMagic = _MAKE_STRUCT_MAGIC("NRO0");
|
||||
|
||||
static const uint32_t kDefaultFormatVersion = 0;
|
||||
static const size_t kRoCrtSize = 8;
|
||||
|
@ -24,7 +24,7 @@ namespace nx
|
|||
{
|
||||
byte_t ro_crt[nro::kRoCrtSize];
|
||||
byte_t reserved_0[8];
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
le_uint32_t format_version;
|
||||
le_uint32_t size;
|
||||
le_uint32_t flags;
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace nx
|
|||
{
|
||||
namespace nrr
|
||||
{
|
||||
static const uint32_t kNrrSig = _MAKE_STRUCT_SIGNATURE("NRR0");
|
||||
static const uint32_t kNrrStructMagic = _MAKE_STRUCT_MAGIC("NRR0");
|
||||
}
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
@ -21,7 +21,7 @@ namespace nx
|
|||
|
||||
struct sNrrHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
byte_t reserved_0[28];
|
||||
sNrrCertificate certificate;
|
||||
byte_t nrr_body_signature[crypto::rsa::kRsa2048Size];
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace nx
|
|||
{
|
||||
namespace nso
|
||||
{
|
||||
static const uint32_t kNsoSig = _MAKE_STRUCT_SIGNATURE("NSO0");
|
||||
static const uint32_t kNsoStructMagic = _MAKE_STRUCT_MAGIC("NSO0");
|
||||
|
||||
enum HeaderFlags
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ namespace nx
|
|||
|
||||
struct sNsoHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
le_uint32_t format_version;
|
||||
byte_t reserved_1[4];
|
||||
le_uint32_t flags;
|
||||
|
|
|
@ -6,15 +6,15 @@ namespace nx
|
|||
{
|
||||
namespace pfs
|
||||
{
|
||||
static const uint32_t kPfsSig = _MAKE_STRUCT_SIGNATURE("PFS0");
|
||||
static const uint32_t kHashedPfsSig = _MAKE_STRUCT_SIGNATURE("HFS0");
|
||||
static const uint32_t kPfsStructMagic = _MAKE_STRUCT_MAGIC("PFS0");
|
||||
static const uint32_t kHashedPfsStructMagic = _MAKE_STRUCT_MAGIC("HFS0");
|
||||
static const size_t kHeaderAlign = 64;
|
||||
}
|
||||
|
||||
#pragma pack(push,1)
|
||||
struct sPfsHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
le_uint32_t file_num;
|
||||
le_uint32_t name_table_size;
|
||||
byte_t padding[4];
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace nx
|
|||
{
|
||||
namespace xci
|
||||
{
|
||||
static const uint32_t kXciSig = _MAKE_STRUCT_SIGNATURE("HEAD");
|
||||
static const uint32_t kXciStructMagic = _MAKE_STRUCT_MAGIC("HEAD");
|
||||
static const uint32_t kHeaderEncOffset = 0x90;
|
||||
static const uint32_t kHeaderEncSize = 0x70;
|
||||
static const uint32_t kPageSize = 0x200;
|
||||
|
@ -66,7 +66,7 @@ namespace nx
|
|||
#pragma pack(push,1)
|
||||
struct sXciHeader
|
||||
{
|
||||
le_uint32_t signature;
|
||||
le_uint32_t st_magic;
|
||||
le_uint32_t rom_area_start_page;
|
||||
le_uint32_t backup_area_start_page;
|
||||
byte_t key_flag;
|
||||
|
|
|
@ -61,10 +61,10 @@ void nx::AciHeader::toBytes()
|
|||
switch (mType)
|
||||
{
|
||||
case (TYPE_ACI0):
|
||||
hdr->signature = aci::kAciStructSig;
|
||||
hdr->st_magic = aci::kAciStructMagic;
|
||||
break;
|
||||
case (TYPE_ACID):
|
||||
hdr->signature = aci::kAciDescStructSig;
|
||||
hdr->st_magic = aci::kAciDescStructMagic;
|
||||
break;
|
||||
default:
|
||||
throw fnd::Exception(kModuleName, "Unexpected ACI type");
|
||||
|
@ -115,12 +115,12 @@ void nx::AciHeader::fromBytes(const byte_t * bytes, size_t len)
|
|||
|
||||
sAciHeader* hdr = (sAciHeader*)mRawBinary.data();
|
||||
|
||||
switch (hdr->signature.get())
|
||||
switch (hdr->st_magic.get())
|
||||
{
|
||||
case (aci::kAciStructSig):
|
||||
case (aci::kAciStructMagic):
|
||||
mType = TYPE_ACI0;
|
||||
break;
|
||||
case (aci::kAciDescStructSig):
|
||||
case (aci::kAciDescStructMagic):
|
||||
mType = TYPE_ACID;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -54,7 +54,7 @@ void nx::HierarchicalIntegrityHeader::fromBytes(const byte_t* data, size_t len)
|
|||
const nx::sHierarchicalIntegrityHeader* hdr = (const nx::sHierarchicalIntegrityHeader*)data;
|
||||
|
||||
// Validate Header Sig "IVFC"
|
||||
if (hdr->signature.get() != hierarchicalintegrity::kStructSig)
|
||||
if (hdr->st_magic.get() != hierarchicalintegrity::kStructMagic)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "Invalid struct magic");
|
||||
}
|
||||
|
|
|
@ -60,10 +60,10 @@ void nx::NcaHeader::toBytes()
|
|||
switch(mFormatVersion)
|
||||
{
|
||||
case (NCA2_FORMAT):
|
||||
hdr->signature = nca::kNca2Sig;
|
||||
hdr->st_magic = nca::kNca2StMagic;
|
||||
break;
|
||||
case (NCA3_FORMAT):
|
||||
hdr->signature = nca::kNca3Sig;
|
||||
hdr->st_magic = nca::kNca3StMagic;
|
||||
break;
|
||||
default:
|
||||
throw fnd::Exception(kModuleName, "Unsupported format version");
|
||||
|
@ -122,12 +122,12 @@ void nx::NcaHeader::fromBytes(const byte_t * data, size_t len)
|
|||
|
||||
sNcaHeader* hdr = (sNcaHeader*)mRawBinary.data();
|
||||
|
||||
switch(hdr->signature.get())
|
||||
switch(hdr->st_magic.get())
|
||||
{
|
||||
case (nca::kNca2Sig) :
|
||||
case (nca::kNca2StMagic) :
|
||||
mFormatVersion = NCA2_FORMAT;
|
||||
break;
|
||||
case (nca::kNca3Sig) :
|
||||
case (nca::kNca3StMagic) :
|
||||
mFormatVersion = NCA3_FORMAT;
|
||||
break;
|
||||
throw fnd::Exception(kModuleName, "NCA header corrupt");
|
||||
|
|
|
@ -9,7 +9,7 @@ void nx::NcaUtils::decryptNcaHeader(const byte_t* src, byte_t* dst, const crypto
|
|||
crypto::aes::AesXtsMakeTweak(tweak, 1);
|
||||
crypto::aes::AesXtsDecryptSector(src + sectorToOffset(1), nx::nca::kSectorSize, key.key[0], key.key[1], tweak, raw_hdr);
|
||||
|
||||
bool useNca2SectorIndex = ((nx::sNcaHeader*)(raw_hdr))->signature.get() == nx::nca::kNca2Sig;
|
||||
bool useNca2SectorIndex = ((nx::sNcaHeader*)(raw_hdr))->st_magic.get() == nx::nca::kNca2StMagic;
|
||||
|
||||
// decrypt whole header
|
||||
for (size_t i = 0; i < nx::nca::kHeaderSectorNum; i++)
|
||||
|
|
|
@ -56,7 +56,7 @@ void nx::NpdmHeader::toBytes()
|
|||
mRawBinary.alloc(sizeof(sNpdmHeader));
|
||||
sNpdmHeader* hdr = (sNpdmHeader*)mRawBinary.data();
|
||||
|
||||
hdr->signature = npdm::kNpdmStructSig;
|
||||
hdr->st_magic = npdm::kNpdmStructMagic;
|
||||
byte_t flag = ((byte_t)(mInstructionType & 1) | (byte_t)((mProcAddressSpaceType & 3) << 1)) & 0xf;
|
||||
hdr->flags = flag;
|
||||
hdr->main_thread_priority = mMainThreadPriority;
|
||||
|
@ -87,7 +87,7 @@ void nx::NpdmHeader::fromBytes(const byte_t* data, size_t len)
|
|||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||
sNpdmHeader* hdr = (sNpdmHeader*)mRawBinary.data();
|
||||
|
||||
if (hdr->signature.get() != npdm::kNpdmStructSig)
|
||||
if (hdr->st_magic.get() != npdm::kNpdmStructMagic)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "NPDM header corrupt");
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ void nx::NroHeader::toBytes()
|
|||
nx::sNroHeader* hdr = (nx::sNroHeader*)mRawBinary.data();
|
||||
|
||||
// set header identifers
|
||||
hdr->signature = nro::kNroSig;
|
||||
hdr->st_magic = nro::kNroStructMagic;
|
||||
hdr->format_version = nro::kDefaultFormatVersion;
|
||||
hdr->flags = 0;
|
||||
|
||||
|
@ -112,7 +112,7 @@ void nx::NroHeader::fromBytes(const byte_t* data, size_t len)
|
|||
const nx::sNroHeader* hdr = (const nx::sNroHeader*)mRawBinary.data();
|
||||
|
||||
// check NRO signature
|
||||
if (hdr->signature.get() != nro::kNroSig)
|
||||
if (hdr->st_magic.get() != nro::kNroStructMagic)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "NRO header corrupt (unrecognised header signature)");
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ void nx::NsoHeader::toBytes()
|
|||
nx::sNsoHeader* hdr = (nx::sNsoHeader*)mRawBinary.data();
|
||||
|
||||
// set header identifers
|
||||
hdr->signature = nso::kNsoSig;
|
||||
hdr->st_magic = nso::kNsoStructMagic;
|
||||
hdr->format_version = nso::kDefaultFormatVersion;
|
||||
|
||||
// variable to store flags before commiting to header
|
||||
|
@ -144,7 +144,7 @@ void nx::NsoHeader::fromBytes(const byte_t* data, size_t len)
|
|||
const nx::sNsoHeader* hdr = (const nx::sNsoHeader*)mRawBinary.data();
|
||||
|
||||
// check NSO signature
|
||||
if (hdr->signature.get() != nso::kNsoSig)
|
||||
if (hdr->st_magic.get() != nso::kNsoStructMagic)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "NSO header corrupt (unrecognised header signature)");
|
||||
}
|
||||
|
|
|
@ -63,10 +63,10 @@ void nx::PfsHeader::toBytes()
|
|||
switch (mFsType)
|
||||
{
|
||||
case (TYPE_PFS0):
|
||||
hdr->signature = pfs::kPfsSig;
|
||||
hdr->st_magic = pfs::kPfsStructMagic;
|
||||
break;
|
||||
case (TYPE_HFS0):
|
||||
hdr->signature = pfs::kHashedPfsSig;
|
||||
hdr->st_magic = pfs::kHashedPfsStructMagic;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -131,12 +131,12 @@ void nx::PfsHeader::fromBytes(const byte_t* data, size_t len)
|
|||
|
||||
// check struct signature
|
||||
FsType fs_type;
|
||||
switch(hdr->signature.get())
|
||||
switch(hdr->st_magic.get())
|
||||
{
|
||||
case (pfs::kPfsSig):
|
||||
case (pfs::kPfsStructMagic):
|
||||
fs_type = TYPE_PFS0;
|
||||
break;
|
||||
case (pfs::kHashedPfsSig):
|
||||
case (pfs::kHashedPfsStructMagic):
|
||||
fs_type = TYPE_HFS0;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -105,7 +105,7 @@ void nx::XciHeader::fromBytes(const byte_t* data, size_t len)
|
|||
const nx::sXciHeader* hdr = (const nx::sXciHeader*)mRawBinary.data();
|
||||
|
||||
// check XCI signature
|
||||
if (hdr->signature.get() != xci::kXciSig)
|
||||
if (hdr->st_magic.get() != xci::kXciStructMagic)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "XCI header corrupt");
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ void PfsProcess::displayFs()
|
|||
size_t PfsProcess::determineHeaderSize(const nx::sPfsHeader* hdr)
|
||||
{
|
||||
size_t fileEntrySize = 0;
|
||||
if (hdr->signature.get() == nx::pfs::kPfsSig)
|
||||
if (hdr->st_magic.get() == nx::pfs::kPfsStructMagic)
|
||||
fileEntrySize = sizeof(nx::sPfsFile);
|
||||
else
|
||||
fileEntrySize = sizeof(nx::sHashedPfsFile);
|
||||
|
@ -137,7 +137,7 @@ size_t PfsProcess::determineHeaderSize(const nx::sPfsHeader* hdr)
|
|||
|
||||
bool PfsProcess::validateHeaderMagic(const nx::sPfsHeader* hdr)
|
||||
{
|
||||
return hdr->signature.get() == nx::pfs::kPfsSig || hdr->signature.get() == nx::pfs::kHashedPfsSig;
|
||||
return hdr->st_magic.get() == nx::pfs::kPfsStructMagic || hdr->st_magic.get() == nx::pfs::kHashedPfsStructMagic;
|
||||
}
|
||||
|
||||
void PfsProcess::validateHfs()
|
||||
|
|
|
@ -724,19 +724,19 @@ FileType UserSettings::determineFileTypeFromFile(const std::string& path)
|
|||
#define _ASSERT_SIZE(sz) (scratch.size() >= (sz))
|
||||
|
||||
// test npdm
|
||||
if (_ASSERT_SIZE(sizeof(nx::sXciHeaderPage)) && _TYPE_PTR(nx::sXciHeaderPage)->header.signature.get() == nx::xci::kXciSig)
|
||||
if (_ASSERT_SIZE(sizeof(nx::sXciHeaderPage)) && _TYPE_PTR(nx::sXciHeaderPage)->header.st_magic.get() == nx::xci::kXciStructMagic)
|
||||
file_type = FILE_XCI;
|
||||
// test pfs0
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sPfsHeader)) && _TYPE_PTR(nx::sPfsHeader)->signature.get() == nx::pfs::kPfsSig)
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sPfsHeader)) && _TYPE_PTR(nx::sPfsHeader)->st_magic.get() == nx::pfs::kPfsStructMagic)
|
||||
file_type = FILE_PARTITIONFS;
|
||||
// test hfs0
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sPfsHeader)) && _TYPE_PTR(nx::sPfsHeader)->signature.get() == nx::pfs::kHashedPfsSig)
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sPfsHeader)) && _TYPE_PTR(nx::sPfsHeader)->st_magic.get() == nx::pfs::kHashedPfsStructMagic)
|
||||
file_type = FILE_PARTITIONFS;
|
||||
// test romfs
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sRomfsHeader)) && _TYPE_PTR(nx::sRomfsHeader)->header_size.get() == sizeof(nx::sRomfsHeader) && _TYPE_PTR(nx::sRomfsHeader)->sections[1].offset.get() == (_TYPE_PTR(nx::sRomfsHeader)->sections[0].offset.get() + _TYPE_PTR(nx::sRomfsHeader)->sections[0].size.get()))
|
||||
file_type = FILE_ROMFS;
|
||||
// test npdm
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sNpdmHeader)) && _TYPE_PTR(nx::sNpdmHeader)->signature.get() == nx::npdm::kNpdmStructSig)
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sNpdmHeader)) && _TYPE_PTR(nx::sNpdmHeader)->st_magic.get() == nx::npdm::kNpdmStructMagic)
|
||||
file_type = FILE_NPDM;
|
||||
// test nca
|
||||
else if (determineValidNcaFromSample(scratch))
|
||||
|
@ -748,13 +748,13 @@ FileType UserSettings::determineFileTypeFromFile(const std::string& path)
|
|||
else if (determineValidNacpFromSample(scratch))
|
||||
file_type = FILE_NACP;
|
||||
// test nso
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sNsoHeader)) && _TYPE_PTR(nx::sNsoHeader)->signature.get() == nx::nso::kNsoSig)
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sNsoHeader)) && _TYPE_PTR(nx::sNsoHeader)->st_magic.get() == nx::nso::kNsoStructMagic)
|
||||
file_type = FILE_NSO;
|
||||
// test nso
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sNroHeader)) && _TYPE_PTR(nx::sNroHeader)->signature.get() == nx::nro::kNroSig)
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sNroHeader)) && _TYPE_PTR(nx::sNroHeader)->st_magic.get() == nx::nro::kNroStructMagic)
|
||||
file_type = FILE_NRO;
|
||||
// test hb asset
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sAssetHeader)) && _TYPE_PTR(nx::sAssetHeader)->signature.get() == nx::aset::kAssetSig)
|
||||
else if (_ASSERT_SIZE(sizeof(nx::sAssetHeader)) && _TYPE_PTR(nx::sAssetHeader)->st_magic.get() == nx::aset::kAssetStructMagic)
|
||||
file_type = FILE_HB_ASSET;
|
||||
// else unrecognised
|
||||
else
|
||||
|
@ -777,7 +777,7 @@ bool UserSettings::determineValidNcaFromSample(const fnd::Vec<byte_t>& sample) c
|
|||
|
||||
nx::NcaUtils::decryptNcaHeader(sample.data(), nca_raw, mKeyset.nca.header_key);
|
||||
|
||||
if (nca_header->signature.get() != nx::nca::kNca2Sig && nca_header->signature.get() != nx::nca::kNca3Sig)
|
||||
if (nca_header->st_magic.get() != nx::nca::kNca2StructMagic && nca_header->st_magic.get() != nx::nca::kNca3StructMagic)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue