How to convert BOB files to BOD files with X2BC

From X-Wiki

Jump to: navigation, search
This tutorial is about converting BOB (plain text) to BOD (binary) format. If you are looking for the opposite, read How to convert BOD files to BOB files with X2BC.

BOB files are binary encoded files containing graphics. BOD files are the same, but they have the data stored in plain text. DBOX2 is designed to work only with BOD files, and so anyone who want to use it to import models need to convert the files first.

The program to make the conversion is called X2BC. It's a command line program and so it must be run from Windows command line.

For the purpose of this tutorial, we will assume that you have X2BC installed in directory C:\X2BC.

First open the command line window - click on Windows Start button and select Run. Type cmd and press enter.

A black window will appear with prompt at the bottom.

Type c:\x2bc\x2bc /? and you will see a help screen with list of all commands.

It looks like this:

X2/X3 BOD compiler/BOB decompiler by Doubleshadow.
BOB decompiler based on work of CheckerTwo.

Usage: x2bc [flags] [input file] [output file]

    -?, --help                  show this help
    -s, --silent                don't ask anything. Assume Yes on questions
        --version               print version information

    -c, --compile               compile BOD to BOB
        --cut                   input BOD contains CUT data
        --bob                   input BOD contains BOB data

    -d, --decompile             decompile BOB to BOD
        --ini <file name>       specify INI file to load
        --frame_warnings[-]     (don't) show user frame warnings
        --xpinfo[-]             (don't) write extra point info
        --x3info[-]             (don't) write extra info stored in X3 BOB1

We will focus on the Decompilation section.

Assume you have a file named D:\X3 Reunion Unpacked Data\objects\ships\argon\argon_M1.bob. To convert (decode) it to BOD type:

 c:\x2bc\x2bc -d "D:\X3 Reunion Unpacked Data\objects\ships\argon\argon_M1.bob"

This will create a BOD file at the same location and with the same name, but with extension BOD.

If you want to name the file differently, just specify the destination file name:

 c:\x2bc\x2bc -d "D:\X3 Reunion Unpacked Data\objects\ships\argon\argon_M1.bob" c:\mytest.bod

Note that in both cases, the first file name is in quotes. That's because it contains space characters - everytime your file path contain a space, you need to put it in quotes.

How to convert several files at once?

There is no support in X2BC for such thing but with little help of Widows shell, we can do it nicely.

 for /R %%f in (*.bob) do c:\x2bc\x2bc -d --silent "%%f" "%%~pf%%~nf.bod"

This command will recursively scan through directories and convert all files with extension BOB to BOD files.

To use it, you must first create a BAT file (a file with extension .bat - for example convert.bat) and paste the above code into it.

Place the file into the directory where your BOB files are stored (for example c:\X3 Reunion Unpacked Data).

The command will traverse through all directories within its parent directory and make the conversion.

How it works:

FOR file IN (set) DO command 
this will scan through file list specified in set and assign the file name into variable file. Finally it will execute command. The /R option makes it work recursively.
c:\x2bc\x2bc -d --silent "%%f" "%%~pf%%~nf.bod" 
this calls the x2bc with flags and two full file names - source and destination. The %%f is the file name, %%~pf specifies full path to that file and %%~nf specifies only the file name of the file (this allows us to change the file extension).

See also


  • MS DOS refference
  • type for /? in Windows command line to get list of available options for the for command
Personal tools