From ca0394e966a42c5089e7e4481d0d80df24edd0e0 Mon Sep 17 00:00:00 2001 From: Jurrie Overgoor <1213142+Jurrie@users.noreply.github.com> Date: Thu, 30 Dec 2021 14:41:21 +0100 Subject: [PATCH 1/2] Update README.md to reflect cube3-encoder binary --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 338f897..06ec269 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,12 @@ 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 three files called `cubepro-encoder`, `cube3-encoder` and `cubex-encoder`. +`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 @@ -32,9 +37,12 @@ These commands will download and compile the program and execute all test cases * Option 2: Run the encoder form the command line as follows: ``` 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 `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. ``` From 33e8f5cd034938a3624c4fdb3f61b7bd67f63892 Mon Sep 17 00:00:00 2001 From: Jurrie Overgoor <1213142+Jurrie@users.noreply.github.com> Date: Thu, 30 Dec 2021 15:03:45 +0100 Subject: [PATCH 2/2] Add support for first generation Cube printer --- Makefile | 11 +++++++---- README.md | 8 +++++--- cube-decoder.c | 2 +- cube-encoder.c | 3 +++ 4 files changed, 16 insertions(+), 8 deletions(-) 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 06ec269..d19c317 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ 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 three files called `cubepro-encoder`, `cube3-encoder` and `cubex-encoder`. +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. @@ -36,15 +37,16 @@ After this you will have three files called `cubepro-encoder`, `cube3-encoder` a * 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 `cube3-encoder` (but with a `.cube3` file extension) and `cubex-encoder` (but with a `.cubex` file extension). +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