diff --git a/src/main.rs b/src/main.rs index 15abecc..26769a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,20 +34,17 @@ pub mod speciesmap { /// /// Parses command-line arguments using the `Cli` struct, and then executes /// the appropriate command based on the parsed input. -/// -/// # Returns -/// -/// Returns `Ok(())` if the program runs successfully, otherwise returns an -/// error wrapped in a `Box`. -/// -fn main() -> Result<(), Box> { +fn main() { let cli = Cli::parse(); - match cli.command { + let res = match cli.command { Command::Distribute { pcd, region, device, address, interval } => distribute(pcd, region, device, address.unwrap_or([0xa4, 0xc0, 0xe1, 0x6e, 0x76, 0x80]), interval), Command::Decrypt { epcd, checksum, address, pcd } => decrypt(epcd, checksum, address, pcd), Command::Info { pcd } => info(pcd), Command::Set { title, kind: card_type, gift_instance, card_id, games, description: comment, redistribution, icons, pgt, date: received, pcd, output } => set(title, card_type, card_id, gift_instance, games, comment, redistribution, icons, pgt, received, pcd, output) + }; + if let Err(err) = res { + eprintln!("Error: {}", err); } } diff --git a/src/pcd.rs b/src/pcd.rs index e2da774..20df2be 100644 --- a/src/pcd.rs +++ b/src/pcd.rs @@ -300,12 +300,8 @@ impl PCD { let icons = [des.icons.0,des.icons.1,des.icons.2].iter().flat_map(|i|i.to_le_bytes()).collect::>(); - eprintln!("{:?} {:?}", des.icons, icons); - card_data[PCD_ICONS_OFFSET - PCD_COMMENT_OFFSET..PCD_ICONS_OFFSET - PCD_COMMENT_OFFSET + 2*3].copy_from_slice(icons.as_slice()); - eprintln!("{:?}", &card_data[PCD_ICONS_OFFSET-PCD_COMMENT_OFFSET..PCD_ICONS_OFFSET-PCD_COMMENT_OFFSET+2*3]); - card_data[PCD_RECEIVED_OFFSET - PCD_COMMENT_OFFSET..PCD_RECEIVED_OFFSET - PCD_COMMENT_OFFSET + 2].copy_from_slice(&des.received.to_le_bytes()); card_data[PCD_REDISTRIBUTION_OFFSET - PCD_COMMENT_OFFSET] = des.redistribution;