2018-05-27 11:25:28 +00:00
|
|
|
#pragma once
|
|
|
|
#include <fnd/types.h>
|
|
|
|
#include <crypto/sha.h>
|
2018-06-03 07:41:56 +00:00
|
|
|
#include <nx/macro.h>
|
2018-05-27 11:25:28 +00:00
|
|
|
|
|
|
|
namespace nx
|
|
|
|
{
|
|
|
|
namespace nso
|
|
|
|
{
|
2018-06-03 07:41:56 +00:00
|
|
|
static const uint32_t kNsoSig = _MAKE_STRUCT_SIGNATURE("NSO0");
|
2018-05-27 11:25:28 +00:00
|
|
|
|
|
|
|
enum HeaderFlags
|
|
|
|
{
|
|
|
|
FLAG_TEXT_COMPRESS,
|
|
|
|
FLAG_RO_COMPRESS,
|
|
|
|
FLAG_DATA_COMPRESS,
|
|
|
|
FLAG_TEXT_HASH,
|
|
|
|
FLAG_RO_HASH,
|
|
|
|
FLAG_DATA_HASH
|
2018-05-27 12:33:39 +00:00
|
|
|
};
|
2018-05-27 11:25:28 +00:00
|
|
|
|
2018-06-01 13:35:36 +00:00
|
|
|
static const uint32_t kDefaultFormatVersion = 0;
|
2018-06-04 04:00:28 +00:00
|
|
|
static const size_t kModuleIdSize = 32;
|
2018-05-27 11:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma pack(push,1)
|
|
|
|
struct sNsoCodeSegment
|
|
|
|
{
|
|
|
|
le_uint32_t file_offset;
|
|
|
|
le_uint32_t memory_offset;
|
|
|
|
le_uint32_t size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sNsoSection
|
|
|
|
{
|
|
|
|
le_uint32_t offset;
|
|
|
|
le_uint32_t size;
|
2018-05-27 12:33:39 +00:00
|
|
|
};
|
2018-05-27 11:25:28 +00:00
|
|
|
|
|
|
|
struct sNsoHeader
|
|
|
|
{
|
2018-06-03 07:41:56 +00:00
|
|
|
le_uint32_t signature;
|
2018-06-01 13:35:36 +00:00
|
|
|
le_uint32_t format_version;
|
2018-05-27 11:25:28 +00:00
|
|
|
byte_t reserved_1[4];
|
|
|
|
le_uint32_t flags;
|
|
|
|
sNsoCodeSegment text;
|
|
|
|
le_uint32_t module_name_offset;
|
|
|
|
sNsoCodeSegment ro;
|
|
|
|
le_uint32_t module_name_size;
|
|
|
|
sNsoCodeSegment data;
|
|
|
|
le_uint32_t bss_size;
|
2018-06-04 04:00:28 +00:00
|
|
|
byte_t module_id[nso::kModuleIdSize];
|
2018-05-27 11:25:28 +00:00
|
|
|
le_uint32_t text_file_size;
|
|
|
|
le_uint32_t ro_file_size;
|
|
|
|
le_uint32_t data_file_size;
|
|
|
|
byte_t reserved_2[28];
|
|
|
|
sNsoSection embedded;
|
|
|
|
sNsoSection dyn_str;
|
|
|
|
sNsoSection dyn_sym;
|
2018-06-01 13:35:36 +00:00
|
|
|
crypto::sha::sSha256Hash text_hash;
|
|
|
|
crypto::sha::sSha256Hash ro_hash;
|
|
|
|
crypto::sha::sSha256Hash data_hash;
|
2018-05-27 11:25:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
}
|