diff --git a/src/Tools/psxfileconv/src/images/tim/types.rs b/src/Tools/psxfileconv/src/images/tim/types.rs index 819a4d98..b786dd4c 100644 --- a/src/Tools/psxfileconv/src/images/tim/types.rs +++ b/src/Tools/psxfileconv/src/images/tim/types.rs @@ -65,7 +65,7 @@ impl DataBlock { const RAW_HEADER_SIZE: usize = (4*std::mem::size_of::()) + std::mem::size_of::(); pub fn new(x: u16, y: u16, w: u16, h: u16) -> DataBlock { - let bytes = ((w as usize*h as usize) + Self::RAW_HEADER_SIZE) as u32; + let bytes = ((w as usize*h as usize*std::mem::size_of::()) + Self::RAW_HEADER_SIZE) as u32; DataBlock{bytes, x, y, w, h} } } @@ -81,10 +81,10 @@ impl RawConversion<{Self::RAW_HEADER_SIZE}> for DataBlock { let mut raw = [0u8; Self::RAW_HEADER_SIZE]; raw[ 0..4].copy_from_slice(&self.bytes.to_le_bytes()); - raw[ 4..6].copy_from_slice(&self.y.to_le_bytes()); - raw[ 6..8].copy_from_slice(&self.x.to_le_bytes()); - raw[ 8..10].copy_from_slice(&self.h.to_le_bytes()); - raw[10..12].copy_from_slice(&self.w.to_le_bytes()); + raw[ 4..6].copy_from_slice(&self.x.to_le_bytes()); + raw[ 6..8].copy_from_slice(&self.y.to_le_bytes()); + raw[ 8..10].copy_from_slice(&self.w.to_le_bytes()); + raw[10..12].copy_from_slice(&self.h.to_le_bytes()); raw } } \ No newline at end of file diff --git a/src/Tools/psxfileconv/src/main.rs b/src/Tools/psxfileconv/src/main.rs index ef2fff9a..5d89e1c6 100644 --- a/src/Tools/psxfileconv/src/main.rs +++ b/src/Tools/psxfileconv/src/main.rs @@ -23,6 +23,7 @@ struct CommandLine { enum SubCommands { Nothing, SimpleTIM(reduced_tim::Arguments), + TIM(tim::Arguments), VAG(vag::Arguments), XA(xa::Arguments), } @@ -45,6 +46,7 @@ fn run_main(cmd: CommandLine) -> Result<(), Error> { match cmd.sub_command { SubCommands::Nothing => nothing::copy(&mut input, dst_buffer), SubCommands::SimpleTIM(args) => reduced_tim::convert(args, input, dst_buffer), + SubCommands::TIM(args) => tim::convert(args, input, dst_buffer), SubCommands::VAG(args) => audio::vag::convert(args, &cmd.output_file, input, dst_buffer), SubCommands::XA(args) => audio::xa::convert(args, input, dst_buffer), }