Wing Commander Toolbox

Discussion in 'Fan Projects & Editing' started by UnnamedCharacter, Feb 26, 2015.

  1. UnnamedCharacter

    UnnamedCharacter Ensign

    Messages:
    93
    Likes Received:
    55
    Trophy Points:
    2,135
    Wow, it has been a long time since an update. Work on the toolbox has continued and this release has substantial changes.

    There are major API/XML changes, resulting in breaking backward compatibility. The code base has been refactored making it easier and quicker to add support for new file types.

    The ability to edit strings in the WC1 executable has finally been added; only a few strings are supported at the moment. For this release I was more concerned with getting the functionality in place and will tackle the tedious work of finding additional string pointers in the future.

    This release also begins support for WC2 and WCAcademy; only a few file types at the moment: COMM, DIFFLEVL, INTELSHP, PALETTE, SPEECH, WAVEINFO, etc.

    See first post for the file attachment.

    This will most likely be the only update for this year; Merry Christmas everyone.
     
  2. UnnamedCharacter

    UnnamedCharacter Ensign

    Messages:
    93
    Likes Received:
    55
    Trophy Points:
    2,135
    WC1 EXE String Editing

    Editing strings in an executable is tricky; there are several constraints. The total amount of space available for strings cannot change; to make one string longer, another has to be made shorter. Strings can be grouped together into a block, with many blocks and individual strings spread across different locations within the executable.

    For example, imagine the following scenario of 4 strings divided into 2 blocks.

    Original layout of strings: 5, 5, 5, 10 = 25 characters
    [DATA] [ string5, string5, string5 ] [DATA] [ string10 ]

    Modified strings: 3, 3, 3, 16 = 25 characters
    Failure: not enough continuous string area for a string with a length of 16

    Modified strings: 8, 3, 3, 11 = 25 characters
    Failure: cannot fit all strings
    [DATA] [ string11, string3, (empty1) ] [DATA] [ string8, (empty2) ]​

    The good news, there are several strings within the executable which can easily be sacrificed with no real impact: the error messages, the information to purchase Secret Missions, and even the credits if necessary. I do not recommend making the sacrificial strings empty, in case the game needs to display a message, but instead to make them as short as possible. At the moment, the algorithm used to position strings is very simple; it does not try to maximize available space.

    Use the following XML to produce the result in the images bellow.

    Code:
    <ExeFile>
      <ExeFile.Strings>
        <ExeFileStrings>
          <ExeFileStrings.Bar>
            <ExeStringItem Value="Talk to SHOTGLASS." />
            <ExeStringItem Value="A longer talk to ??????????????" />
            <ExeStringItem Value="Talk to ??????????????" />
            <ExeStringItem Value="Check pilot scores" />
            <ExeStringItem Value="Enter barracks" />
            <ExeStringItem Value="Fly training mission" />
            <ExeStringItem Value="A longer talk to %s." />
            <ExeStringItem Value="" />
            <ExeStringItem Value="Talk to %s." />
            <ExeStringItem Value="" />
          </ExeFileStrings.Bar>
          <ExeFileStrings.ErrorMessage>
            <ExeStringItem Value="Sorry, an error has occured..." />
            <ExeStringItem Value="You do not have enough memory." />
          </ExeFileStrings.ErrorMessage>
    ...
    
    wc-left.png wc-right.png
     
  3. UnnamedCharacter

    UnnamedCharacter Ensign

    Messages:
    93
    Likes Received:
    55
    Trophy Points:
    2,135
    Since there has been a few post recently about medal scores, I thought I would update the WC1LiveViewer. It has the same restrictions as before, only Kilrathi Saga is supported (WC1.EXE and wing1.exe).

    To use it, start the game, then this program (WC1LiveViewer). If it recognizes the running process, it will populate the table with game data. Since the game data is continuously updating, I find the best approach is to keep pausing the game during gameplay.

    wc1liveviewer-medalscore.png
     

    Attached Files:

  4. UnnamedCharacter

    UnnamedCharacter Ensign

    Messages:
    93
    Likes Received:
    55
    Trophy Points:
    2,135
    Another update with more support for WC2/Academy file types: ALTINT, ALTSHIPS, INTEL, MISSILE, MODULE, PCSHIP, SHIP, and XSHIP. Also updated WC1 EXE file to support editing of closing dialog, comm message, insert disk, landing comment, medal, mission type, rank, and stranded strings.

    See first post for the file attachment.
     
    Last edited: Feb 8, 2018
  5. YPersonified

    YPersonified Petty Officer

    Messages:
    10
    Likes Received:
    5
    Trophy Points:
    585
    Thanks again. Good to see you back with more updates.

    I have a problem while trying to pack WC.EXE.XML with the latest 4.1.0. I chose random destination, clicked Pack, then it says it can't find WC.EXE.

    So I tried the folder with WC.EXE instead, but this 'Unable to fit all executable strings' message pops up and fail.

    Any suggestions?
     
  6. UnnamedCharacter

    UnnamedCharacter Ensign

    Messages:
    93
    Likes Received:
    55
    Trophy Points:
    2,135
    That is the intended behaviour, although perhaps not necessarily obvious as to why. When packing a data file from XML source, a new data file is created; therefore any destination location can be chosen. But, when packing an executable file, a new file cannot be created and must instead be merged with an existing executable file; hence the message of not being able to find WC.EXE.

    The total amount of space available for strings cannot change; to make one string longer, another has to be made shorter. There are several strings within the executable which can easily be sacrificed with no real impact, such as: error messages, information to purchase Secret Missions, etc. I provided more detail in a previous post.
     
    ChrisReid likes this.

Share This Page