diff --git a/ctru-rs/examples/mii-selector.rs b/ctru-rs/examples/mii-selector.rs index 2732cdb..1b89532 100644 --- a/ctru-rs/examples/mii-selector.rs +++ b/ctru-rs/examples/mii-selector.rs @@ -14,16 +14,15 @@ fn main() { mii_selector.blacklist_user_mii(0.into()); mii_selector.set_title("Great Mii Selector!"); - let result = mii_selector.launch(); - - println!("\x1b[0;0HIs Mii selected?: {:?}", result.is_mii_selected); - println!("\x1b[1;0HValid checksum?: {:?}", result.valid_checksum()); - println!("\x1b[2;0HMii type: {:?}", result.mii_type); - println!("\x1b[3;0HMii checksum: {:?}", result.checksum); - println!("\x1b[4;0HName: {:?}", result.name()); - println!("\x1b[5;0HAuthor: {:?}", result.author()); + let result = mii_selector.launch().unwrap(); + + println!("Is Mii selected?: {:?}", result.is_mii_selected); + println!("Mii type: {:?}", result.mii_type); + println!("Mii checksum: {:?}", result.checksum); + println!("Name: {:?}", result.mii_data.name); + println!("Author: {:?}", result.mii_data.author_name); println!( - "\x1b[6;0HDoes the Mii have moles?: {:?}", + "Does the Mii have moles?: {:?}", result.mii_data.mole_details.is_enabled ); diff --git a/ctru-rs/src/applets/mii_selector.rs b/ctru-rs/src/applets/mii_selector.rs index 9602a35..d4fe6d1 100644 --- a/ctru-rs/src/applets/mii_selector.rs +++ b/ctru-rs/src/applets/mii_selector.rs @@ -23,10 +23,12 @@ bitflags! { } } +#[derive(Clone, Debug)] pub struct MiiSelector { config: Box, } +#[derive(Clone, Debug)] pub struct MiiSelectorReturn { pub mii_data: MiiData, pub is_mii_selected: bool, @@ -34,6 +36,7 @@ pub struct MiiSelectorReturn { pub checksum: u16, } +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum MiiLaunchError { InvalidChecksum, } diff --git a/ctru-rs/src/mii.rs b/ctru-rs/src/mii.rs index c966b92..b9d7285 100644 --- a/ctru-rs/src/mii.rs +++ b/ctru-rs/src/mii.rs @@ -435,7 +435,7 @@ fn utf16_byte_pairs_to_string(data: &[u8]) -> String { .map(|chunk| u16::from_le_bytes([chunk[0], chunk[1]])) .collect::>(); - String::from_utf16_lossy(raw_utf16_composed.as_slice()) + String::from_utf16_lossy(raw_utf16_composed.as_slice()).replace("\0", "") } /// Gets the values from the slice and concatenates them