Implement LZ4 strip and make tools write errors to err instead of out
This commit is contained in:
@@ -57,11 +57,11 @@ fn main() {
|
||||
Ok(cmd_line) => {
|
||||
match run_main(cmd_line) {
|
||||
Ok(_) => (),
|
||||
Err(error) => println!("{}", error)
|
||||
Err(error) => eprintln!("{}", error)
|
||||
}
|
||||
},
|
||||
Err(error) => {
|
||||
println!("{}", error);
|
||||
eprintln!("{}", error);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,8 +6,6 @@ use tool_helper::{Error, format_if_error, read_file};
|
||||
|
||||
pub type LBANameVec = Vec<String>;
|
||||
|
||||
const COMPRESSION_LEVEL:u32 = 16;
|
||||
|
||||
#[repr(packed)]
|
||||
struct OverlayHeader {
|
||||
_start_adr: u32,
|
||||
@@ -39,7 +37,7 @@ impl LBAEntry {
|
||||
pub fn load_from(file_name: &str, file_path: PathBuf, lba_source: PathBuf) -> Result<File, Error> {
|
||||
let content = load_content(&file_path)?;
|
||||
let lba_names = load_lba_names(lba_source)?;
|
||||
let content_size = format_if_error!(tool_helper::compress::lz4(&content, COMPRESSION_LEVEL), "Compressing {} failed with \"{error_text}\"", file_path.to_string_lossy())?.len();
|
||||
let content_size = format_if_error!(tool_helper::compress::psx_default::lz4(&content), "Compressing {} failed with \"{error_text}\"", file_path.to_string_lossy())?.len();
|
||||
|
||||
Ok(File::new_overlay(file_name, content, lba_names, content_size)?)
|
||||
}
|
||||
@@ -66,7 +64,7 @@ pub fn update_content(content: &mut Vec<u8>, lba_names: &LBANameVec, file_map: &
|
||||
}
|
||||
}
|
||||
|
||||
Ok(tool_helper::compress::lz4(content, COMPRESSION_LEVEL)?)
|
||||
Ok(tool_helper::compress::psx_default::lz4(content)?)
|
||||
}
|
||||
|
||||
fn load_content(file_path: &PathBuf) -> Result<Vec<u8>, Error> {
|
||||
|
Reference in New Issue
Block a user