diff --git a/src/Tools/psxcdgen_ex/src/main.rs b/src/Tools/psxcdgen_ex/src/main.rs index d9a38722..5adb8d9a 100644 --- a/src/Tools/psxcdgen_ex/src/main.rs +++ b/src/Tools/psxcdgen_ex/src/main.rs @@ -24,7 +24,6 @@ fn populate() -> Result { desc.root.add_file(file); desc.root.add_file(file2); - desc.calculate_lbas(); Ok(desc) } @@ -35,8 +34,8 @@ fn run_main() -> Result<(), Error> { match element { Layout::SystemArea(_) => println!("SystemArea:"), Layout::PVD(_) => println!("PVD:"), - Layout::Directory{name, properties} => println!("Dir: {} @{}", name, properties.lba.unwrap_or(0)), - Layout::File(file) => println!("File: {} @{}", file, file.get_lba().unwrap_or(0)), + Layout::Directory{name, properties} => println!("Dir: {} @{}", name, properties.lba), + Layout::File(file) => println!("File: {} @{}", file, file.get_lba()), } } Ok(()) diff --git a/src/Tools/psxcdgen_ex/src/types/lba_calculator.rs b/src/Tools/psxcdgen_ex/src/types/lba_calculator.rs deleted file mode 100644 index 65520fae..00000000 --- a/src/Tools/psxcdgen_ex/src/types/lba_calculator.rs +++ /dev/null @@ -1,13 +0,0 @@ -use super::layout::MemoryLayoutMut; - -pub fn calculate(layout: MemoryLayoutMut, start_lba: usize) -> usize { - let lba = start_lba; - - for element in layout.into_iter() { - match element { - _ => println!("LBA calculation not implemented yet") - } - } - - lba -} \ No newline at end of file diff --git a/src/Tools/psxcdgen_ex/src/types/mod.rs b/src/Tools/psxcdgen_ex/src/types/mod.rs index 6bb2a3e7..6ad7d448 100644 --- a/src/Tools/psxcdgen_ex/src/types/mod.rs +++ b/src/Tools/psxcdgen_ex/src/types/mod.rs @@ -1,5 +1,4 @@ pub mod layout; -mod lba_calculator; use cdtypes::types::cdstring::DString; use tool_helper::Error; @@ -18,10 +17,6 @@ impl CDDesc { } } - pub fn calculate_lbas(&mut self) { - lba_calculator::calculate(self.get_memory_layout_mut(), 0); - } - pub fn get_memory_layout(&self) -> layout::MemoryLayout { layout::DefaultLayout::new(self) } @@ -69,7 +64,7 @@ impl Directory { self.files.push(file); } - pub fn get_lba(&self) -> Option { + pub fn get_lba(&self) -> usize { self.properties.lba } } @@ -90,7 +85,7 @@ impl File { Ok(File{name: FileName::from_str(file_name)?, properties: Properties::default()}) } - pub fn get_lba(&self) -> Option { + pub fn get_lba(&self) -> usize { self.properties.lba } } @@ -153,13 +148,14 @@ impl std::fmt::Display for FileName { } pub struct Properties { - pub lba: Option, - pub size_b: Option + pub lba: usize, + pub overwrite_size_sectors: Option, + pub is_hidden: bool } impl Default for Properties { fn default() -> Self { - Properties{lba: None, size_b: None} + Properties{lba: 0, overwrite_size_sectors: None, is_hidden: false} } }