From c629ccfb2ce93fccf128db61a3c9d2de0c0c2999 Mon Sep 17 00:00:00 2001 From: Daniel Maslowski Date: Sat, 18 Oct 2025 17:46:26 +0200 Subject: [PATCH] gracefully return when no ME directories can be found This adds Unknown for both enums describing the ME generation and directories. Signed-off-by: Daniel Maslowski --- src/me.rs | 5 ++++- src/show.rs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/me.rs b/src/me.rs index e70e056..ef3ea15 100644 --- a/src/me.rs +++ b/src/me.rs @@ -6,6 +6,7 @@ use crate::{ gen3::{CPD_MAGIC_BYTES, CodePartitionDirectory}, man::Manifest, }, + fpt::FPT_SIZE, fpt::{AFSP, DLMP, EFFS, FPT, FTPR, FTUP, MDMV, MFS, NFTP}, }; @@ -14,12 +15,14 @@ pub enum Generation { Gen1, Gen2, Gen3, + Unknown, } #[derive(Serialize, Deserialize, Clone, Debug)] pub enum Directories { Gen2(Vec), Gen3(Vec), + Unknown, } #[allow(non_camel_case_types)] @@ -115,7 +118,7 @@ impl ME { } else if gen2dirs.len() > 0 { (Generation::Gen2, Directories::Gen2(gen2dirs)) } else { - return None; + (Generation::Unknown, Directories::Unknown) } }; diff --git a/src/show.rs b/src/show.rs index fd34251..749a13f 100644 --- a/src/show.rs +++ b/src/show.rs @@ -61,6 +61,8 @@ fn print_me(me: &ME) { match &me.dirs { Directories::Gen2(dirs) => print_gen2_dirs(dirs), Directories::Gen3(dirs) => print_gen3_dirs(dirs), + // TODO + _ => {} } }