ds_rom::rom::raw

Struct Header

source
#[repr(C)]
pub struct Header {
Show 92 fields pub title: AsciiArray<12>, pub gamecode: AsciiArray<4>, pub makercode: AsciiArray<2>, pub unitcode: u8, pub seed_select: u8, pub capacity: Capacity, pub reserved0: [u8; 7], pub dsi_flags: DsiFlags, pub ds_flags: DsFlags, pub rom_version: u8, pub autostart: u8, pub arm9: ProgramOffset, pub arm7: ProgramOffset, pub file_names: TableOffset, pub file_allocs: TableOffset, pub arm9_overlays: TableOffset, pub arm7_overlays: TableOffset, pub normal_cmd_setting: u32, pub key1_cmd_setting: u32, pub banner_offset: u32, pub secure_area_crc: u16, pub secure_area_delay: Delay, pub arm9_autoload_callback: u32, pub arm7_autoload_callback: u32, pub secure_area_disable: u64, pub rom_size_ds: u32, pub header_size: u32, pub arm9_build_info_offset: u32, pub arm7_build_info_offset: u32, pub ds_rom_region_end: u16, pub dsi_rom_region_end: u16, pub rom_nand_end: u16, pub rw_nand_end: u16, pub reserved1: [u8; 24], pub reserved2: [u8; 16], pub logo: [u8; 156], pub logo_crc: u16, pub header_crc: u16, pub debug_rom_offset: u32, pub debug_size: u32, pub debug_ram_addr: u32, pub reserved3: [u8; 4], pub reserved4: [u8; 16], pub memory_banks_wram: [u32; 5], pub memory_banks_arm9: [u32; 3], pub memory_banks_arm7: [u32; 3], pub memory_bank_9: u32, pub region_flags: RegionFlags, pub access_control: AccessControl, pub arm7_scfg_ext7_setting: u32, pub dsi_flags_2: DsiFlags2, pub arm9i: ProgramOffset, pub arm7i: ProgramOffset, pub digest_ds_area: TableOffset, pub digest_dsi_area: TableOffset, pub digest_sector_hashtable: TableOffset, pub digest_block_hashtable: TableOffset, pub digest_sector_size: u32, pub digest_sector_count: u32, pub banner_size: u32, pub sd_shared2_0000_size: u8, pub sd_shared2_0001_size: u8, pub eula_version: u8, pub use_ratings: bool, pub rom_size_dsi: u32, pub sd_shared2_0002_size: u8, pub sd_shared2_0003_size: u8, pub sd_shared2_0004_size: u8, pub sd_shared2_0005_size: u8, pub arm9i_build_info_offset: u32, pub arm7i_build_info_offset: u32, pub modcrypt_area_1: TableOffset, pub modcrypt_area_2: TableOffset, pub gamecode_rev: AsciiArray<4>, pub file_type: u32, pub sd_public_sav_size: u32, pub sd_private_sav_size: u32, pub reserved5: [u8; 176], pub age_ratings: [u8; 16], pub sha1_hmac_arm9_with_secure_area: [u8; 20], pub sha1_hmac_arm7: [u8; 20], pub sha1_hmac_digest: [u8; 20], pub sha1_hmac_banner: [u8; 20], pub sha1_hmac_arm9i: [u8; 20], pub sha1_hmac_arm7i: [u8; 20], pub sha1_hmac_unk1: [u8; 20], pub sha1_hmac_unk2: [u8; 20], pub sha1_hmac_arm9: [u8; 20], pub reserved6: [u8; 2636], pub debug_args: [u8; 384], pub rsa_sha1: [u8; 128], pub reserved7: [u8; 12288],
}
Expand description

ROM header.

Fields§

§title: AsciiArray<12>

Short game title, normally in uppercase letters.

§gamecode: AsciiArray<4>

4-character game code in uppercase letters.

§makercode: AsciiArray<2>

2-character maker code, normally “01”.

§unitcode: u8

Unit code, depends on which platform (DS, DSi) this game is for.

§seed_select: u8

Encryption seed select.

§capacity: Capacity

ROM capacity, powers of two starting from 128kB.

§reserved0: [u8; 7]

Reserved, zero.

§dsi_flags: DsiFlags

DSi-specific flags.

§ds_flags: DsFlags

Flags for both DS and DSi.

§rom_version: u8

ROM version, usually zero.

§autostart: u8

Autostart, can skip “Health and Safety” screen.

§arm9: ProgramOffset

ARM9 program offset.

§arm7: ProgramOffset

ARM7 program offset.

§file_names: TableOffset

File Name Table (FNT) offset.

§file_allocs: TableOffset

File Allocation Table (FAT) offset.

§arm9_overlays: TableOffset

ARM9 overlay table offset.

§arm7_overlays: TableOffset

ARM7 overlay table offset.

§normal_cmd_setting: u32

Port 0x40001a4 setting for normal commands.

§key1_cmd_setting: u32

Port 0x40001a4 setting for KEY1 commands.

§banner_offset: u32

Banner offset.

§secure_area_crc: u16

CRC checksum of ARM9 secure area.

§secure_area_delay: Delay

Delay to wait for secure area.

§arm9_autoload_callback: u32

ARM9 autoload callback.

§arm7_autoload_callback: u32

ARM7 autoload callback.

§secure_area_disable: u64

Can be set to encrypted “NmMdOnly” to disable secure area de/encryption.

§rom_size_ds: u32

Total ROM size. If this is a DSi game, this value excludes the DSi area.

§header_size: u32

Size of header, always 0x4000.

§arm9_build_info_offset: u32

ARM9 build info offset, see super::BuildInfo.

§arm7_build_info_offset: u32

ARM7 build info offset, see super::BuildInfo.

