update readme, change --unpack to --decompress, put progress bar on stderr

This commit is contained in:
2023-08-24 22:59:27 +02:00
parent e11622202b
commit 1e0c8bb5a7
3 changed files with 15 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "upkr" name = "upkr"
version = "0.2.1" version = "0.2.2"
edition = "2021" edition = "2021"
[profile.release] [profile.release]

View File

@@ -22,6 +22,12 @@ c_unpacker and asm_unpackers unpack the default upkr compressed format. The z80_
is based on some variations to the compressed format. (Use `upkr --z80` to select those variations.) is based on some variations to the compressed format. (Use `upkr --z80` to select those variations.)
The 16 bit dos unpacker also uses some variations. (`upkr --x86`) The 16 bit dos unpacker also uses some variations. (`upkr --x86`)
### More unpackers outside this repository
* [Atari Lynx](https://github.com/42Bastian/new_bll/blob/master/demos/depacker/unupkr.asm)
* [Atari Jaguar](https://github.com/42Bastian/new_bjl/blob/main/exp/depacker/unupkr.js)
* [8080, R800](https://github.com/ivagorRetrocomp/DeUpkr)
## Usage ## Usage
``` ```
@@ -32,10 +38,13 @@ The 16 bit dos unpacker also uses some variations. (`upkr --x86`)
-l, --level N compression level 0-9 -l, --level N compression level 0-9
-0, ..., -9 short form for setting compression level -0, ..., -9 short form for setting compression level
-u, --unpack unpack infile -d, --decompress decompress infile
--heatmap calculate heatmap from compressed file --heatmap calculate heatmap from compressed file
--margin calculate margin for overlapped unpacking of a packed file --margin calculate margin for overlapped unpacking of a packed file
When no infile is given, or the infile is '-', read from stdin.
When no outfile is given and reading from stdin, or when outfile is '-', write to stdout.
Config presets for specific unpackers: Config presets for specific unpackers:
--z80 --big-endian-bitstream --invert-bit-encoding --simplified-prob-update -9 --z80 --big-endian-bitstream --invert-bit-encoding --simplified-prob-update -9
--x86 --bitstream --invert-is-match-bit --invert-continue-value-bit --invert-new-offset-bit --x86 --bitstream --invert-is-match-bit --invert-continue-value-bit --invert-new-offset-bit

View File

@@ -59,7 +59,7 @@ fn main() -> Result<()> {
level = 9; level = 9;
} }
Short('u') | Long("unpack") => unpack = true, Short('u') | Long("unpack") | Short('d') | Long("decompress") => unpack = true,
Long("margin") => calculate_margin = true, Long("margin") => calculate_margin = true,
Long("heatmap") => create_heatmap = true, Long("heatmap") => create_heatmap = true,
#[cfg(feature = "crossterm")] #[cfg(feature = "crossterm")]
@@ -94,7 +94,7 @@ fn main() -> Result<()> {
#[cfg(feature = "terminal")] #[cfg(feature = "terminal")]
let mut packed_data = { let mut packed_data = {
let mut pb = pbr::ProgressBar::new(data.len() as u64); let mut pb = pbr::ProgressBar::on(std::io::stderr(), data.len() as u64);
pb.set_units(pbr::Units::Bytes); pb.set_units(pbr::Units::Bytes);
let packed_data = upkr::pack( let packed_data = upkr::pack(
&data, &data,
@@ -105,6 +105,7 @@ fn main() -> Result<()> {
}), }),
); );
pb.finish(); pb.finish();
eprintln!();
packed_data packed_data
}; };
#[cfg(not(feature = "terminal"))] #[cfg(not(feature = "terminal"))]
@@ -246,7 +247,7 @@ fn print_help(exit_code: i32) -> ! {
eprintln!(); eprintln!();
eprintln!(" -l, --level N compression level 0-9"); eprintln!(" -l, --level N compression level 0-9");
eprintln!(" -0, ..., -9 short form for setting compression level"); eprintln!(" -0, ..., -9 short form for setting compression level");
eprintln!(" -u, --unpack unpack infile"); eprintln!(" -d, --decompress decompress infile");
eprintln!(" --heatmap calculate heatmap from compressed file"); eprintln!(" --heatmap calculate heatmap from compressed file");
eprintln!(" --margin calculate margin for overlapped unpacking of a packed file"); eprintln!(" --margin calculate margin for overlapped unpacking of a packed file");
eprintln!(); eprintln!();