Wcdx - Kilrathi Saga for modern Windows

Stinger

Vice Admiral
Updates:
  • [2021-09-11] - wcdx-2.2.1: Official 2.2.1 release. Fixes cockpit damage and VDU static.
  • [2020-10-10] - wcdx-2.2: Official 2.2 release. Supports Wing Commander 2 and Special Operations 1 and 2.
  • [2018-07-25] - wctools: First release of tools used to help develop wcdx.
  • [2018-07-02] - wcdx-2.0-alpha2: Slightly less full of bugs.
  • [2015-09-06] - wcdx-2.0-alpha1: First playable Wing Commander 2 release. Probably full of bugs.
  • [2015-04-07] - wcdx-1.2: Official 1.2 release. This is 1.2-beta4 rebranded as 1.2.
  • [2015-03-30] - wcdx-1.2-beta4: Fixed crash on minimize; maximize button enables full-screen mode.
  • [2015-03-22] - wcdx-1.2-beta3: Fixed loading bug with planets and added the barracks poster.
  • [2015-03-17] - wcdx-1.2-beta2: Fixed planets and joystick navigation in gameflow sequences.
  • [2015-02-28] - wcdx-1.2-beta1: First beta release featuring support for Secret Missions 2.
  • [2015-02-22] - wcdx-1.1-beta1: First beta release featuring support for Secret Missions 1.
  • [2015-01-09] - wcdx-1.0: Official 1.0 release, containing only very minor revisions from beta update 3.
  • [2014-12-31] - wcdx-1.0-beta-update3: SAVEGAME.WLD is now moved into an appropriate user-specific directory.
  • [2014-12-27] - wcdx-1.0-beta-update2: Fixed a sound bug that could cause a crash on entering autopilot.
  • [2014-12-24] - wcdx-1.0-beta-update1: Prefer local streams over streams found on the CD.

image1.png wing2.png Screenshot (27).png

Hey guys; it's been a while...

A couple of years ago long, long time ago, I started working on a patch for the Kilrathi Saga version of Wing Commander 1. Slightly less than a long, long time ago, I got sidetracked. (Narrator: It would not be the last time.) A couple of weeks ago I decided to pick the project back up, and now it's ready for an introduction. It hasn't yet been extensively tested, but I guess that's what you guys are for. Think of this as a beta. Thanks to all your support and suggestions over the years, this is all quite playable now!

2018-07-25: I've added a small collection of tools that I developed while I was figuring out the Wing Commander data formats. You can find them attached to this messages as wctools.zip. (2020-10-10: I've moved these into the main release archive.) I'll keep this updated as I release newer versions of wcdx in the future. Included is a tool to extract individual resources from gamedat files (wcres), a tool to convert image resources to PNG files (wcimg), and a tool to play music tracks from the stream files or save them as .wav files (wcjukebox). There is also now a tool for converting WC2 font resources to PNG files (wc2font). These are all command-line tools; for instructions on how to use them, just run them from the command prompt.