§ds_rom_region_end: u16

DS ROM region end in multiples of 0x80000. Zero for non-DSi games.

§dsi_rom_region_end: u16

DSi ROM region end in multiples of 0x80000. Zero for non-DSi games.

§rom_nand_end: u16

NAND end of ROM area in multiples of 0x20000 (0x80000 on DSi).

§rw_nand_end: u16

NAND end of RW area in multiples of 0x20000 (0x80000 on DSi).

§reserved1: [u8; 24]

Reserved, zero.

§reserved2: [u8; 16]

Reserved, zero.

Compressed logo, see Logo.

§logo_crc: u16

CRC checksum of Self::logo.

§header_crc: u16

CRC checksum of everything before this member.

§debug_rom_offset: u32

Debug ROM offset, only for debug builds.

§debug_size: u32

Debug ROM size, only for debug builds.

§debug_ram_addr: u32

Debug RAM address, only for debug builds.

§reserved3: [u8; 4]

Reserved, zero

§reserved4: [u8; 16]

Reserved, zero

§memory_banks_wram: [u32; 5]

MBK1 to MBK5

§memory_banks_arm9: [u32; 3]

MBK6 to MBK8

§memory_banks_arm7: [u32; 3]

MBK6 to MBK8

§memory_bank_9: u32

MBK9

§region_flags: RegionFlags

Region flags.

§access_control: AccessControl

Access control.

§arm7_scfg_ext7_setting: u32

ARM7 SCFG_EXT7 setting.

§dsi_flags_2: DsiFlags2

DSi-exclusive flags.

§arm9i: ProgramOffset

ARM9i program offset.

§arm7i: ProgramOffset

ARM7i program offset.

§digest_ds_area: TableOffset

DS area digest range.

§digest_dsi_area: TableOffset

DSi area digest range.

§digest_sector_hashtable: TableOffset

Digest sector hashtable offset.

§digest_block_hashtable: TableOffset

Digest block hashtable offset.

§digest_sector_size: u32

Digest sector size.

§digest_sector_count: u32

Digest sector count.

§banner_size: u32

Banner size.

§sd_shared2_0000_size: u8

SD/MMC size of shared2/0000 file

§sd_shared2_0001_size: u8

SD/MMC size of shared2/0001 file

§eula_version: u8

EULA version.

§use_ratings: bool

Use age ratings.

§rom_size_dsi: u32

Total ROM size, including DSi area.

§sd_shared2_0002_size: u8

SD/MMC size of shared/0002 file

§sd_shared2_0003_size: u8

SD/MMC size of shared/0003 file

§sd_shared2_0004_size: u8

SD/MMC size of shared/0004 file

§sd_shared2_0005_size: u8

SD/MMC size of shared/0005 file

§arm9i_build_info_offset: u32

ARM9i build info offset.

§arm7i_build_info_offset: u32

ARM7i build info offset.

§modcrypt_area_1: TableOffset

Modcrypt area 1 offset.

§modcrypt_area_2: TableOffset

Modcrypt area 1 offset.

§gamecode_rev: AsciiArray<4>

Same as Self::gamecode but byte.reversed.

§file_type: u32

File type.

§sd_public_sav_size: u32

SD/MMC public.sav file size.

§sd_private_sav_size: u32

SD/MMC private.sav file size.

§reserved5: [u8; 176]

Reserved, zero.

§age_ratings: [u8; 16]

Age ratings.

§sha1_hmac_arm9_with_secure_area: [u8; 20]

SHA1-HMAC of ARM9 program including secure area.

§sha1_hmac_arm7: [u8; 20]

SHA1-HMAC of ARM7 program.

§sha1_hmac_digest: [u8; 20]

SHA1-HMAC of digest section.

§sha1_hmac_banner: [u8; 20]

SHA1-HMAC of banner.

§sha1_hmac_arm9i: [u8; 20]

SHA1-HMAC of decrypted ARM9i.

§sha1_hmac_arm7i: [u8; 20]

SHA1-HMAC of decrypted ARM7i.

§sha1_hmac_unk1: [u8; 20]

Unknown SHA1-HMAC, defined by some games.

§sha1_hmac_unk2: [u8; 20]

Unknown SHA1-HMAC, defined by some games.

§sha1_hmac_arm9: [u8; 20]

SHA1-HMAC of ARM9 program excluding secure area.

§reserved6: [u8; 2636]

Reserved, zero.

§debug_args: [u8; 384]

Used for passing arguments in debug environment.

§rsa_sha1: [u8; 128]

RSA-SHA1 signature up to Self::debug_args.

§reserved7: [u8; 12288]

Reserved, zero.

Implementations§

source§

impl Header

source

pub fn version(&self) -> HeaderVersion

Returns the version of this Header.

source

pub fn borrow_from_slice(data: &[u8]) -> Result<&Self, RawHeaderError>

Reinterprets a &[u8] as a reference to Header.

§Errors

This function will return an error if the input is too small or not aligned enough.

source

pub fn borrow_from_slice_mut( data: &mut [u8], ) -> Result<&mut Self, RawHeaderError>

Reinterprets a &mut [u8] as a mutable reference to Header.

§Errors

This function will return an error if the input is too small or not aligned enough.

source

pub fn display(&self, indent: usize) -> DisplayHeader<'_>

Creates a DisplayHeader which implements Display.

Trait Implementations§

source§

impl Clone for Header

source§

fn clone(&self) -> Header

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Zeroable for Header

source§

fn zeroed() -> Self

source§

impl Copy for Header

source§

impl Pod for Header

Auto Trait Implementations§

§

impl Freeze for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> AnyBitPattern for T
where T: Pod,

source§

impl<T> NoUninit for T
where T: Pod,