From 9b8f4239a7640bd9aa719ddcbe8bbcbea2e0a135 Mon Sep 17 00:00:00 2001 From: Maccraft123 Date: Fri, 3 Mar 2023 17:18:31 +0100 Subject: [PATCH] Make TitleInfo into a AM_TitleEntry wrapper --- ctru-rs/examples/title-info.rs | 1 - ctru-rs/src/services/am.rs | 23 +++++------------------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/ctru-rs/examples/title-info.rs b/ctru-rs/examples/title-info.rs index f4231a0..1f5654f 100644 --- a/ctru-rs/examples/title-info.rs +++ b/ctru-rs/examples/title-info.rs @@ -84,7 +84,6 @@ fn main() { Ok(info) => { println!("Size: {} KB", info.size_bytes() / 1024); println!("Version: 0x{:x}", info.version()); - println!("Type: 0x{:x}", info.type_()); } Err(e) => println!("Failed to get title info: {}", e), } diff --git a/ctru-rs/src/services/am.rs b/ctru-rs/src/services/am.rs index c540a05..5a52b99 100644 --- a/ctru-rs/src/services/am.rs +++ b/ctru-rs/src/services/am.rs @@ -4,30 +4,17 @@ use std::marker::PhantomData; use std::mem::MaybeUninit; #[derive(Copy, Clone, Debug)] -#[repr(C)] -pub struct TitleInfo { - id: u64, - size: u64, - version: u16, - pad: u16, - type_: u32, -} - -// Make sure TitleInfo is correct size -const _TITLEINFO_SIZE_CHECK: [u8; 0x18] = [0; std::mem::size_of::()]; - +#[repr(transparent)] +pub struct TitleInfo(ctru_sys::AM_TitleEntry); impl TitleInfo { pub fn id(&self) -> u64 { - self.id + self.0.titleID } pub fn size_bytes(&self) -> u64 { - self.size + self.0.size } pub fn version(&self) -> u16 { - self.version - } - pub fn type_(&self) -> u32 { - self.type_ + self.0.version } }