Wing Commander Toolbox

That's fantastic, thank you very much! All of the in flight stuff now loads fine in WCVIew. Looks like the menu/UI has a different pallette but this is a great start.
 
Very cool project! It got me started and so I untreed The priv.tre file to edit some ship stats. Precisely I'm looking for how to boost ship max velocity and afterburner speed. Am I right that ship stats are defined in the DATA/TYPES/... iff files? I did find the values for armor (presumably) following the ascii chars: "SHIELDS_?_ARMR___| v1 v1 v2 v2 v1 v1 v2 v2" , where v1 and v2 stand for the armor thickness respectively. Unfortunately, I can't find anything related to speed. Could you point me to that, i.e. for the tarsus and or the galaxy?
 
Nevermind, I sorted it out. If its helpful for anybody, here is how its done (CD Version):
1. open the Priv.tre in your favorite HEX Editor.
2. Search for the ship you want to edit, ie Tarsus
3. The relevant speed values can be found between the strings "GUIDSHIP" and "Tarsus ARMR" (both case sensitive)
4. Convert the default ship speed and your target value to Hex. Bot Max Speed and Afterburner speed are defined here.
5. The Hex values are flipped, so a value of 03 E8 will be E8 03 in the file. In the screenshot example, I've set afterburner speed to 1000 kps = HEX 03 E8 and max speed to 500 kps = HEX 01 F4

the range where you can find the values is highlighted in red:

PrivTre.JPG
 
Hi,
My English is bad, sorry.
We translate the add-ons in French of the game Wing Commander 2 French version.
We have two problem:
1) We would like subtitles and voices during videos for add-ons (SO1 and SO2).
We modified wc2.cfg file for to have subtitles only.
It works for Deutsch, English, French versions and two add-ons (SO1 and SO2).
We modified wc2.cfg file for to have subtitles + voice.
It works for Deutsch and French versions. But It does not work for English version and two add-ons (SO1 and SO2).
2) Add-ons do not recognize font (FONTS.FNT). We can not write French letters (à, â, é, è, ç, etc.)

I hope you can help us, thank you.
Regards.
 
Addressing your second question first, the issue appears to be a design choice made for WC2. In WC1, the in-game text variables are escaped with a dollar sign ($):

$N - last name​
$C - call sign​
$K - mission kills​
$L - wingman mission kills​
Example text: "Farewell, $C. You'll be missed."​

But in WC2, text variables are encoded using character code points greater than ASCII:

133; 0x85: à - last name​
134; 0x86: å - call sign​
135; 0x87: ç - mission kills​
136; 0x88: ê - wingman mission kills​
137; 0x89: ë - first name​
Example text: "å was an excellent pilot, and a true friend."​

This seems to cause problems handling characters beyond ASCII. The French version of WC2.EXE is a custom executable and appears to have special handling for characters greater than ASCII; this special handling is obviously missing from the SO1 and SO2 executables. I suspect there is no actual solution to this, but I can offer a work around, well actually more like a hack. It involves replacing printable characters that are not likely to be used in text.

As a proof of concept, I modified the FONTS.FNT and SERIES.S01 files:

Code:
<FntFile>
  <FontBlock BackgroundColor="0" ForegroundColor="15">
    <FontBlock.Glyphs>
      <GlyphItem />
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem001.gif" />
...
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem130.gif" /><!--035 # -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem131.gif" /><!--036 $ -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem132.gif" /><!--037 % -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem133.gif" /><!--038 & -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem039.gif" />
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem135.gif" /><!--040 ( -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem136.gif" /><!--041 ) -->
...

Code:
<ContainerFile>
  <ContainerBlock>
    <ContainerBlock.Chunks>
      <ContainerGroup>
        <TextGroup>
          <SymbolChunk>
            <SymbolChunk.Items>
...
              <SymbolItem Text="Test: #$%&amp; ()" /><!-- éâäà çê -->
              <SymbolItem Text="Example: ...parler au Prince Thrakhath en t)te-&amp;-t)te" /><!-- tête-à-tête -->
...

so1_007.png
so1_008.png


