mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 18:55:29 +00:00
commit
44a9f7744c
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/es/ticket.h>
|
#include <nn/es/ticket.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
|
@ -8,7 +8,7 @@ namespace nn
|
||||||
namespace es
|
namespace es
|
||||||
{
|
{
|
||||||
class SectionHeader_V2 :
|
class SectionHeader_V2 :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectionHeader_V2();
|
SectionHeader_V2();
|
||||||
|
@ -18,7 +18,7 @@ namespace es
|
||||||
bool operator==(const SectionHeader_V2& other) const;
|
bool operator==(const SectionHeader_V2& other) const;
|
||||||
bool operator!=(const SectionHeader_V2& other) const;
|
bool operator!=(const SectionHeader_V2& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/es/ticket.h>
|
#include <nn/es/ticket.h>
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ namespace nn
|
||||||
namespace es
|
namespace es
|
||||||
{
|
{
|
||||||
class TicketBody_V2 :
|
class TicketBody_V2 :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TicketBody_V2();
|
TicketBody_V2();
|
||||||
|
@ -19,7 +19,7 @@ namespace es
|
||||||
bool operator==(const TicketBody_V2& other) const;
|
bool operator==(const TicketBody_V2& other) const;
|
||||||
bool operator!=(const TicketBody_V2& other) const;
|
bool operator!=(const TicketBody_V2& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
namespace fnd
|
namespace fnd
|
||||||
{
|
{
|
||||||
class ISerialisable
|
class IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ISerialisable() = default;
|
virtual ~IByteModel() = default;
|
||||||
|
|
||||||
// serialise
|
// serialise
|
||||||
virtual void toBytes() = 0;
|
virtual void toBytes() = 0;
|
|
@ -129,9 +129,9 @@
|
||||||
<ClInclude Include="include\fnd\elf.h" />
|
<ClInclude Include="include\fnd\elf.h" />
|
||||||
<ClInclude Include="include\fnd\Endian.h" />
|
<ClInclude Include="include\fnd\Endian.h" />
|
||||||
<ClInclude Include="include\fnd\Exception.h" />
|
<ClInclude Include="include\fnd\Exception.h" />
|
||||||
|
<ClInclude Include="include\fnd\IByteModel.h" />
|
||||||
<ClInclude Include="include\fnd\IFile.h" />
|
<ClInclude Include="include\fnd\IFile.h" />
|
||||||
<ClInclude Include="include\fnd\io.h" />
|
<ClInclude Include="include\fnd\io.h" />
|
||||||
<ClInclude Include="include\fnd\ISerialisable.h" />
|
|
||||||
<ClInclude Include="include\fnd\LayeredIntegrityMetadata.h" />
|
<ClInclude Include="include\fnd\LayeredIntegrityMetadata.h" />
|
||||||
<ClInclude Include="include\fnd\LayeredIntegrityWrappedIFile.h" />
|
<ClInclude Include="include\fnd\LayeredIntegrityWrappedIFile.h" />
|
||||||
<ClInclude Include="include\fnd\List.h" />
|
<ClInclude Include="include\fnd\List.h" />
|
||||||
|
|
|
@ -42,15 +42,15 @@
|
||||||
<ClInclude Include="include\fnd\Exception.h">
|
<ClInclude Include="include\fnd\Exception.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\fnd\IByteModel.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\IFile.h">
|
<ClInclude Include="include\fnd\IFile.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\io.h">
|
<ClInclude Include="include\fnd\io.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\ISerialisable.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\fnd\LayeredIntegrityMetadata.h">
|
<ClInclude Include="include\fnd\LayeredIntegrityMetadata.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/aset.h>
|
#include <nn/hac/define/aset.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class AssetHeader :
|
class AssetHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sSection
|
struct sSection
|
||||||
|
@ -41,7 +41,7 @@ namespace hac
|
||||||
bool operator==(const AssetHeader& other) const;
|
bool operator==(const AssetHeader& other) const;
|
||||||
bool operator!=(const AssetHeader& other) const;
|
bool operator!=(const AssetHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/nro.h>
|
#include <nn/hac/define/nro.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -118,9 +118,9 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nn\hac\aset.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\AssetHeader.h" />
|
<ClInclude Include="include\nn\hac\AssetHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\nro-hb.h" />
|
<ClInclude Include="include\nn\hac\define\aset.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\nro-hb.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AssetHeader.cpp" />
|
<ClCompile Include="source\AssetHeader.cpp" />
|
||||||
|
|
|
@ -13,16 +13,19 @@
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Header Files\define">
|
||||||
|
<UniqueIdentifier>{33064298-d382-4e79-9fcd-bc401bdaa763}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nn\hac\aset.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\AssetHeader.h">
|
<ClInclude Include="include\nn\hac\AssetHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nro-hb.h">
|
<ClInclude Include="include\nn\hac\define\aset.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\nn\hac\define\nro-hb.h">
|
||||||
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
57
lib/libhac/include/nn/hac/AccessControlInfo.h
Normal file
57
lib/libhac/include/nn/hac/AccessControlInfo.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <fnd/types.h>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/aci.h>
|
||||||
|
#include <nn/hac/FileSystemAccessControl.h>
|
||||||
|
#include <nn/hac/ServiceAccessControl.h>
|
||||||
|
#include <nn/hac/KernelCapabilityControl.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class AccessControlInfo :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AccessControlInfo();
|
||||||
|
AccessControlInfo(const AccessControlInfo& other);
|
||||||
|
|
||||||
|
void operator=(const AccessControlInfo& other);
|
||||||
|
bool operator==(const AccessControlInfo& other) const;
|
||||||
|
bool operator!=(const AccessControlInfo& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getProgramId() const;
|
||||||
|
void setProgramId(uint64_t program_id);
|
||||||
|
|
||||||
|
const nn::hac::FileSystemAccessControl& getFileSystemAccessControl() const;
|
||||||
|
void setFileSystemAccessControl(const FileSystemAccessControl& fac);
|
||||||
|
|
||||||
|
const nn::hac::ServiceAccessControl& getServiceAccessControl() const;
|
||||||
|
void setServiceAccessControl(const ServiceAccessControl& sac);
|
||||||
|
|
||||||
|
const nn::hac::KernelCapabilityControl& getKernelCapabilities() const;
|
||||||
|
void setKernelCapabilities(const KernelCapabilityControl& kc);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY";
|
||||||
|
|
||||||
|
// raw data
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mProgramId;
|
||||||
|
nn::hac::FileSystemAccessControl mFileSystemAccessControl;
|
||||||
|
nn::hac::ServiceAccessControl mServiceAccessControl;
|
||||||
|
nn::hac::KernelCapabilityControl mKernelCapabilities;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,56 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <fnd/types.h>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <nn/hac/aci.h>
|
|
||||||
#include <nn/hac/FileSystemAccessControlBinary.h>
|
|
||||||
#include <nn/hac/ServiceAccessControlBinary.h>
|
|
||||||
#include <nn/hac/KernelCapabilityBinary.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class AccessControlInfoBinary : public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AccessControlInfoBinary();
|
|
||||||
AccessControlInfoBinary(const AccessControlInfoBinary& other);
|
|
||||||
|
|
||||||
void operator=(const AccessControlInfoBinary& other);
|
|
||||||
bool operator==(const AccessControlInfoBinary& other) const;
|
|
||||||
bool operator!=(const AccessControlInfoBinary& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
uint64_t getProgramId() const;
|
|
||||||
void setProgramId(uint64_t program_id);
|
|
||||||
|
|
||||||
const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
|
|
||||||
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
|
|
||||||
|
|
||||||
const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
|
|
||||||
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
|
|
||||||
|
|
||||||
const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
|
|
||||||
void setKernelCapabilities(const KernelCapabilityBinary& kc);
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY";
|
|
||||||
|
|
||||||
// raw data
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
uint64_t mProgramId;
|
|
||||||
nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
|
|
||||||
nn::hac::ServiceAccessControlBinary mServiceAccessControl;
|
|
||||||
nn::hac::KernelCapabilityBinary mKernelCapabilities;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
92
lib/libhac/include/nn/hac/AccessControlInfoDesc.h
Normal file
92
lib/libhac/include/nn/hac/AccessControlInfoDesc.h
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <fnd/types.h>
|
||||||
|
#include <fnd/List.h>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/aci.h>
|
||||||
|
#include <nn/hac/FileSystemAccessControl.h>
|
||||||
|
#include <nn/hac/ServiceAccessControl.h>
|
||||||
|
#include <nn/hac/KernelCapabilityControl.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class AccessControlInfoDesc :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct sProgramIdRestrict
|
||||||
|
{
|
||||||
|
uint64_t min;
|
||||||
|
uint64_t max;
|
||||||
|
|
||||||
|
void operator=(const sProgramIdRestrict& other)
|
||||||
|
{
|
||||||
|
min = other.min;
|
||||||
|
max = other.max;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const sProgramIdRestrict& other) const
|
||||||
|
{
|
||||||
|
return (min == other.min) \
|
||||||
|
&& (max == other.max);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const sProgramIdRestrict& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AccessControlInfoDesc();
|
||||||
|
AccessControlInfoDesc(const AccessControlInfoDesc& other);
|
||||||
|
|
||||||
|
void operator=(const AccessControlInfoDesc& other);
|
||||||
|
bool operator==(const AccessControlInfoDesc& other) const;
|
||||||
|
bool operator!=(const AccessControlInfoDesc& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
void generateSignature(const fnd::rsa::sRsa2048Key& key);
|
||||||
|
void validateSignature(const fnd::rsa::sRsa2048Key& key) const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
const fnd::rsa::sRsa2048Key& getContentArchiveHeaderSignature2Key() const;
|
||||||
|
void setContentArchiveHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key);
|
||||||
|
|
||||||
|
const fnd::List<aci::Flag>& getFlagList() const;
|
||||||
|
void setFlagList(const fnd::List<aci::Flag>& flags);
|
||||||
|
|
||||||
|
const sProgramIdRestrict& getProgramIdRestrict() const;
|
||||||
|
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
|
||||||
|
|
||||||
|
const nn::hac::FileSystemAccessControl& getFileSystemAccessControl() const;
|
||||||
|
void setFileSystemAccessControl(const FileSystemAccessControl& fac);
|
||||||
|
|
||||||
|
const nn::hac::ServiceAccessControl& getServiceAccessControl() const;
|
||||||
|
void setServiceAccessControl(const ServiceAccessControl& sac);
|
||||||
|
|
||||||
|
const nn::hac::KernelCapabilityControl& getKernelCapabilities() const;
|
||||||
|
void setKernelCapabilities(const KernelCapabilityControl& kc);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
|
||||||
|
|
||||||
|
// raw data
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
fnd::rsa::sRsa2048Key mContentArchiveHeaderSignature2Key;
|
||||||
|
fnd::List<aci::Flag> mFlags;
|
||||||
|
sProgramIdRestrict mProgramIdRestrict;
|
||||||
|
nn::hac::FileSystemAccessControl mFileSystemAccessControl;
|
||||||
|
nn::hac::ServiceAccessControl mServiceAccessControl;
|
||||||
|
nn::hac::KernelCapabilityControl mKernelCapabilities;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,91 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <fnd/types.h>
|
|
||||||
#include <fnd/List.h>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <nn/hac/aci.h>
|
|
||||||
#include <nn/hac/FileSystemAccessControlBinary.h>
|
|
||||||
#include <nn/hac/ServiceAccessControlBinary.h>
|
|
||||||
#include <nn/hac/KernelCapabilityBinary.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class AccessControlInfoDescBinary : public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct sProgramIdRestrict
|
|
||||||
{
|
|
||||||
uint64_t min;
|
|
||||||
uint64_t max;
|
|
||||||
|
|
||||||
void operator=(const sProgramIdRestrict& other)
|
|
||||||
{
|
|
||||||
min = other.min;
|
|
||||||
max = other.max;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const sProgramIdRestrict& other) const
|
|
||||||
{
|
|
||||||
return (min == other.min) \
|
|
||||||
&& (max == other.max);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const sProgramIdRestrict& other) const
|
|
||||||
{
|
|
||||||
return !(*this == other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AccessControlInfoDescBinary();
|
|
||||||
AccessControlInfoDescBinary(const AccessControlInfoDescBinary& other);
|
|
||||||
|
|
||||||
void operator=(const AccessControlInfoDescBinary& other);
|
|
||||||
bool operator==(const AccessControlInfoDescBinary& other) const;
|
|
||||||
bool operator!=(const AccessControlInfoDescBinary& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
void generateSignature(const fnd::rsa::sRsa2048Key& key);
|
|
||||||
void validateSignature(const fnd::rsa::sRsa2048Key& key) const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
const fnd::rsa::sRsa2048Key& getNcaHeaderSignature2Key() const;
|
|
||||||
void setNcaHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key);
|
|
||||||
|
|
||||||
const fnd::List<aci::Flag>& getFlagList() const;
|
|
||||||
void setFlagList(const fnd::List<aci::Flag>& flags);
|
|
||||||
|
|
||||||
const sProgramIdRestrict& getProgramIdRestrict() const;
|
|
||||||
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
|
|
||||||
|
|
||||||
const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
|
|
||||||
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
|
|
||||||
|
|
||||||
const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
|
|
||||||
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
|
|
||||||
|
|
||||||
const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
|
|
||||||
void setKernelCapabilities(const KernelCapabilityBinary& kc);
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
|
|
||||||
|
|
||||||
// raw data
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
fnd::rsa::sRsa2048Key mNcaHeaderSignature2Key;
|
|
||||||
fnd::List<aci::Flag> mFlags;
|
|
||||||
sProgramIdRestrict mProgramIdRestrict;
|
|
||||||
nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
|
|
||||||
nn::hac::ServiceAccessControlBinary mServiceAccessControl;
|
|
||||||
nn::hac::KernelCapabilityBinary mKernelCapabilities;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
46
lib/libhac/include/nn/hac/AddOnContentMetaExtendedHeader.h
Normal file
46
lib/libhac/include/nn/hac/AddOnContentMetaExtendedHeader.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class AddOnContentMetaExtendedHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AddOnContentMetaExtendedHeader();
|
||||||
|
AddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& other);
|
||||||
|
|
||||||
|
void operator=(const AddOnContentMetaExtendedHeader& other);
|
||||||
|
bool operator==(const AddOnContentMetaExtendedHeader& other) const;
|
||||||
|
bool operator!=(const AddOnContentMetaExtendedHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getApplicationId() const;
|
||||||
|
void setApplicationId(uint64_t application_id);
|
||||||
|
|
||||||
|
uint32_t getRequiredApplicationVersion() const;
|
||||||
|
void setRequiredApplicationVersion(uint32_t app_ver);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "ADD_ON_CONTENT_META_EXTENDED_HEADER";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mApplicationId;
|
||||||
|
uint32_t mRequiredApplicationVersion;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/nacp.h>
|
#include <nn/hac/define/nacp.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class ApplicationControlPropertyBinary :
|
class ApplicationControlProperty :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sTitle
|
struct sTitle
|
||||||
|
@ -85,14 +85,14 @@ namespace hac
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ApplicationControlPropertyBinary();
|
ApplicationControlProperty();
|
||||||
ApplicationControlPropertyBinary(const ApplicationControlPropertyBinary& other);
|
ApplicationControlProperty(const ApplicationControlProperty& other);
|
||||||
|
|
||||||
void operator=(const ApplicationControlPropertyBinary& other);
|
void operator=(const ApplicationControlProperty& other);
|
||||||
bool operator==(const ApplicationControlPropertyBinary& other) const;
|
bool operator==(const ApplicationControlProperty& other) const;
|
||||||
bool operator!=(const ApplicationControlPropertyBinary& other) const;
|
bool operator!=(const ApplicationControlProperty& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/nacp.h>
|
#include <nn/hac/define/nacp.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
|
|
46
lib/libhac/include/nn/hac/ApplicationMetaExtendedHeader.h
Normal file
46
lib/libhac/include/nn/hac/ApplicationMetaExtendedHeader.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ApplicationMetaExtendedHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ApplicationMetaExtendedHeader();
|
||||||
|
ApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& other);
|
||||||
|
|
||||||
|
void operator=(const ApplicationMetaExtendedHeader& other);
|
||||||
|
bool operator==(const ApplicationMetaExtendedHeader& other) const;
|
||||||
|
bool operator!=(const ApplicationMetaExtendedHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getPatchId() const;
|
||||||
|
void setPatchId(uint64_t patch_id);
|
||||||
|
|
||||||
|
uint32_t getRequiredSystemVersion() const;
|
||||||
|
void setRequiredSystemVersion(uint32_t sys_ver);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "APPLICATION_META_EXTENDED_HEADER";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mPatchId;
|
||||||
|
uint32_t mRequiredSystemVersion;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
121
lib/libhac/include/nn/hac/ContentArchiveHeader.h
Normal file
121
lib/libhac/include/nn/hac/ContentArchiveHeader.h
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
#pragma once
|
||||||
|
#include <nn/hac/define/nca.h>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <fnd/List.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ContentArchiveHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct sPartitionEntry
|
||||||
|
{
|
||||||
|
byte_t header_index;
|
||||||
|
uint64_t offset;
|
||||||
|
uint64_t size;
|
||||||
|
fnd::sha::sSha256Hash fs_header_hash;
|
||||||
|
|
||||||
|
const sPartitionEntry& operator=(const sPartitionEntry& other)
|
||||||
|
{
|
||||||
|
header_index = other.header_index;
|
||||||
|
offset = other.offset;
|
||||||
|
size = other.size;
|
||||||
|
fs_header_hash = other.fs_header_hash;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const sPartitionEntry& other) const
|
||||||
|
{
|
||||||
|
return (header_index == other.header_index) \
|
||||||
|
&& (offset == other.offset) \
|
||||||
|
&& (size == other.size) \
|
||||||
|
&& (fs_header_hash == other.fs_header_hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const sPartitionEntry& other) const
|
||||||
|
{
|
||||||
|
return !operator==(other);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ContentArchiveHeader();
|
||||||
|
ContentArchiveHeader(const ContentArchiveHeader& other);
|
||||||
|
|
||||||
|
void operator=(const ContentArchiveHeader& other);
|
||||||
|
bool operator==(const ContentArchiveHeader& other) const;
|
||||||
|
bool operator!=(const ContentArchiveHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
byte_t getFormatVersion() const;
|
||||||
|
void setFormatVersion(byte_t ver);
|
||||||
|
|
||||||
|
nca::DistributionType getDistributionType() const;
|
||||||
|
void setDistributionType(nca::DistributionType type);
|
||||||
|
|
||||||
|
nca::ContentType getContentType() const;
|
||||||
|
void setContentType(nca::ContentType type);
|
||||||
|
|
||||||
|
byte_t getKeyGeneration() const;
|
||||||
|
void setKeyGeneration(byte_t gen);
|
||||||
|
|
||||||
|
byte_t getKeyAreaEncryptionKeyIndex() const;
|
||||||
|
void setKeyAreaEncryptionKeyIndex(byte_t index);
|
||||||
|
|
||||||
|
uint64_t getContentSize() const;
|
||||||
|
void setContentSize(uint64_t size);
|
||||||
|
|
||||||
|
uint64_t getProgramId() const;
|
||||||
|
void setProgramId(uint64_t program_id);
|
||||||
|
|
||||||
|
uint32_t getContentIndex() const;
|
||||||
|
void setContentIndex(uint32_t index);
|
||||||
|
|
||||||
|
uint32_t getSdkAddonVersion() const;
|
||||||
|
void setSdkAddonVersion(uint32_t version);
|
||||||
|
|
||||||
|
bool hasRightsId() const;
|
||||||
|
const byte_t* getRightsId() const;
|
||||||
|
void setRightsId(const byte_t* rights_id);
|
||||||
|
|
||||||
|
const fnd::List<sPartitionEntry>& getPartitionEntryList() const;
|
||||||
|
void setPartitionEntryList(const fnd::List<sPartitionEntry>& partition_entry_list);
|
||||||
|
|
||||||
|
const byte_t* getKeyArea() const;
|
||||||
|
void setKeyArea(const byte_t* key_area);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "CONTENT_ARCHIVE_HEADER";
|
||||||
|
|
||||||
|
// binary
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// data
|
||||||
|
byte_t mFormatVersion;
|
||||||
|
nca::DistributionType mDistributionType;
|
||||||
|
nca::ContentType mContentType;
|
||||||
|
byte_t mKeyGeneration;
|
||||||
|
byte_t mKaekIndex;
|
||||||
|
uint64_t mContentSize;
|
||||||
|
uint64_t mProgramId;
|
||||||
|
uint32_t mContentIndex;
|
||||||
|
uint32_t mSdkAddonVersion;
|
||||||
|
fnd::Vec<byte_t> mRightsId;
|
||||||
|
fnd::List<sPartitionEntry> mPartitionEntryList;
|
||||||
|
fnd::Vec<byte_t> mKeyArea;
|
||||||
|
|
||||||
|
uint64_t blockNumToSize(uint32_t block_num) const;
|
||||||
|
uint32_t sizeToBlockNum(uint64_t real_size) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/nca.h>
|
#include <nn/hac/define/nca.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class NcaUtils
|
class ContentArchiveUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nn::hac::nca::kSectorSize; }
|
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nn::hac::nca::kSectorSize; }
|
||||||
static void decryptNcaHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key);
|
static void decryptContentArchiveHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key);
|
||||||
static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation);
|
static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation);
|
||||||
static void getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr);
|
static void getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr);
|
||||||
};
|
};
|
59
lib/libhac/include/nn/hac/ContentInfo.h
Normal file
59
lib/libhac/include/nn/hac/ContentInfo.h
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ContentInfo :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ContentInfo();
|
||||||
|
ContentInfo(const ContentInfo& other);
|
||||||
|
|
||||||
|
void operator=(const ContentInfo& other);
|
||||||
|
bool operator==(const ContentInfo& other) const;
|
||||||
|
bool operator!=(const ContentInfo& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
const fnd::sha::sSha256Hash& getContentHash() const;
|
||||||
|
void setContentHash(const fnd::sha::sSha256Hash& hash);
|
||||||
|
|
||||||
|
const cnmt::sContentId& getContentId() const;
|
||||||
|
void setContentId(const cnmt::sContentId& content_id);
|
||||||
|
|
||||||
|
size_t getContentSize() const;
|
||||||
|
void setContentSize(size_t size);
|
||||||
|
|
||||||
|
cnmt::ContentType getContentType() const;
|
||||||
|
void setContentType(cnmt::ContentType type);
|
||||||
|
|
||||||
|
byte_t getIdOffset() const;
|
||||||
|
void setIdOffset(byte_t id_offset);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "CONTENT_INFO";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
fnd::sha::sSha256Hash mHash;
|
||||||
|
cnmt::sContentId mContentId;
|
||||||
|
size_t mSize;
|
||||||
|
cnmt::ContentType mType;
|
||||||
|
byte_t mIdOffset;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
113
lib/libhac/include/nn/hac/ContentMeta.h
Normal file
113
lib/libhac/include/nn/hac/ContentMeta.h
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <fnd/List.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
#include <nn/hac/ContentInfo.h>
|
||||||
|
#include <nn/hac/ContentMetaInfo.h>
|
||||||
|
#include <nn/hac/ApplicationMetaExtendedHeader.h>
|
||||||
|
#include <nn/hac/PatchMetaExtendedHeader.h>
|
||||||
|
#include <nn/hac/AddOnContentMetaExtendedHeader.h>
|
||||||
|
#include <nn/hac/DeltaMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ContentMeta :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ContentMeta();
|
||||||
|
ContentMeta(const ContentMeta& other);
|
||||||
|
|
||||||
|
void operator=(const ContentMeta& other);
|
||||||
|
bool operator==(const ContentMeta& other) const;
|
||||||
|
bool operator!=(const ContentMeta& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getTitleId() const;
|
||||||
|
void setTitleId(uint64_t title_id);
|
||||||
|
|
||||||
|
uint32_t getTitleVersion() const;
|
||||||
|
void setTitleVersion(uint32_t version);
|
||||||
|
|
||||||
|
cnmt::ContentMetaType getContentMetaType() const;
|
||||||
|
void setContentMetaType(cnmt::ContentMetaType type);
|
||||||
|
|
||||||
|
byte_t getAttributes() const;
|
||||||
|
void setAttributes(byte_t attributes);
|
||||||
|
|
||||||
|
uint32_t getRequiredDownloadSystemVersion() const;
|
||||||
|
void setRequiredDownloadSystemVersion(uint32_t version);
|
||||||
|
|
||||||
|
const ApplicationMetaExtendedHeader& getApplicationMetaExtendedHeader() const;
|
||||||
|
void setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
|
const PatchMetaExtendedHeader& getPatchMetaExtendedHeader() const;
|
||||||
|
void setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
|
const AddOnContentMetaExtendedHeader& getAddOnContentMetaExtendedHeader() const;
|
||||||
|
void setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
|
const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const;
|
||||||
|
void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
|
const fnd::List<ContentInfo>& getContentInfo() const;
|
||||||
|
void setContentInfo(const fnd::List<ContentInfo>& info);
|
||||||
|
|
||||||
|
const fnd::List<ContentMetaInfo>& getContentMetaInfo() const;
|
||||||
|
void setContentMetaInfo(const fnd::List<ContentMetaInfo>& info);
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& getExtendedData() const;
|
||||||
|
void setExtendedData(const fnd::Vec<byte_t>& data);
|
||||||
|
|
||||||
|
const cnmt::sDigest& getDigest() const;
|
||||||
|
void setDigest(const cnmt::sDigest& digest);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "CONTENT_META";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mTitleId;
|
||||||
|
uint32_t mTitleVersion;
|
||||||
|
cnmt::ContentMetaType mType;
|
||||||
|
byte_t mAttributes;
|
||||||
|
uint32_t mRequiredDownloadSystemVersion;
|
||||||
|
fnd::Vec<byte_t> mExtendedHeader;
|
||||||
|
|
||||||
|
ApplicationMetaExtendedHeader mApplicationMetaExtendedHeader;
|
||||||
|
PatchMetaExtendedHeader mPatchMetaExtendedHeader;
|
||||||
|
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
|
||||||
|
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
|
||||||
|
|
||||||
|
fnd::List<ContentInfo> mContentInfo;
|
||||||
|
fnd::List<ContentMetaInfo> mContentMetaInfo;
|
||||||
|
fnd::Vec<byte_t> mExtendedData;
|
||||||
|
cnmt::sDigest mDigest;
|
||||||
|
|
||||||
|
inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); }
|
||||||
|
inline size_t getContentInfoOffset(size_t exhdrSize) const { return getExtendedHeaderOffset() + exhdrSize; }
|
||||||
|
inline size_t getContentMetaInfoOffset(size_t exhdrSize, size_t contentInfoNum) const { return getContentInfoOffset(exhdrSize) + contentInfoNum * sizeof(sContentInfo); }
|
||||||
|
inline size_t getExtendedDataOffset(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum) const { return getContentMetaInfoOffset(exhdrSize, contentInfoNum) + contentMetaNum * sizeof(sContentMetaInfo); }
|
||||||
|
inline size_t getDigestOffset(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum, size_t exdataSize) const { return getExtendedDataOffset(exhdrSize, contentInfoNum, contentMetaNum) + exdataSize; }
|
||||||
|
inline size_t getTotalSize(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum, size_t exdataSize) const { return getDigestOffset(exhdrSize, contentInfoNum, contentMetaNum, exdataSize) + cnmt::kDigestLen; }
|
||||||
|
|
||||||
|
bool validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const;
|
||||||
|
size_t getExtendedDataSize(cnmt::ContentMetaType type, const byte_t* data) const;
|
||||||
|
void validateBinary(const byte_t* bytes, size_t len) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,254 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <cstring>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <fnd/List.h>
|
|
||||||
#include <nn/hac/cnmt.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class ContentMetaBinary :
|
|
||||||
public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct ContentInfo
|
|
||||||
{
|
|
||||||
fnd::sha::sSha256Hash hash;
|
|
||||||
byte_t nca_id[cnmt::kContentIdLen];
|
|
||||||
size_t size;
|
|
||||||
cnmt::ContentType type;
|
|
||||||
|
|
||||||
void operator=(const ContentInfo& other)
|
|
||||||
{
|
|
||||||
hash = other.hash;
|
|
||||||
memcpy(nca_id, other.nca_id, cnmt::kContentIdLen);
|
|
||||||
size = other.size;
|
|
||||||
type = other.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const ContentInfo& other) const
|
|
||||||
{
|
|
||||||
return (hash == other.hash) \
|
|
||||||
&& (memcmp(nca_id, other.nca_id, cnmt::kContentIdLen) == 0) \
|
|
||||||
&& (size == other.size) \
|
|
||||||
&& (type == other.type);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const ContentInfo& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ContentMetaInfo
|
|
||||||
{
|
|
||||||
uint64_t id;
|
|
||||||
uint32_t version;
|
|
||||||
cnmt::ContentMetaType type;
|
|
||||||
byte_t attributes;
|
|
||||||
|
|
||||||
void operator=(const ContentMetaInfo& other)
|
|
||||||
{
|
|
||||||
id = other.id;
|
|
||||||
version = other.version;
|
|
||||||
type = other.type;
|
|
||||||
attributes = other.attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const ContentMetaInfo& other) const
|
|
||||||
{
|
|
||||||
return (id == other.id) \
|
|
||||||
&& (version == other.version) \
|
|
||||||
&& (type == other.type) \
|
|
||||||
&& (attributes == other.attributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const ContentMetaInfo& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ApplicationMetaExtendedHeader
|
|
||||||
{
|
|
||||||
uint64_t patch_id;
|
|
||||||
uint32_t required_system_version;
|
|
||||||
|
|
||||||
void operator=(const ApplicationMetaExtendedHeader& other)
|
|
||||||
{
|
|
||||||
patch_id = other.patch_id;
|
|
||||||
required_system_version = other.required_system_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const ApplicationMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return (patch_id == other.patch_id) \
|
|
||||||
&& (required_system_version == other.required_system_version);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const ApplicationMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PatchMetaExtendedHeader
|
|
||||||
{
|
|
||||||
uint64_t application_id;
|
|
||||||
uint32_t required_system_version;
|
|
||||||
|
|
||||||
void operator=(const PatchMetaExtendedHeader& other)
|
|
||||||
{
|
|
||||||
application_id = other.application_id;
|
|
||||||
required_system_version = other.required_system_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const PatchMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return (application_id == other.application_id) \
|
|
||||||
&& (required_system_version == other.required_system_version);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const PatchMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct AddOnContentMetaExtendedHeader
|
|
||||||
{
|
|
||||||
uint64_t application_id;
|
|
||||||
uint32_t required_application_version;
|
|
||||||
|
|
||||||
void operator=(const AddOnContentMetaExtendedHeader& other)
|
|
||||||
{
|
|
||||||
application_id = other.application_id;
|
|
||||||
required_application_version = other.required_application_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const AddOnContentMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return (application_id == other.application_id) \
|
|
||||||
&& (required_application_version == other.required_application_version);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const AddOnContentMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DeltaMetaExtendedHeader
|
|
||||||
{
|
|
||||||
uint64_t application_id;
|
|
||||||
|
|
||||||
void operator=(const DeltaMetaExtendedHeader& other)
|
|
||||||
{
|
|
||||||
application_id = other.application_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const DeltaMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return (application_id == other.application_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const DeltaMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ContentMetaBinary();
|
|
||||||
ContentMetaBinary(const ContentMetaBinary& other);
|
|
||||||
|
|
||||||
void operator=(const ContentMetaBinary& other);
|
|
||||||
bool operator==(const ContentMetaBinary& other) const;
|
|
||||||
bool operator!=(const ContentMetaBinary& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
uint64_t getTitleId() const;
|
|
||||||
void setTitleId(uint64_t title_id);
|
|
||||||
|
|
||||||
uint32_t getTitleVersion() const;
|
|
||||||
void setTitleVersion(uint32_t version);
|
|
||||||
|
|
||||||
cnmt::ContentMetaType getType() const;
|
|
||||||
void setType(cnmt::ContentMetaType type);
|
|
||||||
|
|
||||||
byte_t getAttributes() const;
|
|
||||||
void setAttributes(byte_t attributes);
|
|
||||||
|
|
||||||
uint32_t getRequiredDownloadSystemVersion() const;
|
|
||||||
void setRequiredDownloadSystemVersion(uint32_t version);
|
|
||||||
|
|
||||||
const ApplicationMetaExtendedHeader& getApplicationMetaExtendedHeader() const;
|
|
||||||
void setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr);
|
|
||||||
|
|
||||||
const PatchMetaExtendedHeader& getPatchMetaExtendedHeader() const;
|
|
||||||
void setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr);
|
|
||||||
|
|
||||||
const AddOnContentMetaExtendedHeader& getAddOnContentMetaExtendedHeader() const;
|
|
||||||
void setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr);
|
|
||||||
|
|
||||||
const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const;
|
|
||||||
void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr);
|
|
||||||
|
|
||||||
const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& getContentInfo() const;
|
|
||||||
void setContentInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& info);
|
|
||||||
|
|
||||||
const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& getContentMetaInfo() const;
|
|
||||||
void setContentMetaInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& info);
|
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& getExtendedData() const;
|
|
||||||
void setExtendedData(const fnd::Vec<byte_t>& data);
|
|
||||||
|
|
||||||
const nn::hac::sDigest& getDigest() const;
|
|
||||||
void setDigest(const nn::hac::sDigest& digest);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "CONTENT_META_BINARY";
|
|
||||||
|
|
||||||
// binary blob
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
uint64_t mTitleId;
|
|
||||||
uint32_t mTitleVersion;
|
|
||||||
cnmt::ContentMetaType mType;
|
|
||||||
byte_t mAttributes;
|
|
||||||
uint32_t mRequiredDownloadSystemVersion;
|
|
||||||
fnd::Vec<byte_t> mExtendedHeader;
|
|
||||||
|
|
||||||
ApplicationMetaExtendedHeader mApplicationMetaExtendedHeader;
|
|
||||||
PatchMetaExtendedHeader mPatchMetaExtendedHeader;
|
|
||||||
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
|
|
||||||
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
|
|
||||||
|
|
||||||
fnd::List<nn::hac::ContentMetaBinary::ContentInfo> mContentInfo;
|
|
||||||
fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo> mContentMetaInfo;
|
|
||||||
fnd::Vec<byte_t> mExtendedData;
|
|
||||||
nn::hac::sDigest mDigest;
|
|
||||||
|
|
||||||
inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); }
|
|
||||||
inline size_t getContentInfoOffset(size_t exhdrSize) const { return getExtendedHeaderOffset() + exhdrSize; }
|
|
||||||
inline size_t getContentMetaInfoOffset(size_t exhdrSize, size_t contentInfoNum) const { return getContentInfoOffset(exhdrSize) + contentInfoNum * sizeof(sContentInfo); }
|
|
||||||
inline size_t getExtendedDataOffset(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum) const { return getContentMetaInfoOffset(exhdrSize, contentInfoNum) + contentMetaNum * sizeof(sContentMetaInfo); }
|
|
||||||
inline size_t getDigestOffset(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum, size_t exdataSize) const { return getExtendedDataOffset(exhdrSize, contentInfoNum, contentMetaNum) + exdataSize; }
|
|
||||||
inline size_t getTotalSize(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum, size_t exdataSize) const { return getDigestOffset(exhdrSize, contentInfoNum, contentMetaNum, exdataSize) + cnmt::kDigestLen; }
|
|
||||||
|
|
||||||
bool validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const;
|
|
||||||
size_t getExtendedDataSize(cnmt::ContentMetaType type, const byte_t* data) const;
|
|
||||||
void validateBinary(const byte_t* bytes, size_t len) const;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
55
lib/libhac/include/nn/hac/ContentMetaInfo.h
Normal file
55
lib/libhac/include/nn/hac/ContentMetaInfo.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ContentMetaInfo :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ContentMetaInfo();
|
||||||
|
ContentMetaInfo(const ContentMetaInfo& other);
|
||||||
|
|
||||||
|
void operator=(const ContentMetaInfo& other);
|
||||||
|
bool operator==(const ContentMetaInfo& other) const;
|
||||||
|
bool operator!=(const ContentMetaInfo& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getTitleId() const;
|
||||||
|
void setTitleId(uint64_t title_id);
|
||||||
|
|
||||||
|
uint32_t getTitleVersion() const;
|
||||||
|
void setTitleVersion(uint32_t ver);
|
||||||
|
|
||||||
|
cnmt::ContentMetaType getContentMetaType() const;
|
||||||
|
void setContentMetaType(cnmt::ContentMetaType type);
|
||||||
|
|
||||||
|
byte_t getAttributes() const;
|
||||||
|
void setAttributes(byte_t attr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "CONTENT_META_INFO";
|
||||||
|
|
||||||
|
// byte model
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mTitleId;
|
||||||
|
uint32_t mTitleVersion;
|
||||||
|
cnmt::ContentMetaType mType;
|
||||||
|
byte_t mAttributes;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
47
lib/libhac/include/nn/hac/DeltaMetaExtendedHeader.h
Normal file
47
lib/libhac/include/nn/hac/DeltaMetaExtendedHeader.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class DeltaMetaExtendedHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DeltaMetaExtendedHeader();
|
||||||
|
DeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& other);
|
||||||
|
|
||||||
|
void operator=(const DeltaMetaExtendedHeader& other);
|
||||||
|
bool operator==(const DeltaMetaExtendedHeader& other) const;
|
||||||
|
bool operator!=(const DeltaMetaExtendedHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getApplicationId() const;
|
||||||
|
void setApplicationId(uint64_t application_id);
|
||||||
|
|
||||||
|
uint32_t getExtendedDataSize() const;
|
||||||
|
void setExtendedDataSize(uint32_t size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "DELTA_META_EXTENDED_HEADER";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mApplicationId;
|
||||||
|
uint32_t mExtendedDataSize;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/fac.h>
|
#include <nn/hac/define/fac.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class FileSystemAccessControlBinary : public fnd::ISerialisable
|
class FileSystemAccessControl :
|
||||||
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sSaveDataOwnerId
|
struct sSaveDataOwnerId
|
||||||
|
@ -35,14 +36,14 @@ namespace hac
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
FileSystemAccessControlBinary();
|
FileSystemAccessControl();
|
||||||
FileSystemAccessControlBinary(const FileSystemAccessControlBinary& other);
|
FileSystemAccessControl(const FileSystemAccessControl& other);
|
||||||
|
|
||||||
void operator=(const FileSystemAccessControlBinary& other);
|
void operator=(const FileSystemAccessControl& other);
|
||||||
bool operator==(const FileSystemAccessControlBinary& other) const;
|
bool operator==(const FileSystemAccessControl& other) const;
|
||||||
bool operator!=(const FileSystemAccessControlBinary& other) const;
|
bool operator!=(const FileSystemAccessControl& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
@ -62,7 +63,7 @@ namespace hac
|
||||||
const fnd::List<sSaveDataOwnerId>& getSaveDataOwnerIdList() const;
|
const fnd::List<sSaveDataOwnerId>& getSaveDataOwnerIdList() const;
|
||||||
void setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list);
|
void setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "FILE_SYSTEM_ACCESS_CONTROL_BINARY";
|
const std::string kModuleName = "FILE_SYSTEM_ACCESS_CONTROL";
|
||||||
|
|
||||||
// raw data
|
// raw data
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
|
@ -1,24 +1,24 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/xci.h>
|
#include <nn/hac/define/gc.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class XciHeader :
|
class GameCardHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XciHeader();
|
GameCardHeader();
|
||||||
XciHeader(const XciHeader& other);
|
GameCardHeader(const GameCardHeader& other);
|
||||||
|
|
||||||
void operator=(const XciHeader& other);
|
void operator=(const GameCardHeader& other);
|
||||||
bool operator==(const XciHeader& other) const;
|
bool operator==(const GameCardHeader& other) const;
|
||||||
bool operator!=(const XciHeader& other) const;
|
bool operator!=(const GameCardHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
@ -86,7 +86,7 @@ namespace hac
|
||||||
void setUppId(uint64_t id);
|
void setUppId(uint64_t id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "XCI_HEADER";
|
const std::string kModuleName = "GAMECARD_HEADER";
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
@ -111,7 +111,7 @@ namespace hac
|
||||||
uint32_t mSelKey;
|
uint32_t mSelKey;
|
||||||
uint32_t mLimAreaPage;
|
uint32_t mLimAreaPage;
|
||||||
|
|
||||||
// Encrypted Data
|
// Encrypted/Extended Data
|
||||||
uint32_t mFwVersion[2];
|
uint32_t mFwVersion[2];
|
||||||
uint32_t mAccCtrl1;
|
uint32_t mAccCtrl1;
|
||||||
uint32_t mWait1TimeRead;
|
uint32_t mWait1TimeRead;
|
|
@ -1,15 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/xci.h>
|
#include <nn/hac/define/gc.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class XciUtils
|
class GameCardUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static inline uint64_t blockToAddr(uint32_t block) { return ((uint64_t)block) << 9; }
|
static inline uint64_t blockToAddr(uint32_t block) { return ((uint64_t)block) << 9; }
|
||||||
static void getXciHeaderAesIv(const nn::hac::sXciHeader* hdr, byte_t* iv);
|
static void getXciHeaderAesIv(const nn::hac::sGcHeader* hdr, byte_t* iv);
|
||||||
static void decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key);
|
static void decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key);
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/hierarchicalintegrity.h>
|
#include <nn/hac/define/hierarchicalintegrity.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ namespace nn
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class HierarchicalIntegrityHeader :
|
class HierarchicalIntegrityHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sLayer
|
struct sLayer
|
||||||
|
@ -43,7 +43,7 @@ namespace hac
|
||||||
bool operator==(const HierarchicalIntegrityHeader& other) const;
|
bool operator==(const HierarchicalIntegrityHeader& other) const;
|
||||||
bool operator!=(const HierarchicalIntegrityHeader& other) const;
|
bool operator!=(const HierarchicalIntegrityHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/hierarchicalsha256.h>
|
#include <nn/hac/define/hierarchicalsha256.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
|
@ -8,7 +8,7 @@ namespace nn
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class HierarchicalSha256Header :
|
class HierarchicalSha256Header :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sLayer
|
struct sLayer
|
||||||
|
@ -40,7 +40,7 @@ namespace hac
|
||||||
bool operator==(const HierarchicalSha256Header& other) const;
|
bool operator==(const HierarchicalSha256Header& other) const;
|
||||||
bool operator!=(const HierarchicalSha256Header& other) const;
|
bool operator!=(const HierarchicalSha256Header& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/ThreadInfoHandler.h>
|
#include <nn/hac/ThreadInfoHandler.h>
|
||||||
#include <nn/hac/SystemCallHandler.h>
|
#include <nn/hac/SystemCallHandler.h>
|
||||||
|
@ -16,18 +16,18 @@ namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class KernelCapabilityBinary :
|
class KernelCapabilityControl :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KernelCapabilityBinary();
|
KernelCapabilityControl();
|
||||||
KernelCapabilityBinary(const KernelCapabilityBinary& other);
|
KernelCapabilityControl(const KernelCapabilityControl& other);
|
||||||
|
|
||||||
void operator=(const KernelCapabilityBinary& other);
|
void operator=(const KernelCapabilityControl& other);
|
||||||
bool operator==(const KernelCapabilityBinary& other) const;
|
bool operator==(const KernelCapabilityControl& other) const;
|
||||||
bool operator!=(const KernelCapabilityBinary& other) const;
|
bool operator!=(const KernelCapabilityControl& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
virtual const fnd::Vec<byte_t>& getBytes() const;
|
virtual const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
@ -59,7 +59,7 @@ namespace hac
|
||||||
MiscFlagsHandler& getMiscFlags();
|
MiscFlagsHandler& getMiscFlags();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "KC_BINARY";
|
const std::string kModuleName = "KERNEL_CAPABILITY_CONTROL";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/kc.h>
|
#include <nn/hac/define/kc.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/hac/meta.h>
|
#include <nn/hac/define/meta.h>
|
||||||
#include <nn/hac/AccessControlInfoBinary.h>
|
#include <nn/hac/AccessControlInfo.h>
|
||||||
#include <nn/hac/AccessControlInfoDescBinary.h>
|
#include <nn/hac/AccessControlInfoDesc.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class MetaBinary :
|
class Meta :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MetaBinary();
|
Meta();
|
||||||
MetaBinary(const MetaBinary& other);
|
Meta(const Meta& other);
|
||||||
|
|
||||||
void operator=(const MetaBinary& other);
|
void operator=(const Meta& other);
|
||||||
bool operator==(const MetaBinary& other) const;
|
bool operator==(const Meta& other) const;
|
||||||
bool operator!=(const MetaBinary& other) const;
|
bool operator!=(const Meta& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
@ -53,13 +53,13 @@ namespace hac
|
||||||
const std::string& getProductCode() const;
|
const std::string& getProductCode() const;
|
||||||
void setProductCode(const std::string& product_code);
|
void setProductCode(const std::string& product_code);
|
||||||
|
|
||||||
const AccessControlInfoBinary& getAci() const;
|
const AccessControlInfo& getAci() const;
|
||||||
void setAci(const AccessControlInfoBinary& aci);
|
void setAci(const AccessControlInfo& aci);
|
||||||
|
|
||||||
const AccessControlInfoDescBinary& getAcid() const;
|
const AccessControlInfoDesc& getAcid() const;
|
||||||
void setAcid(const AccessControlInfoDescBinary& acid);
|
void setAcid(const AccessControlInfoDesc& acid);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "META_BINARY";
|
const std::string kModuleName = "META";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
@ -73,8 +73,8 @@ namespace hac
|
||||||
uint32_t mMainThreadStackSize;
|
uint32_t mMainThreadStackSize;
|
||||||
std::string mName;
|
std::string mName;
|
||||||
std::string mProductCode;
|
std::string mProductCode;
|
||||||
AccessControlInfoBinary mAci;
|
AccessControlInfo mAci;
|
||||||
AccessControlInfoDescBinary mAcid;
|
AccessControlInfoDesc mAcid;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,115 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <nn/hac/nca.h>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <fnd/List.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class NcaHeader :
|
|
||||||
public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum FormatVersion
|
|
||||||
{
|
|
||||||
NCA2_FORMAT,
|
|
||||||
NCA3_FORMAT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sPartition
|
|
||||||
{
|
|
||||||
byte_t index;
|
|
||||||
uint64_t offset;
|
|
||||||
uint64_t size;
|
|
||||||
fnd::sha::sSha256Hash hash;
|
|
||||||
|
|
||||||
const sPartition& operator=(const sPartition& other)
|
|
||||||
{
|
|
||||||
index = other.index;
|
|
||||||
offset = other.offset;
|
|
||||||
size = other.size;
|
|
||||||
hash = other.hash;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const sPartition& other) const
|
|
||||||
{
|
|
||||||
return (index == other.index) \
|
|
||||||
&& (offset == other.offset) \
|
|
||||||
&& (size == other.size) \
|
|
||||||
&& (hash == other.hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const sPartition& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NcaHeader();
|
|
||||||
NcaHeader(const NcaHeader& other);
|
|
||||||
|
|
||||||
void operator=(const NcaHeader& other);
|
|
||||||
bool operator==(const NcaHeader& other) const;
|
|
||||||
bool operator!=(const NcaHeader& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
FormatVersion getFormatVersion() const;
|
|
||||||
void setFormatVersion(FormatVersion ver);
|
|
||||||
nca::DistributionType getDistributionType() const;
|
|
||||||
void setDistributionType(nca::DistributionType type);
|
|
||||||
nca::ContentType getContentType() const;
|
|
||||||
void setContentType(nca::ContentType type);
|
|
||||||
byte_t getKeyGeneration() const;
|
|
||||||
void setKeyGeneration(byte_t gen);
|
|
||||||
byte_t getKaekIndex() const;
|
|
||||||
void setKaekIndex(byte_t index);
|
|
||||||
uint64_t getContentSize() const;
|
|
||||||
void setContentSize(uint64_t size);
|
|
||||||
uint64_t getProgramId() const;
|
|
||||||
void setProgramId(uint64_t program_id);
|
|
||||||
uint32_t getContentIndex() const;
|
|
||||||
void setContentIndex(uint32_t index);
|
|
||||||
uint32_t getSdkAddonVersion() const;
|
|
||||||
void setSdkAddonVersion(uint32_t version);
|
|
||||||
bool hasRightsId() const;
|
|
||||||
const byte_t* getRightsId() const;
|
|
||||||
void setRightsId(const byte_t* rights_id);
|
|
||||||
const fnd::List<sPartition>& getPartitions() const;
|
|
||||||
void setPartitions(const fnd::List<sPartition>& partitions);
|
|
||||||
const fnd::List<fnd::aes::sAes128Key>& getEncAesKeys() const;
|
|
||||||
void setEncAesKeys(const fnd::List<fnd::aes::sAes128Key>& keys);
|
|
||||||
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "NCA_HEADER";
|
|
||||||
|
|
||||||
// binary
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// data
|
|
||||||
FormatVersion mFormatVersion;
|
|
||||||
nca::DistributionType mDistributionType;
|
|
||||||
nca::ContentType mContentType;
|
|
||||||
byte_t mKeyGeneration;
|
|
||||||
byte_t mKaekIndex;
|
|
||||||
uint64_t mContentSize;
|
|
||||||
uint64_t mProgramId;
|
|
||||||
uint32_t mContentIndex;
|
|
||||||
uint32_t mSdkAddonVersion;
|
|
||||||
byte_t mRightsId[nca::kRightsIdLen];
|
|
||||||
fnd::List<sPartition> mPartitions;
|
|
||||||
fnd::List<fnd::aes::sAes128Key> mEncAesKeys;
|
|
||||||
|
|
||||||
uint64_t blockNumToSize(uint32_t block_num) const;
|
|
||||||
uint32_t sizeToBlockNum(uint64_t real_size) const;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/nro.h>
|
#include <nn/hac/define/nro.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
|
@ -9,7 +9,7 @@ namespace nn
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class NroHeader :
|
class NroHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sRoCrt
|
struct sRoCrt
|
||||||
|
@ -82,7 +82,7 @@ namespace hac
|
||||||
bool operator==(const NroHeader& other) const;
|
bool operator==(const NroHeader& other) const;
|
||||||
bool operator!=(const NroHeader& other) const;
|
bool operator!=(const NroHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/nso.h>
|
#include <nn/hac/define/nso.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
|
@ -9,7 +9,7 @@ namespace nn
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class NsoHeader :
|
class NsoHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sModuleId
|
struct sModuleId
|
||||||
|
@ -94,7 +94,7 @@ namespace hac
|
||||||
bool operator==(const NsoHeader& other) const;
|
bool operator==(const NsoHeader& other) const;
|
||||||
bool operator!=(const NsoHeader& other) const;
|
bool operator!=(const NsoHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/pfs.h>
|
#include <nn/hac/define/pfs.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class PfsHeader :
|
class PartitionFsHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum FsType
|
enum FsType
|
||||||
|
@ -62,14 +62,14 @@ namespace hac
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PfsHeader();
|
PartitionFsHeader();
|
||||||
PfsHeader(const PfsHeader& other);
|
PartitionFsHeader(const PartitionFsHeader& other);
|
||||||
|
|
||||||
void operator=(const PfsHeader& other);
|
void operator=(const PartitionFsHeader& other);
|
||||||
bool operator==(const PfsHeader& other) const;
|
bool operator==(const PartitionFsHeader& other) const;
|
||||||
bool operator!=(const PfsHeader& other) const;
|
bool operator!=(const PartitionFsHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
@ -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);
|
void addFile(const std::string& name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "PFS_HEADER";
|
const std::string kModuleName = "PARTITIONFS_HEADER";
|
||||||
|
|
||||||
// binary blob
|
// binary blob
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
51
lib/libhac/include/nn/hac/PatchMetaExtendedHeader.h
Normal file
51
lib/libhac/include/nn/hac/PatchMetaExtendedHeader.h
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class PatchMetaExtendedHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PatchMetaExtendedHeader();
|
||||||
|
PatchMetaExtendedHeader(const PatchMetaExtendedHeader& other);
|
||||||
|
|
||||||
|
void operator=(const PatchMetaExtendedHeader& other);
|
||||||
|
bool operator==(const PatchMetaExtendedHeader& other) const;
|
||||||
|
bool operator!=(const PatchMetaExtendedHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getApplicationId() const;
|
||||||
|
void setApplicationId(uint64_t application_id);
|
||||||
|
|
||||||
|
uint32_t getRequiredSystemVersion() const;
|
||||||
|
void setRequiredSystemVersion(uint32_t sys_ver);
|
||||||
|
|
||||||
|
uint32_t getExtendedDataSize() const;
|
||||||
|
void setExtendedDataSize(uint32_t size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "PATCH_META_EXTENDED_HEADER";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mApplicationId;
|
||||||
|
uint32_t mRequiredSystemVersion;
|
||||||
|
uint32_t mExtendedDataSize;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
42
lib/libhac/include/nn/hac/ServiceAccessControl.h
Normal file
42
lib/libhac/include/nn/hac/ServiceAccessControl.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <fnd/List.h>
|
||||||
|
#include <nn/hac/ServiceAccessControlEntry.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ServiceAccessControl :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ServiceAccessControl();
|
||||||
|
ServiceAccessControl(const ServiceAccessControl& other);
|
||||||
|
|
||||||
|
void operator=(const ServiceAccessControl& other);
|
||||||
|
bool operator==(const ServiceAccessControl& other) const;
|
||||||
|
bool operator!=(const ServiceAccessControl& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
const fnd::List<ServiceAccessControlEntry>& getServiceList() const;
|
||||||
|
void setServiceList(const fnd::List<ServiceAccessControlEntry>& list);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "SERVICE_ACCESS_CONTROL";
|
||||||
|
|
||||||
|
// raw binary
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
fnd::List<ServiceAccessControlEntry> mServices;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,42 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <fnd/List.h>
|
|
||||||
#include <nn/hac/ServiceAccessControlEntry.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class ServiceAccessControlBinary :
|
|
||||||
public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ServiceAccessControlBinary();
|
|
||||||
ServiceAccessControlBinary(const ServiceAccessControlBinary& other);
|
|
||||||
|
|
||||||
void operator=(const ServiceAccessControlBinary& other);
|
|
||||||
bool operator==(const ServiceAccessControlBinary& other) const;
|
|
||||||
bool operator!=(const ServiceAccessControlBinary& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
const fnd::List<ServiceAccessControlEntry>& getServiceList() const;
|
|
||||||
void addService(const ServiceAccessControlEntry& service);
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "SERVICE_ACCESS_CONTROL_BINARY";
|
|
||||||
|
|
||||||
// raw binary
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
fnd::List<ServiceAccessControlEntry> mServices;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class ServiceAccessControlEntry :
|
class ServiceAccessControlEntry :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServiceAccessControlEntry();
|
ServiceAccessControlEntry();
|
||||||
|
@ -19,7 +19,7 @@ namespace hac
|
||||||
bool operator==(const ServiceAccessControlEntry& other) const;
|
bool operator==(const ServiceAccessControlEntry& other) const;
|
||||||
bool operator!=(const ServiceAccessControlEntry& other) const;
|
bool operator!=(const ServiceAccessControlEntry& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -46,10 +46,58 @@ namespace hac
|
||||||
ATTRIBUTE_REBOOTLESS
|
ATTRIBUTE_REBOOTLESS
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t kRequiredSystemVersion = 335544320;
|
|
||||||
static const uint32_t kDefaultVersion = 335545344;
|
|
||||||
static const size_t kContentIdLen = 0x10;
|
static const size_t kContentIdLen = 0x10;
|
||||||
static const size_t kDigestLen = 0x20;
|
static const size_t kDigestLen = 0x20;
|
||||||
|
|
||||||
|
struct sContentId
|
||||||
|
{
|
||||||
|
byte_t data[kContentIdLen];
|
||||||
|
|
||||||
|
void set(const byte_t content_id[kContentIdLen])
|
||||||
|
{
|
||||||
|
memcpy(this->data, content_id, kContentIdLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator=(const sContentId& other)
|
||||||
|
{
|
||||||
|
set(other.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const sContentId& other) const
|
||||||
|
{
|
||||||
|
return memcmp(this->data, other.data, kContentIdLen) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const sContentId& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sDigest
|
||||||
|
{
|
||||||
|
byte_t data[kDigestLen];
|
||||||
|
|
||||||
|
void set(const byte_t digest[kDigestLen])
|
||||||
|
{
|
||||||
|
memcpy(this->data, digest, kDigestLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator=(const sDigest& other)
|
||||||
|
{
|
||||||
|
set(other.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const sDigest& other) const
|
||||||
|
{
|
||||||
|
return memcmp(this->data, other.data, kDigestLen) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const sDigest& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +132,7 @@ namespace hac
|
||||||
struct sContentInfo
|
struct sContentInfo
|
||||||
{
|
{
|
||||||
fnd::sha::sSha256Hash content_hash;
|
fnd::sha::sSha256Hash content_hash;
|
||||||
byte_t content_id[cnmt::kContentIdLen];
|
cnmt::sContentId content_id;
|
||||||
le_uint32_t size_lower;
|
le_uint32_t size_lower;
|
||||||
le_uint16_t size_higher;
|
le_uint16_t size_higher;
|
||||||
byte_t content_type;
|
byte_t content_type;
|
||||||
|
@ -128,11 +176,6 @@ namespace hac
|
||||||
le_uint32_t extended_data_size;
|
le_uint32_t extended_data_size;
|
||||||
byte_t reserved[4];
|
byte_t reserved[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sDigest
|
|
||||||
{
|
|
||||||
byte_t data[cnmt::kDigestLen];
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -4,15 +4,15 @@
|
||||||
#include <fnd/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace xci
|
namespace gc
|
||||||
{
|
{
|
||||||
static const uint32_t kXciStructMagic = _MAKE_STRUCT_MAGIC_U32("HEAD");
|
static const uint32_t kGcHeaderStructMagic = _MAKE_STRUCT_MAGIC_U32("HEAD");
|
||||||
static const uint32_t kHeaderEncOffset = 0x90;
|
static const uint32_t kHeaderEncOffset = 0x90;
|
||||||
static const uint32_t kHeaderEncSize = 0x70;
|
static const uint32_t kHeaderEncSize = 0x70;
|
||||||
static const uint32_t kPageSize = 0x200;
|
static const uint32_t kPageSize = 0x200;
|
||||||
|
@ -68,7 +68,7 @@ namespace hac
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sXciHeader
|
struct sGcHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t rom_area_start_page;
|
le_uint32_t rom_area_start_page;
|
||||||
|
@ -99,16 +99,16 @@ namespace hac
|
||||||
le_uint32_t fw_mode;
|
le_uint32_t fw_mode;
|
||||||
le_uint32_t upp_version;
|
le_uint32_t upp_version;
|
||||||
byte_t reserved_01[0x4];
|
byte_t reserved_01[0x4];
|
||||||
byte_t upp_hash[xci::kUppHashLen];
|
byte_t upp_hash[gc::kUppHashLen];
|
||||||
le_uint64_t upp_id;
|
le_uint64_t upp_id;
|
||||||
byte_t reserved_02[0x38];
|
byte_t reserved_02[0x38];
|
||||||
// END ENCRYPTION
|
// END ENCRYPTION
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sXciHeaderPage
|
struct sGcHeaderPage
|
||||||
{
|
{
|
||||||
byte_t signature[fnd::rsa::kRsa2048Size];
|
byte_t signature[fnd::rsa::kRsa2048Size];
|
||||||
sXciHeader header;
|
sGcHeader header;
|
||||||
}; // sizeof() = 512 (1 page)
|
}; // sizeof() = 512 (1 page)
|
||||||
|
|
||||||
struct sInitialData
|
struct sInitialData
|
||||||
|
@ -123,9 +123,9 @@ namespace hac
|
||||||
struct sKeyDataArea
|
struct sKeyDataArea
|
||||||
{
|
{
|
||||||
sInitialData initial_data; // AES128-CCM encrypted {titlekey[16]}
|
sInitialData initial_data; // AES128-CCM encrypted {titlekey[16]}
|
||||||
byte_t encrypted_00[xci::kPageSize * 6]; // AES128-CTR encrypted {titlekey[16]}
|
byte_t encrypted_00[gc::kPageSize * 6]; // AES128-CTR encrypted {titlekey[16]}
|
||||||
byte_t encrypted_00_aesctr_data[fnd::rsa::kRsa2048Size]; // RSA2048-OAEP-SHA256 encrypted AES-CTR data used for encrypted_00 {key[16],iv[16]}
|
byte_t encrypted_00_aesctr_data[fnd::rsa::kRsa2048Size]; // RSA2048-OAEP-SHA256 encrypted AES-CTR data used for encrypted_00 {key[16],iv[16]}
|
||||||
byte_t reserved[xci::kPageSize - fnd::rsa::kRsa2048Size];
|
byte_t reserved[gc::kPageSize - fnd::rsa::kRsa2048Size];
|
||||||
}; // sizeof() = 512*8 (8 pages)
|
}; // sizeof() = 512*8 (8 pages)
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -3,7 +3,7 @@
|
||||||
#include <fnd/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
|
@ -17,17 +17,24 @@ namespace hac
|
||||||
static const size_t kPartitionNum = 4;
|
static const size_t kPartitionNum = 4;
|
||||||
static const size_t kHeaderSectorNum = 6;
|
static const size_t kHeaderSectorNum = 6;
|
||||||
static const size_t kHeaderSize = kSectorSize * kHeaderSectorNum;
|
static const size_t kHeaderSize = kSectorSize * kHeaderSectorNum;
|
||||||
static const size_t kAesKeyNum = 16;
|
|
||||||
static const size_t kRightsIdLen = 0x10;
|
static const size_t kRightsIdLen = 0x10;
|
||||||
|
static const size_t kKeyAreaSize = 0x100;
|
||||||
|
static const size_t kKeyAreaKeyNum = kKeyAreaSize / fnd::aes::kAes128KeySize;
|
||||||
static const size_t kKeyAreaEncryptionKeyNum = 3;
|
static const size_t kKeyAreaEncryptionKeyNum = 3;
|
||||||
static const size_t kFsHeaderHashSuperblockLen = 0x138;
|
static const size_t kFsHeaderHashSuperblockLen = 0x138;
|
||||||
static const uint16_t kDefaultFsHeaderVersion = 2;
|
static const uint16_t kDefaultFsHeaderVersion = 2;
|
||||||
|
|
||||||
enum ProgramPartitionId
|
enum HeaderFormatVersion
|
||||||
{
|
{
|
||||||
PARTITION_CODE,
|
FORMAT_NCA2 = 2,
|
||||||
PARTITION_DATA,
|
FORMAT_NCA3 = 3
|
||||||
PARTITION_LOGO,
|
};
|
||||||
|
|
||||||
|
enum ProgramContentPartitionIndex
|
||||||
|
{
|
||||||
|
PARTITION_CODE = 0,
|
||||||
|
PARTITION_DATA = 1,
|
||||||
|
PARTITION_LOGO = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DistributionType
|
enum DistributionType
|
||||||
|
@ -87,7 +94,7 @@ namespace hac
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sNcaHeader
|
struct sContentArchiveHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
byte_t distribution_type;
|
byte_t distribution_type;
|
||||||
|
@ -101,15 +108,15 @@ namespace hac
|
||||||
byte_t key_generation_2;
|
byte_t key_generation_2;
|
||||||
byte_t reserved_2[0xf];
|
byte_t reserved_2[0xf];
|
||||||
byte_t rights_id[nca::kRightsIdLen];
|
byte_t rights_id[nca::kRightsIdLen];
|
||||||
struct sNcaSection
|
struct sPartitionEntry
|
||||||
{
|
{
|
||||||
le_uint32_t start; // block units
|
le_uint32_t start_blk; // block units
|
||||||
le_uint32_t end; // block units
|
le_uint32_t end_blk; // block units
|
||||||
byte_t enabled;
|
byte_t enabled;
|
||||||
byte_t reserved[7];
|
byte_t reserved[7];
|
||||||
} partition[nca::kPartitionNum];
|
} partition_entry[nca::kPartitionNum];
|
||||||
fnd::sha::sSha256Hash partition_hash[nca::kPartitionNum];
|
fnd::sha::sSha256Hash fs_header_hash[nca::kPartitionNum];
|
||||||
fnd::aes::sAes128Key enc_aes_key[nca::kAesKeyNum];
|
byte_t key_area[nca::kKeyAreaSize];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNcaFsHeader
|
struct sNcaFsHeader
|
||||||
|
@ -124,11 +131,11 @@ namespace hac
|
||||||
byte_t reserved_1[0xB8];
|
byte_t reserved_1[0xB8];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNcaHeaderBlock
|
struct sContentArchiveHeaderBlock
|
||||||
{
|
{
|
||||||
byte_t signature_main[fnd::rsa::kRsa2048Size];
|
byte_t signature_main[fnd::rsa::kRsa2048Size];
|
||||||
byte_t signature_acid[fnd::rsa::kRsa2048Size];
|
byte_t signature_acid[fnd::rsa::kRsa2048Size];
|
||||||
sNcaHeader header;
|
sContentArchiveHeader header;
|
||||||
sNcaFsHeader fs_header[nn::hac::nca::kPartitionNum];
|
sNcaFsHeader fs_header[nn::hac::nca::kPartitionNum];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
|
@ -22,72 +22,87 @@
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nn\hac\AccessControlInfoBinary.h" />
|
<ClInclude Include="include\nn\hac\AccessControlInfo.h" />
|
||||||
<ClInclude Include="include\nn\hac\AccessControlInfoDescBinary.h" />
|
<ClInclude Include="include\nn\hac\AccessControlInfoDesc.h" />
|
||||||
<ClInclude Include="include\nn\hac\aci.h" />
|
<ClInclude Include="include\nn\hac\AddOnContentMetaExtendedHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\AesKeygen.h" />
|
<ClInclude Include="include\nn\hac\AesKeygen.h" />
|
||||||
<ClInclude Include="include\nn\hac\ApplicationControlPropertyBinary.h" />
|
<ClInclude Include="include\nn\hac\ApplicationControlProperty.h" />
|
||||||
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h" />
|
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h" />
|
||||||
<ClInclude Include="include\nn\hac\cnmt.h" />
|
<ClInclude Include="include\nn\hac\ApplicationMetaExtendedHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\ContentMetaBinary.h" />
|
<ClInclude Include="include\nn\hac\ContentArchiveHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\delta.h" />
|
<ClInclude Include="include\nn\hac\ContentArchiveUtils.h" />
|
||||||
<ClInclude Include="include\nn\hac\fac.h" />
|
<ClInclude Include="include\nn\hac\ContentInfo.h" />
|
||||||
<ClInclude Include="include\nn\hac\FileSystemAccessControlBinary.h" />
|
<ClInclude Include="include\nn\hac\ContentMeta.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\ContentMetaInfo.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\aci.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\cnmt.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\delta.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\fac.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\gc.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\hierarchicalintegrity.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\hierarchicalsha256.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\kc.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\macro.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\meta.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\nacp.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\nca.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\nro.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\nrr.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\nso.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\pfs.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\define\romfs.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\DeltaMetaExtendedHeader.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\FileSystemAccessControl.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\GameCardHeader.h" />
|
||||||
|
<ClInclude Include="include\nn\hac\GameCardUtils.h" />
|
||||||
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h" />
|
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\HandleTableSizeHandler.h" />
|
<ClInclude Include="include\nn\hac\HandleTableSizeHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\hierarchicalintegrity.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h" />
|
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\hierarchicalsha256.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h" />
|
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h" />
|
||||||
<ClInclude Include="include\nn\hac\IdConverter.h" />
|
<ClInclude Include="include\nn\hac\IdConverter.h" />
|
||||||
<ClInclude Include="include\nn\hac\IKernelCapabilityHandler.h" />
|
<ClInclude Include="include\nn\hac\IKernelCapabilityHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\InteruptEntry.h" />
|
<ClInclude Include="include\nn\hac\InteruptEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\InteruptHandler.h" />
|
<ClInclude Include="include\nn\hac\InteruptHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\kc.h" />
|
<ClInclude Include="include\nn\hac\KernelCapabilityControl.h" />
|
||||||
<ClInclude Include="include\nn\hac\KernelCapabilityBinary.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\KernelCapabilityEntry.h" />
|
<ClInclude Include="include\nn\hac\KernelCapabilityEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\KernelVersionEntry.h" />
|
<ClInclude Include="include\nn\hac\KernelVersionEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\KernelVersionHandler.h" />
|
<ClInclude Include="include\nn\hac\KernelVersionHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\macro.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h" />
|
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\MemoryPageEntry.h" />
|
<ClInclude Include="include\nn\hac\MemoryPageEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\meta.h" />
|
<ClInclude Include="include\nn\hac\Meta.h" />
|
||||||
<ClInclude Include="include\nn\hac\MetaBinary.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h" />
|
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\MiscFlagsHandler.h" />
|
<ClInclude Include="include\nn\hac\MiscFlagsHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\MiscParamsEntry.h" />
|
<ClInclude Include="include\nn\hac\MiscParamsEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\MiscParamsHandler.h" />
|
<ClInclude Include="include\nn\hac\MiscParamsHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\nacp.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\nca.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\NcaHeader.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\NcaUtils.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\nro.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\NroHeader.h" />
|
<ClInclude Include="include\nn\hac\NroHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\nrr.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\nso.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\NsoHeader.h" />
|
<ClInclude Include="include\nn\hac\NsoHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\pfs.h" />
|
<ClInclude Include="include\nn\hac\PartitionFsHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\PfsHeader.h" />
|
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\Result.h" />
|
<ClInclude Include="include\nn\hac\Result.h" />
|
||||||
<ClInclude Include="include\nn\hac\romfs.h" />
|
<ClInclude Include="include\nn\hac\ServiceAccessControl.h" />
|
||||||
<ClInclude Include="include\nn\hac\ServiceAccessControlBinary.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h" />
|
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\SystemCallEntry.h" />
|
<ClInclude Include="include\nn\hac\SystemCallEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\SystemCallHandler.h" />
|
<ClInclude Include="include\nn\hac\SystemCallHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\ThreadInfoEntry.h" />
|
<ClInclude Include="include\nn\hac\ThreadInfoEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\ThreadInfoHandler.h" />
|
<ClInclude Include="include\nn\hac\ThreadInfoHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\xci.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\XciHeader.h" />
|
|
||||||
<ClInclude Include="include\nn\hac\XciUtils.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AccessControlInfoBinary.cpp" />
|
<ClCompile Include="source\AccessControlInfo.cpp" />
|
||||||
<ClCompile Include="source\AccessControlInfoDescBinary.cpp" />
|
<ClCompile Include="source\AccessControlInfoDesc.cpp" />
|
||||||
|
<ClCompile Include="source\AddOnContentMetaExtendedHeader.cpp" />
|
||||||
<ClCompile Include="source\AesKeygen.cpp" />
|
<ClCompile Include="source\AesKeygen.cpp" />
|
||||||
<ClCompile Include="source\ApplicationControlPropertyBinary.cpp" />
|
<ClCompile Include="source\ApplicationControlProperty.cpp" />
|
||||||
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp" />
|
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp" />
|
||||||
<ClCompile Include="source\ContentMetaBinary.cpp" />
|
<ClCompile Include="source\ApplicationMetaExtendedHeader.cpp" />
|
||||||
<ClCompile Include="source\FileSystemAccessControlBinary.cpp" />
|
<ClCompile Include="source\ContentArchiveHeader.cpp" />
|
||||||
|
<ClCompile Include="source\ContentArchiveUtils.cpp" />
|
||||||
|
<ClCompile Include="source\ContentInfo.cpp" />
|
||||||
|
<ClCompile Include="source\ContentMeta.cpp" />
|
||||||
|
<ClCompile Include="source\ContentMetaInfo.cpp" />
|
||||||
|
<ClCompile Include="source\DeltaMetaExtendedHeader.cpp" />
|
||||||
|
<ClCompile Include="source\FileSystemAccessControl.cpp" />
|
||||||
|
<ClCompile Include="source\GameCardHeader.cpp" />
|
||||||
|
<ClCompile Include="source\GameCardUtils.cpp" />
|
||||||
<ClCompile Include="source\HandleTableSizeEntry.cpp" />
|
<ClCompile Include="source\HandleTableSizeEntry.cpp" />
|
||||||
<ClCompile Include="source\HandleTableSizeHandler.cpp" />
|
<ClCompile Include="source\HandleTableSizeHandler.cpp" />
|
||||||
<ClCompile Include="source\HierarchicalIntegrityHeader.cpp" />
|
<ClCompile Include="source\HierarchicalIntegrityHeader.cpp" />
|
||||||
|
@ -95,31 +110,28 @@
|
||||||
<ClCompile Include="source\IdConverter.cpp" />
|
<ClCompile Include="source\IdConverter.cpp" />
|
||||||
<ClCompile Include="source\InteruptEntry.cpp" />
|
<ClCompile Include="source\InteruptEntry.cpp" />
|
||||||
<ClCompile Include="source\InteruptHandler.cpp" />
|
<ClCompile Include="source\InteruptHandler.cpp" />
|
||||||
<ClCompile Include="source\KernelCapabilityBinary.cpp" />
|
<ClCompile Include="source\KernelCapabilityControl.cpp" />
|
||||||
<ClCompile Include="source\KernelCapabilityEntry.cpp" />
|
<ClCompile Include="source\KernelCapabilityEntry.cpp" />
|
||||||
<ClCompile Include="source\KernelVersionEntry.cpp" />
|
<ClCompile Include="source\KernelVersionEntry.cpp" />
|
||||||
<ClCompile Include="source\KernelVersionHandler.cpp" />
|
<ClCompile Include="source\KernelVersionHandler.cpp" />
|
||||||
<ClCompile Include="source\MemoryMappingHandler.cpp" />
|
<ClCompile Include="source\MemoryMappingHandler.cpp" />
|
||||||
<ClCompile Include="source\MemoryPageEntry.cpp" />
|
<ClCompile Include="source\MemoryPageEntry.cpp" />
|
||||||
<ClCompile Include="source\MetaBinary.cpp" />
|
<ClCompile Include="source\Meta.cpp" />
|
||||||
<ClCompile Include="source\MiscFlagsEntry.cpp" />
|
<ClCompile Include="source\MiscFlagsEntry.cpp" />
|
||||||
<ClCompile Include="source\MiscFlagsHandler.cpp" />
|
<ClCompile Include="source\MiscFlagsHandler.cpp" />
|
||||||
<ClCompile Include="source\MiscParamsEntry.cpp" />
|
<ClCompile Include="source\MiscParamsEntry.cpp" />
|
||||||
<ClCompile Include="source\MiscParamsHandler.cpp" />
|
<ClCompile Include="source\MiscParamsHandler.cpp" />
|
||||||
<ClCompile Include="source\NcaHeader.cpp" />
|
|
||||||
<ClCompile Include="source\NcaUtils.cpp" />
|
|
||||||
<ClCompile Include="source\NroHeader.cpp" />
|
<ClCompile Include="source\NroHeader.cpp" />
|
||||||
<ClCompile Include="source\NsoHeader.cpp" />
|
<ClCompile Include="source\NsoHeader.cpp" />
|
||||||
<ClCompile Include="source\PfsHeader.cpp" />
|
<ClCompile Include="source\PartitionFsHeader.cpp" />
|
||||||
|
<ClCompile Include="source\PatchMetaExtendedHeader.cpp" />
|
||||||
<ClCompile Include="source\Result.cpp" />
|
<ClCompile Include="source\Result.cpp" />
|
||||||
<ClCompile Include="source\ServiceAccessControlBinary.cpp" />
|
<ClCompile Include="source\ServiceAccessControl.cpp" />
|
||||||
<ClCompile Include="source\ServiceAccessControlEntry.cpp" />
|
<ClCompile Include="source\ServiceAccessControlEntry.cpp" />
|
||||||
<ClCompile Include="source\SystemCallEntry.cpp" />
|
<ClCompile Include="source\SystemCallEntry.cpp" />
|
||||||
<ClCompile Include="source\SystemCallHandler.cpp" />
|
<ClCompile Include="source\SystemCallHandler.cpp" />
|
||||||
<ClCompile Include="source\ThreadInfoEntry.cpp" />
|
<ClCompile Include="source\ThreadInfoEntry.cpp" />
|
||||||
<ClCompile Include="source\ThreadInfoHandler.cpp" />
|
<ClCompile Include="source\ThreadInfoHandler.cpp" />
|
||||||
<ClCompile Include="source\XciHeader.cpp" />
|
|
||||||
<ClCompile Include="source\XciUtils.cpp" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
|
|
|
@ -1,54 +1,117 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Resource Files">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nn\hac\AccessControlInfoBinary.h">
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{040358e3-f1c5-4875-b34f-23607459567c}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{1c33ce2b-25c4-4857-966c-9dc24daf3f61}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\define">
|
||||||
|
<UniqueIdentifier>{a9fd54c0-9fd8-46a1-978e-fb531bf3ee1c}</UniqueIdentifier>
|
||||||
|
</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\gc.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\AccessControlInfo.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\AccessControlInfoDescBinary.h">
|
<ClInclude Include="include\nn\hac\AccessControlInfoDesc.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\aci.h">
|
<ClInclude Include="include\nn\hac\AddOnContentMetaExtendedHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\AesKeygen.h">
|
<ClInclude Include="include\nn\hac\AesKeygen.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ApplicationControlPropertyBinary.h">
|
<ClInclude Include="include\nn\hac\ApplicationControlProperty.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h">
|
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\cnmt.h">
|
<ClInclude Include="include\nn\hac\ApplicationMetaExtendedHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ContentMetaBinary.h">
|
<ClInclude Include="include\nn\hac\ContentArchiveHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\delta.h">
|
<ClInclude Include="include\nn\hac\ContentArchiveUtils.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\fac.h">
|
<ClInclude Include="include\nn\hac\ContentInfo.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\FileSystemAccessControlBinary.h">
|
<ClInclude Include="include\nn\hac\ContentMeta.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\nn\hac\ContentMetaInfo.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\nn\hac\DeltaMetaExtendedHeader.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\nn\hac\FileSystemAccessControl.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\nn\hac\GameCardHeader.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="include\nn\hac\GameCardUtils.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h">
|
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h">
|
||||||
|
@ -57,15 +120,9 @@
|
||||||
<ClInclude Include="include\nn\hac\HandleTableSizeHandler.h">
|
<ClInclude Include="include\nn\hac\HandleTableSizeHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\hierarchicalintegrity.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h">
|
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\hierarchicalsha256.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h">
|
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -81,10 +138,7 @@
|
||||||
<ClInclude Include="include\nn\hac\InteruptHandler.h">
|
<ClInclude Include="include\nn\hac\InteruptHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\kc.h">
|
<ClInclude Include="include\nn\hac\KernelCapabilityControl.h">
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\KernelCapabilityBinary.h">
|
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\KernelCapabilityEntry.h">
|
<ClInclude Include="include\nn\hac\KernelCapabilityEntry.h">
|
||||||
|
@ -96,19 +150,13 @@
|
||||||
<ClInclude Include="include\nn\hac\KernelVersionHandler.h">
|
<ClInclude Include="include\nn\hac\KernelVersionHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\macro.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h">
|
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MemoryPageEntry.h">
|
<ClInclude Include="include\nn\hac\MemoryPageEntry.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\meta.h">
|
<ClInclude Include="include\nn\hac\Meta.h">
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\MetaBinary.h">
|
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h">
|
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h">
|
||||||
|
@ -123,46 +171,22 @@
|
||||||
<ClInclude Include="include\nn\hac\MiscParamsHandler.h">
|
<ClInclude Include="include\nn\hac\MiscParamsHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nacp.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\nca.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\NcaHeader.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\NcaUtils.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\nro.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\NroHeader.h">
|
<ClInclude Include="include\nn\hac\NroHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nrr.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\nso.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\NsoHeader.h">
|
<ClInclude Include="include\nn\hac\NsoHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\pfs.h">
|
<ClInclude Include="include\nn\hac\PartitionFsHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\PfsHeader.h">
|
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\Result.h">
|
<ClInclude Include="include\nn\hac\Result.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\romfs.h">
|
<ClInclude Include="include\nn\hac\ServiceAccessControl.h">
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\ServiceAccessControlBinary.h">
|
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h">
|
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h">
|
||||||
|
@ -180,36 +204,54 @@
|
||||||
<ClInclude Include="include\nn\hac\ThreadInfoHandler.h">
|
<ClInclude Include="include\nn\hac\ThreadInfoHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\xci.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\XciHeader.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\nn\hac\XciUtils.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AccessControlInfoBinary.cpp">
|
<ClCompile Include="source\AccessControlInfo.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\AccessControlInfoDescBinary.cpp">
|
<ClCompile Include="source\AccessControlInfoDesc.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\AddOnContentMetaExtendedHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\AesKeygen.cpp">
|
<ClCompile Include="source\AesKeygen.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ApplicationControlPropertyBinary.cpp">
|
<ClCompile Include="source\ApplicationControlProperty.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp">
|
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ContentMetaBinary.cpp">
|
<ClCompile Include="source\ApplicationMetaExtendedHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\FileSystemAccessControlBinary.cpp">
|
<ClCompile Include="source\ContentArchiveHeader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ContentArchiveUtils.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ContentInfo.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ContentMeta.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ContentMetaInfo.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\DeltaMetaExtendedHeader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\FileSystemAccessControl.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\GameCardHeader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\GameCardUtils.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\HandleTableSizeEntry.cpp">
|
<ClCompile Include="source\HandleTableSizeEntry.cpp">
|
||||||
|
@ -224,13 +266,16 @@
|
||||||
<ClCompile Include="source\HierarchicalSha256Header.cpp">
|
<ClCompile Include="source\HierarchicalSha256Header.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\IdConverter.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="source\InteruptEntry.cpp">
|
<ClCompile Include="source\InteruptEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\InteruptHandler.cpp">
|
<ClCompile Include="source\InteruptHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\KernelCapabilityBinary.cpp">
|
<ClCompile Include="source\KernelCapabilityControl.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\KernelCapabilityEntry.cpp">
|
<ClCompile Include="source\KernelCapabilityEntry.cpp">
|
||||||
|
@ -248,6 +293,9 @@
|
||||||
<ClCompile Include="source\MemoryPageEntry.cpp">
|
<ClCompile Include="source\MemoryPageEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\Meta.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="source\MiscFlagsEntry.cpp">
|
<ClCompile Include="source\MiscFlagsEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -260,25 +308,22 @@
|
||||||
<ClCompile Include="source\MiscParamsHandler.cpp">
|
<ClCompile Include="source\MiscParamsHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NcaHeader.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\NcaUtils.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\MetaBinary.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\NroHeader.cpp">
|
<ClCompile Include="source\NroHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NsoHeader.cpp">
|
<ClCompile Include="source\NsoHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\PfsHeader.cpp">
|
<ClCompile Include="source\PartitionFsHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ServiceAccessControlBinary.cpp">
|
<ClCompile Include="source\PatchMetaExtendedHeader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\Result.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ServiceAccessControl.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ServiceAccessControlEntry.cpp">
|
<ClCompile Include="source\ServiceAccessControlEntry.cpp">
|
||||||
|
@ -296,17 +341,5 @@
|
||||||
<ClCompile Include="source\ThreadInfoHandler.cpp">
|
<ClCompile Include="source\ThreadInfoHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\XciHeader.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\XciUtils.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\IdConverter.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="source\Result.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,16 +1,16 @@
|
||||||
#include <nn/hac/AccessControlInfoBinary.h>
|
#include <nn/hac/AccessControlInfo.h>
|
||||||
|
|
||||||
nn::hac::AccessControlInfoBinary::AccessControlInfoBinary()
|
nn::hac::AccessControlInfo::AccessControlInfo()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::AccessControlInfoBinary::AccessControlInfoBinary(const AccessControlInfoBinary & other)
|
nn::hac::AccessControlInfo::AccessControlInfo(const AccessControlInfo & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::operator=(const AccessControlInfoBinary & other)
|
void nn::hac::AccessControlInfo::operator=(const AccessControlInfo & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mProgramId = other.mProgramId;
|
mProgramId = other.mProgramId;
|
||||||
|
@ -19,7 +19,7 @@ void nn::hac::AccessControlInfoBinary::operator=(const AccessControlInfoBinary &
|
||||||
mKernelCapabilities = other.mKernelCapabilities;
|
mKernelCapabilities = other.mKernelCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::AccessControlInfoBinary::operator==(const AccessControlInfoBinary & other) const
|
bool nn::hac::AccessControlInfo::operator==(const AccessControlInfo & other) const
|
||||||
{
|
{
|
||||||
return (mProgramId == other.mProgramId) \
|
return (mProgramId == other.mProgramId) \
|
||||||
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \
|
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \
|
||||||
|
@ -27,12 +27,12 @@ bool nn::hac::AccessControlInfoBinary::operator==(const AccessControlInfoBinary
|
||||||
&& (mKernelCapabilities == other.mKernelCapabilities);
|
&& (mKernelCapabilities == other.mKernelCapabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::AccessControlInfoBinary::operator!=(const AccessControlInfoBinary & other) const
|
bool nn::hac::AccessControlInfo::operator!=(const AccessControlInfo & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::toBytes()
|
void nn::hac::AccessControlInfo::toBytes()
|
||||||
{
|
{
|
||||||
// serialise the sections
|
// serialise the sections
|
||||||
mFileSystemAccessControl.toBytes();
|
mFileSystemAccessControl.toBytes();
|
||||||
|
@ -77,7 +77,7 @@ void nn::hac::AccessControlInfoBinary::toBytes()
|
||||||
memcpy(mRawBinary.data() + kc.offset, mKernelCapabilities.getBytes().data(), kc.size);
|
memcpy(mRawBinary.data() + kc.offset, mKernelCapabilities.getBytes().data(), kc.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::AccessControlInfo::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check size
|
// check size
|
||||||
if (len < sizeof(sAciHeader))
|
if (len < sizeof(sAciHeader))
|
||||||
|
@ -118,12 +118,12 @@ void nn::hac::AccessControlInfoBinary::fromBytes(const byte_t* data, size_t len)
|
||||||
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
|
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::AccessControlInfoBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::AccessControlInfo::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::clear()
|
void nn::hac::AccessControlInfo::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mProgramId = 0;
|
mProgramId = 0;
|
||||||
|
@ -132,42 +132,42 @@ void nn::hac::AccessControlInfoBinary::clear()
|
||||||
mKernelCapabilities.clear();
|
mKernelCapabilities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::AccessControlInfoBinary::getProgramId() const
|
uint64_t nn::hac::AccessControlInfo::getProgramId() const
|
||||||
{
|
{
|
||||||
return mProgramId;
|
return mProgramId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::setProgramId(uint64_t program_id)
|
void nn::hac::AccessControlInfo::setProgramId(uint64_t program_id)
|
||||||
{
|
{
|
||||||
mProgramId = program_id;
|
mProgramId = program_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::FileSystemAccessControlBinary& nn::hac::AccessControlInfoBinary::getFileSystemAccessControl() const
|
const nn::hac::FileSystemAccessControl& nn::hac::AccessControlInfo::getFileSystemAccessControl() const
|
||||||
{
|
{
|
||||||
return mFileSystemAccessControl;
|
return mFileSystemAccessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::setFileSystemAccessControl(const nn::hac::FileSystemAccessControlBinary& fac)
|
void nn::hac::AccessControlInfo::setFileSystemAccessControl(const nn::hac::FileSystemAccessControl& fac)
|
||||||
{
|
{
|
||||||
mFileSystemAccessControl = fac;
|
mFileSystemAccessControl = fac;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ServiceAccessControlBinary& nn::hac::AccessControlInfoBinary::getServiceAccessControl() const
|
const nn::hac::ServiceAccessControl& nn::hac::AccessControlInfo::getServiceAccessControl() const
|
||||||
{
|
{
|
||||||
return mServiceAccessControl;
|
return mServiceAccessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::setServiceAccessControl(const nn::hac::ServiceAccessControlBinary& sac)
|
void nn::hac::AccessControlInfo::setServiceAccessControl(const nn::hac::ServiceAccessControl& sac)
|
||||||
{
|
{
|
||||||
mServiceAccessControl = sac;
|
mServiceAccessControl = sac;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::KernelCapabilityBinary& nn::hac::AccessControlInfoBinary::getKernelCapabilities() const
|
const nn::hac::KernelCapabilityControl& nn::hac::AccessControlInfo::getKernelCapabilities() const
|
||||||
{
|
{
|
||||||
return mKernelCapabilities;
|
return mKernelCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::setKernelCapabilities(const nn::hac::KernelCapabilityBinary& kc)
|
void nn::hac::AccessControlInfo::setKernelCapabilities(const nn::hac::KernelCapabilityControl& kc)
|
||||||
{
|
{
|
||||||
mKernelCapabilities = kc;
|
mKernelCapabilities = kc;
|
||||||
}
|
}
|
|
@ -1,19 +1,19 @@
|
||||||
#include <nn/hac/AccessControlInfoDescBinary.h>
|
#include <nn/hac/AccessControlInfoDesc.h>
|
||||||
|
|
||||||
nn::hac::AccessControlInfoDescBinary::AccessControlInfoDescBinary()
|
nn::hac::AccessControlInfoDesc::AccessControlInfoDesc()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::AccessControlInfoDescBinary::AccessControlInfoDescBinary(const AccessControlInfoDescBinary & other)
|
nn::hac::AccessControlInfoDesc::AccessControlInfoDesc(const AccessControlInfoDesc & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::operator=(const AccessControlInfoDescBinary & other)
|
void nn::hac::AccessControlInfoDesc::operator=(const AccessControlInfoDesc & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mNcaHeaderSignature2Key = other.mNcaHeaderSignature2Key;
|
mContentArchiveHeaderSignature2Key = other.mContentArchiveHeaderSignature2Key;
|
||||||
mFlags = other.mFlags;
|
mFlags = other.mFlags;
|
||||||
mProgramIdRestrict = other.mProgramIdRestrict;
|
mProgramIdRestrict = other.mProgramIdRestrict;
|
||||||
mFileSystemAccessControl = other.mFileSystemAccessControl;
|
mFileSystemAccessControl = other.mFileSystemAccessControl;
|
||||||
|
@ -21,9 +21,9 @@ void nn::hac::AccessControlInfoDescBinary::operator=(const AccessControlInfoDesc
|
||||||
mKernelCapabilities = other.mKernelCapabilities;
|
mKernelCapabilities = other.mKernelCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::AccessControlInfoDescBinary::operator==(const AccessControlInfoDescBinary & other) const
|
bool nn::hac::AccessControlInfoDesc::operator==(const AccessControlInfoDesc & other) const
|
||||||
{
|
{
|
||||||
return (mNcaHeaderSignature2Key == other.mNcaHeaderSignature2Key) \
|
return (mContentArchiveHeaderSignature2Key == other.mContentArchiveHeaderSignature2Key) \
|
||||||
&& (mFlags == other.mFlags) \
|
&& (mFlags == other.mFlags) \
|
||||||
&& (mProgramIdRestrict == other.mProgramIdRestrict) \
|
&& (mProgramIdRestrict == other.mProgramIdRestrict) \
|
||||||
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \
|
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \
|
||||||
|
@ -31,12 +31,12 @@ bool nn::hac::AccessControlInfoDescBinary::operator==(const AccessControlInfoDes
|
||||||
&& (mKernelCapabilities == other.mKernelCapabilities);
|
&& (mKernelCapabilities == other.mKernelCapabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::AccessControlInfoDescBinary::operator!=(const AccessControlInfoDescBinary & other) const
|
bool nn::hac::AccessControlInfoDesc::operator!=(const AccessControlInfoDesc & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::toBytes()
|
void nn::hac::AccessControlInfoDesc::toBytes()
|
||||||
{
|
{
|
||||||
// serialise the sections
|
// serialise the sections
|
||||||
mFileSystemAccessControl.toBytes();
|
mFileSystemAccessControl.toBytes();
|
||||||
|
@ -62,7 +62,7 @@ void nn::hac::AccessControlInfoDescBinary::toBytes()
|
||||||
sAciDescHeader* hdr = (sAciDescHeader*)mRawBinary.data();
|
sAciDescHeader* hdr = (sAciDescHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// set rsa modulus
|
// set rsa modulus
|
||||||
memcpy(hdr->nca_rsa_signature2_modulus, mNcaHeaderSignature2Key.modulus, fnd::rsa::kRsa2048Size);
|
memcpy(hdr->nca_rsa_signature2_modulus, mContentArchiveHeaderSignature2Key.modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
// set type
|
// set type
|
||||||
hdr->st_magic = aci::kAciDescStructMagic;
|
hdr->st_magic = aci::kAciDescStructMagic;
|
||||||
|
@ -94,7 +94,7 @@ void nn::hac::AccessControlInfoDescBinary::toBytes()
|
||||||
memcpy(mRawBinary.data() + kc.offset, mKernelCapabilities.getBytes().data(), kc.size);
|
memcpy(mRawBinary.data() + kc.offset, mKernelCapabilities.getBytes().data(), kc.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::AccessControlInfoDesc::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check size
|
// check size
|
||||||
if (len < sizeof(sAciDescHeader))
|
if (len < sizeof(sAciDescHeader))
|
||||||
|
@ -129,7 +129,7 @@ void nn::hac::AccessControlInfoDescBinary::fromBytes(const byte_t* data, size_t
|
||||||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||||
|
|
||||||
// save variables
|
// save variables
|
||||||
memcpy(mNcaHeaderSignature2Key.modulus, hdr.nca_rsa_signature2_modulus, fnd::rsa::kRsa2048Size);
|
memcpy(mContentArchiveHeaderSignature2Key.modulus, hdr.nca_rsa_signature2_modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
for (size_t i = 0; i < 32; i++)
|
for (size_t i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
|
@ -145,12 +145,12 @@ void nn::hac::AccessControlInfoDescBinary::fromBytes(const byte_t* data, size_t
|
||||||
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
|
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::AccessControlInfoDescBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::AccessControlInfoDesc::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::generateSignature(const fnd::rsa::sRsa2048Key& key)
|
void nn::hac::AccessControlInfoDesc::generateSignature(const fnd::rsa::sRsa2048Key& key)
|
||||||
{
|
{
|
||||||
if (mRawBinary.size() == 0)
|
if (mRawBinary.size() == 0)
|
||||||
toBytes();
|
toBytes();
|
||||||
|
@ -164,7 +164,7 @@ void nn::hac::AccessControlInfoDescBinary::generateSignature(const fnd::rsa::sRs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::validateSignature(const fnd::rsa::sRsa2048Key& key) const
|
void nn::hac::AccessControlInfoDesc::validateSignature(const fnd::rsa::sRsa2048Key& key) const
|
||||||
{
|
{
|
||||||
if (mRawBinary.size() == 0)
|
if (mRawBinary.size() == 0)
|
||||||
throw fnd::Exception(kModuleName, "No Access Control Info Desc binary exists to verify");
|
throw fnd::Exception(kModuleName, "No Access Control Info Desc binary exists to verify");
|
||||||
|
@ -178,10 +178,10 @@ void nn::hac::AccessControlInfoDescBinary::validateSignature(const fnd::rsa::sRs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::clear()
|
void nn::hac::AccessControlInfoDesc::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
memset((void*)&mNcaHeaderSignature2Key, 0, sizeof(mNcaHeaderSignature2Key));
|
memset((void*)&mContentArchiveHeaderSignature2Key, 0, sizeof(mContentArchiveHeaderSignature2Key));
|
||||||
mFlags.clear();
|
mFlags.clear();
|
||||||
mProgramIdRestrict.min = 0;
|
mProgramIdRestrict.min = 0;
|
||||||
mProgramIdRestrict.max = 0;
|
mProgramIdRestrict.max = 0;
|
||||||
|
@ -190,62 +190,62 @@ void nn::hac::AccessControlInfoDescBinary::clear()
|
||||||
mKernelCapabilities.clear();
|
mKernelCapabilities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::rsa::sRsa2048Key& nn::hac::AccessControlInfoDescBinary::getNcaHeaderSignature2Key() const
|
const fnd::rsa::sRsa2048Key& nn::hac::AccessControlInfoDesc::getContentArchiveHeaderSignature2Key() const
|
||||||
{
|
{
|
||||||
return mNcaHeaderSignature2Key;
|
return mContentArchiveHeaderSignature2Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setNcaHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key)
|
void nn::hac::AccessControlInfoDesc::setContentArchiveHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key)
|
||||||
{
|
{
|
||||||
mNcaHeaderSignature2Key = key;
|
mContentArchiveHeaderSignature2Key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::aci::Flag>& nn::hac::AccessControlInfoDescBinary::getFlagList() const
|
const fnd::List<nn::hac::aci::Flag>& nn::hac::AccessControlInfoDesc::getFlagList() const
|
||||||
{
|
{
|
||||||
return mFlags;
|
return mFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setFlagList(const fnd::List<nn::hac::aci::Flag>& flags)
|
void nn::hac::AccessControlInfoDesc::setFlagList(const fnd::List<nn::hac::aci::Flag>& flags)
|
||||||
{
|
{
|
||||||
mFlags = flags;
|
mFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::AccessControlInfoDescBinary::sProgramIdRestrict& nn::hac::AccessControlInfoDescBinary::getProgramIdRestrict() const
|
const nn::hac::AccessControlInfoDesc::sProgramIdRestrict& nn::hac::AccessControlInfoDesc::getProgramIdRestrict() const
|
||||||
{
|
{
|
||||||
return mProgramIdRestrict;
|
return mProgramIdRestrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setProgramIdRestrict(const sProgramIdRestrict& pid_restrict)
|
void nn::hac::AccessControlInfoDesc::setProgramIdRestrict(const sProgramIdRestrict& pid_restrict)
|
||||||
{
|
{
|
||||||
mProgramIdRestrict = pid_restrict;
|
mProgramIdRestrict = pid_restrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::FileSystemAccessControlBinary& nn::hac::AccessControlInfoDescBinary::getFileSystemAccessControl() const
|
const nn::hac::FileSystemAccessControl& nn::hac::AccessControlInfoDesc::getFileSystemAccessControl() const
|
||||||
{
|
{
|
||||||
return mFileSystemAccessControl;
|
return mFileSystemAccessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setFileSystemAccessControl(const nn::hac::FileSystemAccessControlBinary& fac)
|
void nn::hac::AccessControlInfoDesc::setFileSystemAccessControl(const nn::hac::FileSystemAccessControl& fac)
|
||||||
{
|
{
|
||||||
mFileSystemAccessControl = fac;
|
mFileSystemAccessControl = fac;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ServiceAccessControlBinary& nn::hac::AccessControlInfoDescBinary::getServiceAccessControl() const
|
const nn::hac::ServiceAccessControl& nn::hac::AccessControlInfoDesc::getServiceAccessControl() const
|
||||||
{
|
{
|
||||||
return mServiceAccessControl;
|
return mServiceAccessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setServiceAccessControl(const nn::hac::ServiceAccessControlBinary& sac)
|
void nn::hac::AccessControlInfoDesc::setServiceAccessControl(const nn::hac::ServiceAccessControl& sac)
|
||||||
{
|
{
|
||||||
mServiceAccessControl = sac;
|
mServiceAccessControl = sac;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::KernelCapabilityBinary& nn::hac::AccessControlInfoDescBinary::getKernelCapabilities() const
|
const nn::hac::KernelCapabilityControl& nn::hac::AccessControlInfoDesc::getKernelCapabilities() const
|
||||||
{
|
{
|
||||||
return mKernelCapabilities;
|
return mKernelCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setKernelCapabilities(const nn::hac::KernelCapabilityBinary& kc)
|
void nn::hac::AccessControlInfoDesc::setKernelCapabilities(const nn::hac::KernelCapabilityControl& kc)
|
||||||
{
|
{
|
||||||
mKernelCapabilities = kc;
|
mKernelCapabilities = kc;
|
||||||
}
|
}
|
84
lib/libhac/source/AddOnContentMetaExtendedHeader.cpp
Normal file
84
lib/libhac/source/AddOnContentMetaExtendedHeader.cpp
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
#include <nn/hac/AddOnContentMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
nn::hac::AddOnContentMetaExtendedHeader::AddOnContentMetaExtendedHeader()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::AddOnContentMetaExtendedHeader::AddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::operator=(const AddOnContentMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mApplicationId = other.mApplicationId;
|
||||||
|
mRequiredApplicationVersion = other.mRequiredApplicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::AddOnContentMetaExtendedHeader::operator==(const AddOnContentMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return (mApplicationId == other.mApplicationId) \
|
||||||
|
&& (mRequiredApplicationVersion == other.mRequiredApplicationVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::AddOnContentMetaExtendedHeader::operator!=(const AddOnContentMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sAddOnContentMetaExtendedHeader));
|
||||||
|
sAddOnContentMetaExtendedHeader* info = (sAddOnContentMetaExtendedHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->application_id = mApplicationId;
|
||||||
|
info->required_application_version = mRequiredApplicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sAddOnContentMetaExtendedHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "AddOnContentMetaExtendedHeader too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sAddOnContentMetaExtendedHeader* info = (const sAddOnContentMetaExtendedHeader*)bytes;
|
||||||
|
|
||||||
|
mApplicationId = info->application_id.get();
|
||||||
|
mRequiredApplicationVersion = info->required_application_version.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::AddOnContentMetaExtendedHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mApplicationId = 0;
|
||||||
|
mRequiredApplicationVersion = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::AddOnContentMetaExtendedHeader::getApplicationId() const
|
||||||
|
{
|
||||||
|
return mApplicationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::setApplicationId(uint64_t application_id)
|
||||||
|
{
|
||||||
|
mApplicationId = application_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::AddOnContentMetaExtendedHeader::getRequiredApplicationVersion() const
|
||||||
|
{
|
||||||
|
return mRequiredApplicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::setRequiredApplicationVersion(uint32_t sys_ver)
|
||||||
|
{
|
||||||
|
mRequiredApplicationVersion = sys_ver;
|
||||||
|
}
|
|
@ -1,17 +1,17 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/ApplicationControlPropertyBinary.h>
|
#include <nn/hac/ApplicationControlProperty.h>
|
||||||
|
|
||||||
nn::hac::ApplicationControlPropertyBinary::ApplicationControlPropertyBinary()
|
nn::hac::ApplicationControlProperty::ApplicationControlProperty()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::ApplicationControlPropertyBinary::ApplicationControlPropertyBinary(const ApplicationControlPropertyBinary& other)
|
nn::hac::ApplicationControlProperty::ApplicationControlProperty(const ApplicationControlProperty& other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::operator=(const ApplicationControlPropertyBinary& other)
|
void nn::hac::ApplicationControlProperty::operator=(const ApplicationControlProperty& other)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
mTitle = other.mTitle;
|
mTitle = other.mTitle;
|
||||||
|
@ -55,7 +55,7 @@ void nn::hac::ApplicationControlPropertyBinary::operator=(const ApplicationContr
|
||||||
mProgramIndex = other.mProgramIndex;
|
mProgramIndex = other.mProgramIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ApplicationControlPropertyBinary::operator==(const ApplicationControlPropertyBinary& other) const
|
bool nn::hac::ApplicationControlProperty::operator==(const ApplicationControlProperty& other) const
|
||||||
{
|
{
|
||||||
return (mTitle == other.mTitle) \
|
return (mTitle == other.mTitle) \
|
||||||
&& (mIsbn == other.mIsbn) \
|
&& (mIsbn == other.mIsbn) \
|
||||||
|
@ -98,12 +98,12 @@ bool nn::hac::ApplicationControlPropertyBinary::operator==(const ApplicationCont
|
||||||
&& (mProgramIndex == other.mProgramIndex);
|
&& (mProgramIndex == other.mProgramIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ApplicationControlPropertyBinary::operator!=(const ApplicationControlPropertyBinary& other) const
|
bool nn::hac::ApplicationControlProperty::operator!=(const ApplicationControlProperty& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::toBytes()
|
void nn::hac::ApplicationControlProperty::toBytes()
|
||||||
{
|
{
|
||||||
mRawBinary.alloc(sizeof(nn::hac::sApplicationControlProperty));
|
mRawBinary.alloc(sizeof(nn::hac::sApplicationControlProperty));
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ void nn::hac::ApplicationControlPropertyBinary::toBytes()
|
||||||
data->cache_storage_data_and_journal_size_max = mCacheStorageDataAndJournalSizeMax;
|
data->cache_storage_data_and_journal_size_max = mCacheStorageDataAndJournalSizeMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::fromBytes(const byte_t* bytes, size_t len)
|
void nn::hac::ApplicationControlProperty::fromBytes(const byte_t* bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(nn::hac::sApplicationControlProperty))
|
if (len < sizeof(nn::hac::sApplicationControlProperty))
|
||||||
{
|
{
|
||||||
|
@ -276,12 +276,12 @@ void nn::hac::ApplicationControlPropertyBinary::fromBytes(const byte_t* bytes, s
|
||||||
mCacheStorageDataAndJournalSizeMax = (int64_t)data->cache_storage_data_and_journal_size_max.get();
|
mCacheStorageDataAndJournalSizeMax = (int64_t)data->cache_storage_data_and_journal_size_max.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::ApplicationControlPropertyBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::ApplicationControlProperty::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::clear()
|
void nn::hac::ApplicationControlProperty::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mTitle.clear();
|
mTitle.clear();
|
||||||
|
@ -325,392 +325,392 @@ void nn::hac::ApplicationControlPropertyBinary::clear()
|
||||||
mProgramIndex = 0;
|
mProgramIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::ApplicationControlPropertyBinary::sTitle>& nn::hac::ApplicationControlPropertyBinary::getTitle() const
|
const fnd::List<nn::hac::ApplicationControlProperty::sTitle>& nn::hac::ApplicationControlProperty::getTitle() const
|
||||||
{
|
{
|
||||||
return mTitle;
|
return mTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setTitle(const fnd::List<sTitle>& title)
|
void nn::hac::ApplicationControlProperty::setTitle(const fnd::List<sTitle>& title)
|
||||||
{
|
{
|
||||||
mTitle = title;
|
mTitle = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& nn::hac::ApplicationControlPropertyBinary::getIsbn() const
|
const std::string& nn::hac::ApplicationControlProperty::getIsbn() const
|
||||||
{
|
{
|
||||||
return mIsbn;
|
return mIsbn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setIsbn(const std::string& isbn)
|
void nn::hac::ApplicationControlProperty::setIsbn(const std::string& isbn)
|
||||||
{
|
{
|
||||||
mIsbn = isbn;
|
mIsbn = isbn;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::StartupUserAccount nn::hac::ApplicationControlPropertyBinary::getStartupUserAccount() const
|
nn::hac::nacp::StartupUserAccount nn::hac::ApplicationControlProperty::getStartupUserAccount() const
|
||||||
{
|
{
|
||||||
return mStartupUserAccount;
|
return mStartupUserAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setStartupUserAccount(nacp::StartupUserAccount var)
|
void nn::hac::ApplicationControlProperty::setStartupUserAccount(nacp::StartupUserAccount var)
|
||||||
{
|
{
|
||||||
mStartupUserAccount = var;
|
mStartupUserAccount = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::TouchScreenUsageMode nn::hac::ApplicationControlPropertyBinary::getTouchScreenUsageMode() const
|
nn::hac::nacp::TouchScreenUsageMode nn::hac::ApplicationControlProperty::getTouchScreenUsageMode() const
|
||||||
{
|
{
|
||||||
return mTouchScreenUsageMode;
|
return mTouchScreenUsageMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setTouchScreenUsageMode(nacp::TouchScreenUsageMode var)
|
void nn::hac::ApplicationControlProperty::setTouchScreenUsageMode(nacp::TouchScreenUsageMode var)
|
||||||
{
|
{
|
||||||
mTouchScreenUsageMode = var;
|
mTouchScreenUsageMode = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::AocRegistrationType nn::hac::ApplicationControlPropertyBinary::getAocRegistrationType() const
|
nn::hac::nacp::AocRegistrationType nn::hac::ApplicationControlProperty::getAocRegistrationType() const
|
||||||
{
|
{
|
||||||
return mAocRegistrationType;
|
return mAocRegistrationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setAocRegistrationType(nacp::AocRegistrationType var)
|
void nn::hac::ApplicationControlProperty::setAocRegistrationType(nacp::AocRegistrationType var)
|
||||||
{
|
{
|
||||||
mAocRegistrationType = var;
|
mAocRegistrationType = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::AttributeFlag nn::hac::ApplicationControlPropertyBinary::getAttributeFlag() const
|
nn::hac::nacp::AttributeFlag nn::hac::ApplicationControlProperty::getAttributeFlag() const
|
||||||
{
|
{
|
||||||
return mAttributeFlag;
|
return mAttributeFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setAttributeFlag(nacp::AttributeFlag var)
|
void nn::hac::ApplicationControlProperty::setAttributeFlag(nacp::AttributeFlag var)
|
||||||
{
|
{
|
||||||
mAttributeFlag = var;
|
mAttributeFlag = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::nacp::Language>& nn::hac::ApplicationControlPropertyBinary::getSupportedLanguages() const
|
const fnd::List<nn::hac::nacp::Language>& nn::hac::ApplicationControlProperty::getSupportedLanguages() const
|
||||||
{
|
{
|
||||||
return mSupportedLanguages;
|
return mSupportedLanguages;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setSupportedLanguages(const fnd::List<nacp::Language>& var)
|
void nn::hac::ApplicationControlProperty::setSupportedLanguages(const fnd::List<nacp::Language>& var)
|
||||||
{
|
{
|
||||||
mSupportedLanguages = var;
|
mSupportedLanguages = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::ParentalControlFlag nn::hac::ApplicationControlPropertyBinary::getParentalControlFlag() const
|
nn::hac::nacp::ParentalControlFlag nn::hac::ApplicationControlProperty::getParentalControlFlag() const
|
||||||
{
|
{
|
||||||
return mParentalControlFlag;
|
return mParentalControlFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setParentalControlFlag(nacp::ParentalControlFlag var)
|
void nn::hac::ApplicationControlProperty::setParentalControlFlag(nacp::ParentalControlFlag var)
|
||||||
{
|
{
|
||||||
mParentalControlFlag = var;
|
mParentalControlFlag = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::ScreenshotMode nn::hac::ApplicationControlPropertyBinary::getScreenshotMode() const
|
nn::hac::nacp::ScreenshotMode nn::hac::ApplicationControlProperty::getScreenshotMode() const
|
||||||
{
|
{
|
||||||
return mScreenshotMode;
|
return mScreenshotMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setScreenshotMode(nacp::ScreenshotMode var)
|
void nn::hac::ApplicationControlProperty::setScreenshotMode(nacp::ScreenshotMode var)
|
||||||
{
|
{
|
||||||
mScreenshotMode = var;
|
mScreenshotMode = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::VideoCaptureMode nn::hac::ApplicationControlPropertyBinary::getVideoCaptureMode() const
|
nn::hac::nacp::VideoCaptureMode nn::hac::ApplicationControlProperty::getVideoCaptureMode() const
|
||||||
{
|
{
|
||||||
return mVideoCaptureMode;
|
return mVideoCaptureMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setVideoCaptureMode(nacp::VideoCaptureMode var)
|
void nn::hac::ApplicationControlProperty::setVideoCaptureMode(nacp::VideoCaptureMode var)
|
||||||
{
|
{
|
||||||
mVideoCaptureMode = var;
|
mVideoCaptureMode = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::DataLossConfirmation nn::hac::ApplicationControlPropertyBinary::getDataLossConfirmation() const
|
nn::hac::nacp::DataLossConfirmation nn::hac::ApplicationControlProperty::getDataLossConfirmation() const
|
||||||
{
|
{
|
||||||
return mDataLossConfirmation;
|
return mDataLossConfirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setDataLossConfirmation(nacp::DataLossConfirmation var)
|
void nn::hac::ApplicationControlProperty::setDataLossConfirmation(nacp::DataLossConfirmation var)
|
||||||
{
|
{
|
||||||
mDataLossConfirmation = var;
|
mDataLossConfirmation = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::PlayLogPolicy nn::hac::ApplicationControlPropertyBinary::getPlayLogPolicy() const
|
nn::hac::nacp::PlayLogPolicy nn::hac::ApplicationControlProperty::getPlayLogPolicy() const
|
||||||
{
|
{
|
||||||
return mPlayLogPolicy;
|
return mPlayLogPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setPlayLogPolicy(nacp::PlayLogPolicy var)
|
void nn::hac::ApplicationControlProperty::setPlayLogPolicy(nacp::PlayLogPolicy var)
|
||||||
{
|
{
|
||||||
mPlayLogPolicy = var;
|
mPlayLogPolicy = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::ApplicationControlPropertyBinary::getPresenceGroupId() const
|
uint64_t nn::hac::ApplicationControlProperty::getPresenceGroupId() const
|
||||||
{
|
{
|
||||||
return mPresenceGroupId;
|
return mPresenceGroupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setPresenceGroupId(uint64_t var)
|
void nn::hac::ApplicationControlProperty::setPresenceGroupId(uint64_t var)
|
||||||
{
|
{
|
||||||
mPresenceGroupId = var;
|
mPresenceGroupId = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::ApplicationControlPropertyBinary::sRating>& nn::hac::ApplicationControlPropertyBinary::getRatingAge() const
|
const fnd::List<nn::hac::ApplicationControlProperty::sRating>& nn::hac::ApplicationControlProperty::getRatingAge() const
|
||||||
{
|
{
|
||||||
return mRatingAge;
|
return mRatingAge;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setRatingAge(const fnd::List<sRating>& var)
|
void nn::hac::ApplicationControlProperty::setRatingAge(const fnd::List<sRating>& var)
|
||||||
{
|
{
|
||||||
mRatingAge = var;
|
mRatingAge = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& nn::hac::ApplicationControlPropertyBinary::getDisplayVersion() const
|
const std::string& nn::hac::ApplicationControlProperty::getDisplayVersion() const
|
||||||
{
|
{
|
||||||
return mDisplayVersion;
|
return mDisplayVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setDisplayVersion(const std::string& var)
|
void nn::hac::ApplicationControlProperty::setDisplayVersion(const std::string& var)
|
||||||
{
|
{
|
||||||
mDisplayVersion = var;
|
mDisplayVersion = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::ApplicationControlPropertyBinary::getAocBaseId() const
|
uint64_t nn::hac::ApplicationControlProperty::getAocBaseId() const
|
||||||
{
|
{
|
||||||
return mAocBaseId;
|
return mAocBaseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setAocBaseId(uint64_t var)
|
void nn::hac::ApplicationControlProperty::setAocBaseId(uint64_t var)
|
||||||
{
|
{
|
||||||
mAocBaseId = var;
|
mAocBaseId = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::ApplicationControlPropertyBinary::getSaveDatawOwnerId() const
|
uint64_t nn::hac::ApplicationControlProperty::getSaveDatawOwnerId() const
|
||||||
{
|
{
|
||||||
return mSaveDatawOwnerId;
|
return mSaveDatawOwnerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setSaveDatawOwnerId(uint64_t var)
|
void nn::hac::ApplicationControlProperty::setSaveDatawOwnerId(uint64_t var)
|
||||||
{
|
{
|
||||||
mSaveDatawOwnerId = var;
|
mSaveDatawOwnerId = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getUserAccountSaveDataSize() const
|
const nn::hac::ApplicationControlProperty::sStorageSize& nn::hac::ApplicationControlProperty::getUserAccountSaveDataSize() const
|
||||||
{
|
{
|
||||||
return mUserAccountSaveDataSize;
|
return mUserAccountSaveDataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setUserAccountSaveDataSize(const sStorageSize& var)
|
void nn::hac::ApplicationControlProperty::setUserAccountSaveDataSize(const sStorageSize& var)
|
||||||
{
|
{
|
||||||
mUserAccountSaveDataSize = var;
|
mUserAccountSaveDataSize = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getDeviceSaveDataSize() const
|
const nn::hac::ApplicationControlProperty::sStorageSize& nn::hac::ApplicationControlProperty::getDeviceSaveDataSize() const
|
||||||
{
|
{
|
||||||
return mDeviceSaveDataSize;
|
return mDeviceSaveDataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setDeviceSaveDataSize(const sStorageSize& var)
|
void nn::hac::ApplicationControlProperty::setDeviceSaveDataSize(const sStorageSize& var)
|
||||||
{
|
{
|
||||||
mDeviceSaveDataSize = var;
|
mDeviceSaveDataSize = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nn::hac::ApplicationControlPropertyBinary::getBcatDeliveryCacheStorageSize() const
|
int64_t nn::hac::ApplicationControlProperty::getBcatDeliveryCacheStorageSize() const
|
||||||
{
|
{
|
||||||
return mBcatDeliveryCacheStorageSize;
|
return mBcatDeliveryCacheStorageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setBcatDeliveryCacheStorageSize(int64_t var)
|
void nn::hac::ApplicationControlProperty::setBcatDeliveryCacheStorageSize(int64_t var)
|
||||||
{
|
{
|
||||||
mBcatDeliveryCacheStorageSize = var;
|
mBcatDeliveryCacheStorageSize = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& nn::hac::ApplicationControlPropertyBinary::getApplicationErrorCodeCategory() const
|
const std::string& nn::hac::ApplicationControlProperty::getApplicationErrorCodeCategory() const
|
||||||
{
|
{
|
||||||
return mApplicationErrorCodeCategory;
|
return mApplicationErrorCodeCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setApplicationErrorCodeCategory(const std::string& var)
|
void nn::hac::ApplicationControlProperty::setApplicationErrorCodeCategory(const std::string& var)
|
||||||
{
|
{
|
||||||
mApplicationErrorCodeCategory = var;
|
mApplicationErrorCodeCategory = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<uint64_t>& nn::hac::ApplicationControlPropertyBinary::getLocalCommunicationId() const
|
const fnd::List<uint64_t>& nn::hac::ApplicationControlProperty::getLocalCommunicationId() const
|
||||||
{
|
{
|
||||||
return mLocalCommunicationId;
|
return mLocalCommunicationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setLocalCommunicationId(const fnd::List<uint64_t>& var)
|
void nn::hac::ApplicationControlProperty::setLocalCommunicationId(const fnd::List<uint64_t>& var)
|
||||||
{
|
{
|
||||||
mLocalCommunicationId = var;
|
mLocalCommunicationId = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::LogoType nn::hac::ApplicationControlPropertyBinary::getLogoType() const
|
nn::hac::nacp::LogoType nn::hac::ApplicationControlProperty::getLogoType() const
|
||||||
{
|
{
|
||||||
return mLogoType;
|
return mLogoType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setLogoType(nacp::LogoType var)
|
void nn::hac::ApplicationControlProperty::setLogoType(nacp::LogoType var)
|
||||||
{
|
{
|
||||||
mLogoType = var;
|
mLogoType = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::LogoHandling nn::hac::ApplicationControlPropertyBinary::getLogoHandling() const
|
nn::hac::nacp::LogoHandling nn::hac::ApplicationControlProperty::getLogoHandling() const
|
||||||
{
|
{
|
||||||
return mLogoHandling;
|
return mLogoHandling;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setLogoHandling(nacp::LogoHandling var)
|
void nn::hac::ApplicationControlProperty::setLogoHandling(nacp::LogoHandling var)
|
||||||
{
|
{
|
||||||
mLogoHandling = var;
|
mLogoHandling = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::RuntimeAocInstallMode nn::hac::ApplicationControlPropertyBinary::getRuntimeAocInstallMode() const
|
nn::hac::nacp::RuntimeAocInstallMode nn::hac::ApplicationControlProperty::getRuntimeAocInstallMode() const
|
||||||
{
|
{
|
||||||
return mRuntimeAocInstallMode;
|
return mRuntimeAocInstallMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setRuntimeAocInstallMode(nacp::RuntimeAocInstallMode var)
|
void nn::hac::ApplicationControlProperty::setRuntimeAocInstallMode(nacp::RuntimeAocInstallMode var)
|
||||||
{
|
{
|
||||||
mRuntimeAocInstallMode = var;
|
mRuntimeAocInstallMode = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::CrashReportMode nn::hac::ApplicationControlPropertyBinary::getCrashReportMode() const
|
nn::hac::nacp::CrashReportMode nn::hac::ApplicationControlProperty::getCrashReportMode() const
|
||||||
{
|
{
|
||||||
return mCrashReportMode;
|
return mCrashReportMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setCrashReportMode(nacp::CrashReportMode var)
|
void nn::hac::ApplicationControlProperty::setCrashReportMode(nacp::CrashReportMode var)
|
||||||
{
|
{
|
||||||
mCrashReportMode = var;
|
mCrashReportMode = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::Hdcp nn::hac::ApplicationControlPropertyBinary::getHdcp() const
|
nn::hac::nacp::Hdcp nn::hac::ApplicationControlProperty::getHdcp() const
|
||||||
{
|
{
|
||||||
return mHdcp;
|
return mHdcp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setHdcp(nacp::Hdcp var)
|
void nn::hac::ApplicationControlProperty::setHdcp(nacp::Hdcp var)
|
||||||
{
|
{
|
||||||
mHdcp = var;
|
mHdcp = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::ApplicationControlPropertyBinary::getSeedForPsuedoDeviceId() const
|
uint64_t nn::hac::ApplicationControlProperty::getSeedForPsuedoDeviceId() const
|
||||||
{
|
{
|
||||||
return mSeedForPsuedoDeviceId;
|
return mSeedForPsuedoDeviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setSeedForPsuedoDeviceId(uint64_t var)
|
void nn::hac::ApplicationControlProperty::setSeedForPsuedoDeviceId(uint64_t var)
|
||||||
{
|
{
|
||||||
mSeedForPsuedoDeviceId = var;
|
mSeedForPsuedoDeviceId = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& nn::hac::ApplicationControlPropertyBinary::getBcatPassphase() const
|
const std::string& nn::hac::ApplicationControlProperty::getBcatPassphase() const
|
||||||
{
|
{
|
||||||
return mBcatPassphase;
|
return mBcatPassphase;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setBcatPassphase(const std::string& var)
|
void nn::hac::ApplicationControlProperty::setBcatPassphase(const std::string& var)
|
||||||
{
|
{
|
||||||
mBcatPassphase = var;
|
mBcatPassphase = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getUserAccountSaveDataMax() const
|
const nn::hac::ApplicationControlProperty::sStorageSize& nn::hac::ApplicationControlProperty::getUserAccountSaveDataMax() const
|
||||||
{
|
{
|
||||||
return mUserAccountSaveDataMax;
|
return mUserAccountSaveDataMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setUserAccountSaveDataMax(const sStorageSize& var)
|
void nn::hac::ApplicationControlProperty::setUserAccountSaveDataMax(const sStorageSize& var)
|
||||||
{
|
{
|
||||||
mUserAccountSaveDataMax = var;
|
mUserAccountSaveDataMax = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getDeviceSaveDataMax() const
|
const nn::hac::ApplicationControlProperty::sStorageSize& nn::hac::ApplicationControlProperty::getDeviceSaveDataMax() const
|
||||||
{
|
{
|
||||||
return mDeviceSaveDataMax;
|
return mDeviceSaveDataMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setDeviceSaveDataMax(const sStorageSize& var)
|
void nn::hac::ApplicationControlProperty::setDeviceSaveDataMax(const sStorageSize& var)
|
||||||
{
|
{
|
||||||
mDeviceSaveDataMax = var;
|
mDeviceSaveDataMax = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nn::hac::ApplicationControlPropertyBinary::getTemporaryStorageSize() const
|
int64_t nn::hac::ApplicationControlProperty::getTemporaryStorageSize() const
|
||||||
{
|
{
|
||||||
return mTemporaryStorageSize;
|
return mTemporaryStorageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setTemporaryStorageSize(int64_t var)
|
void nn::hac::ApplicationControlProperty::setTemporaryStorageSize(int64_t var)
|
||||||
{
|
{
|
||||||
mTemporaryStorageSize = var;
|
mTemporaryStorageSize = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getCacheStorageSize() const
|
const nn::hac::ApplicationControlProperty::sStorageSize& nn::hac::ApplicationControlProperty::getCacheStorageSize() const
|
||||||
{
|
{
|
||||||
return mCacheStorageSize;
|
return mCacheStorageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setCacheStorageSize(const sStorageSize& var)
|
void nn::hac::ApplicationControlProperty::setCacheStorageSize(const sStorageSize& var)
|
||||||
{
|
{
|
||||||
mCacheStorageSize = var;
|
mCacheStorageSize = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nn::hac::ApplicationControlPropertyBinary::getCacheStorageDataAndJournalSizeMax() const
|
int64_t nn::hac::ApplicationControlProperty::getCacheStorageDataAndJournalSizeMax() const
|
||||||
{
|
{
|
||||||
return mCacheStorageDataAndJournalSizeMax;
|
return mCacheStorageDataAndJournalSizeMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setCacheStorageDataAndJournalSizeMax(int64_t var)
|
void nn::hac::ApplicationControlProperty::setCacheStorageDataAndJournalSizeMax(int64_t var)
|
||||||
{
|
{
|
||||||
mCacheStorageDataAndJournalSizeMax = var;
|
mCacheStorageDataAndJournalSizeMax = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t nn::hac::ApplicationControlPropertyBinary::getCacheStorageIndexMax() const
|
uint16_t nn::hac::ApplicationControlProperty::getCacheStorageIndexMax() const
|
||||||
{
|
{
|
||||||
return mCacheStorageIndexMax;
|
return mCacheStorageIndexMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setCacheStorageIndexMax(uint16_t var)
|
void nn::hac::ApplicationControlProperty::setCacheStorageIndexMax(uint16_t var)
|
||||||
{
|
{
|
||||||
mCacheStorageIndexMax = var;
|
mCacheStorageIndexMax = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<uint64_t>& nn::hac::ApplicationControlPropertyBinary::getPlayLogQueryableApplicationId() const
|
const fnd::List<uint64_t>& nn::hac::ApplicationControlProperty::getPlayLogQueryableApplicationId() const
|
||||||
{
|
{
|
||||||
return mPlayLogQueryableApplicationId;
|
return mPlayLogQueryableApplicationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setPlayLogQueryableApplicationId(const fnd::List<uint64_t>& var)
|
void nn::hac::ApplicationControlProperty::setPlayLogQueryableApplicationId(const fnd::List<uint64_t>& var)
|
||||||
{
|
{
|
||||||
mPlayLogQueryableApplicationId = var;
|
mPlayLogQueryableApplicationId = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::PlayLogQueryCapability nn::hac::ApplicationControlPropertyBinary::getPlayLogQueryCapability() const
|
nn::hac::nacp::PlayLogQueryCapability nn::hac::ApplicationControlProperty::getPlayLogQueryCapability() const
|
||||||
{
|
{
|
||||||
return mPlayLogQueryCapability;
|
return mPlayLogQueryCapability;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setPlayLogQueryCapability(nacp::PlayLogQueryCapability var)
|
void nn::hac::ApplicationControlProperty::setPlayLogQueryCapability(nacp::PlayLogQueryCapability var)
|
||||||
{
|
{
|
||||||
mPlayLogQueryCapability = var;
|
mPlayLogQueryCapability = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::nacp::RepairFlag nn::hac::ApplicationControlPropertyBinary::getRepairFlag() const
|
nn::hac::nacp::RepairFlag nn::hac::ApplicationControlProperty::getRepairFlag() const
|
||||||
{
|
{
|
||||||
return mRepairFlag;
|
return mRepairFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setRepairFlag(nacp::RepairFlag var)
|
void nn::hac::ApplicationControlProperty::setRepairFlag(nacp::RepairFlag var)
|
||||||
{
|
{
|
||||||
mRepairFlag = var;
|
mRepairFlag = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::ApplicationControlPropertyBinary::getProgramIndex() const
|
byte_t nn::hac::ApplicationControlProperty::getProgramIndex() const
|
||||||
{
|
{
|
||||||
return mProgramIndex;
|
return mProgramIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ApplicationControlPropertyBinary::setProgramIndex(byte_t var)
|
void nn::hac::ApplicationControlProperty::setProgramIndex(byte_t var)
|
||||||
{
|
{
|
||||||
mProgramIndex = var;
|
mProgramIndex = var;
|
||||||
}
|
}
|
84
lib/libhac/source/ApplicationMetaExtendedHeader.cpp
Normal file
84
lib/libhac/source/ApplicationMetaExtendedHeader.cpp
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
#include <nn/hac/ApplicationMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
nn::hac::ApplicationMetaExtendedHeader::ApplicationMetaExtendedHeader()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::ApplicationMetaExtendedHeader::ApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::operator=(const ApplicationMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mPatchId = other.mPatchId;
|
||||||
|
mRequiredSystemVersion = other.mRequiredSystemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ApplicationMetaExtendedHeader::operator==(const ApplicationMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return (mPatchId == other.mPatchId) \
|
||||||
|
&& (mRequiredSystemVersion == other.mRequiredSystemVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ApplicationMetaExtendedHeader::operator!=(const ApplicationMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sApplicationMetaExtendedHeader));
|
||||||
|
sApplicationMetaExtendedHeader* info = (sApplicationMetaExtendedHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->patch_id = mPatchId;
|
||||||
|
info->required_system_version = mRequiredSystemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sApplicationMetaExtendedHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "ApplicationMetaExtendedHeader too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sApplicationMetaExtendedHeader* info = (const sApplicationMetaExtendedHeader*)bytes;
|
||||||
|
|
||||||
|
mPatchId = info->patch_id.get();
|
||||||
|
mRequiredSystemVersion = info->required_system_version.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::ApplicationMetaExtendedHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mPatchId = 0;
|
||||||
|
mRequiredSystemVersion = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ApplicationMetaExtendedHeader::getPatchId() const
|
||||||
|
{
|
||||||
|
return mPatchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::setPatchId(uint64_t application_id)
|
||||||
|
{
|
||||||
|
mPatchId = application_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ApplicationMetaExtendedHeader::getRequiredSystemVersion() const
|
||||||
|
{
|
||||||
|
return mRequiredSystemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::setRequiredSystemVersion(uint32_t sys_ver)
|
||||||
|
{
|
||||||
|
mRequiredSystemVersion = sys_ver;
|
||||||
|
}
|
334
lib/libhac/source/ContentArchiveHeader.cpp
Normal file
334
lib/libhac/source/ContentArchiveHeader.cpp
Normal file
|
@ -0,0 +1,334 @@
|
||||||
|
#include <nn/hac/ContentArchiveHeader.h>
|
||||||
|
|
||||||
|
nn::hac::ContentArchiveHeader::ContentArchiveHeader()
|
||||||
|
{
|
||||||
|
mRightsId.alloc(nca::kRightsIdLen);
|
||||||
|
mKeyArea.alloc(nca::kKeyAreaSize);
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::ContentArchiveHeader::ContentArchiveHeader(const ContentArchiveHeader & other) :
|
||||||
|
ContentArchiveHeader()
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentArchiveHeader::operator==(const ContentArchiveHeader & other) const
|
||||||
|
{
|
||||||
|
return (mFormatVersion == other.mFormatVersion) \
|
||||||
|
&& (mDistributionType == other.mDistributionType) \
|
||||||
|
&& (mContentType == other.mContentType) \
|
||||||
|
&& (mKeyGeneration == other.mKeyGeneration) \
|
||||||
|
&& (mKaekIndex == other.mKaekIndex) \
|
||||||
|
&& (mContentSize == other.mContentSize) \
|
||||||
|
&& (mProgramId == other.mProgramId) \
|
||||||
|
&& (mContentIndex == other.mContentIndex) \
|
||||||
|
&& (mSdkAddonVersion == other.mSdkAddonVersion) \
|
||||||
|
&& (mRightsId == other.mRightsId) \
|
||||||
|
&& (mPartitionEntryList == other.mPartitionEntryList) \
|
||||||
|
&& (mKeyArea == other.mKeyArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentArchiveHeader::operator!=(const ContentArchiveHeader & other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::operator=(const ContentArchiveHeader & other)
|
||||||
|
{
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mDistributionType = other.mDistributionType;
|
||||||
|
mContentType = other.mContentType;
|
||||||
|
mKeyGeneration = other.mKeyGeneration;
|
||||||
|
mKaekIndex = other.mKaekIndex;
|
||||||
|
mContentSize = other.mContentSize;
|
||||||
|
mProgramId = other.mProgramId;
|
||||||
|
mContentIndex = other.mContentIndex;
|
||||||
|
mSdkAddonVersion = other.mSdkAddonVersion;
|
||||||
|
mRightsId = other.mRightsId;
|
||||||
|
mPartitionEntryList = other.mPartitionEntryList;
|
||||||
|
mKeyArea = other.mKeyArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sContentArchiveHeader));
|
||||||
|
sContentArchiveHeader* hdr = (sContentArchiveHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
// set header magic
|
||||||
|
switch(mFormatVersion)
|
||||||
|
{
|
||||||
|
case (nca::FORMAT_NCA2):
|
||||||
|
hdr->st_magic = nca::kNca2StructMagic;
|
||||||
|
break;
|
||||||
|
case (nca::FORMAT_NCA3):
|
||||||
|
hdr->st_magic = nca::kNca3StructMagic;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw fnd::Exception(kModuleName, "Unsupported format version");
|
||||||
|
}
|
||||||
|
|
||||||
|
// set variables
|
||||||
|
hdr->distribution_type = mDistributionType;
|
||||||
|
hdr->content_type = mContentType;
|
||||||
|
if (mKeyGeneration > 2)
|
||||||
|
{
|
||||||
|
hdr->key_generation = 2;
|
||||||
|
hdr->key_generation_2 = mKeyGeneration;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hdr->key_generation = mKeyGeneration;
|
||||||
|
hdr->key_generation_2 = 0;
|
||||||
|
}
|
||||||
|
hdr->key_area_encryption_key_index = mKaekIndex;
|
||||||
|
hdr->content_size = mContentSize;
|
||||||
|
hdr->program_id = mProgramId;
|
||||||
|
hdr->content_index = mContentIndex;
|
||||||
|
hdr->sdk_addon_version = mSdkAddonVersion;
|
||||||
|
memcpy(hdr->rights_id, mRightsId.data(), nca::kRightsIdLen);
|
||||||
|
memcpy(hdr->key_area, mKeyArea.data(), nca::kKeyAreaSize);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < mPartitionEntryList.size(); i++)
|
||||||
|
{
|
||||||
|
byte_t index = mPartitionEntryList[i].header_index;
|
||||||
|
|
||||||
|
if (index >= nca::kPartitionNum) continue;
|
||||||
|
|
||||||
|
hdr->partition_entry[index].start_blk = sizeToBlockNum(mPartitionEntryList[index].offset);
|
||||||
|
hdr->partition_entry[index].end_blk = (sizeToBlockNum(mPartitionEntryList[index].offset) + sizeToBlockNum(mPartitionEntryList[index].size));
|
||||||
|
hdr->partition_entry[index].enabled = true;
|
||||||
|
hdr->fs_header_hash[index] = mPartitionEntryList[i].fs_header_hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::fromBytes(const byte_t * data, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sContentArchiveHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "ContentArchive header size is too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
mRawBinary.alloc(sizeof(sContentArchiveHeader));
|
||||||
|
memcpy(mRawBinary.data(), data, sizeof(sContentArchiveHeader));
|
||||||
|
|
||||||
|
sContentArchiveHeader* hdr = (sContentArchiveHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
// check magic
|
||||||
|
switch(hdr->st_magic.get())
|
||||||
|
{
|
||||||
|
case (nca::kNca2StructMagic) :
|
||||||
|
mFormatVersion = nca::FORMAT_NCA2;
|
||||||
|
break;
|
||||||
|
case (nca::kNca3StructMagic) :
|
||||||
|
mFormatVersion = nca::FORMAT_NCA3;
|
||||||
|
break;
|
||||||
|
throw fnd::Exception(kModuleName, "ContentArchive header corrupt (unrecognised header magic).");
|
||||||
|
}
|
||||||
|
|
||||||
|
// variables
|
||||||
|
mDistributionType = (nca::DistributionType)hdr->distribution_type;
|
||||||
|
mContentType = (nca::ContentType)hdr->content_type;
|
||||||
|
mKeyGeneration = _MAX(hdr->key_generation, hdr->key_generation_2);
|
||||||
|
mKaekIndex = hdr->key_area_encryption_key_index;
|
||||||
|
mContentSize = *hdr->content_size;
|
||||||
|
mProgramId = *hdr->program_id;
|
||||||
|
mContentIndex = *hdr->content_index;
|
||||||
|
mSdkAddonVersion = *hdr->sdk_addon_version;
|
||||||
|
memcpy(mRightsId.data(), hdr->rights_id, nca::kRightsIdLen);
|
||||||
|
memcpy(mKeyArea.data(), hdr->key_area, nca::kKeyAreaSize);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nca::kPartitionNum; i++)
|
||||||
|
{
|
||||||
|
if (hdr->partition_entry[i].enabled)
|
||||||
|
{
|
||||||
|
mPartitionEntryList.addElement({(byte_t)i, blockNumToSize(hdr->partition_entry[i].start_blk.get()), blockNumToSize(hdr->partition_entry[i].end_blk.get() - hdr->partition_entry[i].start_blk.get()), hdr->fs_header_hash[i] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::ContentArchiveHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::clear()
|
||||||
|
{
|
||||||
|
mFormatVersion = nca::FORMAT_NCA3;
|
||||||
|
mDistributionType = nca::DIST_DOWNLOAD;
|
||||||
|
mContentType = nca::TYPE_PROGRAM;
|
||||||
|
mKeyGeneration = 0;
|
||||||
|
mKaekIndex = 0;
|
||||||
|
mContentSize = 0;
|
||||||
|
mProgramId = 0;
|
||||||
|
mContentIndex = 0;
|
||||||
|
mSdkAddonVersion = 0;
|
||||||
|
memset(mRightsId.data(), 0, mRightsId.size());
|
||||||
|
mPartitionEntryList.clear();
|
||||||
|
memset(mKeyArea.data(), 0, mKeyArea.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentArchiveHeader::getFormatVersion() const
|
||||||
|
{
|
||||||
|
return mFormatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setFormatVersion(byte_t version)
|
||||||
|
{
|
||||||
|
mFormatVersion = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::nca::DistributionType nn::hac::ContentArchiveHeader::getDistributionType() const
|
||||||
|
{
|
||||||
|
return mDistributionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setDistributionType(nca::DistributionType type)
|
||||||
|
{
|
||||||
|
mDistributionType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::nca::ContentType nn::hac::ContentArchiveHeader::getContentType() const
|
||||||
|
{
|
||||||
|
return mContentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setContentType(nca::ContentType type)
|
||||||
|
{
|
||||||
|
mContentType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentArchiveHeader::getKeyGeneration() const
|
||||||
|
{
|
||||||
|
return mKeyGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setKeyGeneration(byte_t gen)
|
||||||
|
{
|
||||||
|
mKeyGeneration = gen;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentArchiveHeader::getKeyAreaEncryptionKeyIndex() const
|
||||||
|
{
|
||||||
|
return mKaekIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setKeyAreaEncryptionKeyIndex(byte_t index)
|
||||||
|
{
|
||||||
|
mKaekIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ContentArchiveHeader::getContentSize() const
|
||||||
|
{
|
||||||
|
return mContentSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setContentSize(uint64_t size)
|
||||||
|
{
|
||||||
|
mContentSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ContentArchiveHeader::getProgramId() const
|
||||||
|
{
|
||||||
|
return mProgramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setProgramId(uint64_t program_id)
|
||||||
|
{
|
||||||
|
mProgramId = program_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ContentArchiveHeader::getContentIndex() const
|
||||||
|
{
|
||||||
|
return mContentIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setContentIndex(uint32_t index)
|
||||||
|
{
|
||||||
|
mContentIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ContentArchiveHeader::getSdkAddonVersion() const
|
||||||
|
{
|
||||||
|
return mSdkAddonVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setSdkAddonVersion(uint32_t version)
|
||||||
|
{
|
||||||
|
mSdkAddonVersion = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentArchiveHeader::hasRightsId() const
|
||||||
|
{
|
||||||
|
bool rightsIdIsSet = false;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nca::kRightsIdLen; i++)
|
||||||
|
{
|
||||||
|
if (mRightsId[i] != 0)
|
||||||
|
rightsIdIsSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rightsIdIsSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
const byte_t* nn::hac::ContentArchiveHeader::getRightsId() const
|
||||||
|
{
|
||||||
|
return mRightsId.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setRightsId(const byte_t* rights_id)
|
||||||
|
{
|
||||||
|
memcpy(mRightsId.data(), rights_id, nca::kRightsIdLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::List<nn::hac::ContentArchiveHeader::sPartitionEntry>& nn::hac::ContentArchiveHeader::getPartitionEntryList() const
|
||||||
|
{
|
||||||
|
return mPartitionEntryList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setPartitionEntryList(const fnd::List<nn::hac::ContentArchiveHeader::sPartitionEntry>& partition_entry_list)
|
||||||
|
{
|
||||||
|
mPartitionEntryList = partition_entry_list;
|
||||||
|
|
||||||
|
// sanity check the list
|
||||||
|
if (mPartitionEntryList.size() >= nca::kPartitionNum)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "Too many partitions");
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < mPartitionEntryList.size(); i++)
|
||||||
|
{
|
||||||
|
if (mPartitionEntryList[i].header_index >= nca::kPartitionNum)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "Illegal partition index");
|
||||||
|
}
|
||||||
|
for (size_t j = i+1; j < mPartitionEntryList.size(); j++)
|
||||||
|
{
|
||||||
|
if (mPartitionEntryList[i].header_index == mPartitionEntryList[j].header_index)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "Duplicated partition index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const byte_t* nn::hac::ContentArchiveHeader::getKeyArea() const
|
||||||
|
{
|
||||||
|
return mKeyArea.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setKeyArea(const byte_t* key_area)
|
||||||
|
{
|
||||||
|
memcpy(mKeyArea.data(), key_area, nca::kKeyAreaSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ContentArchiveHeader::blockNumToSize(uint32_t block_num) const
|
||||||
|
{
|
||||||
|
return block_num * nca::kSectorSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ContentArchiveHeader::sizeToBlockNum(uint64_t real_size) const
|
||||||
|
{
|
||||||
|
return (uint32_t)(align(real_size, nca::kSectorSize) / nca::kSectorSize);
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
#include <nn/hac/NcaUtils.h>
|
#include <nn/hac/ContentArchiveUtils.h>
|
||||||
|
|
||||||
void nn::hac::NcaUtils::decryptNcaHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key)
|
void nn::hac::ContentArchiveUtils::decryptContentArchiveHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key)
|
||||||
{
|
{
|
||||||
byte_t tweak[fnd::aes::kAesBlockSize];
|
byte_t tweak[fnd::aes::kAesBlockSize];
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ void nn::hac::NcaUtils::decryptNcaHeader(const byte_t* src, byte_t* dst, const f
|
||||||
fnd::aes::AesXtsMakeTweak(tweak, 1);
|
fnd::aes::AesXtsMakeTweak(tweak, 1);
|
||||||
fnd::aes::AesXtsDecryptSector(src + sectorToOffset(1), nn::hac::nca::kSectorSize, key.key[0], key.key[1], tweak, raw_hdr);
|
fnd::aes::AesXtsDecryptSector(src + sectorToOffset(1), nn::hac::nca::kSectorSize, key.key[0], key.key[1], tweak, raw_hdr);
|
||||||
|
|
||||||
bool useNca2SectorIndex = ((nn::hac::sNcaHeader*)(raw_hdr))->st_magic.get() == nn::hac::nca::kNca2StructMagic;
|
bool useNca2SectorIndex = ((nn::hac::sContentArchiveHeader*)(raw_hdr))->st_magic.get() == nn::hac::nca::kNca2StructMagic;
|
||||||
|
|
||||||
// decrypt whole header
|
// decrypt whole header
|
||||||
for (size_t i = 0; i < nn::hac::nca::kHeaderSectorNum; i++)
|
for (size_t i = 0; i < nn::hac::nca::kHeaderSectorNum; i++)
|
||||||
|
@ -19,7 +19,7 @@ void nn::hac::NcaUtils::decryptNcaHeader(const byte_t* src, byte_t* dst, const f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation)
|
byte_t nn::hac::ContentArchiveUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation)
|
||||||
{
|
{
|
||||||
byte_t masterkey_rev;
|
byte_t masterkey_rev;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ byte_t nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_gener
|
||||||
return masterkey_rev;
|
return masterkey_rev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::NcaUtils::getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr)
|
void nn::hac::ContentArchiveUtils::getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < 8; i++)
|
for (size_t i = 0; i < 8; i++)
|
||||||
{
|
{
|
123
lib/libhac/source/ContentInfo.cpp
Normal file
123
lib/libhac/source/ContentInfo.cpp
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
#include <nn/hac/ContentInfo.h>
|
||||||
|
|
||||||
|
nn::hac::ContentInfo::ContentInfo()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::ContentInfo::ContentInfo(const ContentInfo& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::operator=(const ContentInfo& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mHash = other.mHash;
|
||||||
|
mContentId = other.mContentId;
|
||||||
|
mSize = other.mSize;
|
||||||
|
mType = other.mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentInfo::operator==(const ContentInfo& other) const
|
||||||
|
{
|
||||||
|
return (mHash == other.mHash) \
|
||||||
|
&& (mContentId == other.mContentId) \
|
||||||
|
&& (mSize == other.mSize) \
|
||||||
|
&& (mType == other.mType);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentInfo::operator!=(const ContentInfo& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sContentInfo));
|
||||||
|
sContentInfo* info = (sContentInfo*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->content_hash = mHash;
|
||||||
|
info->content_id = mContentId;
|
||||||
|
info->size_lower = mSize & (uint32_t)(-1);
|
||||||
|
info->size_higher = (mSize >> 32) & (uint16_t)(-1);
|
||||||
|
info->content_type = mType;
|
||||||
|
info->id_offset = mIdOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sContentInfo))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "ContentInfo too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sContentInfo* info = (const sContentInfo*)bytes;
|
||||||
|
|
||||||
|
mHash = info->content_hash;
|
||||||
|
mContentId = info->content_id;
|
||||||
|
mSize = (uint64_t)(info->size_lower.get()) | (uint64_t)(info->size_higher.get()) << 32;
|
||||||
|
mType = (cnmt::ContentType)info->content_type;
|
||||||
|
mIdOffset = info->id_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::ContentInfo::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::sha::sSha256Hash& nn::hac::ContentInfo::getContentHash() const
|
||||||
|
{
|
||||||
|
return mHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setContentHash(const fnd::sha::sSha256Hash& hash)
|
||||||
|
{
|
||||||
|
mHash = hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nn::hac::cnmt::sContentId& nn::hac::ContentInfo::getContentId() const
|
||||||
|
{
|
||||||
|
return mContentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setContentId(const cnmt::sContentId& content_id)
|
||||||
|
{
|
||||||
|
mContentId = content_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t nn::hac::ContentInfo::getContentSize() const
|
||||||
|
{
|
||||||
|
return mSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setContentSize(size_t size)
|
||||||
|
{
|
||||||
|
mSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::cnmt::ContentType nn::hac::ContentInfo::getContentType() const
|
||||||
|
{
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setContentType(cnmt::ContentType type)
|
||||||
|
{
|
||||||
|
mType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentInfo::getIdOffset() const
|
||||||
|
{
|
||||||
|
return mIdOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setIdOffset(byte_t id_offset)
|
||||||
|
{
|
||||||
|
mIdOffset = id_offset;
|
||||||
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
#include <nn/hac/ContentMetaBinary.h>
|
#include <nn/hac/ContentMeta.h>
|
||||||
|
|
||||||
nn::hac::ContentMetaBinary::ContentMetaBinary()
|
nn::hac::ContentMeta::ContentMeta()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::ContentMetaBinary::ContentMetaBinary(const ContentMetaBinary & other)
|
nn::hac::ContentMeta::ContentMeta(const ContentMeta & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::operator=(const ContentMetaBinary& other)
|
void nn::hac::ContentMeta::operator=(const ContentMeta& other)
|
||||||
{
|
{
|
||||||
if (other.getBytes().size() > 0)
|
if (other.getBytes().size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,6 @@ void nn::hac::ContentMetaBinary::operator=(const ContentMetaBinary& other)
|
||||||
mType = other.mType;
|
mType = other.mType;
|
||||||
mAttributes = other.mAttributes;
|
mAttributes = other.mAttributes;
|
||||||
mRequiredDownloadSystemVersion = other.mRequiredDownloadSystemVersion;
|
mRequiredDownloadSystemVersion = other.mRequiredDownloadSystemVersion;
|
||||||
mExtendedHeader = other.mExtendedHeader;
|
|
||||||
mApplicationMetaExtendedHeader = other.mApplicationMetaExtendedHeader;
|
mApplicationMetaExtendedHeader = other.mApplicationMetaExtendedHeader;
|
||||||
mPatchMetaExtendedHeader = other.mPatchMetaExtendedHeader;
|
mPatchMetaExtendedHeader = other.mPatchMetaExtendedHeader;
|
||||||
mAddOnContentMetaExtendedHeader = other.mAddOnContentMetaExtendedHeader;
|
mAddOnContentMetaExtendedHeader = other.mAddOnContentMetaExtendedHeader;
|
||||||
|
@ -36,14 +35,13 @@ void nn::hac::ContentMetaBinary::operator=(const ContentMetaBinary& other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ContentMetaBinary::operator==(const ContentMetaBinary& other) const
|
bool nn::hac::ContentMeta::operator==(const ContentMeta& other) const
|
||||||
{
|
{
|
||||||
return (mTitleId == other.mTitleId) \
|
return (mTitleId == other.mTitleId) \
|
||||||
&& (mTitleVersion == other.mTitleVersion) \
|
&& (mTitleVersion == other.mTitleVersion) \
|
||||||
&& (mType == other.mType) \
|
&& (mType == other.mType) \
|
||||||
&& (mAttributes == other.mAttributes) \
|
&& (mAttributes == other.mAttributes) \
|
||||||
&& (mRequiredDownloadSystemVersion == other.mRequiredDownloadSystemVersion) \
|
&& (mRequiredDownloadSystemVersion == other.mRequiredDownloadSystemVersion) \
|
||||||
&& (mExtendedHeader == other.mExtendedHeader) \
|
|
||||||
&& (mApplicationMetaExtendedHeader == other.mApplicationMetaExtendedHeader) \
|
&& (mApplicationMetaExtendedHeader == other.mApplicationMetaExtendedHeader) \
|
||||||
&& (mPatchMetaExtendedHeader == other.mPatchMetaExtendedHeader) \
|
&& (mPatchMetaExtendedHeader == other.mPatchMetaExtendedHeader) \
|
||||||
&& (mAddOnContentMetaExtendedHeader == other.mAddOnContentMetaExtendedHeader) \
|
&& (mAddOnContentMetaExtendedHeader == other.mAddOnContentMetaExtendedHeader) \
|
||||||
|
@ -54,17 +52,17 @@ bool nn::hac::ContentMetaBinary::operator==(const ContentMetaBinary& other) cons
|
||||||
&& (memcmp(mDigest.data, other.mDigest.data, cnmt::kDigestLen) == 0);
|
&& (memcmp(mDigest.data, other.mDigest.data, cnmt::kDigestLen) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ContentMetaBinary::operator!=(const ContentMetaBinary& other) const
|
bool nn::hac::ContentMeta::operator!=(const ContentMeta& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::toBytes()
|
void nn::hac::ContentMeta::toBytes()
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "exportBinary() not implemented");
|
throw fnd::Exception(kModuleName, "toBytes() not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::ContentMeta::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// clear member variables
|
// clear member variables
|
||||||
clear();
|
clear();
|
||||||
|
@ -85,31 +83,29 @@ void nn::hac::ContentMetaBinary::fromBytes(const byte_t* data, size_t len)
|
||||||
// save exheader
|
// save exheader
|
||||||
if (hdr->exhdr_size.get() > 0)
|
if (hdr->exhdr_size.get() > 0)
|
||||||
{
|
{
|
||||||
mExtendedHeader.alloc(hdr->exhdr_size.get());
|
|
||||||
memcpy(mExtendedHeader.data(), data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
|
||||||
|
|
||||||
switch (mType)
|
switch (mType)
|
||||||
{
|
{
|
||||||
case (cnmt::METATYPE_APPLICATION):
|
case (cnmt::METATYPE_APPLICATION):
|
||||||
mApplicationMetaExtendedHeader.patch_id = ((sApplicationMetaExtendedHeader*)mExtendedHeader.data())->patch_id.get();
|
mApplicationMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
||||||
mApplicationMetaExtendedHeader.required_system_version = ((sApplicationMetaExtendedHeader*)mExtendedHeader.data())->required_system_version.get();
|
exdata_size = 0;
|
||||||
break;
|
break;
|
||||||
case (cnmt::METATYPE_PATCH):
|
case (cnmt::METATYPE_PATCH):
|
||||||
mPatchMetaExtendedHeader.application_id = ((sPatchMetaExtendedHeader*)mExtendedHeader.data())->application_id.get();
|
mPatchMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
||||||
mPatchMetaExtendedHeader.required_system_version = ((sPatchMetaExtendedHeader*)mExtendedHeader.data())->required_system_version.get();
|
exdata_size = mPatchMetaExtendedHeader.getExtendedDataSize();
|
||||||
break;
|
break;
|
||||||
case (cnmt::METATYPE_ADD_ON_CONTENT):
|
case (cnmt::METATYPE_ADD_ON_CONTENT):
|
||||||
mAddOnContentMetaExtendedHeader.application_id = ((sAddOnContentMetaExtendedHeader*)mExtendedHeader.data())->application_id.get();
|
mAddOnContentMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
||||||
mAddOnContentMetaExtendedHeader.required_application_version = ((sAddOnContentMetaExtendedHeader*)mExtendedHeader.data())->required_application_version.get();
|
exdata_size = 0;
|
||||||
break;
|
break;
|
||||||
case (cnmt::METATYPE_DELTA):
|
case (cnmt::METATYPE_DELTA):
|
||||||
mDeltaMetaExtendedHeader.application_id = ((sDeltaMetaExtendedHeader*)mExtendedHeader.data())->application_id.get();
|
mDeltaMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
||||||
|
exdata_size = mDeltaMetaExtendedHeader.getExtendedDataSize();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
throw fnd::Exception(kModuleName, "Unhandled extended header for ContentMeta");
|
||||||
|
//exdata_size = 0;
|
||||||
|
//break;
|
||||||
}
|
}
|
||||||
|
|
||||||
exdata_size = getExtendedDataSize(mType, mExtendedHeader.data());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// save content info
|
// save content info
|
||||||
|
@ -119,10 +115,7 @@ void nn::hac::ContentMetaBinary::fromBytes(const byte_t* data, size_t len)
|
||||||
ContentInfo cinfo;
|
ContentInfo cinfo;
|
||||||
for (size_t i = 0; i < hdr->content_count.get(); i++)
|
for (size_t i = 0; i < hdr->content_count.get(); i++)
|
||||||
{
|
{
|
||||||
cinfo.hash = info[i].content_hash;
|
cinfo.fromBytes((const byte_t*)&info[i], sizeof(sContentInfo));
|
||||||
memcpy(cinfo.nca_id, info[i].content_id, cnmt::kContentIdLen);
|
|
||||||
cinfo.size = (uint64_t)(info[i].size_lower.get()) | (uint64_t)(info[i].size_higher.get()) << 32;
|
|
||||||
cinfo.type = (cnmt::ContentType)info[i].content_type;
|
|
||||||
mContentInfo.addElement(cinfo);
|
mContentInfo.addElement(cinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,10 +127,7 @@ void nn::hac::ContentMetaBinary::fromBytes(const byte_t* data, size_t len)
|
||||||
ContentMetaInfo cmeta;
|
ContentMetaInfo cmeta;
|
||||||
for (size_t i = 0; i < hdr->content_meta_count.get(); i++)
|
for (size_t i = 0; i < hdr->content_meta_count.get(); i++)
|
||||||
{
|
{
|
||||||
cmeta.id = info[i].id.get();
|
cmeta.fromBytes((const byte_t*)&info[i], sizeof(sContentMetaInfo));
|
||||||
cmeta.version = info[i].version.get();
|
|
||||||
cmeta.type = (cnmt::ContentMetaType)info[i].type;
|
|
||||||
cmeta.attributes = info[i].attributes;
|
|
||||||
mContentMetaInfo.addElement(cmeta);
|
mContentMetaInfo.addElement(cmeta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,12 +143,12 @@ void nn::hac::ContentMetaBinary::fromBytes(const byte_t* data, size_t len)
|
||||||
memcpy(mDigest.data, data + getDigestOffset(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), exdata_size), cnmt::kDigestLen);
|
memcpy(mDigest.data, data + getDigestOffset(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), exdata_size), cnmt::kDigestLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::ContentMetaBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::ContentMeta::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::clear()
|
void nn::hac::ContentMeta::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mTitleId = 0;
|
mTitleId = 0;
|
||||||
|
@ -166,149 +156,147 @@ void nn::hac::ContentMetaBinary::clear()
|
||||||
mType = cnmt::METATYPE_SYSTEM_PROGRAM;
|
mType = cnmt::METATYPE_SYSTEM_PROGRAM;
|
||||||
mAttributes = 0;
|
mAttributes = 0;
|
||||||
mRequiredDownloadSystemVersion = 0;
|
mRequiredDownloadSystemVersion = 0;
|
||||||
mExtendedHeader.clear();
|
mApplicationMetaExtendedHeader.clear();
|
||||||
memset(&mApplicationMetaExtendedHeader, 0, sizeof(mApplicationMetaExtendedHeader));
|
mPatchMetaExtendedHeader.clear();
|
||||||
memset(&mPatchMetaExtendedHeader, 0, sizeof(mPatchMetaExtendedHeader));
|
mAddOnContentMetaExtendedHeader.clear();
|
||||||
memset(&mAddOnContentMetaExtendedHeader, 0, sizeof(mAddOnContentMetaExtendedHeader));
|
mDeltaMetaExtendedHeader.clear();
|
||||||
memset(&mDeltaMetaExtendedHeader, 0, sizeof(mDeltaMetaExtendedHeader));
|
|
||||||
mContentInfo.clear();
|
mContentInfo.clear();
|
||||||
mContentMetaInfo.clear();
|
mContentMetaInfo.clear();
|
||||||
mExtendedData.clear();
|
mExtendedData.clear();
|
||||||
memset(mDigest.data, 0, cnmt::kDigestLen);
|
memset(mDigest.data, 0, cnmt::kDigestLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::ContentMetaBinary::getTitleId() const
|
uint64_t nn::hac::ContentMeta::getTitleId() const
|
||||||
{
|
{
|
||||||
return mTitleId;
|
return mTitleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setTitleId(uint64_t title_id)
|
void nn::hac::ContentMeta::setTitleId(uint64_t title_id)
|
||||||
{
|
{
|
||||||
mTitleId = title_id;
|
mTitleId = title_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::ContentMetaBinary::getTitleVersion() const
|
uint32_t nn::hac::ContentMeta::getTitleVersion() const
|
||||||
{
|
{
|
||||||
return mTitleVersion;
|
return mTitleVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setTitleVersion(uint32_t version)
|
void nn::hac::ContentMeta::setTitleVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mTitleVersion = version;
|
mTitleVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::cnmt::ContentMetaType nn::hac::ContentMetaBinary::getType() const
|
nn::hac::cnmt::ContentMetaType nn::hac::ContentMeta::getContentMetaType() const
|
||||||
{
|
{
|
||||||
return mType;
|
return mType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setType(cnmt::ContentMetaType type)
|
void nn::hac::ContentMeta::setContentMetaType(cnmt::ContentMetaType type)
|
||||||
{
|
{
|
||||||
mType = type;
|
mType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::ContentMetaBinary::getAttributes() const
|
byte_t nn::hac::ContentMeta::getAttributes() const
|
||||||
{
|
{
|
||||||
return mAttributes;
|
return mAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setAttributes(byte_t attributes)
|
void nn::hac::ContentMeta::setAttributes(byte_t attributes)
|
||||||
{
|
{
|
||||||
mAttributes = attributes;
|
mAttributes = attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::ContentMetaBinary::getRequiredDownloadSystemVersion() const
|
uint32_t nn::hac::ContentMeta::getRequiredDownloadSystemVersion() const
|
||||||
{
|
{
|
||||||
return mRequiredDownloadSystemVersion;
|
return mRequiredDownloadSystemVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setRequiredDownloadSystemVersion(uint32_t version)
|
void nn::hac::ContentMeta::setRequiredDownloadSystemVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mRequiredDownloadSystemVersion = version;
|
mRequiredDownloadSystemVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ContentMetaBinary::ApplicationMetaExtendedHeader& nn::hac::ContentMetaBinary::getApplicationMetaExtendedHeader() const
|
const nn::hac::ApplicationMetaExtendedHeader& nn::hac::ContentMeta::getApplicationMetaExtendedHeader() const
|
||||||
{
|
{
|
||||||
return mApplicationMetaExtendedHeader;
|
return mApplicationMetaExtendedHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr)
|
void nn::hac::ContentMeta::setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr)
|
||||||
{
|
{
|
||||||
mApplicationMetaExtendedHeader = exhdr;
|
mApplicationMetaExtendedHeader = exhdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ContentMetaBinary::PatchMetaExtendedHeader& nn::hac::ContentMetaBinary::getPatchMetaExtendedHeader() const
|
const nn::hac::PatchMetaExtendedHeader& nn::hac::ContentMeta::getPatchMetaExtendedHeader() const
|
||||||
{
|
{
|
||||||
return mPatchMetaExtendedHeader;
|
return mPatchMetaExtendedHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr)
|
void nn::hac::ContentMeta::setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr)
|
||||||
{
|
{
|
||||||
mPatchMetaExtendedHeader = exhdr;
|
mPatchMetaExtendedHeader = exhdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ContentMetaBinary::AddOnContentMetaExtendedHeader& nn::hac::ContentMetaBinary::getAddOnContentMetaExtendedHeader() const
|
const nn::hac::AddOnContentMetaExtendedHeader& nn::hac::ContentMeta::getAddOnContentMetaExtendedHeader() const
|
||||||
{
|
{
|
||||||
return mAddOnContentMetaExtendedHeader;
|
return mAddOnContentMetaExtendedHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr)
|
void nn::hac::ContentMeta::setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr)
|
||||||
{
|
{
|
||||||
mAddOnContentMetaExtendedHeader = exhdr;
|
mAddOnContentMetaExtendedHeader = exhdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ContentMetaBinary::DeltaMetaExtendedHeader& nn::hac::ContentMetaBinary::getDeltaMetaExtendedHeader() const
|
const nn::hac::DeltaMetaExtendedHeader& nn::hac::ContentMeta::getDeltaMetaExtendedHeader() const
|
||||||
{
|
{
|
||||||
return mDeltaMetaExtendedHeader;
|
return mDeltaMetaExtendedHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr)
|
void nn::hac::ContentMeta::setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr)
|
||||||
{
|
{
|
||||||
mDeltaMetaExtendedHeader = exhdr;
|
mDeltaMetaExtendedHeader = exhdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& nn::hac::ContentMetaBinary::getContentInfo() const
|
const fnd::List<nn::hac::ContentInfo>& nn::hac::ContentMeta::getContentInfo() const
|
||||||
{
|
{
|
||||||
return mContentInfo;
|
return mContentInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setContentInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& info)
|
void nn::hac::ContentMeta::setContentInfo(const fnd::List<nn::hac::ContentInfo>& info)
|
||||||
{
|
{
|
||||||
mContentInfo = info;
|
mContentInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& nn::hac::ContentMetaBinary::getContentMetaInfo() const
|
const fnd::List<nn::hac::ContentMetaInfo>& nn::hac::ContentMeta::getContentMetaInfo() const
|
||||||
{
|
{
|
||||||
return mContentMetaInfo;
|
return mContentMetaInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setContentMetaInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& info)
|
void nn::hac::ContentMeta::setContentMetaInfo(const fnd::List<nn::hac::ContentMetaInfo>& info)
|
||||||
{
|
{
|
||||||
mContentMetaInfo = info;
|
mContentMetaInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t> & nn::hac::ContentMetaBinary::getExtendedData() const
|
const fnd::Vec<byte_t> & nn::hac::ContentMeta::getExtendedData() const
|
||||||
{
|
{
|
||||||
return mExtendedData;
|
return mExtendedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setExtendedData(const fnd::Vec<byte_t> & data)
|
void nn::hac::ContentMeta::setExtendedData(const fnd::Vec<byte_t>& data)
|
||||||
{
|
{
|
||||||
mExtendedData = data;
|
mExtendedData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::sDigest & nn::hac::ContentMetaBinary::getDigest() const
|
const nn::hac::cnmt::sDigest & nn::hac::ContentMeta::getDigest() const
|
||||||
{
|
{
|
||||||
return mDigest;
|
return mDigest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::setDigest(const nn::hac::sDigest & digest)
|
void nn::hac::ContentMeta::setDigest(const nn::hac::cnmt::sDigest& digest)
|
||||||
{
|
{
|
||||||
|
mDigest = digest;
|
||||||
memcpy(mDigest.data, digest.data, cnmt::kDigestLen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ContentMetaBinary::validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const
|
bool nn::hac::ContentMeta::validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const
|
||||||
{
|
{
|
||||||
bool validSize = false;
|
bool validSize = false;
|
||||||
|
|
||||||
|
@ -333,7 +321,7 @@ bool nn::hac::ContentMetaBinary::validateExtendedHeaderSize(cnmt::ContentMetaTyp
|
||||||
return validSize;
|
return validSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nn::hac::ContentMetaBinary::getExtendedDataSize(cnmt::ContentMetaType type, const byte_t * data) const
|
size_t nn::hac::ContentMeta::getExtendedDataSize(cnmt::ContentMetaType type, const byte_t * data) const
|
||||||
{
|
{
|
||||||
size_t exdata_len = 0;
|
size_t exdata_len = 0;
|
||||||
if (type == cnmt::METATYPE_PATCH)
|
if (type == cnmt::METATYPE_PATCH)
|
||||||
|
@ -349,7 +337,7 @@ size_t nn::hac::ContentMetaBinary::getExtendedDataSize(cnmt::ContentMetaType typ
|
||||||
return exdata_len;
|
return exdata_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::validateBinary(const byte_t * data, size_t len) const
|
void nn::hac::ContentMeta::validateBinary(const byte_t * data, size_t len) const
|
||||||
{
|
{
|
||||||
// check if it is large enough to read the header
|
// check if it is large enough to read the header
|
||||||
if (len < sizeof(sContentMetaHeader))
|
if (len < sizeof(sContentMetaHeader))
|
114
lib/libhac/source/ContentMetaInfo.cpp
Normal file
114
lib/libhac/source/ContentMetaInfo.cpp
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
#include <nn/hac/ContentMetaInfo.h>
|
||||||
|
|
||||||
|
nn::hac::ContentMetaInfo::ContentMetaInfo()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::ContentMetaInfo::ContentMetaInfo(const ContentMetaInfo& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::operator=(const ContentMetaInfo& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mTitleId = other.mTitleId;
|
||||||
|
mTitleVersion = other.mTitleVersion;
|
||||||
|
mType = other.mType;
|
||||||
|
mAttributes = other.mAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentMetaInfo::operator==(const ContentMetaInfo& other) const
|
||||||
|
{
|
||||||
|
return (mTitleId == other.mTitleId) \
|
||||||
|
&& (mTitleVersion == other.mTitleVersion) \
|
||||||
|
&& (mType == other.mType) \
|
||||||
|
&& (mAttributes == other.mAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentMetaInfo::operator!=(const ContentMetaInfo& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sContentMetaInfo));
|
||||||
|
sContentMetaInfo* info = (sContentMetaInfo*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->id = mTitleId;
|
||||||
|
info->version = mTitleVersion;
|
||||||
|
info->type = mType;
|
||||||
|
info->attributes = mAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sContentMetaInfo))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "ContentMetaInfo too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sContentMetaInfo* info = (const sContentMetaInfo*)bytes;
|
||||||
|
|
||||||
|
mTitleId = info->id.get();
|
||||||
|
mTitleVersion = info->version.get();
|
||||||
|
mType = (cnmt::ContentMetaType)info->type;
|
||||||
|
mAttributes = info->attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::ContentMetaInfo::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mTitleId = 0;
|
||||||
|
mTitleVersion = 0;
|
||||||
|
mType = cnmt::ContentMetaType::METATYPE_APPLICATION;
|
||||||
|
mAttributes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ContentMetaInfo::getTitleId() const
|
||||||
|
{
|
||||||
|
return mTitleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::setTitleId(uint64_t title_id)
|
||||||
|
{
|
||||||
|
mTitleId = title_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ContentMetaInfo::getTitleVersion() const
|
||||||
|
{
|
||||||
|
return mTitleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::setTitleVersion(uint32_t ver)
|
||||||
|
{
|
||||||
|
mTitleVersion = ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::cnmt::ContentMetaType nn::hac::ContentMetaInfo::getContentMetaType() const
|
||||||
|
{
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::setContentMetaType(cnmt::ContentMetaType type)
|
||||||
|
{
|
||||||
|
mType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentMetaInfo::getAttributes() const
|
||||||
|
{
|
||||||
|
return mAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::setAttributes(byte_t attr)
|
||||||
|
{
|
||||||
|
mAttributes = attr;
|
||||||
|
}
|
84
lib/libhac/source/DeltaMetaExtendedHeader.cpp
Normal file
84
lib/libhac/source/DeltaMetaExtendedHeader.cpp
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
#include <nn/hac/DeltaMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
nn::hac::DeltaMetaExtendedHeader::DeltaMetaExtendedHeader()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::DeltaMetaExtendedHeader::DeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::operator=(const DeltaMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mApplicationId = other.mApplicationId;
|
||||||
|
mExtendedDataSize = other.mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::DeltaMetaExtendedHeader::operator==(const DeltaMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return (mApplicationId == other.mApplicationId) \
|
||||||
|
&& (mExtendedDataSize == other.mExtendedDataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::DeltaMetaExtendedHeader::operator!=(const DeltaMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sDeltaMetaExtendedHeader));
|
||||||
|
sDeltaMetaExtendedHeader* info = (sDeltaMetaExtendedHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->application_id = mApplicationId;
|
||||||
|
info->extended_data_size = mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sDeltaMetaExtendedHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "DeltaMetaExtendedHeader too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sDeltaMetaExtendedHeader* info = (const sDeltaMetaExtendedHeader*)bytes;
|
||||||
|
|
||||||
|
mApplicationId = info->application_id.get();
|
||||||
|
mExtendedDataSize = info->extended_data_size.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::DeltaMetaExtendedHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mApplicationId = 0;
|
||||||
|
mExtendedDataSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::DeltaMetaExtendedHeader::getApplicationId() const
|
||||||
|
{
|
||||||
|
return mApplicationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::setApplicationId(uint64_t application_id)
|
||||||
|
{
|
||||||
|
mApplicationId = application_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::DeltaMetaExtendedHeader::getExtendedDataSize() const
|
||||||
|
{
|
||||||
|
return mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::setExtendedDataSize(uint32_t size)
|
||||||
|
{
|
||||||
|
mExtendedDataSize = size;
|
||||||
|
}
|
|
@ -1,17 +1,17 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/FileSystemAccessControlBinary.h>
|
#include <nn/hac/FileSystemAccessControl.h>
|
||||||
|
|
||||||
nn::hac::FileSystemAccessControlBinary::FileSystemAccessControlBinary()
|
nn::hac::FileSystemAccessControl::FileSystemAccessControl()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::FileSystemAccessControlBinary::FileSystemAccessControlBinary(const FileSystemAccessControlBinary & other)
|
nn::hac::FileSystemAccessControl::FileSystemAccessControl(const FileSystemAccessControl & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::operator=(const FileSystemAccessControlBinary & other)
|
void nn::hac::FileSystemAccessControl::operator=(const FileSystemAccessControl & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mVersion = other.mVersion;
|
mVersion = other.mVersion;
|
||||||
|
@ -20,7 +20,7 @@ void nn::hac::FileSystemAccessControlBinary::operator=(const FileSystemAccessCon
|
||||||
mSaveDataOwnerIdList = other.mSaveDataOwnerIdList;
|
mSaveDataOwnerIdList = other.mSaveDataOwnerIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::FileSystemAccessControlBinary::operator==(const FileSystemAccessControlBinary & other) const
|
bool nn::hac::FileSystemAccessControl::operator==(const FileSystemAccessControl & other) const
|
||||||
{
|
{
|
||||||
return (mVersion == other.mVersion) \
|
return (mVersion == other.mVersion) \
|
||||||
&& (mFsaRights == other.mFsaRights) \
|
&& (mFsaRights == other.mFsaRights) \
|
||||||
|
@ -28,12 +28,12 @@ bool nn::hac::FileSystemAccessControlBinary::operator==(const FileSystemAccessCo
|
||||||
&& (mSaveDataOwnerIdList == other.mSaveDataOwnerIdList);
|
&& (mSaveDataOwnerIdList == other.mSaveDataOwnerIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::FileSystemAccessControlBinary::operator!=(const FileSystemAccessControlBinary & other) const
|
bool nn::hac::FileSystemAccessControl::operator!=(const FileSystemAccessControl & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::toBytes()
|
void nn::hac::FileSystemAccessControl::toBytes()
|
||||||
{
|
{
|
||||||
// determine section layout
|
// determine section layout
|
||||||
struct sLayout {
|
struct sLayout {
|
||||||
|
@ -98,7 +98,7 @@ void nn::hac::FileSystemAccessControlBinary::toBytes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::FileSystemAccessControl::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check size
|
// check size
|
||||||
if (len < sizeof(sFacHeader))
|
if (len < sizeof(sFacHeader))
|
||||||
|
@ -164,12 +164,12 @@ void nn::hac::FileSystemAccessControlBinary::fromBytes(const byte_t* data, size_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::FileSystemAccessControlBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::FileSystemAccessControl::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::clear()
|
void nn::hac::FileSystemAccessControl::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mVersion = 0;
|
mVersion = 0;
|
||||||
|
@ -178,42 +178,42 @@ void nn::hac::FileSystemAccessControlBinary::clear()
|
||||||
mSaveDataOwnerIdList.clear();
|
mSaveDataOwnerIdList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::FileSystemAccessControlBinary::getFormatVersion() const
|
uint32_t nn::hac::FileSystemAccessControl::getFormatVersion() const
|
||||||
{
|
{
|
||||||
return mVersion;
|
return mVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::setFormatVersion(uint32_t format_version)
|
void nn::hac::FileSystemAccessControl::setFormatVersion(uint32_t format_version)
|
||||||
{
|
{
|
||||||
mVersion = format_version;
|
mVersion = format_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::fac::FsAccessFlag>& nn::hac::FileSystemAccessControlBinary::getFsaRightsList() const
|
const fnd::List<nn::hac::fac::FsAccessFlag>& nn::hac::FileSystemAccessControl::getFsaRightsList() const
|
||||||
{
|
{
|
||||||
return mFsaRights;
|
return mFsaRights;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list)
|
void nn::hac::FileSystemAccessControl::setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list)
|
||||||
{
|
{
|
||||||
mFsaRights = list;
|
mFsaRights = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<uint64_t>& nn::hac::FileSystemAccessControlBinary::getContentOwnerIdList() const
|
const fnd::List<uint64_t>& nn::hac::FileSystemAccessControl::getContentOwnerIdList() const
|
||||||
{
|
{
|
||||||
return mContentOwnerIdList;
|
return mContentOwnerIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::setContentOwnerIdList(const fnd::List<uint64_t>& list)
|
void nn::hac::FileSystemAccessControl::setContentOwnerIdList(const fnd::List<uint64_t>& list)
|
||||||
{
|
{
|
||||||
mContentOwnerIdList = list;
|
mContentOwnerIdList = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::FileSystemAccessControlBinary::sSaveDataOwnerId>& nn::hac::FileSystemAccessControlBinary::getSaveDataOwnerIdList() const
|
const fnd::List<nn::hac::FileSystemAccessControl::sSaveDataOwnerId>& nn::hac::FileSystemAccessControl::getSaveDataOwnerIdList() const
|
||||||
{
|
{
|
||||||
return mSaveDataOwnerIdList;
|
return mSaveDataOwnerIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list)
|
void nn::hac::FileSystemAccessControl::setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list)
|
||||||
{
|
{
|
||||||
mSaveDataOwnerIdList = list;
|
mSaveDataOwnerIdList = list;
|
||||||
}
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
#include <nn/hac/XciHeader.h>
|
#include <nn/hac/GameCardHeader.h>
|
||||||
|
|
||||||
nn::hac::XciHeader::XciHeader()
|
nn::hac::GameCardHeader::GameCardHeader()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::XciHeader::XciHeader(const XciHeader& other)
|
nn::hac::GameCardHeader::GameCardHeader(const GameCardHeader& other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::operator=(const XciHeader& other)
|
void nn::hac::GameCardHeader::operator=(const GameCardHeader& other)
|
||||||
{
|
{
|
||||||
mRomAreaStartPage = other.mRomAreaStartPage;
|
mRomAreaStartPage = other.mRomAreaStartPage;
|
||||||
mBackupAreaStartPage = other.mBackupAreaStartPage;
|
mBackupAreaStartPage = other.mBackupAreaStartPage;
|
||||||
|
@ -39,11 +39,11 @@ void nn::hac::XciHeader::operator=(const XciHeader& other)
|
||||||
mWait2TimeWrite = other.mWait2TimeWrite;
|
mWait2TimeWrite = other.mWait2TimeWrite;
|
||||||
mFwMode = other.mFwMode;
|
mFwMode = other.mFwMode;
|
||||||
mUppVersion = other.mUppVersion;
|
mUppVersion = other.mUppVersion;
|
||||||
memcpy(mUppHash, other.mUppHash, xci::kUppHashLen);
|
memcpy(mUppHash, other.mUppHash, gc::kUppHashLen);
|
||||||
mUppId = other.mUppId;
|
mUppId = other.mUppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::XciHeader::operator==(const XciHeader& other) const
|
bool nn::hac::GameCardHeader::operator==(const GameCardHeader& other) const
|
||||||
{
|
{
|
||||||
return (mRomAreaStartPage == other.mRomAreaStartPage)
|
return (mRomAreaStartPage == other.mRomAreaStartPage)
|
||||||
&& (mBackupAreaStartPage == other.mBackupAreaStartPage)
|
&& (mBackupAreaStartPage == other.mBackupAreaStartPage)
|
||||||
|
@ -72,42 +72,42 @@ bool nn::hac::XciHeader::operator==(const XciHeader& other) const
|
||||||
&& (mWait2TimeWrite == other.mWait2TimeWrite)
|
&& (mWait2TimeWrite == other.mWait2TimeWrite)
|
||||||
&& (mFwMode == other.mFwMode)
|
&& (mFwMode == other.mFwMode)
|
||||||
&& (mUppVersion == other.mUppVersion)
|
&& (mUppVersion == other.mUppVersion)
|
||||||
&& (memcmp(mUppHash, other.mUppHash, xci::kUppHashLen) == 0)
|
&& (memcmp(mUppHash, other.mUppHash, gc::kUppHashLen) == 0)
|
||||||
&& (mUppId == other.mUppId);
|
&& (mUppId == other.mUppId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::XciHeader::operator!=(const XciHeader& other) const
|
bool nn::hac::GameCardHeader::operator!=(const GameCardHeader& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::toBytes()
|
void nn::hac::GameCardHeader::toBytes()
|
||||||
{
|
{
|
||||||
fnd::Exception(kModuleName, "exportBinary() not implemented");
|
fnd::Exception(kModuleName, "toBytes() not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::GameCardHeader::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check input data size
|
// check input data size
|
||||||
if (len < sizeof(sXciHeader))
|
if (len < sizeof(sGcHeader))
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "XCI header size is too small");
|
throw fnd::Exception(kModuleName, "GameCardImage header size is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear internal members
|
// clear internal members
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// allocate internal local binary copy
|
// allocate internal local binary copy
|
||||||
mRawBinary.alloc(sizeof(sXciHeader));
|
mRawBinary.alloc(sizeof(sGcHeader));
|
||||||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||||
|
|
||||||
// get sXciHeader ptr
|
// get sGcHeader ptr
|
||||||
const nn::hac::sXciHeader* hdr = (const nn::hac::sXciHeader*)mRawBinary.data();
|
const nn::hac::sGcHeader* hdr = (const nn::hac::sGcHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// check XCI signature
|
// check GameCardImage signature
|
||||||
if (hdr->st_magic.get() != xci::kXciStructMagic)
|
if (hdr->st_magic.get() != gc::kGcHeaderStructMagic)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "XCI header corrupt");
|
throw fnd::Exception(kModuleName, "GameCardImage header corrupt");
|
||||||
}
|
}
|
||||||
|
|
||||||
mRomAreaStartPage = hdr->rom_area_start_page.get();
|
mRomAreaStartPage = hdr->rom_area_start_page.get();
|
||||||
|
@ -133,8 +133,8 @@ void nn::hac::XciHeader::fromBytes(const byte_t* data, size_t len)
|
||||||
// if decrypted
|
// if decrypted
|
||||||
if (hdr->reserved_02[sizeof(hdr->reserved_02)-1] == 0x00 && hdr->reserved_02[sizeof(hdr->reserved_02)-2] == 0x00)
|
if (hdr->reserved_02[sizeof(hdr->reserved_02)-1] == 0x00 && hdr->reserved_02[sizeof(hdr->reserved_02)-2] == 0x00)
|
||||||
{
|
{
|
||||||
mFwVersion[xci::FWVER_MAJOR] = hdr->fw_version[xci::FWVER_MAJOR].get();
|
mFwVersion[gc::FWVER_MAJOR] = hdr->fw_version[gc::FWVER_MAJOR].get();
|
||||||
mFwVersion[xci::FWVER_MINOR] = hdr->fw_version[xci::FWVER_MINOR].get();
|
mFwVersion[gc::FWVER_MINOR] = hdr->fw_version[gc::FWVER_MINOR].get();
|
||||||
mAccCtrl1 = hdr->acc_ctrl_1.get();
|
mAccCtrl1 = hdr->acc_ctrl_1.get();
|
||||||
mWait1TimeRead = hdr->wait_1_time_read.get();
|
mWait1TimeRead = hdr->wait_1_time_read.get();
|
||||||
mWait2TimeRead = hdr->wait_2_time_read.get();
|
mWait2TimeRead = hdr->wait_2_time_read.get();
|
||||||
|
@ -142,19 +142,19 @@ void nn::hac::XciHeader::fromBytes(const byte_t* data, size_t len)
|
||||||
mWait2TimeWrite = hdr->wait_2_time_write.get();
|
mWait2TimeWrite = hdr->wait_2_time_write.get();
|
||||||
mFwMode = hdr->fw_mode.get();
|
mFwMode = hdr->fw_mode.get();
|
||||||
mUppVersion = hdr->upp_version.get();
|
mUppVersion = hdr->upp_version.get();
|
||||||
memcpy(mUppHash, hdr->upp_hash, xci::kUppHashLen);
|
memcpy(mUppHash, hdr->upp_hash, gc::kUppHashLen);
|
||||||
mUppId = hdr->upp_id.get();
|
mUppId = hdr->upp_id.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::XciHeader::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::GameCardHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void nn::hac::XciHeader::clear()
|
void nn::hac::GameCardHeader::clear()
|
||||||
{
|
{
|
||||||
mRomAreaStartPage = 0;
|
mRomAreaStartPage = 0;
|
||||||
mBackupAreaStartPage = 0;
|
mBackupAreaStartPage = 0;
|
||||||
|
@ -183,297 +183,297 @@ void nn::hac::XciHeader::clear()
|
||||||
mWait2TimeWrite = 0;
|
mWait2TimeWrite = 0;
|
||||||
mFwMode = 0;
|
mFwMode = 0;
|
||||||
mUppVersion = 0;
|
mUppVersion = 0;
|
||||||
memset(mUppHash, 0, xci::kUppHashLen);
|
memset(mUppHash, 0, gc::kUppHashLen);
|
||||||
mUppId = 0;
|
mUppId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getRomAreaStartPage() const
|
uint32_t nn::hac::GameCardHeader::getRomAreaStartPage() const
|
||||||
{
|
{
|
||||||
return mRomAreaStartPage;
|
return mRomAreaStartPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setRomAreaStartPage(uint32_t startPage)
|
void nn::hac::GameCardHeader::setRomAreaStartPage(uint32_t startPage)
|
||||||
{
|
{
|
||||||
mRomAreaStartPage = startPage;
|
mRomAreaStartPage = startPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getBackupAreaStartPage() const
|
uint32_t nn::hac::GameCardHeader::getBackupAreaStartPage() const
|
||||||
{
|
{
|
||||||
return mBackupAreaStartPage;
|
return mBackupAreaStartPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setBackupAreaStartPage(uint32_t startPage)
|
void nn::hac::GameCardHeader::setBackupAreaStartPage(uint32_t startPage)
|
||||||
{
|
{
|
||||||
mBackupAreaStartPage = startPage;
|
mBackupAreaStartPage = startPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getKekIndex() const
|
byte_t nn::hac::GameCardHeader::getKekIndex() const
|
||||||
{
|
{
|
||||||
return mKekIndex;
|
return mKekIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setKekIndex(byte_t kekIndex)
|
void nn::hac::GameCardHeader::setKekIndex(byte_t kekIndex)
|
||||||
{
|
{
|
||||||
mKekIndex = kekIndex;
|
mKekIndex = kekIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getTitleKeyDecIndex() const
|
byte_t nn::hac::GameCardHeader::getTitleKeyDecIndex() const
|
||||||
{
|
{
|
||||||
return mTitleKeyDecIndex;
|
return mTitleKeyDecIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setTitleKeyDecIndex(byte_t index)
|
void nn::hac::GameCardHeader::setTitleKeyDecIndex(byte_t index)
|
||||||
{
|
{
|
||||||
mTitleKeyDecIndex = index;
|
mTitleKeyDecIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getRomSizeType() const
|
byte_t nn::hac::GameCardHeader::getRomSizeType() const
|
||||||
{
|
{
|
||||||
return mRomSize;
|
return mRomSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setRomSizeType(byte_t romSizeType)
|
void nn::hac::GameCardHeader::setRomSizeType(byte_t romSizeType)
|
||||||
{
|
{
|
||||||
mRomSize = romSizeType;
|
mRomSize = romSizeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getCardHeaderVersion() const
|
byte_t nn::hac::GameCardHeader::getCardHeaderVersion() const
|
||||||
{
|
{
|
||||||
return mCardHeaderVersion;
|
return mCardHeaderVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setCardHeaderVersion(byte_t version)
|
void nn::hac::GameCardHeader::setCardHeaderVersion(byte_t version)
|
||||||
{
|
{
|
||||||
mCardHeaderVersion = version;
|
mCardHeaderVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getFlags() const
|
byte_t nn::hac::GameCardHeader::getFlags() const
|
||||||
{
|
{
|
||||||
return mFlags;
|
return mFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setFlags(byte_t flags)
|
void nn::hac::GameCardHeader::setFlags(byte_t flags)
|
||||||
{
|
{
|
||||||
mFlags = flags;
|
mFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::XciHeader::getPackageId() const
|
uint64_t nn::hac::GameCardHeader::getPackageId() const
|
||||||
{
|
{
|
||||||
return mPackageId;
|
return mPackageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setPackageId(uint64_t id)
|
void nn::hac::GameCardHeader::setPackageId(uint64_t id)
|
||||||
{
|
{
|
||||||
mPackageId = id;
|
mPackageId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getValidDataEndPage() const
|
uint32_t nn::hac::GameCardHeader::getValidDataEndPage() const
|
||||||
{
|
{
|
||||||
return mValidDataEndPage;
|
return mValidDataEndPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setValidDataEndPage(uint32_t page)
|
void nn::hac::GameCardHeader::setValidDataEndPage(uint32_t page)
|
||||||
{
|
{
|
||||||
mValidDataEndPage = page;
|
mValidDataEndPage = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::aes::sAesIvCtr& nn::hac::XciHeader::getAesCbcIv() const
|
const fnd::aes::sAesIvCtr& nn::hac::GameCardHeader::getAesCbcIv() const
|
||||||
{
|
{
|
||||||
return mAesCbcIv;
|
return mAesCbcIv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setAesCbcIv(const fnd::aes::sAesIvCtr& iv)
|
void nn::hac::GameCardHeader::setAesCbcIv(const fnd::aes::sAesIvCtr& iv)
|
||||||
{
|
{
|
||||||
mAesCbcIv = iv;
|
mAesCbcIv = iv;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::XciHeader::getPartitionFsAddress() const
|
uint64_t nn::hac::GameCardHeader::getPartitionFsAddress() const
|
||||||
{
|
{
|
||||||
return mPartitionFsHeaderAddress;
|
return mPartitionFsHeaderAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setPartitionFsAddress(uint64_t address)
|
void nn::hac::GameCardHeader::setPartitionFsAddress(uint64_t address)
|
||||||
{
|
{
|
||||||
mPartitionFsHeaderAddress = address;
|
mPartitionFsHeaderAddress = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::XciHeader::getPartitionFsSize() const
|
uint64_t nn::hac::GameCardHeader::getPartitionFsSize() const
|
||||||
{
|
{
|
||||||
return mPartitionFsHeaderSize;
|
return mPartitionFsHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setPartitionFsSize(uint64_t size)
|
void nn::hac::GameCardHeader::setPartitionFsSize(uint64_t size)
|
||||||
{
|
{
|
||||||
mPartitionFsHeaderSize = size;
|
mPartitionFsHeaderSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::sha::sSha256Hash& nn::hac::XciHeader::getPartitionFsHash() const
|
const fnd::sha::sSha256Hash& nn::hac::GameCardHeader::getPartitionFsHash() const
|
||||||
{
|
{
|
||||||
return mPartitionFsHeaderHash;
|
return mPartitionFsHeaderHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setPartitionFsHash(const fnd::sha::sSha256Hash& hash)
|
void nn::hac::GameCardHeader::setPartitionFsHash(const fnd::sha::sSha256Hash& hash)
|
||||||
{
|
{
|
||||||
mPartitionFsHeaderHash = hash;
|
mPartitionFsHeaderHash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::sha::sSha256Hash& nn::hac::XciHeader::getInitialDataHash() const
|
const fnd::sha::sSha256Hash& nn::hac::GameCardHeader::getInitialDataHash() const
|
||||||
{
|
{
|
||||||
return mInitialDataHash;
|
return mInitialDataHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setInitialDataHash(const fnd::sha::sSha256Hash& hash)
|
void nn::hac::GameCardHeader::setInitialDataHash(const fnd::sha::sSha256Hash& hash)
|
||||||
{
|
{
|
||||||
mInitialDataHash = hash;
|
mInitialDataHash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getSelSec() const
|
uint32_t nn::hac::GameCardHeader::getSelSec() const
|
||||||
{
|
{
|
||||||
return mSelSec;
|
return mSelSec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setSelSec(uint32_t sel_sec)
|
void nn::hac::GameCardHeader::setSelSec(uint32_t sel_sec)
|
||||||
{
|
{
|
||||||
mSelSec = sel_sec;
|
mSelSec = sel_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getSelT1Key() const
|
uint32_t nn::hac::GameCardHeader::getSelT1Key() const
|
||||||
{
|
{
|
||||||
return mSelT1Key;
|
return mSelT1Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setSelT1Key(uint32_t sel_t1_key)
|
void nn::hac::GameCardHeader::setSelT1Key(uint32_t sel_t1_key)
|
||||||
{
|
{
|
||||||
mSelT1Key = sel_t1_key;
|
mSelT1Key = sel_t1_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getSelKey() const
|
uint32_t nn::hac::GameCardHeader::getSelKey() const
|
||||||
{
|
{
|
||||||
return mSelKey;
|
return mSelKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setSelKey(uint32_t sel_key)
|
void nn::hac::GameCardHeader::setSelKey(uint32_t sel_key)
|
||||||
{
|
{
|
||||||
mSelKey = sel_key;
|
mSelKey = sel_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getLimAreaPage() const
|
uint32_t nn::hac::GameCardHeader::getLimAreaPage() const
|
||||||
{
|
{
|
||||||
return mLimAreaPage;
|
return mLimAreaPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setLimAreaPage(uint32_t page)
|
void nn::hac::GameCardHeader::setLimAreaPage(uint32_t page)
|
||||||
{
|
{
|
||||||
mLimAreaPage = page;
|
mLimAreaPage = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getFwVerMajor() const
|
uint32_t nn::hac::GameCardHeader::getFwVerMajor() const
|
||||||
{
|
{
|
||||||
return mFwVersion[xci::FWVER_MAJOR];
|
return mFwVersion[gc::FWVER_MAJOR];
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setFwVerMajor(uint32_t ver)
|
void nn::hac::GameCardHeader::setFwVerMajor(uint32_t ver)
|
||||||
{
|
{
|
||||||
mFwVersion[xci::FWVER_MAJOR] = ver;
|
mFwVersion[gc::FWVER_MAJOR] = ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getFwVerMinor() const
|
uint32_t nn::hac::GameCardHeader::getFwVerMinor() const
|
||||||
{
|
{
|
||||||
return mFwVersion[xci::FWVER_MINOR];
|
return mFwVersion[gc::FWVER_MINOR];
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setFwVerMinor(uint32_t ver)
|
void nn::hac::GameCardHeader::setFwVerMinor(uint32_t ver)
|
||||||
{
|
{
|
||||||
mFwVersion[xci::FWVER_MINOR] = ver;
|
mFwVersion[gc::FWVER_MINOR] = ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getAccCtrl1() const
|
uint32_t nn::hac::GameCardHeader::getAccCtrl1() const
|
||||||
{
|
{
|
||||||
return mAccCtrl1;
|
return mAccCtrl1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setAccCtrl1(uint32_t acc_ctrl_1)
|
void nn::hac::GameCardHeader::setAccCtrl1(uint32_t acc_ctrl_1)
|
||||||
{
|
{
|
||||||
mAccCtrl1 = acc_ctrl_1;
|
mAccCtrl1 = acc_ctrl_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getWait1TimeRead() const
|
uint32_t nn::hac::GameCardHeader::getWait1TimeRead() const
|
||||||
{
|
{
|
||||||
return mWait1TimeRead;
|
return mWait1TimeRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setWait1TimeRead(uint32_t seconds)
|
void nn::hac::GameCardHeader::setWait1TimeRead(uint32_t seconds)
|
||||||
{
|
{
|
||||||
mWait1TimeRead = seconds;
|
mWait1TimeRead = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getWait2TimeRead() const
|
uint32_t nn::hac::GameCardHeader::getWait2TimeRead() const
|
||||||
{
|
{
|
||||||
return mWait2TimeRead;
|
return mWait2TimeRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setWait2TimeRead(uint32_t seconds)
|
void nn::hac::GameCardHeader::setWait2TimeRead(uint32_t seconds)
|
||||||
{
|
{
|
||||||
mWait2TimeRead = seconds;
|
mWait2TimeRead = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getWait1TimeWrite() const
|
uint32_t nn::hac::GameCardHeader::getWait1TimeWrite() const
|
||||||
{
|
{
|
||||||
return mWait1TimeWrite;
|
return mWait1TimeWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setWait1TimeWrite(uint32_t seconds)
|
void nn::hac::GameCardHeader::setWait1TimeWrite(uint32_t seconds)
|
||||||
{
|
{
|
||||||
mWait1TimeWrite = seconds;
|
mWait1TimeWrite = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getWait2TimeWrite() const
|
uint32_t nn::hac::GameCardHeader::getWait2TimeWrite() const
|
||||||
{
|
{
|
||||||
return mWait2TimeWrite;
|
return mWait2TimeWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setWait2TimeWrite(uint32_t seconds)
|
void nn::hac::GameCardHeader::setWait2TimeWrite(uint32_t seconds)
|
||||||
{
|
{
|
||||||
mWait2TimeWrite = seconds;
|
mWait2TimeWrite = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getFwMode() const
|
uint32_t nn::hac::GameCardHeader::getFwMode() const
|
||||||
{
|
{
|
||||||
return mFwMode;
|
return mFwMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setFwMode(uint32_t fw_mode)
|
void nn::hac::GameCardHeader::setFwMode(uint32_t fw_mode)
|
||||||
{
|
{
|
||||||
mFwMode = fw_mode;
|
mFwMode = fw_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getUppVersion() const
|
uint32_t nn::hac::GameCardHeader::getUppVersion() const
|
||||||
{
|
{
|
||||||
return mUppVersion;
|
return mUppVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setUppVersion(uint32_t version)
|
void nn::hac::GameCardHeader::setUppVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mUppVersion = version;
|
mUppVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte_t* nn::hac::XciHeader::getUppHash() const
|
const byte_t* nn::hac::GameCardHeader::getUppHash() const
|
||||||
{
|
{
|
||||||
return mUppHash;
|
return mUppHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setUppHash(const byte_t* hash)
|
void nn::hac::GameCardHeader::setUppHash(const byte_t* hash)
|
||||||
{
|
{
|
||||||
memcpy(mUppHash, hash, xci::kUppHashLen);
|
memcpy(mUppHash, hash, gc::kUppHashLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::XciHeader::getUppId() const
|
uint64_t nn::hac::GameCardHeader::getUppId() const
|
||||||
{
|
{
|
||||||
return mUppId;
|
return mUppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setUppId(uint64_t id)
|
void nn::hac::GameCardHeader::setUppId(uint64_t id)
|
||||||
{
|
{
|
||||||
mUppId = id;
|
mUppId = id;
|
||||||
}
|
}
|
22
lib/libhac/source/GameCardUtils.cpp
Normal file
22
lib/libhac/source/GameCardUtils.cpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#include <nn/hac/GameCardUtils.h>
|
||||||
|
|
||||||
|
void nn::hac::GameCardUtils::getXciHeaderAesIv(const nn::hac::sGcHeader* hdr, byte_t* iv)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
iv[15-i] = hdr->aescbc_iv.iv[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::GameCardUtils::decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key)
|
||||||
|
{
|
||||||
|
byte_t iv[fnd::aes::kAesBlockSize];
|
||||||
|
|
||||||
|
getXciHeaderAesIv((const nn::hac::sGcHeader*)src, iv);
|
||||||
|
|
||||||
|
// copy plain
|
||||||
|
memcpy(dst, src, nn::hac::gc::kHeaderEncOffset);
|
||||||
|
|
||||||
|
// decrypt encrypted data
|
||||||
|
fnd::aes::AesCbcDecrypt(src + nn::hac::gc::kHeaderEncOffset, nn::hac::gc::kHeaderEncSize, key, iv, dst + nn::hac::gc::kHeaderEncOffset);
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
#include <nn/hac/KernelCapabilityBinary.h>
|
#include <nn/hac/KernelCapabilityControl.h>
|
||||||
|
|
||||||
nn::hac::KernelCapabilityBinary::KernelCapabilityBinary()
|
nn::hac::KernelCapabilityControl::KernelCapabilityControl()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
nn::hac::KernelCapabilityBinary::KernelCapabilityBinary(const KernelCapabilityBinary & other)
|
nn::hac::KernelCapabilityControl::KernelCapabilityControl(const KernelCapabilityControl & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & other)
|
void nn::hac::KernelCapabilityControl::operator=(const KernelCapabilityControl & other)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
|
@ -22,7 +22,7 @@ void nn::hac::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & o
|
||||||
mMiscFlags = other.mMiscFlags;
|
mMiscFlags = other.mMiscFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::KernelCapabilityBinary::operator==(const KernelCapabilityBinary & other) const
|
bool nn::hac::KernelCapabilityControl::operator==(const KernelCapabilityControl & other) const
|
||||||
{
|
{
|
||||||
return (mThreadInfo == other.mThreadInfo) \
|
return (mThreadInfo == other.mThreadInfo) \
|
||||||
&& (mSystemCalls == other.mSystemCalls) \
|
&& (mSystemCalls == other.mSystemCalls) \
|
||||||
|
@ -34,12 +34,12 @@ bool nn::hac::KernelCapabilityBinary::operator==(const KernelCapabilityBinary &
|
||||||
&& (mMiscFlags == other.mMiscFlags);
|
&& (mMiscFlags == other.mMiscFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::KernelCapabilityBinary::operator!=(const KernelCapabilityBinary & other) const
|
bool nn::hac::KernelCapabilityControl::operator!=(const KernelCapabilityControl & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::KernelCapabilityBinary::toBytes()
|
void nn::hac::KernelCapabilityControl::toBytes()
|
||||||
{
|
{
|
||||||
fnd::List<KernelCapabilityEntry> caps;
|
fnd::List<KernelCapabilityEntry> caps;
|
||||||
|
|
||||||
|
@ -64,14 +64,14 @@ void nn::hac::KernelCapabilityBinary::toBytes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::KernelCapabilityBinary::fromBytes(const byte_t * data, size_t len)
|
void nn::hac::KernelCapabilityControl::fromBytes(const byte_t * data, size_t len)
|
||||||
{
|
{
|
||||||
if ((len % sizeof(uint32_t)) != 0)
|
if ((len % sizeof(uint32_t)) != 0)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "KernelCapabilityEntry list must be aligned to 4 bytes");
|
throw fnd::Exception(kModuleName, "KernelCapabilityEntry list must be aligned to 4 bytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
// save copy of KernelCapabilityBinary
|
// save copy of KernelCapabilityControl
|
||||||
mRawBinary.alloc(len);
|
mRawBinary.alloc(len);
|
||||||
memcpy(mRawBinary.data(), data, len);
|
memcpy(mRawBinary.data(), data, len);
|
||||||
|
|
||||||
|
@ -132,12 +132,12 @@ void nn::hac::KernelCapabilityBinary::fromBytes(const byte_t * data, size_t len)
|
||||||
mMiscFlags.importKernelCapabilityList(miscFlagsCaps);
|
mMiscFlags.importKernelCapabilityList(miscFlagsCaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::KernelCapabilityBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::KernelCapabilityControl::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::KernelCapabilityBinary::clear()
|
void nn::hac::KernelCapabilityControl::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mThreadInfo.clear();
|
mThreadInfo.clear();
|
||||||
|
@ -150,82 +150,82 @@ void nn::hac::KernelCapabilityBinary::clear()
|
||||||
mMiscFlags.clear();
|
mMiscFlags.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityBinary::getThreadInfo() const
|
const nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityControl::getThreadInfo() const
|
||||||
{
|
{
|
||||||
return mThreadInfo;
|
return mThreadInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityBinary::getThreadInfo()
|
nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityControl::getThreadInfo()
|
||||||
{
|
{
|
||||||
return mThreadInfo;
|
return mThreadInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::SystemCallHandler & nn::hac::KernelCapabilityBinary::getSystemCalls() const
|
const nn::hac::SystemCallHandler & nn::hac::KernelCapabilityControl::getSystemCalls() const
|
||||||
{
|
{
|
||||||
return mSystemCalls;
|
return mSystemCalls;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::SystemCallHandler & nn::hac::KernelCapabilityBinary::getSystemCalls()
|
nn::hac::SystemCallHandler & nn::hac::KernelCapabilityControl::getSystemCalls()
|
||||||
{
|
{
|
||||||
return mSystemCalls;
|
return mSystemCalls;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityBinary::getMemoryMaps() const
|
const nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityControl::getMemoryMaps() const
|
||||||
{
|
{
|
||||||
return mMemoryMap;
|
return mMemoryMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityBinary::getMemoryMaps()
|
nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityControl::getMemoryMaps()
|
||||||
{
|
{
|
||||||
return mMemoryMap;
|
return mMemoryMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::InteruptHandler & nn::hac::KernelCapabilityBinary::getInterupts() const
|
const nn::hac::InteruptHandler & nn::hac::KernelCapabilityControl::getInterupts() const
|
||||||
{
|
{
|
||||||
return mInterupts;
|
return mInterupts;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::InteruptHandler & nn::hac::KernelCapabilityBinary::getInterupts()
|
nn::hac::InteruptHandler & nn::hac::KernelCapabilityControl::getInterupts()
|
||||||
{
|
{
|
||||||
return mInterupts;
|
return mInterupts;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityBinary::getMiscParams() const
|
const nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityControl::getMiscParams() const
|
||||||
{
|
{
|
||||||
return mMiscParams;
|
return mMiscParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityBinary::getMiscParams()
|
nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityControl::getMiscParams()
|
||||||
{
|
{
|
||||||
return mMiscParams;
|
return mMiscParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityBinary::getKernelVersion() const
|
const nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityControl::getKernelVersion() const
|
||||||
{
|
{
|
||||||
return mKernelVersion;
|
return mKernelVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityBinary::getKernelVersion()
|
nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityControl::getKernelVersion()
|
||||||
{
|
{
|
||||||
return mKernelVersion;
|
return mKernelVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityBinary::getHandleTableSize() const
|
const nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityControl::getHandleTableSize() const
|
||||||
{
|
{
|
||||||
return mHandleTableSize;
|
return mHandleTableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityBinary::getHandleTableSize()
|
nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityControl::getHandleTableSize()
|
||||||
{
|
{
|
||||||
return mHandleTableSize;
|
return mHandleTableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityBinary::getMiscFlags() const
|
const nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityControl::getMiscFlags() const
|
||||||
{
|
{
|
||||||
return mMiscFlags;
|
return mMiscFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityBinary::getMiscFlags()
|
nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityControl::getMiscFlags()
|
||||||
{
|
{
|
||||||
return mMiscFlags;
|
return mMiscFlags;
|
||||||
}
|
}
|
|
@ -1,19 +1,19 @@
|
||||||
#include <nn/hac/MetaBinary.h>
|
#include <nn/hac/Meta.h>
|
||||||
|
|
||||||
#include <fnd/SimpleTextOutput.h>
|
#include <fnd/SimpleTextOutput.h>
|
||||||
|
|
||||||
nn::hac::MetaBinary::MetaBinary()
|
nn::hac::Meta::Meta()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::MetaBinary::MetaBinary(const MetaBinary & other) :
|
nn::hac::Meta::Meta(const Meta & other) :
|
||||||
MetaBinary()
|
Meta()
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::operator=(const MetaBinary & other)
|
void nn::hac::Meta::operator=(const Meta & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mInstructionType = other.mInstructionType;
|
mInstructionType = other.mInstructionType;
|
||||||
|
@ -28,7 +28,7 @@ void nn::hac::MetaBinary::operator=(const MetaBinary & other)
|
||||||
mAcid = other.mAcid;
|
mAcid = other.mAcid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::MetaBinary::operator==(const MetaBinary & other) const
|
bool nn::hac::Meta::operator==(const Meta & other) const
|
||||||
{
|
{
|
||||||
return (mInstructionType == other.mInstructionType) \
|
return (mInstructionType == other.mInstructionType) \
|
||||||
&& (mProcAddressSpaceType == other.mProcAddressSpaceType) \
|
&& (mProcAddressSpaceType == other.mProcAddressSpaceType) \
|
||||||
|
@ -42,12 +42,12 @@ bool nn::hac::MetaBinary::operator==(const MetaBinary & other) const
|
||||||
&& (mAcid == other.mAcid);
|
&& (mAcid == other.mAcid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::MetaBinary::operator!=(const MetaBinary & other) const
|
bool nn::hac::Meta::operator!=(const Meta & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::toBytes()
|
void nn::hac::Meta::toBytes()
|
||||||
{
|
{
|
||||||
if (mAcid.getBytes().size() == 0)
|
if (mAcid.getBytes().size() == 0)
|
||||||
mAcid.toBytes();
|
mAcid.toBytes();
|
||||||
|
@ -103,7 +103,7 @@ void nn::hac::MetaBinary::toBytes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::Meta::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check size
|
// check size
|
||||||
if (len < sizeof(sMetaHeader))
|
if (len < sizeof(sMetaHeader))
|
||||||
|
@ -159,12 +159,12 @@ void nn::hac::MetaBinary::fromBytes(const byte_t* data, size_t len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::MetaBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::Meta::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::clear()
|
void nn::hac::Meta::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mInstructionType = meta::INSTR_64BIT;
|
mInstructionType = meta::INSTR_64BIT;
|
||||||
|
@ -179,32 +179,32 @@ void nn::hac::MetaBinary::clear()
|
||||||
mAcid.clear();
|
mAcid.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::meta::InstructionType nn::hac::MetaBinary::getInstructionType() const
|
nn::hac::meta::InstructionType nn::hac::Meta::getInstructionType() const
|
||||||
{
|
{
|
||||||
return mInstructionType;
|
return mInstructionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setInstructionType(meta::InstructionType type)
|
void nn::hac::Meta::setInstructionType(meta::InstructionType type)
|
||||||
{
|
{
|
||||||
mInstructionType = type;
|
mInstructionType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::meta::ProcAddrSpaceType nn::hac::MetaBinary::getProcAddressSpaceType() const
|
nn::hac::meta::ProcAddrSpaceType nn::hac::Meta::getProcAddressSpaceType() const
|
||||||
{
|
{
|
||||||
return mProcAddressSpaceType;
|
return mProcAddressSpaceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setProcAddressSpaceType(meta::ProcAddrSpaceType type)
|
void nn::hac::Meta::setProcAddressSpaceType(meta::ProcAddrSpaceType type)
|
||||||
{
|
{
|
||||||
mProcAddressSpaceType = type;
|
mProcAddressSpaceType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::MetaBinary::getMainThreadPriority() const
|
byte_t nn::hac::Meta::getMainThreadPriority() const
|
||||||
{
|
{
|
||||||
return mMainThreadPriority;
|
return mMainThreadPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setMainThreadPriority(byte_t priority)
|
void nn::hac::Meta::setMainThreadPriority(byte_t priority)
|
||||||
{
|
{
|
||||||
if (priority > meta::kMaxPriority)
|
if (priority > meta::kMaxPriority)
|
||||||
{
|
{
|
||||||
|
@ -214,42 +214,42 @@ void nn::hac::MetaBinary::setMainThreadPriority(byte_t priority)
|
||||||
mMainThreadPriority = priority;
|
mMainThreadPriority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::MetaBinary::getMainThreadCpuId() const
|
byte_t nn::hac::Meta::getMainThreadCpuId() const
|
||||||
{
|
{
|
||||||
return mMainThreadCpuId;
|
return mMainThreadCpuId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setMainThreadCpuId(byte_t core_num)
|
void nn::hac::Meta::setMainThreadCpuId(byte_t core_num)
|
||||||
{
|
{
|
||||||
mMainThreadCpuId = core_num;
|
mMainThreadCpuId = core_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::MetaBinary::getVersion() const
|
uint32_t nn::hac::Meta::getVersion() const
|
||||||
{
|
{
|
||||||
return mVersion;
|
return mVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setVersion(uint32_t version)
|
void nn::hac::Meta::setVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mVersion = version;
|
mVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::MetaBinary::getMainThreadStackSize() const
|
uint32_t nn::hac::Meta::getMainThreadStackSize() const
|
||||||
{
|
{
|
||||||
return mMainThreadStackSize;
|
return mMainThreadStackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setMainThreadStackSize(uint32_t size)
|
void nn::hac::Meta::setMainThreadStackSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mMainThreadStackSize = size;
|
mMainThreadStackSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & nn::hac::MetaBinary::getName() const
|
const std::string & nn::hac::Meta::getName() const
|
||||||
{
|
{
|
||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setName(const std::string & name)
|
void nn::hac::Meta::setName(const std::string & name)
|
||||||
{
|
{
|
||||||
if (name.length() > meta::kNameMaxLen)
|
if (name.length() > meta::kNameMaxLen)
|
||||||
{
|
{
|
||||||
|
@ -259,12 +259,12 @@ void nn::hac::MetaBinary::setName(const std::string & name)
|
||||||
mName = name;
|
mName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & nn::hac::MetaBinary::getProductCode() const
|
const std::string & nn::hac::Meta::getProductCode() const
|
||||||
{
|
{
|
||||||
return mProductCode;
|
return mProductCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setProductCode(const std::string & product_code)
|
void nn::hac::Meta::setProductCode(const std::string & product_code)
|
||||||
{
|
{
|
||||||
if (product_code.length() > meta::kProductCodeMaxLen)
|
if (product_code.length() > meta::kProductCodeMaxLen)
|
||||||
{
|
{
|
||||||
|
@ -274,22 +274,22 @@ void nn::hac::MetaBinary::setProductCode(const std::string & product_code)
|
||||||
mProductCode = product_code;
|
mProductCode = product_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::AccessControlInfoBinary & nn::hac::MetaBinary::getAci() const
|
const nn::hac::AccessControlInfo & nn::hac::Meta::getAci() const
|
||||||
{
|
{
|
||||||
return mAci;
|
return mAci;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setAci(const AccessControlInfoBinary & aci)
|
void nn::hac::Meta::setAci(const AccessControlInfo & aci)
|
||||||
{
|
{
|
||||||
mAci = aci;
|
mAci = aci;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::AccessControlInfoDescBinary & nn::hac::MetaBinary::getAcid() const
|
const nn::hac::AccessControlInfoDesc & nn::hac::Meta::getAcid() const
|
||||||
{
|
{
|
||||||
return mAcid;
|
return mAcid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setAcid(const AccessControlInfoDescBinary & acid)
|
void nn::hac::Meta::setAcid(const AccessControlInfoDesc & acid)
|
||||||
{
|
{
|
||||||
mAcid = acid;
|
mAcid = acid;
|
||||||
}
|
}
|
|
@ -1,327 +0,0 @@
|
||||||
#include <nn/hac/NcaHeader.h>
|
|
||||||
|
|
||||||
nn::hac::NcaHeader::NcaHeader()
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::hac::NcaHeader::NcaHeader(const NcaHeader & other)
|
|
||||||
{
|
|
||||||
*this = other;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nn::hac::NcaHeader::operator==(const NcaHeader & other) const
|
|
||||||
{
|
|
||||||
return (mDistributionType == other.mDistributionType) \
|
|
||||||
&& (mContentType == other.mContentType) \
|
|
||||||
&& (mKeyGeneration == other.mKeyGeneration) \
|
|
||||||
&& (mKaekIndex == other.mKaekIndex) \
|
|
||||||
&& (mContentSize == other.mContentSize) \
|
|
||||||
&& (mProgramId == other.mProgramId) \
|
|
||||||
&& (mContentIndex == other.mContentIndex) \
|
|
||||||
&& (mSdkAddonVersion == other.mSdkAddonVersion) \
|
|
||||||
&& (mPartitions == other.mPartitions) \
|
|
||||||
&& (mEncAesKeys == other.mEncAesKeys);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nn::hac::NcaHeader::operator!=(const NcaHeader & other) const
|
|
||||||
{
|
|
||||||
return !(*this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::operator=(const NcaHeader & other)
|
|
||||||
{
|
|
||||||
if (other.getBytes().size())
|
|
||||||
{
|
|
||||||
fromBytes(other.getBytes().data(), other.getBytes().size());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mRawBinary.clear();
|
|
||||||
mDistributionType = other.mDistributionType;
|
|
||||||
mContentType = other.mContentType;
|
|
||||||
mKeyGeneration = other.mKeyGeneration;
|
|
||||||
mKaekIndex = other.mKaekIndex;
|
|
||||||
mContentSize = other.mContentSize;
|
|
||||||
mProgramId = other.mProgramId;
|
|
||||||
mContentIndex = other.mContentIndex;
|
|
||||||
mSdkAddonVersion = other.mSdkAddonVersion;
|
|
||||||
mPartitions = other.mPartitions;
|
|
||||||
mEncAesKeys = other.mEncAesKeys;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::toBytes()
|
|
||||||
{
|
|
||||||
mRawBinary.alloc(sizeof(sNcaHeader));
|
|
||||||
sNcaHeader* hdr = (sNcaHeader*)mRawBinary.data();
|
|
||||||
|
|
||||||
|
|
||||||
switch(mFormatVersion)
|
|
||||||
{
|
|
||||||
case (NCA2_FORMAT):
|
|
||||||
hdr->st_magic = nca::kNca2StructMagic;
|
|
||||||
break;
|
|
||||||
case (NCA3_FORMAT):
|
|
||||||
hdr->st_magic = nca::kNca3StructMagic;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw fnd::Exception(kModuleName, "Unsupported format version");
|
|
||||||
}
|
|
||||||
hdr->distribution_type = mDistributionType;
|
|
||||||
hdr->content_type = mContentType;
|
|
||||||
if (mKeyGeneration > 2)
|
|
||||||
{
|
|
||||||
hdr->key_generation = 2;
|
|
||||||
hdr->key_generation_2 = mKeyGeneration;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hdr->key_generation = mKeyGeneration;
|
|
||||||
hdr->key_generation_2 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
hdr->key_area_encryption_key_index = mKaekIndex;
|
|
||||||
hdr->content_size = mContentSize;
|
|
||||||
hdr->program_id = mProgramId;
|
|
||||||
hdr->content_index = mContentIndex;
|
|
||||||
hdr->sdk_addon_version = mSdkAddonVersion;
|
|
||||||
memcpy(hdr->rights_id, mRightsId, nca::kRightsIdLen);
|
|
||||||
|
|
||||||
// TODO: properly reconstruct NCA layout? atm in hands of user
|
|
||||||
for (size_t i = 0; i < mPartitions.size(); i++)
|
|
||||||
{
|
|
||||||
// determine partition index
|
|
||||||
byte_t idx = mPartitions[i].index;
|
|
||||||
|
|
||||||
if (mPartitions[i].index >= nca::kPartitionNum || hdr->partition[idx].enabled) continue;
|
|
||||||
|
|
||||||
hdr->partition[idx].start = sizeToBlockNum(mPartitions[i].offset);
|
|
||||||
hdr->partition[idx].end = (sizeToBlockNum(mPartitions[i].offset) + sizeToBlockNum(mPartitions[i].size));
|
|
||||||
hdr->partition[idx].enabled = true;
|
|
||||||
hdr->partition_hash[idx] = mPartitions[i].hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nca::kAesKeyNum; i++)
|
|
||||||
{
|
|
||||||
hdr->enc_aes_key[i] = mEncAesKeys[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::fromBytes(const byte_t * data, size_t len)
|
|
||||||
{
|
|
||||||
if (len < sizeof(sNcaHeader))
|
|
||||||
{
|
|
||||||
throw fnd::Exception(kModuleName, "NCA header size is too small");
|
|
||||||
}
|
|
||||||
|
|
||||||
clear();
|
|
||||||
|
|
||||||
mRawBinary.alloc(sizeof(sNcaHeader));
|
|
||||||
memcpy(mRawBinary.data(), data, sizeof(sNcaHeader));
|
|
||||||
|
|
||||||
sNcaHeader* hdr = (sNcaHeader*)mRawBinary.data();
|
|
||||||
|
|
||||||
switch(hdr->st_magic.get())
|
|
||||||
{
|
|
||||||
case (nca::kNca2StructMagic) :
|
|
||||||
mFormatVersion = NCA2_FORMAT;
|
|
||||||
break;
|
|
||||||
case (nca::kNca3StructMagic) :
|
|
||||||
mFormatVersion = NCA3_FORMAT;
|
|
||||||
break;
|
|
||||||
throw fnd::Exception(kModuleName, "NCA header corrupt");
|
|
||||||
}
|
|
||||||
|
|
||||||
mDistributionType = (nca::DistributionType)hdr->distribution_type;
|
|
||||||
mContentType = (nca::ContentType)hdr->content_type;
|
|
||||||
mKeyGeneration = _MAX(hdr->key_generation, hdr->key_generation_2);
|
|
||||||
mKaekIndex = hdr->key_area_encryption_key_index;
|
|
||||||
mContentSize = *hdr->content_size;
|
|
||||||
mProgramId = *hdr->program_id;
|
|
||||||
mContentIndex = *hdr->content_index;
|
|
||||||
mSdkAddonVersion = *hdr->sdk_addon_version;
|
|
||||||
memcpy(mRightsId, hdr->rights_id, nca::kRightsIdLen);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nca::kPartitionNum; i++)
|
|
||||||
{
|
|
||||||
// skip sections that don't exist
|
|
||||||
if (hdr->partition[i].enabled == 0) continue;
|
|
||||||
|
|
||||||
// add high level struct
|
|
||||||
mPartitions.addElement({(byte_t)i, blockNumToSize(hdr->partition[i].start.get()), blockNumToSize(hdr->partition[i].end.get() - hdr->partition[i].start.get()), hdr->partition_hash[i] });
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nca::kAesKeyNum; i++)
|
|
||||||
{
|
|
||||||
mEncAesKeys.addElement(hdr->enc_aes_key[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::NcaHeader::getBytes() const
|
|
||||||
{
|
|
||||||
return mRawBinary;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::clear()
|
|
||||||
{
|
|
||||||
mFormatVersion = NCA3_FORMAT;
|
|
||||||
mDistributionType = nca::DIST_DOWNLOAD;
|
|
||||||
mContentType = nca::TYPE_PROGRAM;
|
|
||||||
mKeyGeneration = 0;
|
|
||||||
mKaekIndex = 0;
|
|
||||||
mContentSize = 0;
|
|
||||||
mProgramId = 0;
|
|
||||||
mContentIndex = 0;
|
|
||||||
mSdkAddonVersion = 0;
|
|
||||||
|
|
||||||
mPartitions.clear();
|
|
||||||
mEncAesKeys.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::hac::NcaHeader::FormatVersion nn::hac::NcaHeader::getFormatVersion() const
|
|
||||||
{
|
|
||||||
return mFormatVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setFormatVersion(FormatVersion version)
|
|
||||||
{
|
|
||||||
mFormatVersion = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::hac::nca::DistributionType nn::hac::NcaHeader::getDistributionType() const
|
|
||||||
{
|
|
||||||
return mDistributionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setDistributionType(nca::DistributionType type)
|
|
||||||
{
|
|
||||||
mDistributionType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::hac::nca::ContentType nn::hac::NcaHeader::getContentType() const
|
|
||||||
{
|
|
||||||
return mContentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setContentType(nca::ContentType type)
|
|
||||||
{
|
|
||||||
mContentType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
byte_t nn::hac::NcaHeader::getKeyGeneration() const
|
|
||||||
{
|
|
||||||
return mKeyGeneration;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setKeyGeneration(byte_t gen)
|
|
||||||
{
|
|
||||||
mKeyGeneration = gen;
|
|
||||||
}
|
|
||||||
|
|
||||||
byte_t nn::hac::NcaHeader::getKaekIndex() const
|
|
||||||
{
|
|
||||||
return mKaekIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setKaekIndex(byte_t index)
|
|
||||||
{
|
|
||||||
mKaekIndex = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t nn::hac::NcaHeader::getContentSize() const
|
|
||||||
{
|
|
||||||
return mContentSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setContentSize(uint64_t size)
|
|
||||||
{
|
|
||||||
mContentSize = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t nn::hac::NcaHeader::getProgramId() const
|
|
||||||
{
|
|
||||||
return mProgramId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setProgramId(uint64_t program_id)
|
|
||||||
{
|
|
||||||
mProgramId = program_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t nn::hac::NcaHeader::getContentIndex() const
|
|
||||||
{
|
|
||||||
return mContentIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setContentIndex(uint32_t index)
|
|
||||||
{
|
|
||||||
mContentIndex = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t nn::hac::NcaHeader::getSdkAddonVersion() const
|
|
||||||
{
|
|
||||||
return mSdkAddonVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setSdkAddonVersion(uint32_t version)
|
|
||||||
{
|
|
||||||
mSdkAddonVersion = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nn::hac::NcaHeader::hasRightsId() const
|
|
||||||
{
|
|
||||||
bool rightsIdIsSet = false;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nca::kRightsIdLen; i++)
|
|
||||||
{
|
|
||||||
if (mRightsId[i] != 0)
|
|
||||||
rightsIdIsSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rightsIdIsSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
const byte_t* nn::hac::NcaHeader::getRightsId() const
|
|
||||||
{
|
|
||||||
return mRightsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setRightsId(const byte_t* rights_id)
|
|
||||||
{
|
|
||||||
memcpy(mRightsId, rights_id, nca::kRightsIdLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fnd::List<nn::hac::NcaHeader::sPartition>& nn::hac::NcaHeader::getPartitions() const
|
|
||||||
{
|
|
||||||
return mPartitions;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setPartitions(const fnd::List<nn::hac::NcaHeader::sPartition>& partitions)
|
|
||||||
{
|
|
||||||
mPartitions = partitions;
|
|
||||||
if (mPartitions.size() >= nca::kPartitionNum)
|
|
||||||
{
|
|
||||||
throw fnd::Exception(kModuleName, "Too many NCA partitions");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fnd::List<fnd::aes::sAes128Key>& nn::hac::NcaHeader::getEncAesKeys() const
|
|
||||||
{
|
|
||||||
return mEncAesKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setEncAesKeys(const fnd::List<fnd::aes::sAes128Key>& keys)
|
|
||||||
{
|
|
||||||
mEncAesKeys = keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t nn::hac::NcaHeader::blockNumToSize(uint32_t block_num) const
|
|
||||||
{
|
|
||||||
return block_num*nca::kSectorSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t nn::hac::NcaHeader::sizeToBlockNum(uint64_t real_size) const
|
|
||||||
{
|
|
||||||
return (uint32_t)(align(real_size, nca::kSectorSize) / nca::kSectorSize);
|
|
||||||
}
|
|
|
@ -1,16 +1,16 @@
|
||||||
#include <nn/hac/PfsHeader.h>
|
#include <nn/hac/PartitionFsHeader.h>
|
||||||
|
|
||||||
nn::hac::PfsHeader::PfsHeader()
|
nn::hac::PartitionFsHeader::PartitionFsHeader()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::PfsHeader::PfsHeader(const PfsHeader & other)
|
nn::hac::PartitionFsHeader::PartitionFsHeader(const PartitionFsHeader & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::operator=(const PfsHeader & other)
|
void nn::hac::PartitionFsHeader::operator=(const PartitionFsHeader & other)
|
||||||
{
|
{
|
||||||
if (other.getBytes().size())
|
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) \
|
return (mFsType == other.mFsType) \
|
||||||
&& (mFileList == other.mFileList);
|
&& (mFileList == other.mFileList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::PfsHeader::operator!=(const PfsHeader & other) const
|
bool nn::hac::PartitionFsHeader::operator!=(const PartitionFsHeader & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
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;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nn::hac::PfsHeader::toBytes()
|
void nn::hac::PartitionFsHeader::toBytes()
|
||||||
{
|
{
|
||||||
// calculate name table size
|
// calculate name table size
|
||||||
size_t name_table_size = 0;
|
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
|
// check input length meets minimum size
|
||||||
if (len < sizeof(sPfsHeader))
|
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();
|
mRawBinary.clear();
|
||||||
mFsType = TYPE_PFS0;
|
mFsType = TYPE_PFS0;
|
||||||
mFileList.clear();
|
mFileList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::PfsHeader::FsType nn::hac::PfsHeader::getFsType() const
|
nn::hac::PartitionFsHeader::FsType nn::hac::PartitionFsHeader::getFsType() const
|
||||||
{
|
{
|
||||||
return mFsType;
|
return mFsType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::setFsType(FsType type)
|
void nn::hac::PartitionFsHeader::setFsType(FsType type)
|
||||||
{
|
{
|
||||||
mFsType = 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;
|
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 });
|
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 });
|
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;
|
size_t size = 0;
|
||||||
switch(fs_type)
|
switch(fs_type)
|
||||||
|
@ -244,7 +244,7 @@ size_t nn::hac::PfsHeader::getFileEntrySize(FsType fs_type)
|
||||||
return size;
|
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++)
|
for (size_t i = 0; i < mFileList.size(); i++)
|
||||||
{
|
{
|
99
lib/libhac/source/PatchMetaExtendedHeader.cpp
Normal file
99
lib/libhac/source/PatchMetaExtendedHeader.cpp
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
#include <nn/hac/PatchMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
nn::hac::PatchMetaExtendedHeader::PatchMetaExtendedHeader()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::PatchMetaExtendedHeader::PatchMetaExtendedHeader(const PatchMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::operator=(const PatchMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mApplicationId = other.mApplicationId;
|
||||||
|
mRequiredSystemVersion = other.mRequiredSystemVersion;
|
||||||
|
mExtendedDataSize = other.mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::PatchMetaExtendedHeader::operator==(const PatchMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return (mApplicationId == other.mApplicationId) \
|
||||||
|
&& (mRequiredSystemVersion == other.mRequiredSystemVersion) \
|
||||||
|
&& (mExtendedDataSize == other.mExtendedDataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::PatchMetaExtendedHeader::operator!=(const PatchMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sPatchMetaExtendedHeader));
|
||||||
|
sPatchMetaExtendedHeader* info = (sPatchMetaExtendedHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->application_id = mApplicationId;
|
||||||
|
info->required_system_version = mRequiredSystemVersion;
|
||||||
|
info->extended_data_size = mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sPatchMetaExtendedHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "PatchMetaExtendedHeader too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sPatchMetaExtendedHeader* info = (const sPatchMetaExtendedHeader*)bytes;
|
||||||
|
|
||||||
|
mApplicationId = info->application_id.get();
|
||||||
|
mRequiredSystemVersion = info->required_system_version.get();
|
||||||
|
mExtendedDataSize = info->extended_data_size.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::PatchMetaExtendedHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mApplicationId = 0;
|
||||||
|
mRequiredSystemVersion = 0;
|
||||||
|
mExtendedDataSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::PatchMetaExtendedHeader::getApplicationId() const
|
||||||
|
{
|
||||||
|
return mApplicationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::setApplicationId(uint64_t application_id)
|
||||||
|
{
|
||||||
|
mApplicationId = application_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::PatchMetaExtendedHeader::getRequiredSystemVersion() const
|
||||||
|
{
|
||||||
|
return mRequiredSystemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::setRequiredSystemVersion(uint32_t sys_ver)
|
||||||
|
{
|
||||||
|
mRequiredSystemVersion = sys_ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::PatchMetaExtendedHeader::getExtendedDataSize() const
|
||||||
|
{
|
||||||
|
return mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::setExtendedDataSize(uint32_t size)
|
||||||
|
{
|
||||||
|
mExtendedDataSize = size;
|
||||||
|
}
|
|
@ -1,33 +1,33 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/ServiceAccessControlBinary.h>
|
#include <nn/hac/ServiceAccessControl.h>
|
||||||
|
|
||||||
nn::hac::ServiceAccessControlBinary::ServiceAccessControlBinary()
|
nn::hac::ServiceAccessControl::ServiceAccessControl()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::ServiceAccessControlBinary::ServiceAccessControlBinary(const ServiceAccessControlBinary & other)
|
nn::hac::ServiceAccessControl::ServiceAccessControl(const ServiceAccessControl & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::operator=(const ServiceAccessControlBinary & other)
|
void nn::hac::ServiceAccessControl::operator=(const ServiceAccessControl & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mServices = other.mServices;
|
mServices = other.mServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ServiceAccessControlBinary::operator==(const ServiceAccessControlBinary & other) const
|
bool nn::hac::ServiceAccessControl::operator==(const ServiceAccessControl & other) const
|
||||||
{
|
{
|
||||||
return (mServices == other.mServices);
|
return (mServices == other.mServices);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ServiceAccessControlBinary::operator!=(const ServiceAccessControlBinary & other) const
|
bool nn::hac::ServiceAccessControl::operator!=(const ServiceAccessControl & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::toBytes()
|
void nn::hac::ServiceAccessControl::toBytes()
|
||||||
{
|
{
|
||||||
size_t totalSize = 0;
|
size_t totalSize = 0;
|
||||||
for (size_t i = 0; i < mServices.size(); i++)
|
for (size_t i = 0; i < mServices.size(); i++)
|
||||||
|
@ -43,7 +43,7 @@ void nn::hac::ServiceAccessControlBinary::toBytes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::ServiceAccessControl::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
mRawBinary.alloc(len);
|
mRawBinary.alloc(len);
|
||||||
|
@ -57,23 +57,23 @@ void nn::hac::ServiceAccessControlBinary::fromBytes(const byte_t* data, size_t l
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::ServiceAccessControlBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::ServiceAccessControl::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::clear()
|
void nn::hac::ServiceAccessControl::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mServices.clear();
|
mServices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::ServiceAccessControlEntry>& nn::hac::ServiceAccessControlBinary::getServiceList() const
|
const fnd::List<nn::hac::ServiceAccessControlEntry>& nn::hac::ServiceAccessControl::getServiceList() const
|
||||||
{
|
{
|
||||||
return mServices;
|
return mServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::addService(const ServiceAccessControlEntry& service)
|
void nn::hac::ServiceAccessControl::setServiceList(const fnd::List<ServiceAccessControlEntry>& list)
|
||||||
{
|
{
|
||||||
mServices.addElement(service);
|
mServices = list;
|
||||||
}
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
#include <nn/hac/XciUtils.h>
|
|
||||||
|
|
||||||
void nn::hac::XciUtils::getXciHeaderAesIv(const nn::hac::sXciHeader* hdr, byte_t* iv)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
iv[15-i] = hdr->aescbc_iv.iv[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::XciUtils::decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key)
|
|
||||||
{
|
|
||||||
byte_t iv[fnd::aes::kAesBlockSize];
|
|
||||||
|
|
||||||
getXciHeaderAesIv((const nn::hac::sXciHeader*)src, iv);
|
|
||||||
|
|
||||||
// copy plain
|
|
||||||
memcpy(dst, src, nn::hac::xci::kHeaderEncOffset);
|
|
||||||
|
|
||||||
// decrypt encrypted data
|
|
||||||
fnd::aes::AesCbcDecrypt(src + nn::hac::xci::kHeaderEncOffset, nn::hac::xci::kHeaderEncSize, key, iv, dst + nn::hac::xci::kHeaderEncOffset);
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/pki/cert.h>
|
#include <nn/pki/cert.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
|
@ -8,7 +8,7 @@ namespace nn
|
||||||
namespace pki
|
namespace pki
|
||||||
{
|
{
|
||||||
class CertificateBody
|
class CertificateBody
|
||||||
: public fnd::ISerialisable
|
: public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CertificateBody();
|
CertificateBody();
|
||||||
|
@ -18,7 +18,7 @@ namespace pki
|
||||||
bool operator==(const CertificateBody& other) const;
|
bool operator==(const CertificateBody& other) const;
|
||||||
bool operator!=(const CertificateBody& other) const;
|
bool operator!=(const CertificateBody& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* src, size_t size);
|
void fromBytes(const byte_t* src, size_t size);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/pki/sign.h>
|
#include <nn/pki/sign.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
|
@ -8,7 +8,7 @@ namespace nn
|
||||||
namespace pki
|
namespace pki
|
||||||
{
|
{
|
||||||
class SignatureBlock
|
class SignatureBlock
|
||||||
: public fnd::ISerialisable
|
: public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SignatureBlock();
|
SignatureBlock();
|
||||||
|
@ -18,7 +18,7 @@ namespace pki
|
||||||
bool operator==(const SignatureBlock& other) const;
|
bool operator==(const SignatureBlock& other) const;
|
||||||
bool operator!=(const SignatureBlock& other) const;
|
bool operator!=(const SignatureBlock& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* src, size_t size);
|
void fromBytes(const byte_t* src, size_t size);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/pki/SignatureBlock.h>
|
#include <nn/pki/SignatureBlock.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
|
@ -9,7 +9,7 @@ namespace pki
|
||||||
{
|
{
|
||||||
template <class T>
|
template <class T>
|
||||||
class SignedData
|
class SignedData
|
||||||
: public fnd::ISerialisable
|
: public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SignedData();
|
SignedData();
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
<ClInclude Include="source\SdkApiString.h" />
|
<ClInclude Include="source\SdkApiString.h" />
|
||||||
<ClInclude Include="source\UserSettings.h" />
|
<ClInclude Include="source\UserSettings.h" />
|
||||||
<ClInclude Include="source\version.h" />
|
<ClInclude Include="source\version.h" />
|
||||||
<ClInclude Include="source\XciProcess.h" />
|
<ClInclude Include="source\GameCardProcess.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AssetProcess.cpp" />
|
<ClCompile Include="source\AssetProcess.cpp" />
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
<ClCompile Include="source\RomfsProcess.cpp" />
|
<ClCompile Include="source\RomfsProcess.cpp" />
|
||||||
<ClCompile Include="source\SdkApiString.cpp" />
|
<ClCompile Include="source\SdkApiString.cpp" />
|
||||||
<ClCompile Include="source\UserSettings.cpp" />
|
<ClCompile Include="source\UserSettings.cpp" />
|
||||||
<ClCompile Include="source\XciProcess.cpp" />
|
<ClCompile Include="source\GameCardProcess.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
<ClInclude Include="source\version.h">
|
<ClInclude Include="source\version.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\XciProcess.h">
|
<ClInclude Include="source\GameCardProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
<ClCompile Include="source\UserSettings.cpp">
|
<ClCompile Include="source\UserSettings.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\XciProcess.cpp">
|
<ClCompile Include="source\GameCardProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -34,7 +34,7 @@ void CnmtProcess::setVerifyMode(bool verify)
|
||||||
mVerify = verify;
|
mVerify = verify;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ContentMetaBinary& CnmtProcess::getContentMetaBinary() const
|
const nn::hac::ContentMeta& CnmtProcess::getContentMeta() const
|
||||||
{
|
{
|
||||||
return mCnmt;
|
return mCnmt;
|
||||||
}
|
}
|
||||||
|
@ -61,31 +61,31 @@ void CnmtProcess::displayCnmt()
|
||||||
std::cout << "[ContentMeta]" << std::endl;
|
std::cout << "[ContentMeta]" << std::endl;
|
||||||
std::cout << " TitleId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getTitleId() << std::endl;
|
std::cout << " TitleId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getTitleId() << std::endl;
|
||||||
std::cout << " Version: v" << std::dec << mCnmt.getTitleVersion() << " (" << _SPLIT_VER(mCnmt.getTitleVersion()) << ")"<< std::endl;
|
std::cout << " Version: v" << std::dec << mCnmt.getTitleVersion() << " (" << _SPLIT_VER(mCnmt.getTitleVersion()) << ")"<< std::endl;
|
||||||
std::cout << " Type: " << getContentMetaTypeStr(mCnmt.getType()) << " (" << std::dec << mCnmt.getType() << ")" << std::endl;
|
std::cout << " Type: " << getContentMetaTypeStr(mCnmt.getContentMetaType()) << " (" << std::dec << mCnmt.getContentMetaType() << ")" << std::endl;
|
||||||
std::cout << " Attributes: 0x" << std::hex << (uint32_t)mCnmt.getAttributes() << std::endl;
|
std::cout << " Attributes: 0x" << std::hex << (uint32_t)mCnmt.getAttributes() << std::endl;
|
||||||
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
|
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
|
||||||
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
|
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
|
||||||
std::cout << " RequiredDownloadSystemVersion: v" << mCnmt.getRequiredDownloadSystemVersion() << " (" << _SPLIT_VER(mCnmt.getRequiredDownloadSystemVersion()) << ")"<< std::endl;
|
std::cout << " RequiredDownloadSystemVersion: v" << mCnmt.getRequiredDownloadSystemVersion() << " (" << _SPLIT_VER(mCnmt.getRequiredDownloadSystemVersion()) << ")"<< std::endl;
|
||||||
switch(mCnmt.getType())
|
switch(mCnmt.getContentMetaType())
|
||||||
{
|
{
|
||||||
case (nn::hac::cnmt::METATYPE_APPLICATION):
|
case (nn::hac::cnmt::METATYPE_APPLICATION):
|
||||||
std::cout << " ApplicationExtendedHeader:" << std::endl;
|
std::cout << " ApplicationExtendedHeader:" << std::endl;
|
||||||
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getApplicationMetaExtendedHeader().required_system_version << " (" << _SPLIT_VER(mCnmt.getApplicationMetaExtendedHeader().required_system_version) << ")"<< std::endl;
|
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getApplicationMetaExtendedHeader().getRequiredSystemVersion() << " (" << _SPLIT_VER(mCnmt.getApplicationMetaExtendedHeader().getRequiredSystemVersion()) << ")"<< std::endl;
|
||||||
std::cout << " PatchId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getApplicationMetaExtendedHeader().patch_id << std::endl;
|
std::cout << " PatchId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getApplicationMetaExtendedHeader().getPatchId() << std::endl;
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_PATCH):
|
case (nn::hac::cnmt::METATYPE_PATCH):
|
||||||
std::cout << " PatchMetaExtendedHeader:" << std::endl;
|
std::cout << " PatchMetaExtendedHeader:" << std::endl;
|
||||||
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getPatchMetaExtendedHeader().required_system_version << " (" << _SPLIT_VER(mCnmt.getPatchMetaExtendedHeader().required_system_version) << ")"<< std::endl;
|
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getPatchMetaExtendedHeader().getRequiredSystemVersion() << " (" << _SPLIT_VER(mCnmt.getPatchMetaExtendedHeader().getRequiredSystemVersion()) << ")"<< std::endl;
|
||||||
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getPatchMetaExtendedHeader().application_id << std::endl;
|
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getPatchMetaExtendedHeader().getApplicationId() << std::endl;
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_ADD_ON_CONTENT):
|
case (nn::hac::cnmt::METATYPE_ADD_ON_CONTENT):
|
||||||
std::cout << " AddOnContentMetaExtendedHeader:" << std::endl;
|
std::cout << " AddOnContentMetaExtendedHeader:" << std::endl;
|
||||||
std::cout << " RequiredApplicationVersion: v" << std::dec << mCnmt.getAddOnContentMetaExtendedHeader().required_application_version << " (" << _SPLIT_VER(mCnmt.getAddOnContentMetaExtendedHeader().required_application_version) << ")" << std::endl;
|
std::cout << " RequiredApplicationVersion: v" << std::dec << mCnmt.getAddOnContentMetaExtendedHeader().getRequiredApplicationVersion() << " (" << _SPLIT_VER(mCnmt.getAddOnContentMetaExtendedHeader().getRequiredApplicationVersion()) << ")" << std::endl;
|
||||||
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getAddOnContentMetaExtendedHeader().application_id << std::endl;
|
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getAddOnContentMetaExtendedHeader().getApplicationId() << std::endl;
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_DELTA):
|
case (nn::hac::cnmt::METATYPE_DELTA):
|
||||||
std::cout << " DeltaMetaExtendedHeader:" << std::endl;
|
std::cout << " DeltaMetaExtendedHeader:" << std::endl;
|
||||||
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getDeltaMetaExtendedHeader().application_id << std::endl;
|
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getDeltaMetaExtendedHeader().getApplicationId() << std::endl;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -95,12 +95,12 @@ void CnmtProcess::displayCnmt()
|
||||||
printf(" ContentInfo:\n");
|
printf(" ContentInfo:\n");
|
||||||
for (size_t i = 0; i < mCnmt.getContentInfo().size(); i++)
|
for (size_t i = 0; i < mCnmt.getContentInfo().size(); i++)
|
||||||
{
|
{
|
||||||
const nn::hac::ContentMetaBinary::ContentInfo& info = mCnmt.getContentInfo()[i];
|
const nn::hac::ContentInfo& info = mCnmt.getContentInfo()[i];
|
||||||
std::cout << " " << std::dec << i << std::endl;
|
std::cout << " " << std::dec << i << std::endl;
|
||||||
std::cout << " Type: " << getContentTypeStr(info.type) << " (" << std::dec << info.type << ")" << std::endl;
|
std::cout << " Type: " << getContentTypeStr(info.getContentType()) << " (" << std::dec << info.getContentType() << ")" << std::endl;
|
||||||
std::cout << " Id: " << fnd::SimpleTextOutput::arrayToString(info.nca_id, nn::hac::cnmt::kContentIdLen, false, "") << std::endl;
|
std::cout << " Id: " << fnd::SimpleTextOutput::arrayToString(info.getContentId().data, nn::hac::cnmt::kContentIdLen, false, "") << std::endl;
|
||||||
std::cout << " Size: 0x" << std::hex << info.size << std::endl;
|
std::cout << " Size: 0x" << std::hex << info.getContentSize() << std::endl;
|
||||||
std::cout << " Hash: " << fnd::SimpleTextOutput::arrayToString(info.hash.bytes, sizeof(info.hash), false, "") << std::endl;
|
std::cout << " Hash: " << fnd::SimpleTextOutput::arrayToString(info.getContentHash().bytes, sizeof(info.getContentHash()), false, "") << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mCnmt.getContentMetaInfo().size() > 0)
|
if (mCnmt.getContentMetaInfo().size() > 0)
|
||||||
|
@ -108,14 +108,14 @@ void CnmtProcess::displayCnmt()
|
||||||
std::cout << " ContentMetaInfo:" << std::endl;
|
std::cout << " ContentMetaInfo:" << std::endl;
|
||||||
for (size_t i = 0; i < mCnmt.getContentMetaInfo().size(); i++)
|
for (size_t i = 0; i < mCnmt.getContentMetaInfo().size(); i++)
|
||||||
{
|
{
|
||||||
const nn::hac::ContentMetaBinary::ContentMetaInfo& info = mCnmt.getContentMetaInfo()[i];
|
const nn::hac::ContentMetaInfo& info = mCnmt.getContentMetaInfo()[i];
|
||||||
std::cout << " " << std::dec << i << std::endl;
|
std::cout << " " << std::dec << i << std::endl;
|
||||||
std::cout << " Id: 0x" << std::hex << std::setw(16) << std::setfill('0') << info.id << std::endl;
|
std::cout << " Id: 0x" << std::hex << std::setw(16) << std::setfill('0') << info.getTitleId() << std::endl;
|
||||||
std::cout << " Version: v" << std::dec << info.version << " (" << _SPLIT_VER(info.version) << ")"<< std::endl;
|
std::cout << " Version: v" << std::dec << info.getTitleVersion() << " (" << _SPLIT_VER(info.getTitleVersion()) << ")"<< std::endl;
|
||||||
std::cout << " Type: " << getContentMetaTypeStr(info.type) << " (" << std::dec << info.type << ")" << std::endl;
|
std::cout << " Type: " << getContentMetaTypeStr(info.getContentMetaType()) << " (" << std::dec << info.getContentMetaType() << ")" << std::endl;
|
||||||
std::cout << " Attributes: 0x" << std::hex << (uint32_t)info.attributes << std::endl;
|
std::cout << " Attributes: 0x" << std::hex << (uint32_t)info.getAttributes() << std::endl;
|
||||||
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(info.attributes, nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
|
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(info.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
|
||||||
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(info.attributes, nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
|
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(info.getAttributes(), nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <nn/hac/ContentMetaBinary.h>
|
#include <nn/hac/ContentMeta.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
void setCliOutputMode(CliOutputMode type);
|
void setCliOutputMode(CliOutputMode type);
|
||||||
void setVerifyMode(bool verify);
|
void setVerifyMode(bool verify);
|
||||||
|
|
||||||
const nn::hac::ContentMetaBinary& getContentMetaBinary() const;
|
const nn::hac::ContentMeta& getContentMeta() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "CnmtProcess";
|
const std::string kModuleName = "CnmtProcess";
|
||||||
|
@ -27,7 +27,7 @@ private:
|
||||||
CliOutputMode mCliOutputMode;
|
CliOutputMode mCliOutputMode;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
nn::hac::ContentMetaBinary mCnmt;
|
nn::hac::ContentMeta mCnmt;
|
||||||
|
|
||||||
void importCnmt();
|
void importCnmt();
|
||||||
void displayCnmt();
|
void displayCnmt();
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fnd/SimpleTextOutput.h>
|
#include <fnd/SimpleTextOutput.h>
|
||||||
#include <fnd/OffsetAdjustedIFile.h>
|
#include <fnd/OffsetAdjustedIFile.h>
|
||||||
#include <nn/hac/XciUtils.h>
|
#include <nn/hac/GameCardUtils.h>
|
||||||
#include "XciProcess.h"
|
#include "GameCardProcess.h"
|
||||||
|
|
||||||
XciProcess::XciProcess() :
|
GameCardProcess::GameCardProcess() :
|
||||||
mFile(),
|
mFile(),
|
||||||
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
||||||
mVerify(false),
|
mVerify(false),
|
||||||
|
@ -15,7 +15,7 @@ XciProcess::XciProcess() :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::process()
|
void GameCardProcess::process()
|
||||||
{
|
{
|
||||||
importHeader();
|
importHeader();
|
||||||
|
|
||||||
|
@ -34,37 +34,37 @@ void XciProcess::process()
|
||||||
processPartitionPfs();
|
processPartitionPfs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
void GameCardProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
||||||
{
|
{
|
||||||
mFile = file;
|
mFile = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setKeyCfg(const KeyConfiguration& keycfg)
|
void GameCardProcess::setKeyCfg(const KeyConfiguration& keycfg)
|
||||||
{
|
{
|
||||||
mKeyCfg = keycfg;
|
mKeyCfg = keycfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setCliOutputMode(CliOutputMode type)
|
void GameCardProcess::setCliOutputMode(CliOutputMode type)
|
||||||
{
|
{
|
||||||
mCliOutputMode = type;
|
mCliOutputMode = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setVerifyMode(bool verify)
|
void GameCardProcess::setVerifyMode(bool verify)
|
||||||
{
|
{
|
||||||
mVerify = verify;
|
mVerify = verify;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setPartitionForExtract(const std::string& partition_name, const std::string& extract_path)
|
void GameCardProcess::setPartitionForExtract(const std::string& partition_name, const std::string& extract_path)
|
||||||
{
|
{
|
||||||
mExtractInfo.addElement({partition_name, extract_path});
|
mExtractInfo.addElement({partition_name, extract_path});
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setListFs(bool list_fs)
|
void GameCardProcess::setListFs(bool list_fs)
|
||||||
{
|
{
|
||||||
mListFs = list_fs;
|
mListFs = list_fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::importHeader()
|
void GameCardProcess::importHeader()
|
||||||
{
|
{
|
||||||
fnd::Vec<byte_t> scratch;
|
fnd::Vec<byte_t> scratch;
|
||||||
|
|
||||||
|
@ -74,22 +74,22 @@ void XciProcess::importHeader()
|
||||||
}
|
}
|
||||||
|
|
||||||
// read header page
|
// read header page
|
||||||
(*mFile)->read((byte_t*)&mHdrPage, 0, sizeof(nn::hac::sXciHeaderPage));
|
(*mFile)->read((byte_t*)&mHdrPage, 0, sizeof(nn::hac::sGcHeaderPage));
|
||||||
|
|
||||||
// allocate memory for and decrypt sXciHeader
|
// allocate memory for and decrypt sXciHeader
|
||||||
scratch.alloc(sizeof(nn::hac::sXciHeader));
|
scratch.alloc(sizeof(nn::hac::sGcHeader));
|
||||||
|
|
||||||
fnd::aes::sAes128Key header_key;
|
fnd::aes::sAes128Key header_key;
|
||||||
mKeyCfg.getXciHeaderKey(header_key);
|
mKeyCfg.getXciHeaderKey(header_key);
|
||||||
nn::hac::XciUtils::decryptXciHeader((const byte_t*)&mHdrPage.header, scratch.data(), header_key.key);
|
nn::hac::GameCardUtils::decryptXciHeader((const byte_t*)&mHdrPage.header, scratch.data(), header_key.key);
|
||||||
|
|
||||||
// deserialise header
|
// deserialise header
|
||||||
mHdr.fromBytes(scratch.data(), scratch.size());
|
mHdr.fromBytes(scratch.data(), scratch.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::displayHeader()
|
void GameCardProcess::displayHeader()
|
||||||
{
|
{
|
||||||
std::cout << "[XCI Header]" << std::endl;
|
std::cout << "[GameCard Header]" << std::endl;
|
||||||
std::cout << " CardHeaderVersion: " << std::dec << (uint32_t)mHdr.getCardHeaderVersion() << std::endl;
|
std::cout << " CardHeaderVersion: " << std::dec << (uint32_t)mHdr.getCardHeaderVersion() << std::endl;
|
||||||
std::cout << " RomSize: " << getRomSizeStr(mHdr.getRomSizeType());
|
std::cout << " RomSize: " << getRomSizeStr(mHdr.getRomSizeType());
|
||||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
||||||
|
@ -128,22 +128,22 @@ void XciProcess::displayHeader()
|
||||||
{
|
{
|
||||||
std::cout << " RomAreaStartPage: 0x" << std::hex << mHdr.getRomAreaStartPage();
|
std::cout << " RomAreaStartPage: 0x" << std::hex << mHdr.getRomAreaStartPage();
|
||||||
if (mHdr.getRomAreaStartPage() != (uint32_t)(-1))
|
if (mHdr.getRomAreaStartPage() != (uint32_t)(-1))
|
||||||
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getRomAreaStartPage()) << ")";
|
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getRomAreaStartPage()) << ")";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << " BackupAreaStartPage: 0x" << std::hex << mHdr.getBackupAreaStartPage();
|
std::cout << " BackupAreaStartPage: 0x" << std::hex << mHdr.getBackupAreaStartPage();
|
||||||
if (mHdr.getBackupAreaStartPage() != (uint32_t)(-1))
|
if (mHdr.getBackupAreaStartPage() != (uint32_t)(-1))
|
||||||
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getBackupAreaStartPage()) << ")";
|
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getBackupAreaStartPage()) << ")";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << " ValidDataEndPage: 0x" << std::hex << mHdr.getValidDataEndPage();
|
std::cout << " ValidDataEndPage: 0x" << std::hex << mHdr.getValidDataEndPage();
|
||||||
if (mHdr.getValidDataEndPage() != (uint32_t)(-1))
|
if (mHdr.getValidDataEndPage() != (uint32_t)(-1))
|
||||||
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getValidDataEndPage()) << ")";
|
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getValidDataEndPage()) << ")";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << " LimArea: 0x" << std::hex << mHdr.getLimAreaPage();
|
std::cout << " LimArea: 0x" << std::hex << mHdr.getLimAreaPage();
|
||||||
if (mHdr.getLimAreaPage() != (uint32_t)(-1))
|
if (mHdr.getLimAreaPage() != (uint32_t)(-1))
|
||||||
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getLimAreaPage()) << ")";
|
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getLimAreaPage()) << ")";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << " PartitionFs Header:" << std::endl;
|
std::cout << " PartitionFs Header:" << std::endl;
|
||||||
|
@ -160,7 +160,7 @@ void XciProcess::displayHeader()
|
||||||
|
|
||||||
if (mHdr.getFwVerMinor() != 0)
|
if (mHdr.getFwVerMinor() != 0)
|
||||||
{
|
{
|
||||||
std::cout << "[XCI Extended Header]" << std::endl;
|
std::cout << "[GameCard Extended Header]" << std::endl;
|
||||||
std::cout << " FwVersion: v" << std::dec << mHdr.getFwVerMajor() << "." << mHdr.getFwVerMinor() << std::endl;
|
std::cout << " FwVersion: v" << std::dec << mHdr.getFwVerMajor() << "." << mHdr.getFwVerMinor() << std::endl;
|
||||||
std::cout << " AccCtrl1: 0x" << std::hex << mHdr.getAccCtrl1() << std::endl;
|
std::cout << " AccCtrl1: 0x" << std::hex << mHdr.getAccCtrl1() << std::endl;
|
||||||
std::cout << " CardClockRate: " << getCardClockRate(mHdr.getAccCtrl1()) << std::endl;
|
std::cout << " CardClockRate: " << getCardClockRate(mHdr.getAccCtrl1()) << std::endl;
|
||||||
|
@ -178,7 +178,7 @@ void XciProcess::displayHeader()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XciProcess::validateRegionOfFile(size_t offset, size_t len, const byte_t* test_hash)
|
bool GameCardProcess::validateRegionOfFile(size_t offset, size_t len, const byte_t* test_hash)
|
||||||
{
|
{
|
||||||
fnd::Vec<byte_t> scratch;
|
fnd::Vec<byte_t> scratch;
|
||||||
fnd::sha::sSha256Hash calc_hash;
|
fnd::sha::sSha256Hash calc_hash;
|
||||||
|
@ -188,23 +188,23 @@ bool XciProcess::validateRegionOfFile(size_t offset, size_t len, const byte_t* t
|
||||||
return calc_hash.compare(test_hash);
|
return calc_hash.compare(test_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::validateXciSignature()
|
void GameCardProcess::validateXciSignature()
|
||||||
{
|
{
|
||||||
fnd::rsa::sRsa2048Key header_sign_key;
|
fnd::rsa::sRsa2048Key header_sign_key;
|
||||||
fnd::sha::sSha256Hash calc_hash;
|
fnd::sha::sSha256Hash calc_hash;
|
||||||
fnd::sha::Sha256((byte_t*)&mHdrPage.header, sizeof(nn::hac::sXciHeader), calc_hash.bytes);
|
fnd::sha::Sha256((byte_t*)&mHdrPage.header, sizeof(nn::hac::sGcHeader), calc_hash.bytes);
|
||||||
mKeyCfg.getXciHeaderSignKey(header_sign_key);
|
mKeyCfg.getXciHeaderSignKey(header_sign_key);
|
||||||
if (fnd::rsa::pkcs::rsaVerify(header_sign_key, fnd::sha::HASH_SHA256, calc_hash.bytes, mHdrPage.signature) != 0)
|
if (fnd::rsa::pkcs::rsaVerify(header_sign_key, fnd::sha::HASH_SHA256, calc_hash.bytes, mHdrPage.signature) != 0)
|
||||||
{
|
{
|
||||||
std::cout << "[WARNING] XCI Header Signature: FAIL" << std::endl;
|
std::cout << "[WARNING] GameCard Header Signature: FAIL" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::processRootPfs()
|
void GameCardProcess::processRootPfs()
|
||||||
{
|
{
|
||||||
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize(), mHdr.getPartitionFsHash().bytes) == false)
|
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize(), mHdr.getPartitionFsHash().bytes) == false)
|
||||||
{
|
{
|
||||||
std::cout << "[WARNING] XCI Root HFS0: FAIL (bad hash)" << std::endl;
|
std::cout << "[WARNING] GameCard Root HFS0: FAIL (bad hash)" << std::endl;
|
||||||
}
|
}
|
||||||
mRootPfs.setInputFile(new fnd::OffsetAdjustedIFile(mFile, mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize()));
|
mRootPfs.setInputFile(new fnd::OffsetAdjustedIFile(mFile, mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize()));
|
||||||
mRootPfs.setListFs(mListFs);
|
mRootPfs.setListFs(mListFs);
|
||||||
|
@ -214,15 +214,15 @@ void XciProcess::processRootPfs()
|
||||||
mRootPfs.process();
|
mRootPfs.process();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::processPartitionPfs()
|
void GameCardProcess::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++)
|
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
|
// this must be validated here because only the size of the root partiton header is known at verification time
|
||||||
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress() + rootPartitions[i].offset, rootPartitions[i].hash_protected_size, rootPartitions[i].hash.bytes) == false)
|
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress() + rootPartitions[i].offset, rootPartitions[i].hash_protected_size, rootPartitions[i].hash.bytes) == false)
|
||||||
{
|
{
|
||||||
std::cout << "[WARNING] XCI " << rootPartitions[i].name << " Partition HFS0: FAIL (bad hash)" << std::endl;
|
std::cout << "[WARNING] GameCard " << rootPartitions[i].name << " Partition HFS0: FAIL (bad hash)" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
PfsProcess tmp;
|
PfsProcess tmp;
|
||||||
|
@ -238,28 +238,28 @@ void XciProcess::processPartitionPfs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* XciProcess::getRomSizeStr(byte_t rom_size) const
|
const char* GameCardProcess::getRomSizeStr(byte_t rom_size) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (rom_size)
|
switch (rom_size)
|
||||||
{
|
{
|
||||||
case (nn::hac::xci::ROM_SIZE_1GB):
|
case (nn::hac::gc::ROM_SIZE_1GB):
|
||||||
str = "1GB";
|
str = "1GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_2GB):
|
case (nn::hac::gc::ROM_SIZE_2GB):
|
||||||
str = "2GB";
|
str = "2GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_4GB):
|
case (nn::hac::gc::ROM_SIZE_4GB):
|
||||||
str = "4GB";
|
str = "4GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_8GB):
|
case (nn::hac::gc::ROM_SIZE_8GB):
|
||||||
str = "8GB";
|
str = "8GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_16GB):
|
case (nn::hac::gc::ROM_SIZE_16GB):
|
||||||
str = "16GB";
|
str = "16GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_32GB):
|
case (nn::hac::gc::ROM_SIZE_32GB):
|
||||||
str = "32GB";
|
str = "32GB";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -270,19 +270,19 @@ const char* XciProcess::getRomSizeStr(byte_t rom_size) const
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* XciProcess::getHeaderFlagStr(byte_t flag) const
|
const char* GameCardProcess::getHeaderFlagStr(byte_t flag) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
case (nn::hac::xci::FLAG_AUTOBOOT):
|
case (nn::hac::gc::FLAG_AUTOBOOT):
|
||||||
str = "AutoBoot";
|
str = "AutoBoot";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::FLAG_HISTORY_ERASE):
|
case (nn::hac::gc::FLAG_HISTORY_ERASE):
|
||||||
str = "HistoryErase";
|
str = "HistoryErase";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::FLAG_REPAIR_TOOL):
|
case (nn::hac::gc::FLAG_REPAIR_TOOL):
|
||||||
str = "RepairTool";
|
str = "RepairTool";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -294,16 +294,16 @@ const char* XciProcess::getHeaderFlagStr(byte_t flag) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* XciProcess::getCardClockRate(uint32_t acc_ctrl_1) const
|
const char* GameCardProcess::getCardClockRate(uint32_t acc_ctrl_1) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (acc_ctrl_1)
|
switch (acc_ctrl_1)
|
||||||
{
|
{
|
||||||
case (nn::hac::xci::CLOCK_RATE_25):
|
case (nn::hac::gc::CLOCK_RATE_25):
|
||||||
str = "20 MHz";
|
str = "20 MHz";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::CLOCK_RATE_50):
|
case (nn::hac::gc::CLOCK_RATE_50):
|
||||||
str = "50 MHz";
|
str = "50 MHz";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
|
@ -4,16 +4,16 @@
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/XciHeader.h>
|
#include <nn/hac/GameCardHeader.h>
|
||||||
#include "KeyConfiguration.h"
|
#include "KeyConfiguration.h"
|
||||||
#include "PfsProcess.h"
|
#include "PfsProcess.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class XciProcess
|
class GameCardProcess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XciProcess();
|
GameCardProcess();
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public:
|
||||||
void setListFs(bool list_fs);
|
void setListFs(bool list_fs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "XciProcess";
|
const std::string kModuleName = "GameCardProcess";
|
||||||
const std::string kXciMountPointName = "gamecard:/";
|
const std::string kXciMountPointName = "gamecard:/";
|
||||||
|
|
||||||
fnd::SharedPtr<fnd::IFile> mFile;
|
fnd::SharedPtr<fnd::IFile> mFile;
|
||||||
|
@ -55,8 +55,8 @@ private:
|
||||||
|
|
||||||
bool mListFs;
|
bool mListFs;
|
||||||
|
|
||||||
nn::hac::sXciHeaderPage mHdrPage;
|
nn::hac::sGcHeaderPage mHdrPage;
|
||||||
nn::hac::XciHeader mHdr;
|
nn::hac::GameCardHeader mHdr;
|
||||||
PfsProcess mRootPfs;
|
PfsProcess mRootPfs;
|
||||||
fnd::List<sExtractInfo> mExtractInfo;
|
fnd::List<sExtractInfo> mExtractInfo;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <fnd/ResourceFileReader.h>
|
#include <fnd/ResourceFileReader.h>
|
||||||
#include <fnd/SimpleTextOutput.h>
|
#include <fnd/SimpleTextOutput.h>
|
||||||
#include <nn/hac/AesKeygen.h>
|
#include <nn/hac/AesKeygen.h>
|
||||||
#include <nn/hac/NcaUtils.h>
|
#include <nn/hac/ContentArchiveUtils.h>
|
||||||
|
|
||||||
KeyConfiguration::KeyConfiguration()
|
KeyConfiguration::KeyConfiguration()
|
||||||
{
|
{
|
||||||
|
@ -19,10 +19,10 @@ void KeyConfiguration::operator=(const KeyConfiguration& other)
|
||||||
{
|
{
|
||||||
mAcidSignKey = other.mAcidSignKey;
|
mAcidSignKey = other.mAcidSignKey;
|
||||||
mPkg2SignKey = other.mPkg2SignKey;
|
mPkg2SignKey = other.mPkg2SignKey;
|
||||||
mNcaHeader0SignKey = other.mNcaHeader0SignKey;
|
mContentArchiveHeader0SignKey = other.mContentArchiveHeader0SignKey;
|
||||||
mXciHeaderSignKey = other.mXciHeaderSignKey;
|
mXciHeaderSignKey = other.mXciHeaderSignKey;
|
||||||
|
|
||||||
mNcaHeaderKey = other.mNcaHeaderKey;
|
mContentArchiveHeaderKey = other.mContentArchiveHeaderKey;
|
||||||
mXciHeaderKey = other.mXciHeaderKey;
|
mXciHeaderKey = other.mXciHeaderKey;
|
||||||
|
|
||||||
for (size_t i = 0; i < kMasterKeyNum; i++)
|
for (size_t i = 0; i < kMasterKeyNum; i++)
|
||||||
|
@ -114,14 +114,14 @@ void KeyConfiguration::importHactoolGenericKeyfile(const std::string& path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// store nca header key
|
// store nca header key
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kNcaHeaderBase[nameidx], kKeyStr), mNcaHeaderKey.key[0], 0x20);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kContentArchiveHeaderBase[nameidx], kKeyStr), mContentArchiveHeaderKey.key[0], 0x20);
|
||||||
|
|
||||||
// store xci header key
|
// store xci header key
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kKeyStr), mXciHeaderKey.key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kKeyStr), mXciHeaderKey.key, 0x10);
|
||||||
|
|
||||||
// store rsa keys
|
// store rsa keys
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kNcaHeaderBase[nameidx], kRsaKeyPrivate), mNcaHeader0SignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kContentArchiveHeaderBase[nameidx], kRsaKeyPrivate), mContentArchiveHeader0SignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kNcaHeaderBase[nameidx], kRsaKeyModulus), mNcaHeader0SignKey.modulus, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kContentArchiveHeaderBase[nameidx], kRsaKeyModulus), mContentArchiveHeader0SignKey.modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kRsaKeyPrivate), mXciHeaderSignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kRsaKeyPrivate), mXciHeaderSignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kRsaKeyModulus), mXciHeaderSignKey.modulus, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kRsaKeyModulus), mXciHeaderSignKey.modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
@ -149,12 +149,12 @@ void KeyConfiguration::importHactoolGenericKeyfile(const std::string& path)
|
||||||
{
|
{
|
||||||
if (i == 0 && nca_header_kek_source != kNullAesKey && nca_header_key_source != kNullAesXtsKey)
|
if (i == 0 && nca_header_kek_source != kNullAesKey && nca_header_key_source != kNullAesXtsKey)
|
||||||
{
|
{
|
||||||
if (mNcaHeaderKey == kNullAesXtsKey)
|
if (mContentArchiveHeaderKey == kNullAesXtsKey)
|
||||||
{
|
{
|
||||||
fnd::aes::sAes128Key nca_header_kek;
|
fnd::aes::sAes128Key nca_header_kek;
|
||||||
nn::hac::AesKeygen::generateKey(nca_header_kek.key, aes_kek_generation_source.key, nca_header_kek_source.key, aes_key_generation_source.key, master_key[i].key);
|
nn::hac::AesKeygen::generateKey(nca_header_kek.key, aes_kek_generation_source.key, nca_header_kek_source.key, aes_key_generation_source.key, master_key[i].key);
|
||||||
nn::hac::AesKeygen::generateKey(mNcaHeaderKey.key[0], nca_header_key_source.key[0], nca_header_kek.key);
|
nn::hac::AesKeygen::generateKey(mContentArchiveHeaderKey.key[0], nca_header_key_source.key[0], nca_header_kek.key);
|
||||||
nn::hac::AesKeygen::generateKey(mNcaHeaderKey.key[1], nca_header_key_source.key[1], nca_header_kek.key);
|
nn::hac::AesKeygen::generateKey(mContentArchiveHeaderKey.key[1], nca_header_key_source.key[1], nca_header_kek.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,11 +196,11 @@ void KeyConfiguration::clearGeneralKeyConfiguration()
|
||||||
{
|
{
|
||||||
mAcidSignKey = kNullRsa2048Key;
|
mAcidSignKey = kNullRsa2048Key;
|
||||||
mPkg2SignKey = kNullRsa2048Key;
|
mPkg2SignKey = kNullRsa2048Key;
|
||||||
mNcaHeader0SignKey = kNullRsa2048Key;
|
mContentArchiveHeader0SignKey = kNullRsa2048Key;
|
||||||
mXciHeaderSignKey = kNullRsa2048Key;
|
mXciHeaderSignKey = kNullRsa2048Key;
|
||||||
mPkiRootKeyList.clear();
|
mPkiRootKeyList.clear();
|
||||||
|
|
||||||
mNcaHeaderKey = kNullAesXtsKey;
|
mContentArchiveHeaderKey = kNullAesXtsKey;
|
||||||
mXciHeaderKey = kNullAesKey;
|
mXciHeaderKey = kNullAesKey;
|
||||||
|
|
||||||
for (size_t i = 0; i < kMasterKeyNum; i++)
|
for (size_t i = 0; i < kMasterKeyNum; i++)
|
||||||
|
@ -221,14 +221,14 @@ void KeyConfiguration::clearNcaExternalKeys()
|
||||||
mNcaExternalContentKeyList.clear();
|
mNcaExternalContentKeyList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getNcaHeaderKey(fnd::aes::sAesXts128Key& key) const
|
bool KeyConfiguration::getContentArchiveHeaderKey(fnd::aes::sAesXts128Key& key) const
|
||||||
{
|
{
|
||||||
return copyOutKeyResourceIfExists(mNcaHeaderKey, key, kNullAesXtsKey);
|
return copyOutKeyResourceIfExists(mContentArchiveHeaderKey, key, kNullAesXtsKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getNcaHeader0SignKey(fnd::rsa::sRsa2048Key& key) const
|
bool KeyConfiguration::getContentArchiveHeader0SignKey(fnd::rsa::sRsa2048Key& key) const
|
||||||
{
|
{
|
||||||
return copyOutKeyResourceIfExists(mNcaHeader0SignKey, key, kNullRsa2048Key);
|
return copyOutKeyResourceIfExists(mContentArchiveHeader0SignKey, key, kNullRsa2048Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getAcidSignKey(fnd::rsa::sRsa2048Key& key) const
|
bool KeyConfiguration::getAcidSignKey(fnd::rsa::sRsa2048Key& key) const
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <fnd/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <fnd/ecdsa.h>
|
#include <fnd/ecdsa.h>
|
||||||
#include <nn/hac/nca.h>
|
#include <nn/hac/define/nca.h>
|
||||||
#include <nn/pki/SignedData.h>
|
#include <nn/pki/SignedData.h>
|
||||||
#include <nn/es/TicketBody_V2.h>
|
#include <nn/es/TicketBody_V2.h>
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ public:
|
||||||
void clearNcaExternalKeys();
|
void clearNcaExternalKeys();
|
||||||
|
|
||||||
// nca keys
|
// nca keys
|
||||||
bool getNcaHeaderKey(fnd::aes::sAesXts128Key& key) const;
|
bool getContentArchiveHeaderKey(fnd::aes::sAesXts128Key& key) const;
|
||||||
bool getNcaHeader0SignKey(fnd::rsa::sRsa2048Key& key) const;
|
bool getContentArchiveHeader0SignKey(fnd::rsa::sRsa2048Key& key) const;
|
||||||
bool getAcidSignKey(fnd::rsa::sRsa2048Key& key) const;
|
bool getAcidSignKey(fnd::rsa::sRsa2048Key& key) const;
|
||||||
bool getNcaKeyAreaEncryptionKey(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const;
|
bool getNcaKeyAreaEncryptionKey(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const;
|
||||||
bool getNcaKeyAreaEncryptionKeyHw(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const;
|
bool getNcaKeyAreaEncryptionKeyHw(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const;
|
||||||
|
@ -71,7 +71,7 @@ private:
|
||||||
const std::string kPkg1Base[kNameVariantNum] = { "package1", "package1", "package1" };
|
const std::string kPkg1Base[kNameVariantNum] = { "package1", "package1", "package1" };
|
||||||
const std::string kPkg2Base[kNameVariantNum] = { "package2", "package2", "package2" };
|
const std::string kPkg2Base[kNameVariantNum] = { "package2", "package2", "package2" };
|
||||||
const std::string kXciHeaderBase[kNameVariantNum] = { "xci_header", "xci_header", "xci_header" };
|
const std::string kXciHeaderBase[kNameVariantNum] = { "xci_header", "xci_header", "xci_header" };
|
||||||
const std::string kNcaHeaderBase[kNameVariantNum] = { "nca_header", "header", "nca_header" };
|
const std::string kContentArchiveHeaderBase[kNameVariantNum] = { "nca_header", "header", "nca_header" };
|
||||||
const std::string kAcidBase[kNameVariantNum] = { "acid", "acid", "acid" };
|
const std::string kAcidBase[kNameVariantNum] = { "acid", "acid", "acid" };
|
||||||
const std::string kPkiRootBase[kNameVariantNum] = { "pki_root", "pki_root", "pki_root" };
|
const std::string kPkiRootBase[kNameVariantNum] = { "pki_root", "pki_root", "pki_root" };
|
||||||
const std::string kTicketCommonKeyBase[kNameVariantNum] = { "ticket_commonkey", "titlekek", "ticket_commonkey" };
|
const std::string kTicketCommonKeyBase[kNameVariantNum] = { "ticket_commonkey", "titlekek", "ticket_commonkey" };
|
||||||
|
@ -175,8 +175,8 @@ private:
|
||||||
fnd::aes::sAes128Key mPkg2Key[kMasterKeyNum];
|
fnd::aes::sAes128Key mPkg2Key[kMasterKeyNum];
|
||||||
|
|
||||||
// nca
|
// nca
|
||||||
fnd::rsa::sRsa2048Key mNcaHeader0SignKey;
|
fnd::rsa::sRsa2048Key mContentArchiveHeader0SignKey;
|
||||||
fnd::aes::sAesXts128Key mNcaHeaderKey;
|
fnd::aes::sAesXts128Key mContentArchiveHeaderKey;
|
||||||
fnd::aes::sAes128Key mNcaKeyAreaEncryptionKey[kNcaKeakNum][kMasterKeyNum];
|
fnd::aes::sAes128Key mNcaKeyAreaEncryptionKey[kNcaKeakNum][kMasterKeyNum];
|
||||||
fnd::aes::sAes128Key mNcaKeyAreaEncryptionKeyHw[kNcaKeakNum][kMasterKeyNum];
|
fnd::aes::sAes128Key mNcaKeyAreaEncryptionKeyHw[kNcaKeakNum][kMasterKeyNum];
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ void MetaProcess::setVerifyMode(bool verify)
|
||||||
mVerify = verify;
|
mVerify = verify;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::MetaBinary& MetaProcess::getMetaBinary() const
|
const nn::hac::Meta& MetaProcess::getMeta() const
|
||||||
{
|
{
|
||||||
return mMeta;
|
return mMeta;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ void MetaProcess::importMeta()
|
||||||
mMeta.fromBytes(scratch.data(), scratch.size());
|
mMeta.fromBytes(scratch.data(), scratch.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProcess::validateAcidSignature(const nn::hac::AccessControlInfoDescBinary& acid)
|
void MetaProcess::validateAcidSignature(const nn::hac::AccessControlInfoDesc& acid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
fnd::rsa::sRsa2048Key acid_sign_key;
|
fnd::rsa::sRsa2048Key acid_sign_key;
|
||||||
|
@ -96,7 +96,7 @@ void MetaProcess::validateAcidSignature(const nn::hac::AccessControlInfoDescBina
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProcess::validateAciFromAcid(const nn::hac::AccessControlInfoBinary& aci, const nn::hac::AccessControlInfoDescBinary& acid)
|
void MetaProcess::validateAciFromAcid(const nn::hac::AccessControlInfo& aci, const nn::hac::AccessControlInfoDesc& acid)
|
||||||
{
|
{
|
||||||
// check Program ID
|
// check Program ID
|
||||||
if (acid.getProgramIdRestrict().min > 0 && aci.getProgramId() < acid.getProgramIdRestrict().min)
|
if (acid.getProgramIdRestrict().min > 0 && aci.getProgramId() < acid.getProgramIdRestrict().min)
|
||||||
|
@ -287,7 +287,7 @@ void MetaProcess::validateAciFromAcid(const nn::hac::AccessControlInfoBinary& ac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProcess::displayMetaHeader(const nn::hac::MetaBinary& hdr)
|
void MetaProcess::displayMetaHeader(const nn::hac::Meta& hdr)
|
||||||
{
|
{
|
||||||
std::cout << "[Meta Header]" << std::endl;
|
std::cout << "[Meta Header]" << std::endl;
|
||||||
std::cout << " Process Architecture Params:" << std::endl;
|
std::cout << " Process Architecture Params:" << std::endl;
|
||||||
|
@ -306,13 +306,13 @@ void MetaProcess::displayMetaHeader(const nn::hac::MetaBinary& hdr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProcess::displayAciHdr(const nn::hac::AccessControlInfoBinary& aci)
|
void MetaProcess::displayAciHdr(const nn::hac::AccessControlInfo& aci)
|
||||||
{
|
{
|
||||||
std::cout << "[Access Control Info]" << std::endl;
|
std::cout << "[Access Control Info]" << std::endl;
|
||||||
std::cout << " ProgramID: 0x" << std::hex << std::setw(16) << std::setfill('0') << aci.getProgramId() << std::endl;
|
std::cout << " ProgramID: 0x" << std::hex << std::setw(16) << std::setfill('0') << aci.getProgramId() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProcess::displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary& acid)
|
void MetaProcess::displayAciDescHdr(const nn::hac::AccessControlInfoDesc& acid)
|
||||||
{
|
{
|
||||||
std::cout << "[Access Control Info Desc]" << std::endl;
|
std::cout << "[Access Control Info Desc]" << std::endl;
|
||||||
if (acid.getFlagList().size() > 0 || _HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
if (acid.getFlagList().size() > 0 || _HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
||||||
|
@ -328,7 +328,7 @@ void MetaProcess::displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary&
|
||||||
std::cout << " Max: 0x" << std::hex << std::setw(16) << std::setfill('0') << acid.getProgramIdRestrict().max << std::endl;
|
std::cout << " Max: 0x" << std::hex << std::setw(16) << std::setfill('0') << acid.getProgramIdRestrict().max << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProcess::displayFac(const nn::hac::FileSystemAccessControlBinary& fac)
|
void MetaProcess::displayFac(const nn::hac::FileSystemAccessControl& fac)
|
||||||
{
|
{
|
||||||
std::cout << "[FS Access Control]" << std::endl;
|
std::cout << "[FS Access Control]" << std::endl;
|
||||||
std::cout << " Format Version: " << std::dec << (uint32_t)fac.getFormatVersion() << std::endl;
|
std::cout << " Format Version: " << std::dec << (uint32_t)fac.getFormatVersion() << std::endl;
|
||||||
|
@ -349,8 +349,8 @@ void MetaProcess::displayFac(const nn::hac::FileSystemAccessControlBinary& fac)
|
||||||
std::cout << " (bit " << std::dec << (uint32_t)fac.getFsaRightsList()[i] << ")";
|
std::cout << " (bit " << std::dec << (uint32_t)fac.getFsaRightsList()[i] << ")";
|
||||||
if (fac.getFsaRightsList()[i] != fac.getFsaRightsList().atBack())
|
if (fac.getFsaRightsList()[i] != fac.getFsaRightsList().atBack())
|
||||||
std::cout << ", ";
|
std::cout << ", ";
|
||||||
std::cout << std::endl;
|
|
||||||
}
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fac.getContentOwnerIdList().size())
|
if (fac.getContentOwnerIdList().size())
|
||||||
|
@ -373,7 +373,7 @@ void MetaProcess::displayFac(const nn::hac::FileSystemAccessControlBinary& fac)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProcess::displaySac(const nn::hac::ServiceAccessControlBinary& sac)
|
void MetaProcess::displaySac(const nn::hac::ServiceAccessControl& sac)
|
||||||
{
|
{
|
||||||
std::cout << "[Service Access Control]" << std::endl;
|
std::cout << "[Service Access Control]" << std::endl;
|
||||||
std::cout << " Service List:" << std::endl;
|
std::cout << " Service List:" << std::endl;
|
||||||
|
@ -394,7 +394,7 @@ void MetaProcess::displaySac(const nn::hac::ServiceAccessControlBinary& sac)
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaProcess::displayKernelCap(const nn::hac::KernelCapabilityBinary& kern)
|
void MetaProcess::displayKernelCap(const nn::hac::KernelCapabilityControl& kern)
|
||||||
{
|
{
|
||||||
std::cout << "[Kernel Capabilities]" << std::endl;
|
std::cout << "[Kernel Capabilities]" << std::endl;
|
||||||
if (kern.getThreadInfo().isSet())
|
if (kern.getThreadInfo().isSet())
|
||||||
|
@ -437,12 +437,12 @@ void MetaProcess::displayKernelCap(const nn::hac::KernelCapabilityBinary& kern)
|
||||||
std::cout << " MemoryMaps:" << std::endl;
|
std::cout << " MemoryMaps:" << std::endl;
|
||||||
for (size_t i = 0; i < maps.size(); i++)
|
for (size_t i = 0; i < maps.size(); i++)
|
||||||
{
|
{
|
||||||
std::cout << " 0x" << std::hex << std::setw(16) << std::setfill('0') << ((uint64_t)maps[i].addr << 12) << " - 0x" << std::hex << std::setw(16) << std::setfill('0') << (((uint64_t)(maps[i].addr + maps[i].size) << 12) - 1) << " (perm=" << getMemMapPermStr(maps[i].perm) << ") (type=" << getMemMapTypeStr(maps[i].type) << ") not permitted)" << std::endl;
|
std::cout << " 0x" << std::hex << std::setw(16) << std::setfill('0') << ((uint64_t)maps[i].addr << 12) << " - 0x" << std::hex << std::setw(16) << std::setfill('0') << (((uint64_t)(maps[i].addr + maps[i].size) << 12) - 1) << " (perm=" << getMemMapPermStr(maps[i].perm) << ") (type=" << getMemMapTypeStr(maps[i].type) << ")" << std::endl;
|
||||||
}
|
}
|
||||||
//std::cout << " IoMaps:" << std::endl;
|
//std::cout << " IoMaps:" << std::endl;
|
||||||
for (size_t i = 0; i < ioMaps.size(); i++)
|
for (size_t i = 0; i < ioMaps.size(); i++)
|
||||||
{
|
{
|
||||||
std::cout << " 0x" << std::hex << std::setw(16) << std::setfill('0') << ((uint64_t)ioMaps[i].addr << 12) << " - 0x" << std::hex << std::setw(16) << std::setfill('0') << (((uint64_t)(ioMaps[i].addr + ioMaps[i].size) << 12) - 1) << " (perm=" << getMemMapPermStr(ioMaps[i].perm) << ") (type=" << getMemMapTypeStr(ioMaps[i].type) << ") not permitted)" << std::endl;
|
std::cout << " 0x" << std::hex << std::setw(16) << std::setfill('0') << ((uint64_t)ioMaps[i].addr << 12) << " - 0x" << std::hex << std::setw(16) << std::setfill('0') << (((uint64_t)(ioMaps[i].addr + ioMaps[i].size) << 12) - 1) << " (perm=" << getMemMapPermStr(ioMaps[i].perm) << ") (type=" << getMemMapTypeStr(ioMaps[i].type) << ")" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (kern.getInterupts().isSet())
|
if (kern.getInterupts().isSet())
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <nn/hac/MetaBinary.h>
|
#include <nn/hac/Meta.h>
|
||||||
#include "KeyConfiguration.h"
|
#include "KeyConfiguration.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
void setCliOutputMode(CliOutputMode type);
|
void setCliOutputMode(CliOutputMode type);
|
||||||
void setVerifyMode(bool verify);
|
void setVerifyMode(bool verify);
|
||||||
|
|
||||||
const nn::hac::MetaBinary& getMetaBinary() const;
|
const nn::hac::Meta& getMeta() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "MetaProcess";
|
const std::string kModuleName = "MetaProcess";
|
||||||
|
@ -30,19 +30,19 @@ private:
|
||||||
CliOutputMode mCliOutputMode;
|
CliOutputMode mCliOutputMode;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
nn::hac::MetaBinary mMeta;
|
nn::hac::Meta mMeta;
|
||||||
|
|
||||||
void importMeta();
|
void importMeta();
|
||||||
|
|
||||||
void validateAcidSignature(const nn::hac::AccessControlInfoDescBinary& acid);
|
void validateAcidSignature(const nn::hac::AccessControlInfoDesc& acid);
|
||||||
void validateAciFromAcid(const nn::hac::AccessControlInfoBinary& aci, const nn::hac::AccessControlInfoDescBinary& acid);
|
void validateAciFromAcid(const nn::hac::AccessControlInfo& aci, const nn::hac::AccessControlInfoDesc& acid);
|
||||||
|
|
||||||
void displayMetaHeader(const nn::hac::MetaBinary& hdr);
|
void displayMetaHeader(const nn::hac::Meta& hdr);
|
||||||
void displayAciHdr(const nn::hac::AccessControlInfoBinary& aci);
|
void displayAciHdr(const nn::hac::AccessControlInfo& aci);
|
||||||
void displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary& aci);
|
void displayAciDescHdr(const nn::hac::AccessControlInfoDesc& aci);
|
||||||
void displayFac(const nn::hac::FileSystemAccessControlBinary& fac);
|
void displayFac(const nn::hac::FileSystemAccessControl& fac);
|
||||||
void displaySac(const nn::hac::ServiceAccessControlBinary& sac);
|
void displaySac(const nn::hac::ServiceAccessControl& sac);
|
||||||
void displayKernelCap(const nn::hac::KernelCapabilityBinary& kern);
|
void displayKernelCap(const nn::hac::KernelCapabilityControl& kern);
|
||||||
|
|
||||||
const char* getInstructionTypeStr(nn::hac::meta::InstructionType type) const;
|
const char* getInstructionTypeStr(nn::hac::meta::InstructionType type) const;
|
||||||
const char* getProcAddressSpaceTypeStr(nn::hac::meta::ProcAddrSpaceType type) const;
|
const char* getProcAddressSpaceTypeStr(nn::hac::meta::ProcAddrSpaceType type) const;
|
||||||
|
|
|
@ -35,7 +35,7 @@ void NacpProcess::setVerifyMode(bool verify)
|
||||||
mVerify = verify;
|
mVerify = verify;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ApplicationControlPropertyBinary& NacpProcess::getApplicationControlPropertyBinary() const
|
const nn::hac::ApplicationControlProperty& NacpProcess::getApplicationControlProperty() const
|
||||||
{
|
{
|
||||||
return mNacp;
|
return mNacp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <nn/hac/ApplicationControlPropertyBinary.h>
|
#include <nn/hac/ApplicationControlProperty.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
void setCliOutputMode(CliOutputMode type);
|
void setCliOutputMode(CliOutputMode type);
|
||||||
void setVerifyMode(bool verify);
|
void setVerifyMode(bool verify);
|
||||||
|
|
||||||
const nn::hac::ApplicationControlPropertyBinary& getApplicationControlPropertyBinary() const;
|
const nn::hac::ApplicationControlProperty& getApplicationControlProperty() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "NacpProcess";
|
const std::string kModuleName = "NacpProcess";
|
||||||
|
@ -27,7 +27,7 @@ private:
|
||||||
CliOutputMode mCliOutputMode;
|
CliOutputMode mCliOutputMode;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
nn::hac::ApplicationControlPropertyBinary mNacp;
|
nn::hac::ApplicationControlProperty mNacp;
|
||||||
|
|
||||||
void importNacp();
|
void importNacp();
|
||||||
void displayNacp();
|
void displayNacp();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <fnd/OffsetAdjustedIFile.h>
|
#include <fnd/OffsetAdjustedIFile.h>
|
||||||
#include <fnd/AesCtrWrappedIFile.h>
|
#include <fnd/AesCtrWrappedIFile.h>
|
||||||
#include <fnd/LayeredIntegrityWrappedIFile.h>
|
#include <fnd/LayeredIntegrityWrappedIFile.h>
|
||||||
#include <nn/hac/NcaUtils.h>
|
#include <nn/hac/ContentArchiveUtils.h>
|
||||||
#include <nn/hac/AesKeygen.h>
|
#include <nn/hac/AesKeygen.h>
|
||||||
#include <nn/hac/HierarchicalSha256Header.h>
|
#include <nn/hac/HierarchicalSha256Header.h>
|
||||||
#include <nn/hac/HierarchicalIntegrityHeader.h>
|
#include <nn/hac/HierarchicalIntegrityHeader.h>
|
||||||
|
@ -107,18 +107,18 @@ void NcaProcess::importHeader()
|
||||||
}
|
}
|
||||||
|
|
||||||
// read header block
|
// read header block
|
||||||
(*mFile)->read((byte_t*)&mHdrBlock, 0, sizeof(nn::hac::sNcaHeaderBlock));
|
(*mFile)->read((byte_t*)&mHdrBlock, 0, sizeof(nn::hac::sContentArchiveHeaderBlock));
|
||||||
|
|
||||||
// decrypt header block
|
// decrypt header block
|
||||||
fnd::aes::sAesXts128Key header_key;
|
fnd::aes::sAesXts128Key header_key;
|
||||||
mKeyCfg.getNcaHeaderKey(header_key);
|
mKeyCfg.getContentArchiveHeaderKey(header_key);
|
||||||
nn::hac::NcaUtils::decryptNcaHeader((byte_t*)&mHdrBlock, (byte_t*)&mHdrBlock, header_key);
|
nn::hac::ContentArchiveUtils::decryptContentArchiveHeader((byte_t*)&mHdrBlock, (byte_t*)&mHdrBlock, header_key);
|
||||||
|
|
||||||
// generate header hash
|
// generate header hash
|
||||||
fnd::sha::Sha256((byte_t*)&mHdrBlock.header, sizeof(nn::hac::sNcaHeader), mHdrHash.bytes);
|
fnd::sha::Sha256((byte_t*)&mHdrBlock.header, sizeof(nn::hac::sContentArchiveHeader), mHdrHash.bytes);
|
||||||
|
|
||||||
// proccess main header
|
// proccess main header
|
||||||
mHdr.fromBytes((byte_t*)&mHdrBlock.header, sizeof(nn::hac::sNcaHeader));
|
mHdr.fromBytes((byte_t*)&mHdrBlock.header, sizeof(nn::hac::sContentArchiveHeader));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NcaProcess::generateNcaBodyEncryptionKeys()
|
void NcaProcess::generateNcaBodyEncryptionKeys()
|
||||||
|
@ -128,26 +128,28 @@ void NcaProcess::generateNcaBodyEncryptionKeys()
|
||||||
memset(zero_aesctr_key.key, 0, sizeof(zero_aesctr_key));
|
memset(zero_aesctr_key.key, 0, sizeof(zero_aesctr_key));
|
||||||
|
|
||||||
// get key data from header
|
// get key data from header
|
||||||
byte_t masterkey_rev = nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(mHdr.getKeyGeneration());
|
byte_t masterkey_rev = nn::hac::ContentArchiveUtils::getMasterKeyRevisionFromKeyGeneration(mHdr.getKeyGeneration());
|
||||||
byte_t keak_index = mHdr.getKaekIndex();
|
byte_t keak_index = mHdr.getKeyAreaEncryptionKeyIndex();
|
||||||
|
|
||||||
// process key area
|
// process key area
|
||||||
sKeys::sKeyAreaKey kak;
|
sKeys::sKeyAreaKey kak;
|
||||||
fnd::aes::sAes128Key key_area_enc_key;
|
fnd::aes::sAes128Key key_area_enc_key;
|
||||||
for (size_t i = 0; i < nn::hac::nca::kAesKeyNum; i++)
|
const fnd::aes::sAes128Key* key_area = (const fnd::aes::sAes128Key*) mHdr.getKeyArea();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nn::hac::nca::kKeyAreaKeyNum; i++)
|
||||||
{
|
{
|
||||||
if (mHdr.getEncAesKeys()[i] != zero_aesctr_key)
|
if (key_area[i] != zero_aesctr_key)
|
||||||
{
|
{
|
||||||
kak.index = (byte_t)i;
|
kak.index = (byte_t)i;
|
||||||
kak.enc = mHdr.getEncAesKeys()[i];
|
kak.enc = key_area[i];
|
||||||
// key[0-3]
|
// key[0-3]
|
||||||
if (i < 4 && mKeyCfg.getNcaKeyAreaEncryptionKey(masterkey_rev, keak_index, key_area_enc_key) == true)
|
if (i < 4 && mKeyCfg.getNcaKeyAreaEncryptionKey(masterkey_rev, keak_index, key_area_enc_key) == true)
|
||||||
{
|
{
|
||||||
kak.decrypted = true;
|
kak.decrypted = true;
|
||||||
nn::hac::AesKeygen::generateKey(kak.dec.key, kak.enc.key, key_area_enc_key.key);
|
nn::hac::AesKeygen::generateKey(kak.dec.key, kak.enc.key, key_area_enc_key.key);
|
||||||
}
|
}
|
||||||
// key[4]
|
// key[KEY_AESCTR_HW]
|
||||||
else if (i == 4 && mKeyCfg.getNcaKeyAreaEncryptionKeyHw(masterkey_rev, keak_index, key_area_enc_key) == true)
|
else if (i == nn::hac::nca::KEY_AESCTR_HW && mKeyCfg.getNcaKeyAreaEncryptionKeyHw(masterkey_rev, keak_index, key_area_enc_key) == true)
|
||||||
{
|
{
|
||||||
kak.decrypted = true;
|
kak.decrypted = true;
|
||||||
nn::hac::AesKeygen::generateKey(kak.dec.key, kak.enc.key, key_area_enc_key.key);
|
nn::hac::AesKeygen::generateKey(kak.dec.key, kak.enc.key, key_area_enc_key.key);
|
||||||
|
@ -223,22 +225,22 @@ void NcaProcess::generatePartitionConfiguration()
|
||||||
{
|
{
|
||||||
std::stringstream error;
|
std::stringstream error;
|
||||||
|
|
||||||
for (size_t i = 0; i < mHdr.getPartitions().size(); i++)
|
for (size_t i = 0; i < mHdr.getPartitionEntryList().size(); i++)
|
||||||
{
|
{
|
||||||
// get reference to relevant structures
|
// get reference to relevant structures
|
||||||
const nn::hac::NcaHeader::sPartition& partition = mHdr.getPartitions()[i];
|
const nn::hac::ContentArchiveHeader::sPartitionEntry& partition = mHdr.getPartitionEntryList()[i];
|
||||||
nn::hac::sNcaFsHeader& fs_header = mHdrBlock.fs_header[partition.index];
|
nn::hac::sNcaFsHeader& fs_header = mHdrBlock.fs_header[partition.header_index];
|
||||||
|
|
||||||
// output structure
|
// output structure
|
||||||
sPartitionInfo& info = mPartitions[partition.index];
|
sPartitionInfo& info = mPartitions[partition.header_index];
|
||||||
|
|
||||||
// validate header hash
|
// validate header hash
|
||||||
fnd::sha::sSha256Hash calc_hash;
|
fnd::sha::sSha256Hash fs_header_hash;
|
||||||
fnd::sha::Sha256((const byte_t*)&mHdrBlock.fs_header[partition.index], sizeof(nn::hac::sNcaFsHeader), calc_hash.bytes);
|
fnd::sha::Sha256((const byte_t*)&mHdrBlock.fs_header[partition.header_index], sizeof(nn::hac::sNcaFsHeader), fs_header_hash.bytes);
|
||||||
if (calc_hash.compare(partition.hash) == false)
|
if (fs_header_hash.compare(partition.fs_header_hash) == false)
|
||||||
{
|
{
|
||||||
error.clear();
|
error.clear();
|
||||||
error << "NCA FS Header [" << partition.index << "] Hash: FAIL \n";
|
error << "NCA FS Header [" << partition.header_index << "] Hash: FAIL \n";
|
||||||
throw fnd::Exception(kModuleName, error.str());
|
throw fnd::Exception(kModuleName, error.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,12 +248,12 @@ void NcaProcess::generatePartitionConfiguration()
|
||||||
if (fs_header.version.get() != nn::hac::nca::kDefaultFsHeaderVersion)
|
if (fs_header.version.get() != nn::hac::nca::kDefaultFsHeaderVersion)
|
||||||
{
|
{
|
||||||
error.clear();
|
error.clear();
|
||||||
error << "NCA FS Header [" << partition.index << "] Version(" << fs_header.version.get() << "): UNSUPPORTED";
|
error << "NCA FS Header [" << partition.header_index << "] Version(" << fs_header.version.get() << "): UNSUPPORTED";
|
||||||
throw fnd::Exception(kModuleName, error.str());
|
throw fnd::Exception(kModuleName, error.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup AES-CTR
|
// setup AES-CTR
|
||||||
nn::hac::NcaUtils::getNcaPartitionAesCtr(&fs_header, info.aes_ctr.iv);
|
nn::hac::ContentArchiveUtils::getNcaPartitionAesCtr(&fs_header, info.aes_ctr.iv);
|
||||||
|
|
||||||
// save partition config
|
// save partition config
|
||||||
info.reader = nullptr;
|
info.reader = nullptr;
|
||||||
|
@ -387,7 +389,7 @@ void NcaProcess::validateNcaSignatures()
|
||||||
{
|
{
|
||||||
// validate signature[0]
|
// validate signature[0]
|
||||||
fnd::rsa::sRsa2048Key sign0_key;
|
fnd::rsa::sRsa2048Key sign0_key;
|
||||||
mKeyCfg.getNcaHeader0SignKey(sign0_key);
|
mKeyCfg.getContentArchiveHeader0SignKey(sign0_key);
|
||||||
if (fnd::rsa::pss::rsaVerify(sign0_key, fnd::sha::HASH_SHA256, mHdrHash.bytes, mHdrBlock.signature_main) != 0)
|
if (fnd::rsa::pss::rsaVerify(sign0_key, fnd::sha::HASH_SHA256, mHdrHash.bytes, mHdrBlock.signature_main) != 0)
|
||||||
{
|
{
|
||||||
std::cout << "[WARNING] NCA Header Main Signature: FAIL" << std::endl;
|
std::cout << "[WARNING] NCA Header Main Signature: FAIL" << std::endl;
|
||||||
|
@ -408,14 +410,14 @@ void NcaProcess::validateNcaSignatures()
|
||||||
// open main.npdm
|
// open main.npdm
|
||||||
if (exefs.getPfsHeader().getFileList().hasElement(kNpdmExefsPath) == true)
|
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;
|
MetaProcess npdm;
|
||||||
npdm.setInputFile(new fnd::OffsetAdjustedIFile(mPartitions[nn::hac::nca::PARTITION_CODE].reader, file.offset, file.size));
|
npdm.setInputFile(new fnd::OffsetAdjustedIFile(mPartitions[nn::hac::nca::PARTITION_CODE].reader, file.offset, file.size));
|
||||||
npdm.setCliOutputMode(0);
|
npdm.setCliOutputMode(0);
|
||||||
npdm.process();
|
npdm.process();
|
||||||
|
|
||||||
if (fnd::rsa::pss::rsaVerify(npdm.getMetaBinary().getAcid().getNcaHeaderSignature2Key(), fnd::sha::HASH_SHA256, mHdrHash.bytes, mHdrBlock.signature_acid) != 0)
|
if (fnd::rsa::pss::rsaVerify(npdm.getMeta().getAcid().getContentArchiveHeaderSignature2Key(), fnd::sha::HASH_SHA256, mHdrHash.bytes, mHdrBlock.signature_acid) != 0)
|
||||||
{
|
{
|
||||||
std::cout << "[WARNING] NCA Header ACID Signature: FAIL" << std::endl;
|
std::cout << "[WARNING] NCA Header ACID Signature: FAIL" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +447,7 @@ void NcaProcess::displayHeader()
|
||||||
std::cout << " Dist. Type: " << getDistributionTypeStr(mHdr.getDistributionType()) << std::endl;
|
std::cout << " Dist. Type: " << getDistributionTypeStr(mHdr.getDistributionType()) << std::endl;
|
||||||
std::cout << " Content Type: " << getContentTypeStr(mHdr.getContentType()) << std::endl;
|
std::cout << " Content Type: " << getContentTypeStr(mHdr.getContentType()) << std::endl;
|
||||||
std::cout << " Key Generation: " << std::dec << (uint32_t)mHdr.getKeyGeneration() << std::endl;
|
std::cout << " Key Generation: " << std::dec << (uint32_t)mHdr.getKeyGeneration() << std::endl;
|
||||||
std::cout << " Kaek Index: " << getKaekIndexStr((nn::hac::nca::KeyAreaEncryptionKeyIndex)mHdr.getKaekIndex()) << " (" << std::dec << (uint32_t)mHdr.getKaekIndex() << ")" << std::endl;
|
std::cout << " Kaek Index: " << getKaekIndexStr((nn::hac::nca::KeyAreaEncryptionKeyIndex)mHdr.getKeyAreaEncryptionKeyIndex()) << " (" << std::dec << (uint32_t)mHdr.getKeyAreaEncryptionKeyIndex() << ")" << std::endl;
|
||||||
std::cout << " Size: 0x" << std::hex << mHdr.getContentSize() << std::endl;
|
std::cout << " Size: 0x" << std::hex << mHdr.getContentSize() << std::endl;
|
||||||
std::cout << " ProgID: 0x" << std::hex << std::setw(16) << std::setfill('0') << mHdr.getProgramId() << std::endl;
|
std::cout << " ProgID: 0x" << std::hex << std::setw(16) << std::setfill('0') << mHdr.getProgramId() << std::endl;
|
||||||
std::cout << " Content Index: " << std::dec << mHdr.getContentIndex() << std::endl;
|
std::cout << " Content Index: " << std::dec << mHdr.getContentIndex() << std::endl;
|
||||||
|
@ -483,10 +485,11 @@ void NcaProcess::displayHeader()
|
||||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_LAYOUT))
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_LAYOUT))
|
||||||
{
|
{
|
||||||
std::cout << " Partitions:" << std::endl;
|
std::cout << " Partitions:" << std::endl;
|
||||||
for (size_t i = 0; i < mHdr.getPartitions().size(); i++)
|
for (size_t i = 0; i < mHdr.getPartitionEntryList().size(); i++)
|
||||||
{
|
{
|
||||||
size_t index = mHdr.getPartitions()[i].index;
|
uint32_t index = mHdr.getPartitionEntryList()[i].header_index;
|
||||||
sPartitionInfo& info = mPartitions[index];
|
sPartitionInfo& info = mPartitions[index];
|
||||||
|
if (info.size == 0) continue;
|
||||||
|
|
||||||
std::cout << " " << std::dec << index << ":" << std::endl;
|
std::cout << " " << std::dec << index << ":" << std::endl;
|
||||||
std::cout << " Offset: 0x" << std::hex << (uint64_t)info.offset << std::endl;
|
std::cout << " Offset: 0x" << std::hex << (uint64_t)info.offset << std::endl;
|
||||||
|
@ -546,9 +549,9 @@ void NcaProcess::displayHeader()
|
||||||
|
|
||||||
void NcaProcess::processPartitions()
|
void NcaProcess::processPartitions()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < mHdr.getPartitions().size(); i++)
|
for (size_t i = 0; i < mHdr.getPartitionEntryList().size(); i++)
|
||||||
{
|
{
|
||||||
size_t index = mHdr.getPartitions()[i].index;
|
uint32_t index = mHdr.getPartitionEntryList()[i].header_index;
|
||||||
struct sPartitionInfo& partition = mPartitions[index];
|
struct sPartitionInfo& partition = mPartitions[index];
|
||||||
|
|
||||||
// if the reader is null, skip
|
// if the reader is null, skip
|
||||||
|
@ -604,16 +607,16 @@ void NcaProcess::processPartitions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* NcaProcess::getFormatVersionStr(nn::hac::NcaHeader::FormatVersion format_ver) const
|
const char* NcaProcess::getFormatVersionStr(byte_t format_ver) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (format_ver)
|
switch (format_ver)
|
||||||
{
|
{
|
||||||
case (nn::hac::NcaHeader::NCA2_FORMAT):
|
case (nn::hac::nca::FORMAT_NCA2):
|
||||||
str = "NCA2";
|
str = "NCA2";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::NcaHeader::NCA3_FORMAT):
|
case (nn::hac::nca::FORMAT_NCA3):
|
||||||
str = "NCA3";
|
str = "NCA3";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -797,7 +800,7 @@ const char* NcaProcess::getContentTypeForMountStr(nn::hac::nca::ContentType cont
|
||||||
str = "data";
|
str = "data";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::nca::TYPE_PUBLIC_DATA):
|
case (nn::hac::nca::TYPE_PUBLIC_DATA):
|
||||||
str = "publicData";
|
str = "publicdata";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str = "";
|
str = "";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <fnd/LayeredIntegrityMetadata.h>
|
#include <fnd/LayeredIntegrityMetadata.h>
|
||||||
#include <nn/hac/NcaHeader.h>
|
#include <nn/hac/ContentArchiveHeader.h>
|
||||||
#include "KeyConfiguration.h"
|
#include "KeyConfiguration.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,9 +49,9 @@ private:
|
||||||
bool mListFs;
|
bool mListFs;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
nn::hac::sNcaHeaderBlock mHdrBlock;
|
nn::hac::sContentArchiveHeaderBlock mHdrBlock;
|
||||||
fnd::sha::sSha256Hash mHdrHash;
|
fnd::sha::sSha256Hash mHdrHash;
|
||||||
nn::hac::NcaHeader mHdr;
|
nn::hac::ContentArchiveHeader mHdr;
|
||||||
|
|
||||||
// crypto
|
// crypto
|
||||||
struct sKeys
|
struct sKeys
|
||||||
|
@ -111,7 +111,7 @@ private:
|
||||||
void displayHeader();
|
void displayHeader();
|
||||||
void processPartitions();
|
void processPartitions();
|
||||||
|
|
||||||
const char* getFormatVersionStr(nn::hac::NcaHeader::FormatVersion format_ver) const;
|
const char* getFormatVersionStr(byte_t format_ver) const;
|
||||||
const char* getDistributionTypeStr(nn::hac::nca::DistributionType dist_type) const;
|
const char* getDistributionTypeStr(nn::hac::nca::DistributionType dist_type) const;
|
||||||
const char* getContentTypeStr(nn::hac::nca::ContentType cont_type) const;
|
const char* getContentTypeStr(nn::hac::nca::ContentType cont_type) const;
|
||||||
const char* getEncryptionTypeStr(nn::hac::nca::EncryptionType enc_type) const;
|
const char* getEncryptionTypeStr(nn::hac::nca::EncryptionType enc_type) const;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <fnd/OffsetAdjustedIFile.h>
|
#include <fnd/OffsetAdjustedIFile.h>
|
||||||
#include <fnd/Vec.h>
|
#include <fnd/Vec.h>
|
||||||
#include <fnd/lz4.h>
|
#include <fnd/lz4.h>
|
||||||
#include <nn/hac/nro-hb.h>
|
#include <nn/hac/define/nro-hb.h>
|
||||||
#include "NroProcess.h"
|
#include "NroProcess.h"
|
||||||
|
|
||||||
NroProcess::NroProcess():
|
NroProcess::NroProcess():
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <nn/hac/meta.h>
|
#include <nn/hac/define/meta.h>
|
||||||
#include <nn/hac/NroHeader.h>
|
#include <nn/hac/NroHeader.h>
|
||||||
#include "AssetProcess.h"
|
#include "AssetProcess.h"
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue