mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
[nstool] Misc rename.
This commit is contained in:
parent
d5da5afaae
commit
90bbbede60
1 changed files with 8 additions and 8 deletions
|
@ -587,14 +587,14 @@ FileType UserSettings::determineFileTypeFromFile(const std::string& path)
|
||||||
static const size_t kMaxReadSize = 0x1000;
|
static const size_t kMaxReadSize = 0x1000;
|
||||||
FileType file_type = FILE_INVALID;
|
FileType file_type = FILE_INVALID;
|
||||||
fnd::SimpleFile file;
|
fnd::SimpleFile file;
|
||||||
fnd::MemoryBlob blob;
|
fnd::MemoryBlob scratch;
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
file.open(path, file.Read);
|
file.open(path, file.Read);
|
||||||
|
|
||||||
// read file
|
// read file
|
||||||
blob.alloc(MIN(kMaxReadSize, file.size()));
|
scratch.alloc(MIN(kMaxReadSize, file.size()));
|
||||||
file.read(blob.getBytes(), 0, blob.getSize());
|
file.read(scratch.getBytes(), 0, scratch.getSize());
|
||||||
// close file
|
// close file
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
@ -602,14 +602,14 @@ FileType UserSettings::determineFileTypeFromFile(const std::string& path)
|
||||||
byte_t nca_raw[nx::nca::kHeaderSize];
|
byte_t nca_raw[nx::nca::kHeaderSize];
|
||||||
nx::sNcaHeader* nca_header = (nx::sNcaHeader*)(nca_raw + nx::NcaUtils::sectorToOffset(1));
|
nx::sNcaHeader* nca_header = (nx::sNcaHeader*)(nca_raw + nx::NcaUtils::sectorToOffset(1));
|
||||||
|
|
||||||
if (blob.getSize() >= nx::nca::kHeaderSize)
|
if (scratch.getSize() >= nx::nca::kHeaderSize)
|
||||||
{
|
{
|
||||||
nx::NcaUtils::decryptNcaHeader(blob.getBytes(), nca_raw, mKeyset.nca.header_key);
|
nx::NcaUtils::decryptNcaHeader(scratch.getBytes(), nca_raw, mKeyset.nca.header_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _QUICK_CAST resolves to a pointer of type 'st' located at blob.getBytes() + 'oft'
|
// _QUICK_CAST resolves to a pointer of type 'st' located at scratch.getBytes() + 'oft'
|
||||||
#define _QUICK_CAST(st, oft) ((st*)(blob.getBytes() + (oft)))
|
#define _QUICK_CAST(st, oft) ((st*)(scratch.getBytes() + (oft)))
|
||||||
#define _ASSERT_SIZE(size) (blob.getSize() >= (size))
|
#define _ASSERT_SIZE(size) (scratch.getSize() >= (size))
|
||||||
|
|
||||||
// test npdm
|
// test npdm
|
||||||
if (_ASSERT_SIZE(sizeof(nx::sXciHeaderPage)) && std::string(_QUICK_CAST(nx::sXciHeaderPage, 0)->header.signature, 4) == nx::xci::kXciSig)
|
if (_ASSERT_SIZE(sizeof(nx::sXciHeaderPage)) && std::string(_QUICK_CAST(nx::sXciHeaderPage, 0)->header.signature, 4) == nx::xci::kXciSig)
|
||||||
|
|
Loading…
Reference in a new issue