Download June/July 1995
Transcript
C H O P P I N G B L O C K Listing 1. General TRE File Format FILE OFFSET DATA SIZE 0-3 4-7 8-11 12-15 16-19 20-23 24-(xx-1) char char long long long long var xx-(yy-1) var yy-(zz-1) var Record Pointer Table. This table consists of structures containing the file offsets and sizes of the Data Records in this TRE file. zz-EOF var Individual Data Records. DESCRIPTION “XTRE” char string. Blanks. 4 bytes of 00. Starting Offset of the Indirect Record Pointer Table. Starting Offset of the Path Name Table. Starting Offset of the Record Pointer Table. Offset of the first Data Record in this TRE file. Indirect Record Pointer Table. This table contains indirect pointers, or “pointers to pointers”. The values in this table point into the Path Name Table or into the Record Pointer Table. Path Name Table. Table of variable-length records containing system path names and other path-related data. NOTES: 1. var refers to data having variable sizes. 2. xx is the Starting Offset of the Path Name Table. 3. yy is the Starting Offset of the Record Pointer Table. 4. zz is the Offset of the First Data Record. 5. EOF refers to the end of the file. and uses about 40MB of hard disk space. A VESA driver is required for SVGA graphics. Because Wing Commander III is such a large game and weighs heavily on system resources, it is no surprise that many users have had trouble installing it. (I experienced installation troubles because the size of my CD-ROM drivers combined with a Pro Audio Spectrum driver exceeded the minimum conventional memory requirements for my 8MB RAM system. The game features a boot disk creation routine that solved my memory management problems.) Wing Commander III requires a minimum of 360K conventional RAM plus 7,000K of either extended or expanded memory. Access to memory above 640K is provided by Origin’s custom JEMM.OVL protected mode (DPMI), 32-bit driver. Virtual memory is emulated through the use of a swap file named SWAPFILE.$$$. The size of the swap file is generally determined by the amount of free hard disk space, and it is usually 15MB to 20MB. The swap file is created when Wing Commander III is booted and erased when you exit the game. (This file is erased when you exit the game via the Alt-X keystrokes. So be sure to erase the swap file from your Wing Commander III hard drive subdirectory if you exit the game using any other method such as rebooting your PC.) The primary Wing Commander III executable, WC3.EXE, is about 1.1MB in size. Wing Commander III was developed using the MetaWare High C/C++ system and is written primarily in C++. (The MetaWare High C system features C++ templates and a compiler for developing 32-bit protected mode applications.) The WC3.EXE game engine includes a built-in Examination Mode that provides general development and debugging information while the game is running. Developers can observe the status of the numerous game engine flags, accumulators, stack manipulation calls, and game flow data such as act, scene, and mission information. I found several undocumented keystrokes while exploring game operation, and I’ll summarize them further on. Data Storage Essentially all of the game data is stored in files suffixed with TRE. (I will refer to these data files as TRE files.) TRE files use a very flexible, open-ended data storage format that allows for very large files. You can store hundreds of megabytes of data in a single TRE file. Listing 1 gives a general summary of the TRE file format. The first four bytes in the file contain the XTRE ASCII text string. The XTRE string possibly indicates this file contains cross-referenced data records. The bytes at offsets 8 to 23 contain four pointers. The first three pointers give the file offsets (offsets into the TRE file with the first byte in the file referenced as byte 0) of three data tables. The fourth pointer gives the offset of the first Data Record in the file. The first data table in the TRE file, the Indirect Record Pointer Table, contains pointers (file offset values) that reference data in the other TRE file data tables. In C nomenclature, the Indirect Record Pointer Table contains pointers to pointers. The Indirect Record Pointer Table entries “point” to various “pointers” contained in other TRE file tables. Each entry in this table is an 8-byte structure. The first four bytes are bit flags and the last four bytes contain the pointer expressed as a 32bit long value. I observed that the Indirect Record Pointer Tables of several TRE files had “blanks” or empty data slots. As I mentioned earlier, the TRE file format is flexible and expandable, and these empty data slots are probably part of this expandable format. The Path Name Table follows the Indirect Record Pointer Table. Embedded in this table are the ASCII text strings of the source paths along with binary (possibly file offset) data related to each path name. The Record Pointer Table follows the Path Name table. The Record Pointer Table contains the file offsets and sizes of the Data Records stored in GAME DEVELOPER • JUNE/JULY 1995 53