Wing Commander Toolbox

UnnamedCharacter

2nd Lieutenant
The following is another example for extracting the random male faces, which includes facial features and a few uniforms.

We start by extracting the files from a tree file:

Priv1ToolsCmd.exe untree GAMEFLOW.TRE​

Next we unmake an interchange file since it contains the palette we need:

Priv1ToolsCmd.exe unmake DATA\OPTIONS\FACES.IFF /t:Interchange​

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

Priv1ToolsCmd.exe unpalette FACES000.PAL​

Next we extract the packets from a pack file since it contains the shapes we need:

Priv1ToolsCmd.exe unpack DATA\OPTIONS\RANDMALE.PAK​

This step is optional, we rename the packets to indicate they are shape files:

rename RANDMALE.PAK-Packet0??.PCK RANDMALE.PAK-Packet0??.SHP​

Finally, we convert the shapes into images:

Priv1ToolsCmd.exe unshape RANDMALE.PAK-Packet0??.SHP /p:FACES000.PAL.PNG​


example-face.PNG
example-noses.PNG

example-uniform1.PNG
example-uniform2.PNG



A bit weird to look at that disembodied head without ears.
 

UnnamedCharacter

2nd Lieutenant
The following is another example for extracting the conversation voices; requires the CD version.

We start by extracting the files from a tree file:

Priv1ToolsCmd.exe untree PRIV.TRE​

Next we extract the packets from all the conversation pack files:

Priv1ToolsCmd.exe unpack DATA\CONV\*.VPK
Priv1ToolsCmd.exe unpack DATA\CONV\*.VPF​

This step is optional, we rename the packets to indicate they are voice files:

rename *.PCK *.VOC​
 

UnnamedCharacter

2nd Lieutenant
The following is an example for making a simple game data modification: changing the landing fee.

We start by extracting the files from a tree file:

Priv1ToolsCmd.exe untree GAMEFLOW.TRE​

Next we unmake an interchange file:

Priv1ToolsCmd.exe unmake DATA\OPTIONS\LANDFEE.IFF DATA\OPTIONS /t:Interchange​

Edit the "DATA\OPTIONS\LANDFEE.XMF" file and change the fee to "100" credits.

Code:
FORM "LFEE"
{
    CHUNK "DATA"
    {
        long 100
    }
}
Next we recreate the interchange file (from DOSBox if in 64-bit Windows):

XMIFF.EXE DATA\OPTIONS\LANDFEE.XMF DATA\OPTIONS\LANDFEE.IFF​

Finally, we recreate the tree file:

Priv1ToolsCmd.exe tree GAMEFLOW.TRE.SCR​
 

Darkmage

Vice Admiral
Finally the tool we've been waiting for! What language is the toolset written in? Nevermind, the toolset appears to run fine under Mono. I just dumped out all the Privateer speech.
 
Last edited:

Bandit LOAF

Long Live the Confederation!
I just wanted to say thank you, this is going to help me out a great deal. I'm so glad you're working on this.
 
  • Like
Reactions: AD
@UnnamedCharacter I want to say thank you very much for the tool you've made. I was trying to extract the WC2 font and received this error. The WC 1 extracted fine so I don't know what I'm doing wrong.
upload_2018-9-23_11-27-4.png


As to the tool I think it would be nice if we could permanently set the default path for each of the WC games supported and that it would show all the files it could extract from that game. Also it would be nice if we could permanently set the destination to be a folder of the same name under WCTools with a button to open the folder after extracted. I know it would make things a bit complex but it would make it far easier and faster to use.

Keep up the great work! :D
 

UnnamedCharacter

2nd Lieutenant
Do you think you might implement some of the ideas I mentioned above at some future release?
I would like to say yes, but it's not likely. Not because they are not good ideas, they are, it's a matter of time and where to focus that time. You'll notice none of the new Privateer functionality is included as well; that's because I am not investing any time in the WCTools UI.

I realize working at the command-line is not for everyone, but maybe the attached ZIP file can help a little, just unzip into the WCToolbox folder. The ZIP file includes batch files to extract all the assets from WC1/2/Acad. That way you only need to go to the command-line once.

From the command-line, to view the simplistic help:

WC1ToolsCmd-ExtractAll.cmd /?​

Code:
Wing Commander 1 Extract All Script

Extracts all supported files.

WC1ToolsCmd-ExtractAll source [output]

  source  The Wing Commander 1 source directory.
  output  The extraction output directory.

