Introduction
TYRIAN.CFG keeps the settings that Tyrian and its setup program write: how much detail to draw, how fast to run, the two volumes,
what the joystick buttons do and which keys play. It is 28 bytes and, unlike TYRIAN.SAV, not scrambled.
The layout is OpenTyrian’s (config.c, loadConfiguration and saveConfiguration), which reads and writes the same file as the DOS game; it was checked against the real
tyrian.cfg found on this machine, which decodes to sensible values in every field.
.cfg is a very common extension. The game itself checks only the length and clamps the volumes, so it loads any 28-byte file. To keep
other programs’ files out, the explorer takes a 28-byte file for Tyrian’s when at most three of 13 checks fail:
background layer 2 is 0 or 1, speed 1 to 5, version up to 2, detail 1 to 6, difficulty up to 10, and each of the eight key codes 1 to 88. Every check that fails is marked on the
setting (“the game loads the file as it is”). A random 28-byte file passes this about once in a million times (1 of 1,000,000 measured). Any volume is accepted and one above 255 is
marked “used as 255”. A file of 10 to 27 or of 29 to 64 bytes that begins like one is shown as far as it goes with the problem marked (the game finds it invalid and uses its defaults).
Any other file is shown as text.
Fields
| Offset | Size | Name | Description |
|---|---|---|---|
0x00 | 1 | Background layer 2 | The second background layer’s setting. It is read, but OpenTyrian then sets the layer on whatever the byte says, except that detail level 1 turns it off, so the byte has no effect there. |
0x01 | 1 | Game speed | 1 Slug Mode, 2 Slower, 3 Slow, 4 Normal, 5 Turbo (OpenTyrian’s comment calls it Pentium Hyper). OpenTyrian turns it into a timing, as frames to a step and a step value: 1 Slug Mode four frames, 0x5300; 2 Slower three frames, 0x4300; 3 Slow two frames, 0x53C0 (the longest step); 4 Normal two frames, 0x4300; 5 Turbo two frames, 0x3000 (the shortest). |
0x02 | 1 | Input device | Kept for compatibility; OpenTyrian ignores it and sets it to 0. |
0x03 | 1 | Joystick configured | A flag; OpenTyrian turns a 0 into 1 when it loads the file. |
0x04 | 1 | Version | OpenTyrian’s comment: “SW 1.0 and SW/Reg 1.1 = 0 or 1, EA 1.2 = 2”. No other source for those releases was found, so that meaning is unconfirmed. OpenTyrian sets it to 2 whatever the file holds (“Game resets version number; ShipEdit doesn’t”) and writes 2 back, and nothing else reads it: so it is a marker of the program that wrote the file, never used. Real files hold 2 (the file here) and 0 (the TYRIAN.CFG in the archive.org 2.1 package). |
0x05 | 1 | Detail level | 1 Low (a 386), 2 Normal (a 486), 3 High, 4 Pentium, 5 Laptop VGA (nonstandard VGA), 6 Wild (the “super wild” effects). OpenTyrian sets from it: 1 no second background, no score display, opaque explosions; 2 the defaults (smooth scrolling, transparent explosions, score shown); 3 smooth scrolling off; 4 “wild” effects and colour filtering on; 5 smooth scrolling off; 6 “wild”, “super wild” effects and colour filtering. |
0x06 | 1 | MIDI port | Kept from the DOS setup; OpenTyrian keeps the value and does not use it. |
0x07 | 1 | Sound effects | Kept from the DOS setup; OpenTyrian keeps the value and does not use it. |
0x08 | 1 | Gamma correction | The screen brightness step, 0 to 3: a key in the game cycles it (adds 1 modulo 4) and the palette is corrected by it, at once and at the start of each level. |
0x09 | 1 | Difficulty | A signed byte: the difficulty last chosen (the numbering). |
0x0A | 4 | Joystick buttons | What buttons 1 to 4 do: 1 fire the main weapons, 2 fire the left sidekick, 3 fire the right sidekick, 4 fire both sidekicks, 5 change the rear weapon. The defaults are 1, 4, 5, 5. |
0x0E | 2 | Music volume | 0 to 255; the game treats a larger value as 255. Default 223. |
0x10 | 2 | Sound volume | 0 to 255. Default 223. |
0x12 | 1 | Player 1 input device | 0 any, 1 keyboard, 2 mouse, 3 and up joysticks. |
0x13 | 1 | Player 2 input device | The same for player 2. |
0x14 | 8 | Keys | The keyboard scan codes (IBM PC set 1) of Up, Down, Left, Right, Fire, Change fire, Left sidekick and Right sidekick, in that order. |
When the file is missing, is not 28 bytes or cannot be read, OpenTyrian starts with background layer 2 on, speed 4, version 2, detail 3, MIDI port 1, sound effects 1, gamma 0, difficulty 0, the default joystick buttons, both volumes 223, both input devices 0 and the default keys 72, 80, 75, 77, 57, 28, 29, 56 (Up, Down, Left, Right, Space, Enter, Ctrl, Alt).
Scan codes
The key bytes are the codes the PC keyboard sends: 72 Up, 80 Down, 75 Left, 77 Right, 57 Space, 28 Enter, 29 Ctrl, 56 Alt, 30 A, 32 D, and so on (letters follow the keyboard rows: Q 16 to P 25, A 30 to L 38, Z 44 to M 50; digits 2 to 11; F1 to F10 are 59 to 68). The explorer names every code from 1 to 88 that has a key.
A real file
The tyrian.cfg found here is 28 bytes: 01 04 00 01 02 04 02 04 00 03 01 04 05 05 CF 00 FE 00 00 00 48 50 4B 4D 39 1C 1E 20.
It says: background layer 2 on, speed Normal (4), joystick configured, version 2, detail Pentium (4), MIDI port 2, sound effects 4, gamma 0, difficulty Hard (3),
the default joystick buttons, music volume 207, sound volume 254, both input devices 0, and the keys Up, Down, Left, Right, Space, Enter and, for the sidekicks, A and D (codes 30 and 32)
instead of Ctrl and Alt.
Not described
Known, not yet covered
- Viewer: OpenTyrian’s own
opentyrian.cfg(a text file of video and key settings) is shown as text only.
Unknown
- Reference: what the MIDI port and sound-effects bytes mean to the DOS setup program. OpenTyrian reads them and writes them back and never uses them; the real files hold 2 and 4 (the file here) and 2 and 2 (the 2.1 package).
- Reference: a
TYRIAN.CFGwritten by Tyrian 1.0, 1.1 or 2.0: none was found (the archive.org dumps are fresh installs); the 2.1 package’s file has the layout described here.
Also used for
- INI-style configuration file – Configuration text: sections in brackets, then key=value lines.
Links
Reference
- OpenTyrian src/config.c – loadConfiguration and saveConfiguration
- Tyrian saved games – the other file of the game