#pragma once #include namespace ntd { namespace n3ds { #pragma pack(push,1) struct FirmwareHeader { static const uint32_t kStructMagic = tc::bn::make_struct_magic_uint32("FIRM"); struct SectionHeader { enum CopyMethod { CopyMethod_NDMA = 0, CopyMethod_XDMA = 1, CopyMethod_MEMCPY = 2 }; tc::bn::le32 offset; tc::bn::le32 address; tc::bn::le32 size; tc::bn::le32 copy_method; std::array hash; // SHA2-256 over 0x000+offset - 0x000+offset+size-1 }; tc::bn::le32 struct_magic; // FIRM tc::bn::le32 priority; tc::bn::le32 entrypoint_arm11; tc::bn::le32 entrypoint_arm9; tc::bn::pad<0x30> reserved1; std::array section; std::array signature; // RSA2048-PKCS1-SHA2-256 over 0x000-0x0ff }; static_assert(sizeof(FirmwareHeader) == 0x200, "FirmwareHeader had invalid size"); #pragma pack(pop) }} // namespace ntd::n3ds