uncart/source/headers.h
Gabriel Marcano 913bc867b7 No longer saves more than the ROM size, cleanup
Using some header information from rom_tool, it was possible to
implement something that will accurately determine the real ROM size.
With that information, uncart no longer dumps in 2GB chunks, but to the
actual size of ROM (all 8 partitions).

Warnings were cleaned up as much as possible for now (2 remain). i2c
support was added in order to be able to shut down uncart when it is
over (it isn't clear that the ASM in start.s is right for returning
control to brahma, if that's even possible). More warnings were enabled
in the Makefile, and lto was enabled.

Currently, the Makefile and the draw.h are configured for a9lh support.
2016-06-07 02:32:45 -04:00

76 lines
1.4 KiB
C

#ifndef UNCART_HEADERS_H_
#define UNCART_HEADERS_H_
#include "common.h"
typedef enum
{
MEDIA_6X_SAVE_CRYPTO = 1,
MEDIA_CARD_DEVICE = 3,
MEDIA_PLATFORM_INDEX = 4,
MEDIA_TYPE_INDEX = 5,
MEDIA_UNIT_SIZE = 6,
MEDIA_CARD_DEVICE_OLD = 7
} NcsdFlagIndex;
typedef struct
{
u32 offset;
u32 size;
} partition_offsetsize;
typedef struct
{
u8 sha256[0x100];
u8 magic[4];
u32 media_size;
u8 title_id[8];
u8 partitions_fs_type[8];
u8 partitions_crypto_type[8];
partition_offsetsize offsetsize_table[8];
u8 exheader_hash[0x20];
u8 additional_header_size[0x4];
u8 sector_zero_offset[0x4];
u8 partition_flags[8];
u8 partition_id_table[8][8];
u8 reserved[0x30];
} NCSD_HEADER;
typedef struct
{
u8 sha256[0x100];
u8 magic[4];
u32 content_size;
u8 title_id[8];
u8 maker_code[2];
u8 version[2];
u8 reserved_0[4];
u8 program_id[8];
u8 temp_flag;
u8 reserved_1[0xF];
u8 logo_sha_256_hash[0x20];
u8 product_code[0x10];
u8 extended_header_sha_256_hash[0x20];
u8 extended_header_size[4];
u8 reserved_2[4];
u8 flags[8];
u8 plain_region_offset[4];
u8 plain_region_size[4];
u8 logo_region_offset[4];
u8 logo_region_size[4];
u8 exefs_offset[4];
u8 exefs_size[4];
u8 exefs_hash_size[4];
u8 reserved_4[4];
u8 romfs_offset[4];
u8 romfs_size[4];
u8 romfs_hash_size[4];
u8 reserved_5[4];
u8 exefs_sha_256_hash[0x20];
u8 romfs_sha_256_hash[0x20];
} __attribute__((__packed__))
NCCH_HEADER;
#endif//UNCART_HEADERS_H_