Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
```
2 changes: 1 addition & 1 deletion cube-decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
3 changes: 3 additions & 0 deletions cube-encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down