Skip to main content

Overlay

Struct Overlay 

Source
pub struct Overlay<'a> { /* private fields */ }
Expand description

An overlay module for ARM9/ARM7.

Implementations§

Source§

impl<'a> Overlay<'a>

Source

pub fn new<T: Into<Cow<'a, [u8]>>>( data: T, options: OverlayOptions, ) -> Result<Self, OverlayError>

Creates a new Overlay from plain data.

Source

pub fn parse_arm9( overlay: &Overlay, rom: &'a Rom<'_>, arm9: &Arm9<'_>, ) -> Result<Self, OverlayError>

Parses an ARM9 Overlay from a ROM.

§Errors

This function will return an error if the overlay is signed and the ARM9 program does not contain overlay signatures.

Source

pub fn parse_arm7( overlay: &Overlay, rom: &'a Rom<'_>, ) -> Result<Self, OverlayError>

Parses an ARM7 Overlay from a ROM.

§Errors

This function will return an error if the overlay is signed, as ARM7 overlay signatures are not supported.

Source

pub fn build(&self) -> Overlay

Builds a raw overlay table entry.

Source

pub fn id(&self) -> u16

Returns the ID of this Overlay.

Source

pub fn base_address(&self) -> u32

Returns the base address of this Overlay.

Source

pub fn end_address(&self) -> u32

Returns the end address of this Overlay.

Source

pub fn code_size(&self) -> u32

Returns the size of initialized data in this Overlay.

Source

pub fn bss_size(&self) -> u32

Returns the size of uninitialized data in this Overlay.

Source

pub fn ctor_start(&self) -> u32

Returns the offset to the start of the .ctor section.

Source

pub fn ctor_end(&self) -> u32

Returns the offset to the end of the .ctor section.

Source

pub fn file_id(&self) -> u32

Returns the file ID of this Overlay.

Source

pub fn is_compressed(&self) -> bool

Returns whether this Overlay is compressed. See Self::originally_compressed for whether this overlay was compressed originally.

Source

pub fn is_signed(&self) -> bool

Returns whether this Overlay has a signature.

Source

pub fn decompress(&mut self) -> Result<(), Lz77DecompressError>

Decompresses this Overlay, but does nothing if already decompressed.

Source

pub fn compress(&mut self) -> Result<(), Error>

Compresses this Overlay, but does nothing if already compressed.

§Errors

This function will return an error if an I/O operation fails.

Source

pub fn code(&self) -> &[u8]

Returns a reference to the code of this Overlay.

Source

pub fn full_data(&self) -> &[u8]

Returns a reference to the full data of this Overlay.

Source

pub fn info(&self) -> &OverlayInfo

Returns a reference to the info of this Overlay.

Source

pub fn originally_compressed(&self) -> bool

Returns whether this Overlay was compressed originally. See Self::is_compressed for the current state.

Source

pub fn compute_signature( &self, hmac_sha1: &HmacSha1, ) -> Result<HmacSha1Signature, OverlayError>

Computes the signature of this Overlay using the given HMAC-SHA1 key.

Source

pub fn signature(&self) -> Option<HmacSha1Signature>

Returns the signature of this Overlay, if it exists.

Source

pub fn verify_signature( &self, hmac_sha1: &HmacSha1, ) -> Result<bool, OverlayError>

Verifies the signature of this Overlay using the given HMAC-SHA1 key.

Source

pub fn sign(&mut self, hmac_sha1: &HmacSha1) -> Result<(), OverlayError>

Signs this Overlay using the given HMAC-SHA1 key.

Trait Implementations§

Source§

impl<'a> Clone for Overlay<'a>

Source§

fn clone(&self) -> Overlay<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Overlay<'a>

§

impl<'a> RefUnwindSafe for Overlay<'a>

§

impl<'a> Send for Overlay<'a>

§

impl<'a> Sync for Overlay<'a>

§

impl<'a> Unpin for Overlay<'a>

§

impl<'a> UnsafeUnpin for Overlay<'a>

§

impl<'a> UnwindSafe for Overlay<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
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.