It is obviously far from ideal, but workable. Perhaps the best approach would be to use the correct characters and do a search-and-replace before processing with the WCToolbox.


As for subtitles and speech, I suspect the issue here is the same as above, no special handling in SO1 and SO2. Can you share the configuration setting you used, I will look further into it.
 
Last edited:
Have you made any headway on figuring out Wing Commander Academy's executable? I'd be very interested to finally have the correct stats for the Academy-exclusive weapons.
 
(Second message at 1 am)
@ UnnammedCharacter,
Hi,
I thank you for your answer and your help.
I am bad at IT ((computer).
I used WCTools.
I wanted to try to change the font. For example for é
I extracted FONTS.FNT file.
I have 762 PNG +1 FONTS.FNT.txt files.
I modified: FONTS.FNT-Block001-Glyph233.png + FONTS.FNT-Block002-Glyph233.png
I do not know how to insert new font for test.

Otherwise, I have a font for my hex editor (Sierra/wc2 codes). Because I translate other games (Sierra).
It is my table of codes:

--------- Sierra ------------------------WC2

â= =131=83 /// e2= 226 ----------â= =131=83
à= =133=85//// e0= 224 -- -------à= =133 =85
ç= =135=87//// e7= 231-----------ç= =135=87
é= =130=82/// e9= 233-----------é= =130=82/
ê= =136=88//// ea= 234 ---------ê= =136=88/
ë= =137=89//// eb= 235---------- ë= =137=89/
è= =138=8a//// e8= 232----------è= =138=8a
ï= =139=8b//// ef= 239-----------ï= =139=8b
î= =140=8c//// ee= 238---------- î= =140=8c/
ô= =147=93//// f4= 244----------ô= =147=93
ö= =148=94//// f6= 246---------- ö= =148=94
û= =150=96//// f9= 249----------û= =150=96
ù= =151=97//// fb= 251----------ù= =151=97
--------------------------------------

For WC2.cfg file:
Delete d1 and add L/l (voice + subtitles) or C/c (Subtitles only)
WC2.cfg = voice + subtitles: v a904 c27 L or v r c27 L (Deutsch and French version).
WC2.cfg = Subtitles only: v a904 c25 C or v r c27 C or v a904 c27 C (English, Deutsch and French versions).
According WC2.cfg file.
Regards.
 
Last edited:
I do not know how to insert new font for test.

To edit content, use XML Unpack instead, make changes and then use XML Pack to recreate the game data files. Keep in mind that the font must be limited to ASCII, in other words limited to the first 128 characters. Since the WCToolbox uses XML, this also imposes an additional limitation excluding control characters; so only printable characters.
 
@ UnnamedCharacter.
Hi,
To edit content, use XML Unpack instead, make changes and then use XML Pack to recreate the game data files.

I extracted the font, thanks.

You wrote this to Rubenbirri (page 5):
1. Unpack the fonts, from the command line: WC1Xml.exe FONTS.FNT; this will extract all the font glyphs (characters) as images.
2. Edit the glyphs of the first font (from Block 0).
1. Edit individual images corresponding to the specific position of each character. For the characters you have indicated, you can use ISO-8859-1 encoding (Western European); you can find tables that list the positions of characters. For example, the character "é" is at position 233; so you would modify the image: FONTS.FNT-FontBlock000-Font-Glyph233.gif.
3. Once the edits are complete, pack the font, from the command line: WC1Xml.exe FONTS.FNT.XML.


I tried with these codes in English version:

â= =131=83 --> FONTS.FNT-FontBlock000-GlyphItem131.gif
à= =133=85 --> FONTS.FNT-FontBlock000-GlyphItem133.gif
ç= =135=87 --> FONTS.FNT-FontBlock000-GlyphItem135.gif
é= =130=82 --> FONTS.FNT-FontBlock000-GlyphItem130.gif
ê= =136=88 --> FONTS.FNT-FontBlock000-GlyphItem136.gif
ë= =137=89 --> FONTS.FNT-FontBlock000-GlyphItem137.gif
è= =138=8a --> FONTS.FNT-FontBlock000-GlyphItem138.gif
ï= =139=8b --> FONTS.FNT-FontBlock000-GlyphItem139.gif
î= =140=8c --> FONTS.FNT-FontBlock000-GlyphItem140.gif
ô= =147=93 --> FONTS.FNT-FontBlock000-GlyphItem147.gif
ö= =148=94 --> FONTS.FNT-FontBlock000-GlyphItem148.gif
û= =150=96 --> FONTS.FNT-FontBlock000-GlyphItem150.gif
ù= =151=97 --> FONTS.FNT-FontBlock000-GlyphItem151.gif

I have written in hex in SERIES.S01 file: 828385878889

It is not good. I have only ; é, â and these words "PCNAME, FIRSTNAME".

These words are in SO1.EXE file.

It is the same problem as French version

I tried with these codes in English version:
â= =e2= 226 --> FONTS.FNT-FontBlock000-GlyphItem131.gif
à= =e0= 224 --> FONTS.FNT-FontBlock000-GlyphItem133.gif
ç= =e7= 231 --> FONTS.FNT-FontBlock000-GlyphItem135.gif
é= =e9= 233 --> FONTS.FNT-FontBlock000-GlyphItem130.gif
ê= =ea= 234 --> FONTS.FNT-FontBlock000-GlyphItem136.gif
ë= =eb= 235 --> FONTS.FNT-FontBlock000-GlyphItem137.gif
è= =e8= 232 --> FONTS.FNT-FontBlock000-GlyphItem138.gif
ï= =ef= 239 --> FONTS.FNT-FontBlock000-GlyphItem139.gif
î= =ee= 238 --> FONTS.FNT-FontBlock000-GlyphItem140.gif
ô= =f4= 244 --> FONTS.FNT-FontBlock000-GlyphItem147.gif
ö= =f6= 246 --> FONTS.FNT-FontBlock000-GlyphItem148.gif
û= =f9= 249 --> FONTS.FNT-FontBlock000-GlyphItem150.gif
ù= =fb= 251 --> FONTS.FNT-FontBlock000-GlyphItem151.gif

It is not good.


We must modify FONTS.FNT.xml file?

Keep in mind that the font must be limited to ASCII, in other words limited to the first 128 characters. Since the WCToolbox uses XML, this also imposes an additional limitation excluding control characters; so only printable characters.

that is to say, I must to replace a sign with a letter? For example : [--> é, ] --> è, # --> ç, etc.

I thank you for your help.
Regards.
 
I must replace a sign with a letter? For example: '[' --> 'é', ']' --> 'è', '#' --> 'ç', etc.

That is correct. It would involve changing this:

Code:
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem089.gif" /><!-- Y -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem090.gif" /><!-- Z -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem091.gif" /><!-- [ -->

to this:

Code:
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem089.gif" /><!-- Y -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem090.gif" /><!-- Z -->
      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem130.gif" /><!-- é -->

therefore replacing '[' with 'é'.

But in text (SERIES.S01) you would need to use '[' instead of 'é'. Therefore this:

Je désire parler au Prince Thrakhath...​

would become:

Je d[sire parler au Prince Thrakhath...​

Not ideal, but workable.
 
@ UnnameCharacter,

Not ideal, but workable.

Yes, It is not ideal.

I do not understand anything anymore. I am lost.

I must to modify the file FONTS.FNT.XML? I have same mistakes (with or without modification of the XML file):

How did you do to have French letters?

My English font extract (French letters):
 
Unfortunately, the approach taken for WC1 cannot be applied to WC2. For WC2, only the first 128 glyph slots can be used, they match the ASCII characters, but further limited to printable characters as a result of XML. Now the visual aspect of these glyphs can by anything, they are just bitmaps; this is what we will be taking advantage of.

Using XML Unpack, unpack the FONTS.FNT file. Edit the resulting XML file changing the following:

Original:

Code:
line 94:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem089.gif" /><!-- Y -->
line 95:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem090.gif" /><!-- Z -->
line 96:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem091.gif" /><!-- [ -->
line 97:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem092.gif" />
line 98:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem093.gif" /><!-- ] -->

Edited:

Code:
line 94:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem089.gif" /><!-- Y -->
line 95:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem090.gif" /><!-- Z -->
line 96:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem130.gif" /><!-- é -->
line 97:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem092.gif" />
line 98:      <GlyphItem file="FONTS.FNT-FontBlock000-GlyphItem138.gif" /><!-- è -->

The above will substitute the '[' and ']' glyphs for 'é' and 'è'. In another word, the textual character '[' will use the 'é' glyph. Use XML Pack to pack the FONTS.FNT.xml into a new and updated file.

Afterward modify the SERIES.S01 file using '[' and ']' instead of the accented characters; they will display correctly in the game.

Qu'est-il arriv[ au pilote humain qui nous a caus[ tant de probl]mes?​


so1_007.png



Using WCTools, unpack both the FONTS.FNT and SERIES.S01 files. In the attachment are replacement XML files, use these to replace the unpacked ones. Then re-pack both files.
 

Attachments

@ UnnameCharacter.
Hi,
I thank you for your help and your patience:


I explained (expressed) myself badly. I have already modified a font like WC2.
I do not edit the glyphs in WC2. But I edit FONTS.FNT.XML file. I create a font with the new characters (French letters) for my hexadecimal editor.

The game that I translated. It was the opposite. I edited the font and location of characters (french letters).
Do not pay attention to colors (red and blue), it is an old screenshot.
With Dorian Grey's tools:


In your opinion for voice + subtitles in SO1and SO2 add-ons. It is possible or not?

Regards.
 
PS: WARNING, I changed FONTS.FNT file . Because there was an error, sorry.

New font for wc2 and font (tbl) for hexadecimal editor. (French version)
 

Attachments

Last edited:
In your opinion for voice + subtitles in SO1 and SO2 add-ons. It is possible or not?

No, not from the configuration file or the command-line. This functionality was specifically added in the non-English WC2.EXE executables. That said, I think I understand how it was done and I can mimic the functionality, but it requires hacking the English executables (WC2, SO1, and SO2). It is a small change that can easily be done with a hex-editor:

Code:
WC2.EXE, file size: 363696; pos: 307112; from  B0 01 --> B0 00
SO1.EXE, file size: 363600; pos: 306584; from  B0 01 --> B0 00
SO2.EXE, file size: 354400; pos: 312584; from  B0 01 --> B0 00

I have barely tested this, but it seems to work.
 
Work on the toolbox has continued. Took a little longer than I was hoping for, but this release begins support for Wing Commander Armada.

This update adds the ability to create or edit many of the Armada file types: IFF, PAK, PAL, SHP, TEP, and TRE. Most of the file types are common to Privateer and therefore make use of the same command format; you can view previous posts for examples. At the moment, there is no support for the 3D models.

See first post for the file attachment.

ARROW000.SHP-Shape000.PNG
DRALT000.SHP-Shape000.PNG
 
Armada has many shape files where each individual shape is a glyph in a font. Previously these were treated as any other shape file, but this produces hundreds of images. For Armada, I decided to include a specialized command for these kinds of shape files: font / unfont.

Let's start by extracting the files from a tree file:

WCArmToolsCmd.exe untree DATA.TRE​

Next we convert the palette file into an image for use later when unmaking the font:

WCArmToolsCmd.exe unpalette DATA\PALETTE\NETSCREN.PAL​

Finally, we convert the font (actually a shape file) into an image:

WCArmToolsCmd.exe unfont DATA\GAMEFLOW\NETFONTR.SHP /p:NETSCREN.PAL.PNG​

This will output an image representing the font, and a script to run which will remake the font (shape) file (I have enlarged the result since in this case it is a particularly small font).

NETFONTR.SHP; Scaled.png


Code:
…
rectangularregion 1 29 1 1
inputfile NETFONTR.SHP.PNG  # ascii @ (0x40)

rectangularregion   7  25   4   5
inputfile NETFONTR.SHP.PNG  # ascii A (0x41)

rectangularregion  13  25   3   5
inputfile NETFONTR.SHP.PNG # ascii B (0x42)
…

To make a font (shape) file:

WCArmToolsCmd.exe font NETFONTR.SHP.SCR​
 
Back
Top