Here are the main features:
7338-655d01e245ff896566bc8c9c005b14a7.jpg
7339-f0885d458b210d9d2deaf6e6abd117bc.jpg
7340-3e89a20748e2395cc877595c8b91d4e1.jpg
7759-65134a7475b81ca4ff1a9a461c297c1c.jpg

  • Replaced DirectDraw calls with Direct3D 9.
    • D3D should be more maintainable going forward should the need arise to add new features or fix unexpected bugs.
    • The game no longer tries to use a hardware palette, which was poorly supported in Vista and later operating systems.
    • The game no longer switches the display resolution. Instead, it blits to a desktop-sized window. I felt a need to do this because my display (an old 23" Apple Cinema Display) couldn't handle a 320x200 resolution, but there are other benefits. By determining the precise boundaries of the image on your display, the game can ensure a correct 4:3 aspect ratio no matter what your display's size actually is. Additionally, without a mode switch, the game now goes instantly into full screen mode and back. (This is what some current games refer to as "windowed fullscreen.")
    • Oh, yeah, I also added windowed mode. At any point in the game, hit Alt-Enter to toggle between full-screen and windowed modes. The game will pick a pretty good default windowed size, but you can resize it to your heart's delight.
  • Removed all privileged instructions/API calls.
    • The game can now be run without using compatibility mode and without requiring administrative privileges.
    • The game can now be run without using administrative privileges.
    • Really. Please stop elevating the game's privilege level. UAC exists for a reason; don't disable it.
  • Compatible with Windows XP and up.
    • Actually, I haven't tested it on Windows XP, but if you give it a try and it works for you, please post here.
  • Fixed that annoying music bug.
    • You know the one. You take out that fleeing salthi, and then you get that victory fanfare, and then you get that victory fanfare, and then you get that victory fanfare, and then your roommate goes crazy and tosses your computer out the nearest window. (Old times...)
    • Actually, this is technically a separate patch because it was a data issue, but in any case it's fixed.
  • Fixed planets.
    • In the Kilrathi Saga, the vast emptiness of space was vastly empty. No longer! Now Windows gamers can enjoy the same stellar backdrops as everyone else!
  • Fixed the poster.
    • Check out that poster!
  • Secret Missions 1 and 2 support!
  • Now with support for Wing Commander 2!
    • And Special Operations 1!
    • And Special Operations 2!
  • Tools for all (well, some) of your data extraction needs! This release includes tools for extracting game resources from the data files, including sprites, fonts, and more!
    • wcres for extracting resources
    • wcimg for converting extracted resources to PNG images
    • wc2font for converting the resources in fonts.fnt to PNG images
  • Do you love George Oldziey's prerendered digital arrangements of the original MIDI scores? With wcjukebox, now you can sit back, relax, and let the WAVs wash over you!
  • Fixed cockpit damage and VDU static.
    • Fly without a radar in WC2!
Caveats:
  • The patch only works for the executables distributed with the add-on packs for WC1 and WC2. If you haven't installed the add-on packs, the patch will do you no good.
  • Cut scenes in WC2 are... well, they're not quite right. They're overly responsive to player input, skipping important bits of dialogue here and there (especially if you click to move to the next line; this will often skip two lines of dialogue). The timings are also pretty bad. For whatever reason, Origin reworked the scripted sequences to play back at a very high frame rate, but didn't adjust all the timings properly, resulting in bugs such as fighter cockpits floating in the middle of space, without the rest of the fighter attached. This is a data issue, and I haven't figured out a good approach to fixing it yet.
  • I haven't yet touched WC3. It's a lot of work, but it's not impossible that I'll do something with it at some point.
The surprisingly awesome news:
  • Because it's a data patch, the annoying music bug is fixed throughout both Wing Commander 1 and the Secret Missions pack. (I vaguely recall that it wasn't an issue in WC2.)
How to use it:
  1. Install the game. You can use the installer from the CD if you wish, but my preferred method is to simply take the WC1 and WC2 folders and copy them somewhere. You can also use the PC Gamer release, available from the CIC Downloads section. If you use the installer, be sure to go back and copy the streams directory afterward. This will allow you to run the game without the CD, and (more importantly) is required in order for the music patch to work.
  2. Install the Secret Missions add-on pack. Once again, you can use the included installer, or you can simply copy the files over. If you choose to do it manually, note that every file that isn't an executable (.exe) belongs in the gamedat directory.
  3. Install the Special Operations add-on pack. This time, if you're installing it manually, be sure to rename the original wc2.exe to Wing2.exe. (The wc2.exe that is in the Special Operations zip file is a launcher, not the game itself.)
  4. Copy wcdx.dll, wcpatch.exe, and patchmusic.exe into the directory containing Wing1.exe.
  5. Open a command prompt and run this command: wcpatch Wing1.exe Wing1_wcdx.exe
  6. For Secret Missions support, repeat step 5 for SM1.EXE, SM2.EXE and TRANSFER.EXE.
  7. Run this other command: patchmusic streams\mission.str
  8. For Wing Commander 2 and Special Operations, repeat step 5 for Wing2.exe (don't forget step 3!), SO1.exe, and SO2.exe. There is no need to run patchmusic for Wing Commander 2.
  9. Try it out! Double-click on Wing1_wcdx to start the game. If everything works the way you expect it to, you can delete your old Wing1.exe and rename Wing1_wcdx back to Wing1.
Where to get it:
  • Right here on GitHub!
  • I've also attached the latest binaries to this post, and will keep it updated as newer versions are released.
Screenshot (42).png
 

Attachments

  • image2.png
    image2.png
    290.3 KB · Views: 976
  • image3.png
    image3.png
    409.9 KB · Views: 1,022
  • wcdx-2.2.1.zip
    830.3 KB · Views: 193
Last edited:
Awesome, can't wait to find the time to try this out!

May I ask, how something like that is accomplished on a technical level?
I guess lots of debugging and assembler is necessary?
 
Yup, that's pretty much it. It also helps (in the same way that having a job "helps" pay the rent) to have a good static analysis tool; I used IDA Pro (freeware version here) to track down all the spots where the game calls into DirectDraw, then replaced those with calls into my own dll (wcdx.dll). Other enhancements were possible by tweaking the code here and there, sometimes just changing a constant to add or remove a flag, sometimes replacing short snippets with my own code. The hard part lies in figuring out what the original programmers intended when they wrote the code, and for that IDA is indispensable.
 
Well, this is embarrassing; I just discovered that the music bug isn't actually fixed. I'll have to look into that one some more.
 
Turns out I was right the first time; the music patch does work. However, it only works if the game is looking at the right stream. If you have the CD inserted, the game will find the stream there, ignoring my patched version. I've now updated the game patch to look for streams locally before looking for the CD.
 
Very cool project! My KS CDs have been gathering dust for years because of DOSBox and GOG. I might have to break them out when I get back and try this out.

Keep up the good work!
 
I'll have to give this a serious look.

Haven't had much time tor flying lately but this changes my priorities for my game time. I have a very stable install running on a Vista x86 OS (yeah, yeah, people laugh about and even bash Vista but I have more stability from my older titles in Vista, as opposed to XP and 7 x64.). I've always enjoyed it despite some of the gripes it receives... except for that music bug. It does get on the nerves some hearing the victory bars over and again. Fixing that alone is a Godsend to me.

Always happy to see the coders in this community work their asses off improving and modding the games as my talents exist in a different disciplines.
 
Can this also be applied with the free KS-WC1 that was on some demo disk and has been hosted here?
 
I haven't tried it, but probably; the patch actually applies to the Wing1.exe that shipped with the Secret Missions pack, so as long as that works, you should be fine.
 
I've just fixed a bug that could cause a crash on entering autopilot. Updated release attached to original message.
 
I really appreciate your work and I am so hopeful to see you extend it to the rest of the games. Even if it is lots of work and you are only one person I trust your passion for the Kilrathi Saga will eventually bring you there.

Keep it up and thanks again!

PS One question: how does your patch compare to the one found here: https://www.wcnews.com/wcpedia/DirectDraw_Hack - could you also in the future provide a bilinear filter (or better) like the DirectDraw_Hack does?
 
Last edited by a moderator:
Thanks! Let me know how your play-through goes; I've managed to complete a full play-through without a hitch, but I'd like some feedback from others to help decide what to focus on next.
 
Salk: ddhack (as I understand it; I never actually tried it out) is a more general patch for any game that uses DirectDraw. Mine is targeted specifically at this game. Where ddhack is limited to replacing graphics functions only, my approach allows me to solve other kinds of problems (in addition to the graphical issues), but at the cost of having to modify each game individually. In theory, this becomes easier over time as I learn more about the overall design of the games, but there's still a ton of work reimplementing the same features for each game. I believe that the benefits of true compatibility with modern Windows are compelling enough to give it a try, and a number of smaller drive-by fixes also become possible. (For example, the original version of the game would often crash on exit due to a double-free of a semaphore. This wasn't necessarily noticeable, but I fixed it anyway.)

