[nx] Added nx namespace.

This commit is contained in:
jakcron 2017-07-06 21:17:21 +10:00
parent 01162b8187
commit 7b34bd404d
14 changed files with 450 additions and 420 deletions

View file

@ -1,5 +1,7 @@
#include "AciHeader.h"
using namespace nx;
void AciHeader::clearVariables()
{
mType = TYPE_ACI0;

View file

@ -4,6 +4,8 @@
#include <fnd/memory_blob.h>
#include <nx/ISerialiseableBinary.h>
namespace nx
{
class AciHeader : public ISerialiseableBinary
{
public:
@ -106,4 +108,5 @@ private:
bool isEqual(const AciHeader& other) const;
void copyFrom(const AciHeader& other);
};
}

View file

@ -1,6 +1,6 @@
#include "FacBinary.h"
using namespace nx;
FacBinary::FacBinary() :
mHeader()

View file

@ -5,6 +5,8 @@
#include <nx/ISerialiseableBinary.h>
#include <nx/FacHeader.h>
namespace nx
{
class FacBinary :
public ISerialiseableBinary
{
@ -78,4 +80,5 @@ private:
bool isEqual(const FacBinary& other) const;
void copyFrom(const FacBinary& other);
};
}

View file

@ -1,6 +1,6 @@
#include "FacHeader.h"
using namespace nx;
FacHeader::FacHeader()
{

View file

@ -3,6 +3,8 @@
#include <fnd/memory_blob.h>
#include <nx/ISerialiseableBinary.h>
namespace nx
{
class FacHeader :
public ISerialiseableBinary
{
@ -80,7 +82,8 @@ private:
// variables
u64 mFsaRights;
struct sSection {
struct sSection
{
size_t offset;
size_t size;
} mContentOwnerIdPos, mSaveDataOwnerIdPos;
@ -90,4 +93,5 @@ private:
bool isEqual(const FacHeader& other) const;
void copyFrom(const FacHeader& other);
};
}

View file

@ -1,6 +1,8 @@
#pragma once
#include <fnd/types.h>
namespace nx
{
class ISerialiseableBinary
{
public:
@ -14,4 +16,5 @@ public:
virtual void importBinary(const u8* bytes) = 0;
virtual void importBinary(const u8* bytes, size_t len) = 0;
};
}

View file

@ -1,6 +1,9 @@
#include "NcaHeader.h"
#include <fnd/exception.h>
using namespace nx;
void NcaHeader::exportBinary()
{
mBinaryBlob.alloc(sizeof(sNcaHeader));

View file

@ -7,6 +7,8 @@
#include <crypto/sha.h>
#include <nx/ISerialiseableBinary.h>
namespace nx
{
class NcaHeader : public ISerialiseableBinary
{
public:
@ -153,3 +155,5 @@ private:
bool isEqual(const NcaHeader& other) const;
void copyFrom(const NcaHeader& other);
};
}

View file

@ -1,6 +1,6 @@
#include "SacBinary.h"
using namespace nx;
SacBinary::SacBinary()
{

View file

@ -6,6 +6,8 @@
#include <nx/ISerialiseableBinary.h>
#include <nx/SacEntry.h>
namespace nx
{
class SacBinary :
public ISerialiseableBinary
{
@ -44,3 +46,4 @@ private:
void copyFrom(const SacBinary& other);
};
}

View file

@ -1,5 +1,7 @@
#include "SacEntry.h"
using namespace nx;
SacEntry::SacEntry() :
mIsServer(false),
mName("")

View file

@ -4,6 +4,8 @@
#include <fnd/memory_blob.h>
#include <nx/ISerialiseableBinary.h>
namespace nx
{
class SacEntry : public ISerialiseableBinary
{
public:
@ -49,3 +51,4 @@ private:
bool isEqual(const SacEntry& other) const;
void copyFrom(const SacEntry& other);
};
}

View file

@ -6,7 +6,7 @@
#include <nx/NcaHeader.h>
#include <inttypes.h>
const size_t kNcaSectorSize = NcaHeader::kDefaultBlockSize;
const size_t kNcaSectorSize = nx::NcaHeader::kDefaultBlockSize;
void initNcaCtr(u8 ctr[crypto::aes::kAesBlockSize], u32 generation)
{
@ -69,7 +69,7 @@ int main(int argc, char** argv)
{
decryptNcaSectorXts(nca, sector, 1, nx::crypto::aes::nca_header_key[0], nx::crypto::aes::nca_header_key[1]);
NcaHeader hdr;
nx::NcaHeader hdr;
hdr.importBinary(sector);
printf("[NCA Header]\n");
@ -79,7 +79,7 @@ int main(int argc, char** argv)
printf(" Sections:\n");
for (size_t i = 0; i < hdr.getSections().getSize(); i++)
{
const NcaHeader::sSection& section = hdr.getSections()[i];
const nx::NcaHeader::sSection& section = hdr.getSections()[i];
printf(" %lu:\n", i);
//printf(" Start Blk: %" PRId32 "\n", section.start_blk);
//printf(" End Blk: %" PRId32 "\n", section.end_blk);