Support basic TIM
This commit is contained in:
parent
3b3b2ecfc4
commit
410eacc39b
|
@ -65,7 +65,7 @@ impl DataBlock {
|
||||||
const RAW_HEADER_SIZE: usize = (4*std::mem::size_of::<u16>()) + std::mem::size_of::<u32>();
|
const RAW_HEADER_SIZE: usize = (4*std::mem::size_of::<u16>()) + std::mem::size_of::<u32>();
|
||||||
|
|
||||||
pub fn new(x: u16, y: u16, w: u16, h: u16) -> DataBlock {
|
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::<u16>()) + Self::RAW_HEADER_SIZE) as u32;
|
||||||
DataBlock{bytes, x, y, w, h}
|
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];
|
let mut raw = [0u8; Self::RAW_HEADER_SIZE];
|
||||||
|
|
||||||
raw[ 0..4].copy_from_slice(&self.bytes.to_le_bytes());
|
raw[ 0..4].copy_from_slice(&self.bytes.to_le_bytes());
|
||||||
raw[ 4..6].copy_from_slice(&self.y.to_le_bytes());
|
raw[ 4..6].copy_from_slice(&self.x.to_le_bytes());
|
||||||
raw[ 6..8].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.h.to_le_bytes());
|
raw[ 8..10].copy_from_slice(&self.w.to_le_bytes());
|
||||||
raw[10..12].copy_from_slice(&self.w.to_le_bytes());
|
raw[10..12].copy_from_slice(&self.h.to_le_bytes());
|
||||||
raw
|
raw
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,6 +23,7 @@ struct CommandLine {
|
||||||
enum SubCommands {
|
enum SubCommands {
|
||||||
Nothing,
|
Nothing,
|
||||||
SimpleTIM(reduced_tim::Arguments),
|
SimpleTIM(reduced_tim::Arguments),
|
||||||
|
TIM(tim::Arguments),
|
||||||
VAG(vag::Arguments),
|
VAG(vag::Arguments),
|
||||||
XA(xa::Arguments),
|
XA(xa::Arguments),
|
||||||
}
|
}
|
||||||
|
@ -45,6 +46,7 @@ fn run_main(cmd: CommandLine) -> Result<(), Error> {
|
||||||
match cmd.sub_command {
|
match cmd.sub_command {
|
||||||
SubCommands::Nothing => nothing::copy(&mut input, dst_buffer),
|
SubCommands::Nothing => nothing::copy(&mut input, dst_buffer),
|
||||||
SubCommands::SimpleTIM(args) => reduced_tim::convert(args, 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::VAG(args) => audio::vag::convert(args, &cmd.output_file, input, dst_buffer),
|
||||||
SubCommands::XA(args) => audio::xa::convert(args, input, dst_buffer),
|
SubCommands::XA(args) => audio::xa::convert(args, input, dst_buffer),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue