diff --git a/lib/libhac-hb/include/nn/hac/aset.h b/lib/libhac-hb/include/nn/hac/aset.h index f7c1bfd..7050d01 100644 --- a/lib/libhac-hb/include/nn/hac/aset.h +++ b/lib/libhac-hb/include/nn/hac/aset.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include namespace nn { diff --git a/lib/libhac-hb/include/nn/hac/nro-hb.h b/lib/libhac-hb/include/nn/hac/nro-hb.h index a1dcc67..1602092 100644 --- a/lib/libhac-hb/include/nn/hac/nro-hb.h +++ b/lib/libhac-hb/include/nn/hac/nro-hb.h @@ -1,6 +1,6 @@ #pragma once -#include -#include +#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/AccessControlInfo.h b/lib/libhac/include/nn/hac/AccessControlInfo.h index 8861f8e..803a8ac 100644 --- a/lib/libhac/include/nn/hac/AccessControlInfo.h +++ b/lib/libhac/include/nn/hac/AccessControlInfo.h @@ -2,10 +2,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace nn { @@ -33,14 +33,14 @@ namespace hac uint64_t getProgramId() const; void setProgramId(uint64_t program_id); - const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const; - void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac); + const nn::hac::FileSystemAccessControl& getFileSystemAccessControl() const; + void setFileSystemAccessControl(const FileSystemAccessControl& fac); - const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const; - void setServiceAccessControl(const ServiceAccessControlBinary& sac); + const nn::hac::ServiceAccessControl& getServiceAccessControl() const; + void setServiceAccessControl(const ServiceAccessControl& sac); - const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const; - void setKernelCapabilities(const KernelCapabilityBinary& kc); + const nn::hac::KernelCapabilityControl& getKernelCapabilities() const; + void setKernelCapabilities(const KernelCapabilityControl& kc); private: const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY"; @@ -49,9 +49,9 @@ namespace hac // variables uint64_t mProgramId; - nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl; - nn::hac::ServiceAccessControlBinary mServiceAccessControl; - nn::hac::KernelCapabilityBinary mKernelCapabilities; + nn::hac::FileSystemAccessControl mFileSystemAccessControl; + nn::hac::ServiceAccessControl mServiceAccessControl; + nn::hac::KernelCapabilityControl mKernelCapabilities; }; } } \ No newline at end of file diff --git a/lib/libhac/include/nn/hac/AccessControlInfoDesc.h b/lib/libhac/include/nn/hac/AccessControlInfoDesc.h index f446e49..18c9c85 100644 --- a/lib/libhac/include/nn/hac/AccessControlInfoDesc.h +++ b/lib/libhac/include/nn/hac/AccessControlInfoDesc.h @@ -3,10 +3,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace nn { @@ -66,14 +66,14 @@ namespace hac const sProgramIdRestrict& getProgramIdRestrict() const; void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict); - const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const; - void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac); + const nn::hac::FileSystemAccessControl& getFileSystemAccessControl() const; + void setFileSystemAccessControl(const FileSystemAccessControl& fac); - const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const; - void setServiceAccessControl(const ServiceAccessControlBinary& sac); + const nn::hac::ServiceAccessControl& getServiceAccessControl() const; + void setServiceAccessControl(const ServiceAccessControl& sac); - const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const; - void setKernelCapabilities(const KernelCapabilityBinary& kc); + const nn::hac::KernelCapabilityControl& getKernelCapabilities() const; + void setKernelCapabilities(const KernelCapabilityControl& kc); private: const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY"; @@ -84,9 +84,9 @@ namespace hac fnd::rsa::sRsa2048Key mNcaHeaderSignature2Key; fnd::List mFlags; sProgramIdRestrict mProgramIdRestrict; - nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl; - nn::hac::ServiceAccessControlBinary mServiceAccessControl; - nn::hac::KernelCapabilityBinary mKernelCapabilities; + nn::hac::FileSystemAccessControl mFileSystemAccessControl; + nn::hac::ServiceAccessControl mServiceAccessControl; + nn::hac::KernelCapabilityControl mKernelCapabilities; }; } } \ No newline at end of file diff --git a/lib/libhac/include/nn/hac/AddOnContentMetaExtendedHeader.h b/lib/libhac/include/nn/hac/AddOnContentMetaExtendedHeader.h index 89ffcb8..525f7b9 100644 --- a/lib/libhac/include/nn/hac/AddOnContentMetaExtendedHeader.h +++ b/lib/libhac/include/nn/hac/AddOnContentMetaExtendedHeader.h @@ -2,7 +2,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/ApplicationControlProperty.h b/lib/libhac/include/nn/hac/ApplicationControlProperty.h index 6931130..5288dc9 100644 --- a/lib/libhac/include/nn/hac/ApplicationControlProperty.h +++ b/lib/libhac/include/nn/hac/ApplicationControlProperty.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/ApplicationControlPropertyUtils.h b/lib/libhac/include/nn/hac/ApplicationControlPropertyUtils.h index 9955de3..5e093be 100644 --- a/lib/libhac/include/nn/hac/ApplicationControlPropertyUtils.h +++ b/lib/libhac/include/nn/hac/ApplicationControlPropertyUtils.h @@ -1,5 +1,5 @@ #pragma once -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/ApplicationMetaExtendedHeader.h b/lib/libhac/include/nn/hac/ApplicationMetaExtendedHeader.h index ca526d6..0b36187 100644 --- a/lib/libhac/include/nn/hac/ApplicationMetaExtendedHeader.h +++ b/lib/libhac/include/nn/hac/ApplicationMetaExtendedHeader.h @@ -2,7 +2,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/ContentInfo.h b/lib/libhac/include/nn/hac/ContentInfo.h index d9a86ce..eb644c5 100644 --- a/lib/libhac/include/nn/hac/ContentInfo.h +++ b/lib/libhac/include/nn/hac/ContentInfo.h @@ -2,7 +2,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/ContentMeta.h b/lib/libhac/include/nn/hac/ContentMeta.h index a48106d..0bcb18a 100644 --- a/lib/libhac/include/nn/hac/ContentMeta.h +++ b/lib/libhac/include/nn/hac/ContentMeta.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/libhac/include/nn/hac/ContentMetaInfo.h b/lib/libhac/include/nn/hac/ContentMetaInfo.h index 4749bf2..c8fa6a2 100644 --- a/lib/libhac/include/nn/hac/ContentMetaInfo.h +++ b/lib/libhac/include/nn/hac/ContentMetaInfo.h @@ -2,7 +2,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/DeltaMetaExtendedHeader.h b/lib/libhac/include/nn/hac/DeltaMetaExtendedHeader.h index ea8ddb4..74feea7 100644 --- a/lib/libhac/include/nn/hac/DeltaMetaExtendedHeader.h +++ b/lib/libhac/include/nn/hac/DeltaMetaExtendedHeader.h @@ -2,7 +2,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/FileSystemAccessControlBinary.h b/lib/libhac/include/nn/hac/FileSystemAccessControl.h similarity index 77% rename from lib/libhac/include/nn/hac/FileSystemAccessControlBinary.h rename to lib/libhac/include/nn/hac/FileSystemAccessControl.h index 72901fd..5821328 100644 --- a/lib/libhac/include/nn/hac/FileSystemAccessControlBinary.h +++ b/lib/libhac/include/nn/hac/FileSystemAccessControl.h @@ -3,13 +3,13 @@ #include #include #include -#include +#include namespace nn { namespace hac { - class FileSystemAccessControlBinary : + class FileSystemAccessControl : public fnd::IByteModel { public: @@ -36,12 +36,12 @@ namespace hac } }; - FileSystemAccessControlBinary(); - FileSystemAccessControlBinary(const FileSystemAccessControlBinary& other); + FileSystemAccessControl(); + FileSystemAccessControl(const FileSystemAccessControl& other); - void operator=(const FileSystemAccessControlBinary& other); - bool operator==(const FileSystemAccessControlBinary& other) const; - bool operator!=(const FileSystemAccessControlBinary& other) const; + void operator=(const FileSystemAccessControl& other); + bool operator==(const FileSystemAccessControl& other) const; + bool operator!=(const FileSystemAccessControl& other) const; // IByteModel void toBytes(); @@ -63,7 +63,7 @@ namespace hac const fnd::List& getSaveDataOwnerIdList() const; void setSaveDataOwnerIdList(const fnd::List& list); private: - const std::string kModuleName = "FILE_SYSTEM_ACCESS_CONTROL_BINARY"; + const std::string kModuleName = "FILE_SYSTEM_ACCESS_CONTROL"; // raw data fnd::Vec mRawBinary; diff --git a/lib/libhac/include/nn/hac/HierarchicalIntegrityHeader.h b/lib/libhac/include/nn/hac/HierarchicalIntegrityHeader.h index 340995a..28ea9f1 100644 --- a/lib/libhac/include/nn/hac/HierarchicalIntegrityHeader.h +++ b/lib/libhac/include/nn/hac/HierarchicalIntegrityHeader.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include #include diff --git a/lib/libhac/include/nn/hac/HierarchicalSha256Header.h b/lib/libhac/include/nn/hac/HierarchicalSha256Header.h index 0967e59..9a6a17a 100644 --- a/lib/libhac/include/nn/hac/HierarchicalSha256Header.h +++ b/lib/libhac/include/nn/hac/HierarchicalSha256Header.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include diff --git a/lib/libhac/include/nn/hac/KernelCapabilityBinary.h b/lib/libhac/include/nn/hac/KernelCapabilityControl.h similarity index 82% rename from lib/libhac/include/nn/hac/KernelCapabilityBinary.h rename to lib/libhac/include/nn/hac/KernelCapabilityControl.h index 91ca53c..6ca4a71 100644 --- a/lib/libhac/include/nn/hac/KernelCapabilityBinary.h +++ b/lib/libhac/include/nn/hac/KernelCapabilityControl.h @@ -16,16 +16,16 @@ namespace nn { namespace hac { - class KernelCapabilityBinary : + class KernelCapabilityControl : public fnd::IByteModel { public: - KernelCapabilityBinary(); - KernelCapabilityBinary(const KernelCapabilityBinary& other); + KernelCapabilityControl(); + KernelCapabilityControl(const KernelCapabilityControl& other); - void operator=(const KernelCapabilityBinary& other); - bool operator==(const KernelCapabilityBinary& other) const; - bool operator!=(const KernelCapabilityBinary& other) const; + void operator=(const KernelCapabilityControl& other); + bool operator==(const KernelCapabilityControl& other) const; + bool operator!=(const KernelCapabilityControl& other) const; // IByteModel void toBytes(); @@ -59,7 +59,7 @@ namespace hac MiscFlagsHandler& getMiscFlags(); private: - const std::string kModuleName = "KC_BINARY"; + const std::string kModuleName = "KERNEL_CAPABILITY_CONTROL"; // raw binary fnd::Vec mRawBinary; diff --git a/lib/libhac/include/nn/hac/KernelCapabilityEntry.h b/lib/libhac/include/nn/hac/KernelCapabilityEntry.h index e8711e3..478fefa 100644 --- a/lib/libhac/include/nn/hac/KernelCapabilityEntry.h +++ b/lib/libhac/include/nn/hac/KernelCapabilityEntry.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/MetaBinary.h b/lib/libhac/include/nn/hac/MetaBinary.h deleted file mode 100644 index 7bb4798..0000000 --- a/lib/libhac/include/nn/hac/MetaBinary.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include - -namespace nn -{ -namespace hac -{ - class MetaBinary : - public fnd::IByteModel - { - public: - MetaBinary(); - MetaBinary(const MetaBinary& other); - - void operator=(const MetaBinary& other); - bool operator==(const MetaBinary& other) const; - bool operator!=(const MetaBinary& other) const; - - // IByteModel - void toBytes(); - void fromBytes(const byte_t* bytes, size_t len); - const fnd::Vec& getBytes() const; - - // variables - void clear(); - - meta::InstructionType getInstructionType() const; - void setInstructionType(meta::InstructionType type); - - meta::ProcAddrSpaceType getProcAddressSpaceType() const; - void setProcAddressSpaceType(meta::ProcAddrSpaceType type); - - byte_t getMainThreadPriority() const; - void setMainThreadPriority(byte_t priority); - - byte_t getMainThreadCpuId() const; - void setMainThreadCpuId(byte_t cpu_id); - - uint32_t getVersion() const; - void setVersion(uint32_t version); - - uint32_t getMainThreadStackSize() const; - void setMainThreadStackSize(uint32_t size); - - const std::string& getName() const; - void setName(const std::string& name); - - const std::string& getProductCode() const; - void setProductCode(const std::string& product_code); - - const AccessControlInfo& getAci() const; - void setAci(const AccessControlInfo& aci); - - const AccessControlInfoDesc& getAcid() const; - void setAcid(const AccessControlInfoDesc& acid); - private: - const std::string kModuleName = "META_BINARY"; - - // raw binary - fnd::Vec mRawBinary; - - // variables - meta::InstructionType mInstructionType; - meta::ProcAddrSpaceType mProcAddressSpaceType; - byte_t mMainThreadPriority; - byte_t mMainThreadCpuId; - uint32_t mVersion; - uint32_t mMainThreadStackSize; - std::string mName; - std::string mProductCode; - AccessControlInfo mAci; - AccessControlInfoDesc mAcid; - }; -} -} \ No newline at end of file diff --git a/lib/libhac/include/nn/hac/NcaHeader.h b/lib/libhac/include/nn/hac/NcaHeader.h index 6953fb1..bc066ef 100644 --- a/lib/libhac/include/nn/hac/NcaHeader.h +++ b/lib/libhac/include/nn/hac/NcaHeader.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include diff --git a/lib/libhac/include/nn/hac/NcaUtils.h b/lib/libhac/include/nn/hac/NcaUtils.h index 0b4da75..44eb6bb 100644 --- a/lib/libhac/include/nn/hac/NcaUtils.h +++ b/lib/libhac/include/nn/hac/NcaUtils.h @@ -1,5 +1,5 @@ #pragma once -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/NroHeader.h b/lib/libhac/include/nn/hac/NroHeader.h index d1865c1..408ad98 100644 --- a/lib/libhac/include/nn/hac/NroHeader.h +++ b/lib/libhac/include/nn/hac/NroHeader.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include #include #include diff --git a/lib/libhac/include/nn/hac/NsoHeader.h b/lib/libhac/include/nn/hac/NsoHeader.h index bc716fa..9b2d8d9 100644 --- a/lib/libhac/include/nn/hac/NsoHeader.h +++ b/lib/libhac/include/nn/hac/NsoHeader.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include #include #include diff --git a/lib/libhac/include/nn/hac/PatchMetaExtendedHeader.h b/lib/libhac/include/nn/hac/PatchMetaExtendedHeader.h index 8caede4..1513fc2 100644 --- a/lib/libhac/include/nn/hac/PatchMetaExtendedHeader.h +++ b/lib/libhac/include/nn/hac/PatchMetaExtendedHeader.h @@ -2,7 +2,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/PfsHeader.h b/lib/libhac/include/nn/hac/PfsHeader.h index 89b94ac..8a3e660 100644 --- a/lib/libhac/include/nn/hac/PfsHeader.h +++ b/lib/libhac/include/nn/hac/PfsHeader.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/ServiceAccessControlBinary.h b/lib/libhac/include/nn/hac/ServiceAccessControl.h similarity index 61% rename from lib/libhac/include/nn/hac/ServiceAccessControlBinary.h rename to lib/libhac/include/nn/hac/ServiceAccessControl.h index f2ef2ff..f324269 100644 --- a/lib/libhac/include/nn/hac/ServiceAccessControlBinary.h +++ b/lib/libhac/include/nn/hac/ServiceAccessControl.h @@ -9,16 +9,16 @@ namespace nn { namespace hac { - class ServiceAccessControlBinary : + class ServiceAccessControl : public fnd::IByteModel { public: - ServiceAccessControlBinary(); - ServiceAccessControlBinary(const ServiceAccessControlBinary& other); + ServiceAccessControl(); + ServiceAccessControl(const ServiceAccessControl& other); - void operator=(const ServiceAccessControlBinary& other); - bool operator==(const ServiceAccessControlBinary& other) const; - bool operator!=(const ServiceAccessControlBinary& other) const; + void operator=(const ServiceAccessControl& other); + bool operator==(const ServiceAccessControl& other) const; + bool operator!=(const ServiceAccessControl& other) const; // IByteModel void toBytes(); @@ -30,7 +30,7 @@ namespace hac const fnd::List& getServiceList() const; void addService(const ServiceAccessControlEntry& service); private: - const std::string kModuleName = "SERVICE_ACCESS_CONTROL_BINARY"; + const std::string kModuleName = "SERVICE_ACCESS_CONTROL"; // raw binary fnd::Vec mRawBinary; diff --git a/lib/libhac/include/nn/hac/XciHeader.h b/lib/libhac/include/nn/hac/XciHeader.h index 05c48a6..6fc2fcb 100644 --- a/lib/libhac/include/nn/hac/XciHeader.h +++ b/lib/libhac/include/nn/hac/XciHeader.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include diff --git a/lib/libhac/include/nn/hac/XciUtils.h b/lib/libhac/include/nn/hac/XciUtils.h index 7ba7eaa..da7e0d3 100644 --- a/lib/libhac/include/nn/hac/XciUtils.h +++ b/lib/libhac/include/nn/hac/XciUtils.h @@ -1,5 +1,5 @@ #pragma once -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/aci.h b/lib/libhac/include/nn/hac/define/aci.h similarity index 96% rename from lib/libhac/include/nn/hac/aci.h rename to lib/libhac/include/nn/hac/define/aci.h index 55742e1..5db3de1 100644 --- a/lib/libhac/include/nn/hac/aci.h +++ b/lib/libhac/include/nn/hac/define/aci.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/cnmt.h b/lib/libhac/include/nn/hac/define/cnmt.h similarity index 100% rename from lib/libhac/include/nn/hac/cnmt.h rename to lib/libhac/include/nn/hac/define/cnmt.h diff --git a/lib/libhac/include/nn/hac/delta.h b/lib/libhac/include/nn/hac/define/delta.h similarity index 92% rename from lib/libhac/include/nn/hac/delta.h rename to lib/libhac/include/nn/hac/define/delta.h index 0b17d08..9de195e 100644 --- a/lib/libhac/include/nn/hac/delta.h +++ b/lib/libhac/include/nn/hac/define/delta.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/fac.h b/lib/libhac/include/nn/hac/define/fac.h similarity index 100% rename from lib/libhac/include/nn/hac/fac.h rename to lib/libhac/include/nn/hac/define/fac.h diff --git a/lib/libhac/include/nn/hac/hierarchicalintegrity.h b/lib/libhac/include/nn/hac/define/hierarchicalintegrity.h similarity index 95% rename from lib/libhac/include/nn/hac/hierarchicalintegrity.h rename to lib/libhac/include/nn/hac/define/hierarchicalintegrity.h index e662ee2..2ade347 100644 --- a/lib/libhac/include/nn/hac/hierarchicalintegrity.h +++ b/lib/libhac/include/nn/hac/define/hierarchicalintegrity.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/hierarchicalsha256.h b/lib/libhac/include/nn/hac/define/hierarchicalsha256.h similarity index 100% rename from lib/libhac/include/nn/hac/hierarchicalsha256.h rename to lib/libhac/include/nn/hac/define/hierarchicalsha256.h diff --git a/lib/libhac/include/nn/hac/kc.h b/lib/libhac/include/nn/hac/define/kc.h similarity index 92% rename from lib/libhac/include/nn/hac/kc.h rename to lib/libhac/include/nn/hac/define/kc.h index e15d487..a5cbe9a 100644 --- a/lib/libhac/include/nn/hac/kc.h +++ b/lib/libhac/include/nn/hac/define/kc.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/macro.h b/lib/libhac/include/nn/hac/define/macro.h similarity index 100% rename from lib/libhac/include/nn/hac/macro.h rename to lib/libhac/include/nn/hac/define/macro.h diff --git a/lib/libhac/include/nn/hac/define/meta.h b/lib/libhac/include/nn/hac/define/meta.h new file mode 100644 index 0000000..a97af2d --- /dev/null +++ b/lib/libhac/include/nn/hac/define/meta.h @@ -0,0 +1,58 @@ +#pragma once +#include +#include + +namespace nn +{ +namespace hac +{ + namespace meta + { + static const uint32_t kMetaStructMagic = _MAKE_STRUCT_MAGIC_U32("META"); + static const size_t kNameMaxLen = 0x10; + static const size_t kProductCodeMaxLen = 0x10; + static const uint32_t kMaxPriority = BIT(6) - 1; + static const size_t kSectionAlignSize = 0x10; + static const uint32_t kDefaultMainThreadStackSize = 4096; + + enum InstructionType + { + INSTR_32BIT, + INSTR_64BIT, + }; + + enum ProcAddrSpaceType + { + ADDR_SPACE_64BIT = 1, + ADDR_SPACE_32BIT, + ADDR_SPACE_32BIT_NO_RESERVED, + }; + } +#pragma pack(push,1) + struct sMetaSection + { + le_uint32_t offset; + le_uint32_t size; + }; + + struct sMetaHeader + { + le_uint32_t st_magic; + byte_t reserved_0[8]; + byte_t flags; + byte_t reserved_1; + byte_t main_thread_priority; + byte_t main_thread_cpu_id; + byte_t reserved_2[8]; + le_uint32_t version; + le_uint32_t main_thread_stack_size; + char name[meta::kNameMaxLen]; // important + char product_code[meta::kProductCodeMaxLen]; // can be empty + byte_t reserved_3[48]; + sMetaSection aci; + sMetaSection acid; + }; + +#pragma pack(pop) +} +} \ No newline at end of file diff --git a/lib/libhac/include/nn/hac/nacp.h b/lib/libhac/include/nn/hac/define/nacp.h similarity index 100% rename from lib/libhac/include/nn/hac/nacp.h rename to lib/libhac/include/nn/hac/define/nacp.h diff --git a/lib/libhac/include/nn/hac/nca.h b/lib/libhac/include/nn/hac/define/nca.h similarity index 98% rename from lib/libhac/include/nn/hac/nca.h rename to lib/libhac/include/nn/hac/define/nca.h index 4dac6f0..a27a46c 100644 --- a/lib/libhac/include/nn/hac/nca.h +++ b/lib/libhac/include/nn/hac/define/nca.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/nro.h b/lib/libhac/include/nn/hac/define/nro.h similarity index 96% rename from lib/libhac/include/nn/hac/nro.h rename to lib/libhac/include/nn/hac/define/nro.h index e46b316..fe90a96 100644 --- a/lib/libhac/include/nn/hac/nro.h +++ b/lib/libhac/include/nn/hac/define/nro.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/nrr.h b/lib/libhac/include/nn/hac/define/nrr.h similarity index 95% rename from lib/libhac/include/nn/hac/nrr.h rename to lib/libhac/include/nn/hac/define/nrr.h index 452cc71..83a1c6d 100644 --- a/lib/libhac/include/nn/hac/nrr.h +++ b/lib/libhac/include/nn/hac/define/nrr.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/nso.h b/lib/libhac/include/nn/hac/define/nso.h similarity index 97% rename from lib/libhac/include/nn/hac/nso.h rename to lib/libhac/include/nn/hac/define/nso.h index 1b4a10b..ee2121e 100644 --- a/lib/libhac/include/nn/hac/nso.h +++ b/lib/libhac/include/nn/hac/define/nso.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/pfs.h b/lib/libhac/include/nn/hac/define/pfs.h similarity index 96% rename from lib/libhac/include/nn/hac/pfs.h rename to lib/libhac/include/nn/hac/define/pfs.h index 60f12fa..becf9a6 100644 --- a/lib/libhac/include/nn/hac/pfs.h +++ b/lib/libhac/include/nn/hac/define/pfs.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/romfs.h b/lib/libhac/include/nn/hac/define/romfs.h similarity index 100% rename from lib/libhac/include/nn/hac/romfs.h rename to lib/libhac/include/nn/hac/define/romfs.h diff --git a/lib/libhac/include/nn/hac/xci.h b/lib/libhac/include/nn/hac/define/xci.h similarity index 99% rename from lib/libhac/include/nn/hac/xci.h rename to lib/libhac/include/nn/hac/define/xci.h index a995fa4..382eab3 100644 --- a/lib/libhac/include/nn/hac/xci.h +++ b/lib/libhac/include/nn/hac/define/xci.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include namespace nn { diff --git a/lib/libhac/include/nn/hac/meta.h b/lib/libhac/include/nn/hac/meta.h index 477a687..92019c4 100644 --- a/lib/libhac/include/nn/hac/meta.h +++ b/lib/libhac/include/nn/hac/meta.h @@ -1,58 +1,80 @@ -#pragma once -#include -#include - -namespace nn -{ -namespace hac -{ - namespace meta - { - static const uint32_t kMetaStructMagic = _MAKE_STRUCT_MAGIC_U32("META"); - static const size_t kNameMaxLen = 0x10; - static const size_t kProductCodeMaxLen = 0x10; - static const uint32_t kMaxPriority = BIT(6) - 1; - static const size_t kSectionAlignSize = 0x10; - static const uint32_t kDefaultMainThreadStackSize = 4096; - - enum InstructionType - { - INSTR_32BIT, - INSTR_64BIT, - }; - - enum ProcAddrSpaceType - { - ADDR_SPACE_64BIT = 1, - ADDR_SPACE_32BIT, - ADDR_SPACE_32BIT_NO_RESERVED, - }; - } -#pragma pack(push,1) - struct sMetaSection - { - le_uint32_t offset; - le_uint32_t size; - }; - - struct sMetaHeader - { - le_uint32_t st_magic; - byte_t reserved_0[8]; - byte_t flags; - byte_t reserved_1; - byte_t main_thread_priority; - byte_t main_thread_cpu_id; - byte_t reserved_2[8]; - le_uint32_t version; - le_uint32_t main_thread_stack_size; - char name[meta::kNameMaxLen]; // important - char product_code[meta::kProductCodeMaxLen]; // can be empty - byte_t reserved_3[48]; - sMetaSection aci; - sMetaSection acid; - }; - -#pragma pack(pop) -} +#pragma once +#include +#include +#include +#include +#include +#include + +namespace nn +{ +namespace hac +{ + class Meta : + public fnd::IByteModel + { + public: + Meta(); + Meta(const Meta& other); + + void operator=(const Meta& other); + bool operator==(const Meta& other) const; + bool operator!=(const Meta& other) const; + + // IByteModel + void toBytes(); + void fromBytes(const byte_t* bytes, size_t len); + const fnd::Vec& getBytes() const; + + // variables + void clear(); + + meta::InstructionType getInstructionType() const; + void setInstructionType(meta::InstructionType type); + + meta::ProcAddrSpaceType getProcAddressSpaceType() const; + void setProcAddressSpaceType(meta::ProcAddrSpaceType type); + + byte_t getMainThreadPriority() const; + void setMainThreadPriority(byte_t priority); + + byte_t getMainThreadCpuId() const; + void setMainThreadCpuId(byte_t cpu_id); + + uint32_t getVersion() const; + void setVersion(uint32_t version); + + uint32_t getMainThreadStackSize() const; + void setMainThreadStackSize(uint32_t size); + + const std::string& getName() const; + void setName(const std::string& name); + + const std::string& getProductCode() const; + void setProductCode(const std::string& product_code); + + const AccessControlInfo& getAci() const; + void setAci(const AccessControlInfo& aci); + + const AccessControlInfoDesc& getAcid() const; + void setAcid(const AccessControlInfoDesc& acid); + private: + const std::string kModuleName = "META"; + + // raw binary + fnd::Vec mRawBinary; + + // variables + meta::InstructionType mInstructionType; + meta::ProcAddrSpaceType mProcAddressSpaceType; + byte_t mMainThreadPriority; + byte_t mMainThreadCpuId; + uint32_t mVersion; + uint32_t mMainThreadStackSize; + std::string mName; + std::string mProductCode; + AccessControlInfo mAci; + AccessControlInfoDesc mAcid; + }; +} } \ No newline at end of file diff --git a/lib/libhac/libhac.vcxproj b/lib/libhac/libhac.vcxproj index ff80a4d..1c69043 100644 --- a/lib/libhac/libhac.vcxproj +++ b/lib/libhac/libhac.vcxproj @@ -37,7 +37,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -98,7 +98,7 @@ - + @@ -106,13 +106,13 @@ - + - + @@ -124,7 +124,7 @@ - + diff --git a/lib/libhac/libhac.vcxproj.filters b/lib/libhac/libhac.vcxproj.filters index b83c0d2..1aca3c6 100644 --- a/lib/libhac/libhac.vcxproj.filters +++ b/lib/libhac/libhac.vcxproj.filters @@ -63,7 +63,7 @@ Header Files - + Header Files @@ -99,7 +99,7 @@ Header Files - + Header Files @@ -123,7 +123,7 @@ Header Files - + Header Files @@ -180,7 +180,7 @@ Header Files - + Header Files @@ -242,7 +242,7 @@ Source Files - + Source Files @@ -263,7 +263,7 @@ Source Files - + Source Files @@ -299,7 +299,7 @@ Source Files - + Source Files @@ -314,7 +314,7 @@ Source Files - + Source Files diff --git a/lib/libhac/source/AccessControlInfo.cpp b/lib/libhac/source/AccessControlInfo.cpp index 9a62828..794fad2 100644 --- a/lib/libhac/source/AccessControlInfo.cpp +++ b/lib/libhac/source/AccessControlInfo.cpp @@ -142,32 +142,32 @@ void nn::hac::AccessControlInfo::setProgramId(uint64_t program_id) mProgramId = program_id; } -const nn::hac::FileSystemAccessControlBinary& nn::hac::AccessControlInfo::getFileSystemAccessControl() const +const nn::hac::FileSystemAccessControl& nn::hac::AccessControlInfo::getFileSystemAccessControl() const { return mFileSystemAccessControl; } -void nn::hac::AccessControlInfo::setFileSystemAccessControl(const nn::hac::FileSystemAccessControlBinary& fac) +void nn::hac::AccessControlInfo::setFileSystemAccessControl(const nn::hac::FileSystemAccessControl& fac) { mFileSystemAccessControl = fac; } -const nn::hac::ServiceAccessControlBinary& nn::hac::AccessControlInfo::getServiceAccessControl() const +const nn::hac::ServiceAccessControl& nn::hac::AccessControlInfo::getServiceAccessControl() const { return mServiceAccessControl; } -void nn::hac::AccessControlInfo::setServiceAccessControl(const nn::hac::ServiceAccessControlBinary& sac) +void nn::hac::AccessControlInfo::setServiceAccessControl(const nn::hac::ServiceAccessControl& sac) { mServiceAccessControl = sac; } -const nn::hac::KernelCapabilityBinary& nn::hac::AccessControlInfo::getKernelCapabilities() const +const nn::hac::KernelCapabilityControl& nn::hac::AccessControlInfo::getKernelCapabilities() const { return mKernelCapabilities; } -void nn::hac::AccessControlInfo::setKernelCapabilities(const nn::hac::KernelCapabilityBinary& kc) +void nn::hac::AccessControlInfo::setKernelCapabilities(const nn::hac::KernelCapabilityControl& kc) { mKernelCapabilities = kc; } \ No newline at end of file diff --git a/lib/libhac/source/AccessControlInfoDesc.cpp b/lib/libhac/source/AccessControlInfoDesc.cpp index 882f38a..cfa5f7e 100644 --- a/lib/libhac/source/AccessControlInfoDesc.cpp +++ b/lib/libhac/source/AccessControlInfoDesc.cpp @@ -220,32 +220,32 @@ void nn::hac::AccessControlInfoDesc::setProgramIdRestrict(const sProgramIdRestri mProgramIdRestrict = pid_restrict; } -const nn::hac::FileSystemAccessControlBinary& nn::hac::AccessControlInfoDesc::getFileSystemAccessControl() const +const nn::hac::FileSystemAccessControl& nn::hac::AccessControlInfoDesc::getFileSystemAccessControl() const { return mFileSystemAccessControl; } -void nn::hac::AccessControlInfoDesc::setFileSystemAccessControl(const nn::hac::FileSystemAccessControlBinary& fac) +void nn::hac::AccessControlInfoDesc::setFileSystemAccessControl(const nn::hac::FileSystemAccessControl& fac) { mFileSystemAccessControl = fac; } -const nn::hac::ServiceAccessControlBinary& nn::hac::AccessControlInfoDesc::getServiceAccessControl() const +const nn::hac::ServiceAccessControl& nn::hac::AccessControlInfoDesc::getServiceAccessControl() const { return mServiceAccessControl; } -void nn::hac::AccessControlInfoDesc::setServiceAccessControl(const nn::hac::ServiceAccessControlBinary& sac) +void nn::hac::AccessControlInfoDesc::setServiceAccessControl(const nn::hac::ServiceAccessControl& sac) { mServiceAccessControl = sac; } -const nn::hac::KernelCapabilityBinary& nn::hac::AccessControlInfoDesc::getKernelCapabilities() const +const nn::hac::KernelCapabilityControl& nn::hac::AccessControlInfoDesc::getKernelCapabilities() const { return mKernelCapabilities; } -void nn::hac::AccessControlInfoDesc::setKernelCapabilities(const nn::hac::KernelCapabilityBinary& kc) +void nn::hac::AccessControlInfoDesc::setKernelCapabilities(const nn::hac::KernelCapabilityControl& kc) { mKernelCapabilities = kc; } \ No newline at end of file diff --git a/lib/libhac/source/FileSystemAccessControlBinary.cpp b/lib/libhac/source/FileSystemAccessControl.cpp similarity index 77% rename from lib/libhac/source/FileSystemAccessControlBinary.cpp rename to lib/libhac/source/FileSystemAccessControl.cpp index 18f08af..7a5a270 100644 --- a/lib/libhac/source/FileSystemAccessControlBinary.cpp +++ b/lib/libhac/source/FileSystemAccessControl.cpp @@ -1,17 +1,17 @@ #include -#include +#include -nn::hac::FileSystemAccessControlBinary::FileSystemAccessControlBinary() +nn::hac::FileSystemAccessControl::FileSystemAccessControl() { clear(); } -nn::hac::FileSystemAccessControlBinary::FileSystemAccessControlBinary(const FileSystemAccessControlBinary & other) +nn::hac::FileSystemAccessControl::FileSystemAccessControl(const FileSystemAccessControl & other) { *this = other; } -void nn::hac::FileSystemAccessControlBinary::operator=(const FileSystemAccessControlBinary & other) +void nn::hac::FileSystemAccessControl::operator=(const FileSystemAccessControl & other) { mRawBinary = other.mRawBinary; mVersion = other.mVersion; @@ -20,7 +20,7 @@ void nn::hac::FileSystemAccessControlBinary::operator=(const FileSystemAccessCon 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) \ && (mFsaRights == other.mFsaRights) \ @@ -28,12 +28,12 @@ bool nn::hac::FileSystemAccessControlBinary::operator==(const FileSystemAccessCo && (mSaveDataOwnerIdList == other.mSaveDataOwnerIdList); } -bool nn::hac::FileSystemAccessControlBinary::operator!=(const FileSystemAccessControlBinary & other) const +bool nn::hac::FileSystemAccessControl::operator!=(const FileSystemAccessControl & other) const { return !(*this == other); } -void nn::hac::FileSystemAccessControlBinary::toBytes() +void nn::hac::FileSystemAccessControl::toBytes() { // determine section layout 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 if (len < sizeof(sFacHeader)) @@ -164,12 +164,12 @@ void nn::hac::FileSystemAccessControlBinary::fromBytes(const byte_t* data, size_ } } -const fnd::Vec& nn::hac::FileSystemAccessControlBinary::getBytes() const +const fnd::Vec& nn::hac::FileSystemAccessControl::getBytes() const { return mRawBinary; } -void nn::hac::FileSystemAccessControlBinary::clear() +void nn::hac::FileSystemAccessControl::clear() { mRawBinary.clear(); mVersion = 0; @@ -178,42 +178,42 @@ void nn::hac::FileSystemAccessControlBinary::clear() mSaveDataOwnerIdList.clear(); } -uint32_t nn::hac::FileSystemAccessControlBinary::getFormatVersion() const +uint32_t nn::hac::FileSystemAccessControl::getFormatVersion() const { return mVersion; } -void nn::hac::FileSystemAccessControlBinary::setFormatVersion(uint32_t format_version) +void nn::hac::FileSystemAccessControl::setFormatVersion(uint32_t format_version) { mVersion = format_version; } -const fnd::List& nn::hac::FileSystemAccessControlBinary::getFsaRightsList() const +const fnd::List& nn::hac::FileSystemAccessControl::getFsaRightsList() const { return mFsaRights; } -void nn::hac::FileSystemAccessControlBinary::setFsaRightsList(const fnd::List& list) +void nn::hac::FileSystemAccessControl::setFsaRightsList(const fnd::List& list) { mFsaRights = list; } -const fnd::List& nn::hac::FileSystemAccessControlBinary::getContentOwnerIdList() const +const fnd::List& nn::hac::FileSystemAccessControl::getContentOwnerIdList() const { return mContentOwnerIdList; } -void nn::hac::FileSystemAccessControlBinary::setContentOwnerIdList(const fnd::List& list) +void nn::hac::FileSystemAccessControl::setContentOwnerIdList(const fnd::List& list) { mContentOwnerIdList = list; } -const fnd::List& nn::hac::FileSystemAccessControlBinary::getSaveDataOwnerIdList() const +const fnd::List& nn::hac::FileSystemAccessControl::getSaveDataOwnerIdList() const { return mSaveDataOwnerIdList; } -void nn::hac::FileSystemAccessControlBinary::setSaveDataOwnerIdList(const fnd::List& list) +void nn::hac::FileSystemAccessControl::setSaveDataOwnerIdList(const fnd::List& list) { mSaveDataOwnerIdList = list; } \ No newline at end of file diff --git a/lib/libhac/source/KernelCapabilityBinary.cpp b/lib/libhac/source/KernelCapabilityControl.cpp similarity index 66% rename from lib/libhac/source/KernelCapabilityBinary.cpp rename to lib/libhac/source/KernelCapabilityControl.cpp index 096c7b3..101a771 100644 --- a/lib/libhac/source/KernelCapabilityBinary.cpp +++ b/lib/libhac/source/KernelCapabilityControl.cpp @@ -1,14 +1,14 @@ -#include +#include -nn::hac::KernelCapabilityBinary::KernelCapabilityBinary() +nn::hac::KernelCapabilityControl::KernelCapabilityControl() {} -nn::hac::KernelCapabilityBinary::KernelCapabilityBinary(const KernelCapabilityBinary & other) +nn::hac::KernelCapabilityControl::KernelCapabilityControl(const KernelCapabilityControl & other) { *this = other; } -void nn::hac::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & other) +void nn::hac::KernelCapabilityControl::operator=(const KernelCapabilityControl & other) { clear(); mRawBinary = other.mRawBinary; @@ -22,7 +22,7 @@ void nn::hac::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & o 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) \ && (mSystemCalls == other.mSystemCalls) \ @@ -34,12 +34,12 @@ bool nn::hac::KernelCapabilityBinary::operator==(const KernelCapabilityBinary & && (mMiscFlags == other.mMiscFlags); } -bool nn::hac::KernelCapabilityBinary::operator!=(const KernelCapabilityBinary & other) const +bool nn::hac::KernelCapabilityControl::operator!=(const KernelCapabilityControl & other) const { return !(*this == other); } -void nn::hac::KernelCapabilityBinary::toBytes() +void nn::hac::KernelCapabilityControl::toBytes() { fnd::List 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) { throw fnd::Exception(kModuleName, "KernelCapabilityEntry list must be aligned to 4 bytes"); } - // save copy of KernelCapabilityBinary + // save copy of KernelCapabilityControl mRawBinary.alloc(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); } -const fnd::Vec& nn::hac::KernelCapabilityBinary::getBytes() const +const fnd::Vec& nn::hac::KernelCapabilityControl::getBytes() const { return mRawBinary; } -void nn::hac::KernelCapabilityBinary::clear() +void nn::hac::KernelCapabilityControl::clear() { mRawBinary.clear(); mThreadInfo.clear(); @@ -150,82 +150,82 @@ void nn::hac::KernelCapabilityBinary::clear() mMiscFlags.clear(); } -const nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityBinary::getThreadInfo() const +const nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityControl::getThreadInfo() const { return mThreadInfo; } -nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityBinary::getThreadInfo() +nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityControl::getThreadInfo() { return mThreadInfo; } -const nn::hac::SystemCallHandler & nn::hac::KernelCapabilityBinary::getSystemCalls() const +const nn::hac::SystemCallHandler & nn::hac::KernelCapabilityControl::getSystemCalls() const { return mSystemCalls; } -nn::hac::SystemCallHandler & nn::hac::KernelCapabilityBinary::getSystemCalls() +nn::hac::SystemCallHandler & nn::hac::KernelCapabilityControl::getSystemCalls() { return mSystemCalls; } -const nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityBinary::getMemoryMaps() const +const nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityControl::getMemoryMaps() const { return mMemoryMap; } -nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityBinary::getMemoryMaps() +nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityControl::getMemoryMaps() { return mMemoryMap; } -const nn::hac::InteruptHandler & nn::hac::KernelCapabilityBinary::getInterupts() const +const nn::hac::InteruptHandler & nn::hac::KernelCapabilityControl::getInterupts() const { return mInterupts; } -nn::hac::InteruptHandler & nn::hac::KernelCapabilityBinary::getInterupts() +nn::hac::InteruptHandler & nn::hac::KernelCapabilityControl::getInterupts() { return mInterupts; } -const nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityBinary::getMiscParams() const +const nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityControl::getMiscParams() const { return mMiscParams; } -nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityBinary::getMiscParams() +nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityControl::getMiscParams() { return mMiscParams; } -const nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityBinary::getKernelVersion() const +const nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityControl::getKernelVersion() const { return mKernelVersion; } -nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityBinary::getKernelVersion() +nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityControl::getKernelVersion() { return mKernelVersion; } -const nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityBinary::getHandleTableSize() const +const nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityControl::getHandleTableSize() const { return mHandleTableSize; } -nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityBinary::getHandleTableSize() +nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityControl::getHandleTableSize() { return mHandleTableSize; } -const nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityBinary::getMiscFlags() const +const nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityControl::getMiscFlags() const { return mMiscFlags; } -nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityBinary::getMiscFlags() +nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityControl::getMiscFlags() { return mMiscFlags; } \ No newline at end of file diff --git a/lib/libhac/source/MetaBinary.cpp b/lib/libhac/source/Meta.cpp similarity index 74% rename from lib/libhac/source/MetaBinary.cpp rename to lib/libhac/source/Meta.cpp index cc8dc17..f3f83bb 100644 --- a/lib/libhac/source/MetaBinary.cpp +++ b/lib/libhac/source/Meta.cpp @@ -1,19 +1,19 @@ -#include +#include #include -nn::hac::MetaBinary::MetaBinary() +nn::hac::Meta::Meta() { clear(); } -nn::hac::MetaBinary::MetaBinary(const MetaBinary & other) : - MetaBinary() +nn::hac::Meta::Meta(const Meta & other) : + Meta() { *this = other; } -void nn::hac::MetaBinary::operator=(const MetaBinary & other) +void nn::hac::Meta::operator=(const Meta & other) { mRawBinary = other.mRawBinary; mInstructionType = other.mInstructionType; @@ -28,7 +28,7 @@ void nn::hac::MetaBinary::operator=(const MetaBinary & other) 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) \ && (mProcAddressSpaceType == other.mProcAddressSpaceType) \ @@ -42,12 +42,12 @@ bool nn::hac::MetaBinary::operator==(const MetaBinary & other) const && (mAcid == other.mAcid); } -bool nn::hac::MetaBinary::operator!=(const MetaBinary & other) const +bool nn::hac::Meta::operator!=(const Meta & other) const { return !(*this == other); } -void nn::hac::MetaBinary::toBytes() +void nn::hac::Meta::toBytes() { if (mAcid.getBytes().size() == 0) 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 if (len < sizeof(sMetaHeader)) @@ -159,12 +159,12 @@ void nn::hac::MetaBinary::fromBytes(const byte_t* data, size_t len) } } -const fnd::Vec& nn::hac::MetaBinary::getBytes() const +const fnd::Vec& nn::hac::Meta::getBytes() const { return mRawBinary; } -void nn::hac::MetaBinary::clear() +void nn::hac::Meta::clear() { mRawBinary.clear(); mInstructionType = meta::INSTR_64BIT; @@ -179,32 +179,32 @@ void nn::hac::MetaBinary::clear() mAcid.clear(); } -nn::hac::meta::InstructionType nn::hac::MetaBinary::getInstructionType() const +nn::hac::meta::InstructionType nn::hac::Meta::getInstructionType() const { return mInstructionType; } -void nn::hac::MetaBinary::setInstructionType(meta::InstructionType type) +void nn::hac::Meta::setInstructionType(meta::InstructionType type) { mInstructionType = type; } -nn::hac::meta::ProcAddrSpaceType nn::hac::MetaBinary::getProcAddressSpaceType() const +nn::hac::meta::ProcAddrSpaceType nn::hac::Meta::getProcAddressSpaceType() const { return mProcAddressSpaceType; } -void nn::hac::MetaBinary::setProcAddressSpaceType(meta::ProcAddrSpaceType type) +void nn::hac::Meta::setProcAddressSpaceType(meta::ProcAddrSpaceType type) { mProcAddressSpaceType = type; } -byte_t nn::hac::MetaBinary::getMainThreadPriority() const +byte_t nn::hac::Meta::getMainThreadPriority() const { return mMainThreadPriority; } -void nn::hac::MetaBinary::setMainThreadPriority(byte_t priority) +void nn::hac::Meta::setMainThreadPriority(byte_t priority) { if (priority > meta::kMaxPriority) { @@ -214,42 +214,42 @@ void nn::hac::MetaBinary::setMainThreadPriority(byte_t priority) mMainThreadPriority = priority; } -byte_t nn::hac::MetaBinary::getMainThreadCpuId() const +byte_t nn::hac::Meta::getMainThreadCpuId() const { return mMainThreadCpuId; } -void nn::hac::MetaBinary::setMainThreadCpuId(byte_t core_num) +void nn::hac::Meta::setMainThreadCpuId(byte_t core_num) { mMainThreadCpuId = core_num; } -uint32_t nn::hac::MetaBinary::getVersion() const +uint32_t nn::hac::Meta::getVersion() const { return mVersion; } -void nn::hac::MetaBinary::setVersion(uint32_t version) +void nn::hac::Meta::setVersion(uint32_t version) { mVersion = version; } -uint32_t nn::hac::MetaBinary::getMainThreadStackSize() const +uint32_t nn::hac::Meta::getMainThreadStackSize() const { return mMainThreadStackSize; } -void nn::hac::MetaBinary::setMainThreadStackSize(uint32_t size) +void nn::hac::Meta::setMainThreadStackSize(uint32_t size) { mMainThreadStackSize = size; } -const std::string & nn::hac::MetaBinary::getName() const +const std::string & nn::hac::Meta::getName() const { 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) { @@ -259,12 +259,12 @@ void nn::hac::MetaBinary::setName(const std::string & name) mName = name; } -const std::string & nn::hac::MetaBinary::getProductCode() const +const std::string & nn::hac::Meta::getProductCode() const { 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) { @@ -274,22 +274,22 @@ void nn::hac::MetaBinary::setProductCode(const std::string & product_code) mProductCode = product_code; } -const nn::hac::AccessControlInfo & nn::hac::MetaBinary::getAci() const +const nn::hac::AccessControlInfo & nn::hac::Meta::getAci() const { return mAci; } -void nn::hac::MetaBinary::setAci(const AccessControlInfo & aci) +void nn::hac::Meta::setAci(const AccessControlInfo & aci) { mAci = aci; } -const nn::hac::AccessControlInfoDesc & nn::hac::MetaBinary::getAcid() const +const nn::hac::AccessControlInfoDesc & nn::hac::Meta::getAcid() const { return mAcid; } -void nn::hac::MetaBinary::setAcid(const AccessControlInfoDesc & acid) +void nn::hac::Meta::setAcid(const AccessControlInfoDesc & acid) { mAcid = acid; } \ No newline at end of file diff --git a/lib/libhac/source/ServiceAccessControlBinary.cpp b/lib/libhac/source/ServiceAccessControl.cpp similarity index 54% rename from lib/libhac/source/ServiceAccessControlBinary.cpp rename to lib/libhac/source/ServiceAccessControl.cpp index dd53c27..b1c8edb 100644 --- a/lib/libhac/source/ServiceAccessControlBinary.cpp +++ b/lib/libhac/source/ServiceAccessControl.cpp @@ -1,33 +1,33 @@ #include -#include +#include -nn::hac::ServiceAccessControlBinary::ServiceAccessControlBinary() +nn::hac::ServiceAccessControl::ServiceAccessControl() { clear(); } -nn::hac::ServiceAccessControlBinary::ServiceAccessControlBinary(const ServiceAccessControlBinary & other) +nn::hac::ServiceAccessControl::ServiceAccessControl(const ServiceAccessControl & other) { *this = other; } -void nn::hac::ServiceAccessControlBinary::operator=(const ServiceAccessControlBinary & other) +void nn::hac::ServiceAccessControl::operator=(const ServiceAccessControl & other) { mRawBinary = other.mRawBinary; 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); } -bool nn::hac::ServiceAccessControlBinary::operator!=(const ServiceAccessControlBinary & other) const +bool nn::hac::ServiceAccessControl::operator!=(const ServiceAccessControl & other) const { return !(*this == other); } -void nn::hac::ServiceAccessControlBinary::toBytes() +void nn::hac::ServiceAccessControl::toBytes() { size_t totalSize = 0; 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(); mRawBinary.alloc(len); @@ -57,23 +57,23 @@ void nn::hac::ServiceAccessControlBinary::fromBytes(const byte_t* data, size_t l } } -const fnd::Vec& nn::hac::ServiceAccessControlBinary::getBytes() const +const fnd::Vec& nn::hac::ServiceAccessControl::getBytes() const { return mRawBinary; } -void nn::hac::ServiceAccessControlBinary::clear() +void nn::hac::ServiceAccessControl::clear() { mRawBinary.clear(); mServices.clear(); } -const fnd::List& nn::hac::ServiceAccessControlBinary::getServiceList() const +const fnd::List& nn::hac::ServiceAccessControl::getServiceList() const { return mServices; } -void nn::hac::ServiceAccessControlBinary::addService(const ServiceAccessControlEntry& service) +void nn::hac::ServiceAccessControl::addService(const ServiceAccessControlEntry& service) { mServices.addElement(service); } \ No newline at end of file diff --git a/programs/nstool/source/KeyConfiguration.h b/programs/nstool/source/KeyConfiguration.h index 8925708..258dfbb 100644 --- a/programs/nstool/source/KeyConfiguration.h +++ b/programs/nstool/source/KeyConfiguration.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include diff --git a/programs/nstool/source/MetaProcess.cpp b/programs/nstool/source/MetaProcess.cpp index 1baa7e2..c32bde0 100644 --- a/programs/nstool/source/MetaProcess.cpp +++ b/programs/nstool/source/MetaProcess.cpp @@ -61,7 +61,7 @@ void MetaProcess::setVerifyMode(bool verify) mVerify = verify; } -const nn::hac::MetaBinary& MetaProcess::getMetaBinary() const +const nn::hac::Meta& MetaProcess::getMeta() const { return mMeta; } @@ -287,7 +287,7 @@ void MetaProcess::validateAciFromAcid(const nn::hac::AccessControlInfo& aci, con } } -void MetaProcess::displayMetaHeader(const nn::hac::MetaBinary& hdr) +void MetaProcess::displayMetaHeader(const nn::hac::Meta& hdr) { std::cout << "[Meta Header]" << std::endl; std::cout << " Process Architecture Params:" << std::endl; @@ -328,7 +328,7 @@ void MetaProcess::displayAciDescHdr(const nn::hac::AccessControlInfoDesc& acid) 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 << " Format Version: " << std::dec << (uint32_t)fac.getFormatVersion() << std::endl; @@ -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 List:" << std::endl; @@ -394,7 +394,7 @@ void MetaProcess::displaySac(const nn::hac::ServiceAccessControlBinary& sac) 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; if (kern.getThreadInfo().isSet()) diff --git a/programs/nstool/source/MetaProcess.h b/programs/nstool/source/MetaProcess.h index b88d0ea..1c734c8 100644 --- a/programs/nstool/source/MetaProcess.h +++ b/programs/nstool/source/MetaProcess.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include "KeyConfiguration.h" #include "common.h" @@ -20,7 +20,7 @@ public: void setCliOutputMode(CliOutputMode type); void setVerifyMode(bool verify); - const nn::hac::MetaBinary& getMetaBinary() const; + const nn::hac::Meta& getMeta() const; private: const std::string kModuleName = "MetaProcess"; @@ -30,19 +30,19 @@ private: CliOutputMode mCliOutputMode; bool mVerify; - nn::hac::MetaBinary mMeta; + nn::hac::Meta mMeta; void importMeta(); void validateAcidSignature(const nn::hac::AccessControlInfoDesc& 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::AccessControlInfo& aci); void displayAciDescHdr(const nn::hac::AccessControlInfoDesc& aci); - void displayFac(const nn::hac::FileSystemAccessControlBinary& fac); - void displaySac(const nn::hac::ServiceAccessControlBinary& sac); - void displayKernelCap(const nn::hac::KernelCapabilityBinary& kern); + void displayFac(const nn::hac::FileSystemAccessControl& fac); + void displaySac(const nn::hac::ServiceAccessControl& sac); + void displayKernelCap(const nn::hac::KernelCapabilityControl& kern); const char* getInstructionTypeStr(nn::hac::meta::InstructionType type) const; const char* getProcAddressSpaceTypeStr(nn::hac::meta::ProcAddrSpaceType type) const; diff --git a/programs/nstool/source/NcaProcess.cpp b/programs/nstool/source/NcaProcess.cpp index 323f5a4..465c965 100644 --- a/programs/nstool/source/NcaProcess.cpp +++ b/programs/nstool/source/NcaProcess.cpp @@ -415,7 +415,7 @@ void NcaProcess::validateNcaSignatures() npdm.setCliOutputMode(0); 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().getNcaHeaderSignature2Key(), fnd::sha::HASH_SHA256, mHdrHash.bytes, mHdrBlock.signature_acid) != 0) { std::cout << "[WARNING] NCA Header ACID Signature: FAIL" << std::endl; } diff --git a/programs/nstool/source/NroProcess.h b/programs/nstool/source/NroProcess.h index c0610b3..b019208 100644 --- a/programs/nstool/source/NroProcess.h +++ b/programs/nstool/source/NroProcess.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include "AssetProcess.h" diff --git a/programs/nstool/source/NsoProcess.h b/programs/nstool/source/NsoProcess.h index ca738b5..70b2f31 100644 --- a/programs/nstool/source/NsoProcess.h +++ b/programs/nstool/source/NsoProcess.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include "common.h" diff --git a/programs/nstool/source/RoMetadataProcess.h b/programs/nstool/source/RoMetadataProcess.h index 616a43e..bef72d9 100644 --- a/programs/nstool/source/RoMetadataProcess.h +++ b/programs/nstool/source/RoMetadataProcess.h @@ -4,7 +4,7 @@ #include #include -#include +#include #include "common.h" #include "SdkApiString.h" diff --git a/programs/nstool/source/RomfsProcess.h b/programs/nstool/source/RomfsProcess.h index 9edb32c..d6cee47 100644 --- a/programs/nstool/source/RomfsProcess.h +++ b/programs/nstool/source/RomfsProcess.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include "common.h" diff --git a/programs/nstool/source/UserSettings.cpp b/programs/nstool/source/UserSettings.cpp index 955e9ee..5149a85 100644 --- a/programs/nstool/source/UserSettings.cpp +++ b/programs/nstool/source/UserSettings.cpp @@ -15,15 +15,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/programs/nstool/source/UserSettings.h b/programs/nstool/source/UserSettings.h index 935c0c5..ba846a6 100644 --- a/programs/nstool/source/UserSettings.h +++ b/programs/nstool/source/UserSettings.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include "common.h" #include "KeyConfiguration.h" diff --git a/programs/nstool/source/common.h b/programs/nstool/source/common.h index 0df08c7..614ab26 100644 --- a/programs/nstool/source/common.h +++ b/programs/nstool/source/common.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include static const size_t kMasterKeyNum = 0x20; static const size_t kNcaKeakNum = nn::hac::nca::kKeyAreaEncryptionKeyNum;