As it happens, my approach to the graphical side is more-or-less the same as what ddhack did: Apply the color palette in software, blit and scale the frame in hardware. The difference is that my patch doesn't pretend to be DirectDraw; instead, the game actually knows about my DLL and its interface.

Filtering is certainly a strong possibility for the future. Since it's purely a graphical effect, it also wouldn't take any extra effort to support on the other games once they know how to talk to the DLL.
 
I've added a new release that moves the SAVEGAME.WLD file into an appropriate user-specific directory. On Windows Vista and higher, this should be the user-specific saved games directory (usually "Saved Games" under your Windows user directory); on XP, this should be the local application data directory. This change means that the game's application directory can remain immutable, which should work better for installs into the system's Program Files directory.

If anyone out there has been trying this out, please let me know by posting to this thread. It will help me to gauge the interest in this project and verify the stability of the current release. At this point, I think I have everything in place that I'd like for 1.0 (before moving on to the next title), but I'd like to be sure it's working as well as I think it is.
 
Thank you a lot, Stinger.

Unfortunately at this time I am not planning a WC1 gaming session but I'll be sure to report anything that is worth your attention once I come around to it.
 
Now that the beta has had some bake time, I've officially promoted it to 1.0, with only very minor revisions from 1.0 beta update 3. Wing Commander 1 is fully playable, but the mission packs are not.

Next up is Secret Missions 1. I've already converted the transfer program to use WCDX (although that's not part of the 1.0 release), but with the resumption of my normal workload following the holiday break, I have less time available for working on this project. I'll try to set aside some weekend hours; hopefully it won't be too long before we can start chasing the Sivar dreadnought.

Happy flying!
 
This is awesome and congratulations on the fine work. No big deal, but I just thought I'd throw this at you...planets in the backgrounds for WC1?
 
Can you explain what the problem was with the music bug? It drove me nuts and made me give up on at least one KS playthrough
 
This is awesome and congratulations on the fine work. No big deal, but I just thought I'd throw this at you...planets in the backgrounds for WC1?
Can you remind me what that issue was? I did notice that the victory sequence was missing the planet, but I haven't looked into it; where else should they be?
 
Back
Top