diff --git a/Makefile b/Makefile index deea16b..bc8a937 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ MAKEFLAGS += --quiet -TARGETS = cubepro-encoder cubex-encoder cube3-encoder cube-decoder +TARGETS = cubepro-encoder cubex-encoder cube3-encoder cube-encoder cube-decoder LIBS = -lm CC = gcc CFLAGS += -g -Wall @@ -22,13 +22,16 @@ all: $(TARGETS) .PRECIOUS: $(TARGETS) $(OBJECTS) -cubepro-encoder: cube-encoder.o blowfish.o +cube-encoder: cube-encoder.o blowfish.o $(CC) $^ -Wall $(LIBS) -o $@ -cubex-encoder: cubepro-encoder +cubex-encoder: cube-encoder cp $^ $@ -cube3-encoder: cubepro-encoder +cube3-encoder: cube-encoder + cp $^ $@ + +cubepro-encoder: cube-encoder cp $^ $@ cube-decoder: cube-decoder.o blowfish.o diff --git a/README.md b/README.md index 338f897..d19c317 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,13 @@ make all make test ``` -These commands will download and compile the program and execute all test cases to verify that it works correctly. After this you will have two files called `cubepro-encoder` and `cubex-encoder`. The first one will encode `.bfb` files into `.cubepro` files and the second one into `.cubex` files. *(In fact both encoders are identical. Only the name makes the difference, so do not rename them).* +These commands will download and compile the program and execute all test cases to verify that it works correctly. +After this you will have four files called `cube-encoder`, `cubepro-encoder`, `cube3-encoder` and `cubex-encoder`. +`cube-encoder` will encode `.bfb` files into `.cube` files. +`cubepro-encoder` will encode `.bfb` files into `.cubepro` files. +`cube3-encoder` will encode `.bfb` files into `.cube3` files. +`cubex-encoder` will encode `.bfb` files into `.cubex` files. +*(In fact all encoders are identical. Only the name makes the difference, so do not rename them).* ## Usage @@ -31,12 +37,16 @@ These commands will download and compile the program and execute all test cases * Option 1: Just drop the `.bfb` file on the correct encoder program with your mouse. * Option 2: Run the encoder form the command line as follows: ``` +cube-encoder inputfile [outputfile] cubepro-encoder inputfile [outputfile] +cube3-encoder inputfile [outputfile] cubex-encoder inputfile [outputfile] ``` -where the outputfile is optional. To encode a `.bfb` file, simply call `cubepro-encoder somefile.bfb` and it will create `somefile.cubepro`. Same for `cubex-encoder`, but with a `.cubex` file extension. If that doesn't suit you, you can specify any output file name you like. +where the outputfile is optional. To encode a `.bfb` file, simply call `cubepro-encoder somefile.bfb` and it will create `somefile.cubepro`. +Same for `cube-encoder` (but with a `.cube` file extension), `cube3-encoder` (but with a `.cube3` file extension) and `cubex-encoder` (but with a `.cubex` file extension). +If that doesn't suit you, you can specify any output file name you like. To decode an encoded `.cubepro` or `.cubex` file, just drop it on the `cube-decoder` program or run the following command. The file type to decode is automatically determined from the file extension of the input file. ``` -cube-decoder inputfile [outputfile] +cube-decoder inputfile outputfile ``` diff --git a/cube-decoder.c b/cube-decoder.c index 2bcceb1..da6f0a1 100644 --- a/cube-decoder.c +++ b/cube-decoder.c @@ -43,7 +43,7 @@ int main(int argc, char **argv) { } else { printf("Usage:\n" " %s [-x] inputfile outputfile\n" - " Normally, the inputfile will be decoded as a .cubepro file.\n" + " Normally, the inputfile will be decoded as a .cube/.cubepro/.cube3 file.\n" " If the file name ends in .cubex or the -x parameter is present,i\n" " it will be decoded as a .cubex file instead.\n", argv[0]); diff --git a/cube-encoder.c b/cube-encoder.c index d61d2e5..fa62771 100644 --- a/cube-encoder.c +++ b/cube-encoder.c @@ -55,6 +55,9 @@ int main(int argc, char **argv) { } else if (ends_with(executable, "cube3-encoder") || ends_with(executable, "cube3-encoder.exe")) { extension = ".cube3"; + } else if (ends_with(executable, "cube-encoder") || + ends_with(executable, "cube-encoder.exe")) { + extension = ".cube"; } // "Parse" arguments