From the command-line, to extract all the assets:

WC1ToolsCmd-ExtractAll.cmd path-to-WC1​

Code:
Wing Commander 1 Extract All Script

Source: C:\WCToolbox\workspace\WC1
Output: C:\WCToolbox\workspace\WC1-Extracted

Extracting CRUSADE.CFG file... FAILURE; Unsupported source file.
Extracting INSTALL.EXE file... FAILURE; Unrecognized executable file.
Extracting SM2.EXE file... SUCCESS
Extracting TRANS2.EXE file... FAILURE; Unrecognized executable file.
Extracting TRANSFER.EXE file... FAILURE; Unrecognized executable file.
Extracting WC.EXE file... SUCCESS
Extracting WINGCMDR.CFG file... FAILURE; Unsupported source file.
Extracting ARROW.VGA file... SUCCESS
Extracting BRIEFING.000 file... SUCCESS
Extracting BRIEFING.001 file... SUCCESS
Extracting BRIEFING.002 file... SUCCESS
Extracting BRIEFING.VGA file... SUCCESS
Extracting CAMP.000 file... SUCCESS
Extracting CAMP.001 file... SUCCESS
Extracting CAMP.002 file... SUCCESS
Extracting COCKPIT.VGA file... SUCCESS
Extracting COMMSM2.DAT file... SUCCESS
Extracting COMMUNIC.DAT file... SUCCESS
Extracting CONVERT.PAL file... SUCCESS
Extracting DISK.001 file... SUCCESS
Extracting DISK.002 file... SUCCESS
Extracting DISK.003 file... SUCCESS
Extracting DISK.004 file... SUCCESS
Extracting DISK.005 file... SUCCESS
Extracting FONTS.FNT file... SUCCESS
Extracting GAME.PAL file... SUCCESS
...

I actually forgot I had these files.
 

Attachments

Thanks for the file @UnnamedCharacter I look forward to trying it. :D
I understand your time it limited and i really appreciate all the effort and work you've put into it. (I'll still cross my fingers for the UI ;D)
 

UnnamedCharacter

2nd Lieutenant
A quick update to the toolbox, this time adding a new console application. This new application will act as a catch-all for functionality that is either applicable to most of the games, or not specific to any game.

Included in this release is a palette remap command which converts the colors of an image to a different color palette; this allows for easily moving paletted images between games. The process used is fairly straight forward, simply finding the closest color match without making any changes to the image beyond the colors. Bellow is a complete example to move the external views of a WC2 ship to WC1.

See first post for an updated download.


Unpack the Tiger's Claw (WC1; SHIP.V08) ship file:

WC1ToolsCmd xmlunpack WC1\GAMEDAT\SHIP.V08 workspace\SHIP.V08\SHIP.V08.xml​

Unpack the Concordia (WC2; SHIP.V18) ship file:

WC2ToolsCmd xmlunpack WC2\GAMEDAT\SHIP.V18 workspace\SHIP.V18\SHIP.V18.xml​

Remap the colors of the Concordia images using the Tiger's Claw palette:

WCToolsCmd remap workspace\SHIP.V18\SHIP.V18-ImageBlock0??-ImageItem0??.gif workspace\SHIP.V08-remapped\ /palette:workspace\SHIP.V08\SHIP.V08-ImageBlock000-ImageItem000.gif​

Copy the Tiger's Claw XML file:

COPY workspace\SHIP.V08\SHIP.V08.xml workspace\SHIP.V08-remapped\​

Edit the copied Tiger's Claw XML file using the Concordia values:

Code:
<ShipFile xmlns="http://www.wctoolbox.com/2017/WC1">
  <ImageBlock>
    <ImageBlock.Items>
      <ImageItem Origin="83,32" file="SHIP.V18-ImageBlock000-ImageItem000.gif" />
    </ImageBlock.Items>
  </ImageBlock>
  <ImageBlock>
    <ImageBlock.Items>
      <ImageItem Origin="36,62" file="SHIP.V18-ImageBlock001-ImageItem000.gif" />
    </ImageBlock.Items>
  </ImageBlock>
...
Pack the remapped Concordia:

WC1ToolsCmd xmlpack workspace\SHIP.V08-remapped\SHIP.V08.xml​


wc_276.png
wc_277.png
wc_278.png


wc_281.png



Looks like this little fella got lost; he's a long way from the Gemini sector.

