pub struct Arm9<'a> { /* private fields */ }Expand description
ARM9 program.
Implementations§
source§impl<'a> Arm9<'a>
impl<'a> Arm9<'a>
sourcepub fn new<T: Into<Cow<'a, [u8]>>>(
data: T,
header_version: HeaderVersion,
offsets: Arm9Offsets,
) -> Self
pub fn new<T: Into<Cow<'a, [u8]>>>( data: T, header_version: HeaderVersion, offsets: Arm9Offsets, ) -> Self
Creates a new ARM9 program from raw data.
sourcepub fn with_two_tcms(
data: Vec<u8>,
itcm: Autoload<'_>,
dtcm: Autoload<'_>,
header_version: HeaderVersion,
offsets: Arm9Offsets,
) -> Result<Self, RawBuildInfoError>
pub fn with_two_tcms( data: Vec<u8>, itcm: Autoload<'_>, dtcm: Autoload<'_>, header_version: HeaderVersion, offsets: Arm9Offsets, ) -> Result<Self, RawBuildInfoError>
Creates a new ARM9 program with raw data and two autoloads (ITCM and DTCM).
§Errors
See Self::build_info_mut.
sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Returns whether the secure area is encrypted.
sourcepub fn decrypt(
&mut self,
key: &BlowfishKey,
gamecode: u32,
) -> Result<(), Arm9Error>
pub fn decrypt( &mut self, key: &BlowfishKey, gamecode: u32, ) -> Result<(), Arm9Error>
Decrypts the secure area. Does nothing if already decrypted.
§Errors
This function will return an error if the program is too small to contain a secure area, Blowfish::decrypt fails or
“encryObj” was not found.
sourcepub fn encrypt(
&mut self,
key: &BlowfishKey,
gamecode: u32,
) -> Result<(), Arm9Error>
pub fn encrypt( &mut self, key: &BlowfishKey, gamecode: u32, ) -> Result<(), Arm9Error>
Encrypts the secure area. Does nothing if already encrypted.
§Errors
This function will return an error if the program is too small to contain a secure area, or the secure area ID was not found.
sourcepub fn encrypted_secure_area(
&self,
key: &BlowfishKey,
gamecode: u32,
) -> [u8; 16384]
pub fn encrypted_secure_area( &self, key: &BlowfishKey, gamecode: u32, ) -> [u8; 16384]
Returns an encrypted copy of the secure area.
sourcepub fn secure_area_crc(&self, key: &BlowfishKey, gamecode: u32) -> u16
pub fn secure_area_crc(&self, key: &BlowfishKey, gamecode: u32) -> u16
Returns a CRC checksum of the encrypted secure area.
sourcepub fn build_info(&self) -> Result<&BuildInfo, RawBuildInfoError>
pub fn build_info(&self) -> Result<&BuildInfo, RawBuildInfoError>
sourcepub fn build_info_mut(&mut self) -> Result<&mut BuildInfo, RawBuildInfoError>
pub fn build_info_mut(&mut self) -> Result<&mut BuildInfo, RawBuildInfoError>
sourcepub fn is_compressed(&self) -> Result<bool, RawBuildInfoError>
pub fn is_compressed(&self) -> Result<bool, RawBuildInfoError>
sourcepub fn decompress(&mut self) -> Result<(), Arm9Error>
pub fn decompress(&mut self) -> Result<(), Arm9Error>
Decompresses this ARM9 program. Does nothing if already decompressed.
§Errors
See Self::is_compressed and Self::build_info_mut.
sourcepub fn compress(&mut self) -> Result<(), Arm9Error>
pub fn compress(&mut self) -> Result<(), Arm9Error>
Compresses this ARM9 program. Does nothing if already compressed.
§Errors
See Self::is_compressed, Lz77::compress and Self::build_info_mut.
sourcepub fn autoload_infos(&self) -> Result<&[AutoloadInfo], Arm9AutoloadError>
pub fn autoload_infos(&self) -> Result<&[AutoloadInfo], Arm9AutoloadError>
Returns the autoload infos of this Arm9.
§Errors
This function will return an error if Self::build_info or Self::get_autoload_infos fails or this ARM9 program
is compressed.
sourcepub fn autoloads(&self) -> Result<Box<[Autoload<'_>]>, Arm9AutoloadError>
pub fn autoloads(&self) -> Result<Box<[Autoload<'_>]>, Arm9AutoloadError>
Returns the autoloads of this Arm9.
§Errors
This function will return an error if Self::build_info or Self::get_autoload_infos fails or this ARM9 program
is compressed.
sourcepub fn code(&self) -> Result<&[u8], RawBuildInfoError>
pub fn code(&self) -> Result<&[u8], RawBuildInfoError>
sourcepub fn base_address(&self) -> u32
pub fn base_address(&self) -> u32
Returns the base address.
sourcepub fn entry_function(&self) -> u32
pub fn entry_function(&self) -> u32
Returns the entry function address.
sourcepub fn build_info_offset(&self) -> u32
pub fn build_info_offset(&self) -> u32
Returns the build info offset.
sourcepub fn autoload_callback(&self) -> u32
pub fn autoload_callback(&self) -> u32
Returns the autoload callback address.
sourcepub fn offsets(&self) -> &Arm9Offsets
pub fn offsets(&self) -> &Arm9Offsets
Returns a reference to the ARM9 offsets.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Arm9<'a>
impl<'a> RefUnwindSafe for Arm9<'a>
impl<'a> Send for Arm9<'a>
impl<'a> Sync for Arm9<'a>
impl<'a> Unpin for Arm9<'a>
impl<'a> UnwindSafe for Arm9<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)