Sei sulla pagina 1di 1

How to Convert Files to Binary Format

Data File Format


The tools supplied with Train Simulator write out most data files in text format. This is helpful during development of new routes since it makes it easy to examine the contents of a data file, and check whether a file has become corrupted, etc. A drawback of text format files, however, is that they take longer to load. This isnt a problem for most configuration files, as these are small and are only loaded once when running up a route. However, text format files can cause slowdowns for the following file types, which are loaded progressively (i.e. as required) as the player drives along a route. World (.w) files These contain the positions of objects placed in the route Shape (.s) files The 3D shapes themselves While these files should be kept in text format for editing and archival, they can be converted to binary format for distribution. Data files in binary format cannot be viewed in a text editor, but are smaller and load faster.

Text Format Shape Files


Note that all source text files for the conversion described below must be in Unicode text format. This is always the case for text format .w file, but shape files output by the Conv3DS utility are in ASCII text format. To convert a .s file output by this utility to Unicode text format, use the txt2uni command line utility. For example the following converts the file myshape.s from ASCII to Unicode text format (overwriting the file). Note that shape files need to be in Unicode text format in order to be loaded into Train Simulator.
txt2uni myshape.s

Converting Files
Files are converted to binary format using the ffeditc command line utility. This automatically identifies the file type and converts it. ffeditc can only accept one file at a time the easiest way to get around this is to write a script, as follows. ffeditc ffeditc ffeditc ffeditc

Use Windows Explorer to copy the .w files to be converted into the directory where ffeditc resides. Open an MS-DOS command line prompt Use cd to move to the directory where, e.g., your world files are. E.g.: cd
C:\TrainSim\Utils\FFEdit

Create an empty output directory: mkdir out Create a list of the files: dir *.w /b/s >convert.bat (*.w here is for world files; use *.s here if converting shape files) Edit the newly created convert.bat file in a text editor. Insert ffeditc at the beginning of every line (you could use your text editors find/replace function to replace the c:\ or similar which each line will begin with). Append /o:out\.w to the end of each line (again, use .s here if converting shape files) This file should now contain something like the following:
C:\TrainSim\Utils\FFEdit\w-000149+014067.w C:\TrainSim\Utils\FFEdit\w-000149+014068.w C:\TrainSim\Utils\FFEdit\w-000149+014069.w C:\TrainSim\Utils\FFEdit\w-000150+014069.w /o:out\.w /o:out\.w /o:out\.w /o:out\.w

etc Now run this batch file: convert This should convert all the files and place the new files in the out directory. When complete, copy or move the new files and delete the source files from the ffedit directory.

Potrebbero piacerti anche