wc_280.png
wc_281.png
wc_283.png
 

UnnamedCharacter

2nd Lieutenant
Another quick update to the toolbox, adding support for editing of ship view mappings; this enables making use of the full 62 image set for ship views.

Code:
<ExeFile xmlns="http://www.wctoolbox.com/2017/WC1">
  <ExeFile.ShipViewImageMappings>
    <ShipViewMappingItem
        Missile="0 1 2 3 4 5 6 7 6 5 4 3 2 14 13 12 11 10 9 8 9 10 11 12 13 15 16 17 18 19 20 21 20 19 18 17 16 14 13 12 11 10 9 8 9 10 11 12 13 1 2 3 4 5 6 7 6 5 4 3 2 0"
        Ship="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62"
        StarPost="0 1 2 3 1 3 2 1 2 3 1 3 2 4 5 6 4 6 5 4 5 6 4 6 5 7 8 9 7 9 8 7 8 9 7 9 8 10 11 12 10 12 11 10 11 12 10 12 11 13 14 15 13 15 14 13 14 15 13 15 14 16" />
  </ExeFile.ShipViewImageMappings>
  <ExeFile.ShipViewModifierMappings>
    <ShipViewMappingItem
        Missile="0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 2 2 2 2 2 2 2 3 3 3 3 3 2"
        Ship="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
        StarPost="0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0" />
  </ExeFile.ShipViewModifierMappings>
...

I also migrated the functionality of the WC2Assembler application into the toolbox; adding the disassemble/assemble command pair to the WC2 tools. At the same time, I took the opportunity to remove the previous limitation on jump target values and to update the instruction listing from opcode values to actual names, borrowing heavily from the list provided by @lskovlun.

See the first post for an updated download.


Here is an example, start by unpacking the container file and then disassemble the bytecode:

WC2ToolsCmd.exe xmlunpack SERIES.S00
WC2ToolsCmd.exe disassemble SERIES.S00-ContainerBlock000-*.bin​

Code:
; SERIES.S00-ContainerBlock000-ContainerGroup-SceneGroup-ScriptGroup-OffsetChunk.asm

.entry ;   0
  _0000: yield
  _0001: load.const1              15
  _0003: set.style.color
  _0004: load.global               4
  _0006: load.const1               0
  _0008: compare.eq
  _0009: branch.false          _0011
  _000c: run.sequence             22
  _000e: branch                _0052
  _0011: load.global               4
  _0013: load.const1               1
  _0015: compare.eq
  _0016: branch.false          _001e
  _0019: run.sequence             23
  _001b: branch                _0052
  _001e: load.global               4
  _0020: load.const1               2
  _0022: compare.eq
  _0023: branch.false          _002b
  _0026: run.sequence             24
  _0028: branch                _0052
  _002b: load.global               4
  _002d: load.const1               3
  _002f: compare.eq
  _0030: branch.false          _0038
  _0033: run.sequence             25
  _0035: branch                _0052
  _0038: load.global               4
  _003a: load.const1               4
  _003c: compare.eq
  _003d: branch.false          _0045
  _0040: run.sequence             26
  _0042: branch                _0052
  _0045: load.global               4
  _0047: load.const1               5
  _0049: compare.eq
  _004a: branch.false          _0052
  _004d: run.sequence             27
  _004f: branch                _0052
  _0052: set.palette               0,     0,   255
  _0056: branch                _0000
 
@Bandit LOAF I've had two WC1 fonts done for years now. That's what I used in the story guides I released here. (Wherever they are?) I recently notice that they expanded the number of characters in WC2 and when I find some time I want to add the new characters into the font.
It might be interesting to see if the fonts from WC2 can be ported to WC1 in the hopes that someday someone could translate WC1 into other languages: German, French, etc. It can't be done with the present WC1 character set but with the added characters from WC2 I think it could be done.
 
Last edited:

Bandit LOAF

Long Live the Confederation!
@Bandit LOAF I've had two WC1 fonts done for years now. That's what I used in the story guides I released here. (Wherever they are?) I recently notice that they expanded the number of characters in WC2 and when I find some time I want to add the new characters into the font.
It might be interesting to see if the fonts from WC2 can be ported to WC1 in the hopes that someday someone could translate WC1 into other languages: German, French, etc. It can't be done with the present WC1 character set but with the added characters from WC2 I think it could be done.
That's great! Could you post them here? (Or maybe I can extract them from the story guides.)
 
Top