GOBREAD.EXE - Container File Extractor; USAGE.TXT (Jan 26, 2010)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THIS PROGRAM IS MADE FOR FUN AND EVALUATION PURPOSES ONLY.

IT IS FREE FOR PRIVATE USE ONLY.

IF YOU WANT TO USE IT THEN USE IT ONLY IF YOU KNOW WHAT YOU DO AND ONLY AT YOUR OWN RISK.

PLEASE RESPECT COPYRIGHTS.

Visit WWW.XENTAX.COM for knowledge and many fine tools.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PURPOSE:
~~~~~~~~

GOBREAD is a DOS commandline utility which extracts contents from container files (or "archive files") used in many games or programs. In almost any case it is able to reconstruct the original file structure if such information is available. It doesn't remove any copy protection. It is mainly developed to extract original data from archive files in its genuine shape if possible.


FEATURES:
~~~~~~~~~
- Handles more than 80 different file formats
- Automatically detects file formats in many cases
- Data decryption
- Available common data decompression methods: ZLIB, LZSS (+custom)


SYSTEM REQUIREMENTS:
~~~~~~~~~~~~~~~~~~~~

- Pentium based 32Bit processor with "MMX+"/"SSE" instruction set (other systems will crash)
- 192KB RAM
- DOS 3.31+ with LFN (long file names) support or any 32(!)Bit based Windows
- PC DOS Emulator like DOSBOX (only for 64Bit systems)


RESTRICTIONS:
~~~~~~~~~~~~~

- It doesn't run on 64Bit systems
- File sizes above 4GByte are not supported
- Some foreign character sets in file names might cause problems when accessing created files
- "/view" switch ("file content listing") doesn't work for all formats
- Specifying a file selection is not possible; only an entire container can be extracted/created
- Creating a container is generally not supported because of the varying complexity of supported formats


USAGE:
~~~~~~

Notes:
Any output written to the screen can be captured into a file by appending ">ANYFILE.TXT" (or any other filename) to the command line. See your DOS/Windows manual for the command line interface ("CLI").
All switches are case insensitive an must be preceded by "-" (minus) or "/" (slash) and can be at any position.
Any switch which is not in an internal comparison list will be interpreted as a file statement, for example:

GOBREAD /xyz file.dat

GOBREAD will try to open the file "\XYZ." on the current drive.



Printing a general help text:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GOBREAD

Printing a list of supported formats:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GOBREAD /list
or
GOBREAD -LIST


*Structure of the list:

-General:
<format_switch> <flag> <description>

-Example:
WARCR2   AC Warcraft II (incl. expansion-CD)
|        || |
|        || '- Short description of the game and supported files
|        ||
|        |'--- "C"  =   A container can be created (not fully implemented)
|        |     "-"  =   Creation of a container is not supported
|        |
|        '---- "A"  =   The container can be detected automatically.
|              "-"  =   There is no possibility to recognize this format automatically;
|                       the commandline must include the <format_switch>:
|                       GOBREAD /WARCR2 filename.ext
|
'------------- <string> Force to use this extraction module.
                        A wrong <format_switch> could reject the extraction process
                        or crash the program.


Check if a container file is supported by GOBREAD:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GOBREAD /CHECK "container.dat"

If "container.dat" is a supported format and can be detected automatically, a line with a short description will be printed. An extraction is possible.

If not, the message "File format not recognized" will be printed. In this case a <format_switch> should be given:

GOBREAD /CHECK "container.dat" /<format_switch>

Because the recognition method is not 100% proof it should not be used with unknown files.


Example:

The game "Fallout" uses some .DAT container files. These files don't have any signature which could be evaluated by GOBREAD.

If you invoke:

GOBREAD /check critter.dat

you will get the trifle message "File format not recognized."

If you are sure that you deal with the "Fallout" .DAT container format you could use the format specifier:

GOBREAD /check /fo1 critter.dat
		|
		'-- format specifier


You will (hopefully) get the message:

FO1      -- Fallout 1, DAT-files
|	 ||
|	 |'-------- = "-"	No packing support
|	 '--------- = "-"	No automatic format recognition
'------------------ = "/fo1"	format specifier to give on the command line

 

Extracting container files:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Notes:
- The extraction process can be interrupted by hitting the "ESC"-key.
- Files above 4GB are not supported.
- There is no possibility to choose certain files from the container. Only the whole content can be extracted.
- Make sure the container you want to extract is generally supported (see LIST- or CHECK-switch).
- Dependent on the content thousands of files could be created with huge storage waste. Be aware of it.
- GOBREAD never overwrites existing files and will issue "**ERROR**"-messages instead.
- Before extracting you should create an empty folder, change to it and invoke GOBREAD from there.
- To catch error messages divert the output-print to a file and search it for the string "**ERROR**".

If the <flag> "A" (see LIST-/CHECK-switch) is visible, the command will be simple:
GOBREAD container.dat

This extracts all files from CONTAINER.DAT.

If the <flag> "A" is not visible, the <format_switch> must be given (example for Hellforces RES-files):
GOBREAD /hf 'hellfile.res'




EXAMPLES
~~~~~~~~

Assume that GOBREAD.EXE is located in the current directory.
Assume that the container file "data.xyz" is also located in the current directory.
Assume that you want to extract a file which is known to GOBREAD (<flag> "A" is visible)
The command will be:

gobread data.xyz


Assume that GOBREAD shall extract files from a container which it can't detect automatically. (<flag> "A" not visible)
Assume you want to extract a BCB-file from "Stolen".
The command will be:

gobread filename.bcb /stolbcb


Assume GOBREAD.EXE is located in "C:\CMD".
Assume a container file "PACK001.RES" file is located in "C:\MYGAME\DATA\".
Assume you want to extract "PACK001.RES" to "D:\TEST".
Assume GOBREAD can't detect the format automatically but you know the right one and GOBREAD supports it (for example "Hellforces-RES-files").

Here the commands will be:

md d:\test
d:
cd \test
c:\cmd\gobread "c:\mygame\data\pack001.res" /hf



Assume you want to see if a format named like "turok" is supported.
The "find" command can be used for it:

gobread /list | find /i "turok"



Batch File Processing
~~~~~~~~~~~~~~~~~~~~~

In case to extract more container files at once it might be necessary to create a batch file.
GOBREAD returns some EXIT-codes which can evaluated with "IF ERRORLEVEL==...":

0 - No error
1 - Help text printed
2 - Program cancelled by ESC-key
3 - Container format error
4 - Error during file operations
5 - Error in decompression system
6 - Unsupported function requested
7 - Memory error



Assume a bunch of PAK files have to be processed. Each PAK file needs to be extracted into a separate directory.
For example, two batch files (e.g. EXTRACT.BAT + INNER.BAT) could be created and EXTRACT.BAT must be invoked like this:

EXTRACT.BAT <file_spec> <format_id>,

e.g. EXTRACT.BAT *.PAK /KREED



Begin of EXTRACT.BAT
______________________________________________________________
REM Win9x only: "LFNFOR"
lfnfor on
for %%i in (%1) do call inner.bat %%i %2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
End of EXTRACT.BAT


Begin of INNER.BAT
______________________________________________________________
md %1.$$$
cd %1.$$$
echo Extracting %1...
gobread.exe %2 ..\%1
if errorlevel==1 goto err_extract
cd ..
goto next

:err_extract
if not exist %1 cd ..
choice "An error occured during extraction! Continue "
if errorlevel==2 exit

:next
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
End of INNER.BAT