Introducing wcdx - Kilrathi Saga for modern Windows

Discussion in 'Fan Projects & Editing' started by Stinger, Dec 23, 2014.

  1. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    Updates:
    • [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.
    Hey guys; it's been a while...

    A couple of years ago, I started working on a patch for the Kilrathi Saga version of Wing Commander 1. Slightly less than a couple of years ago, I got sidetracked. 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.

    Here are the main features:
    [​IMG][​IMG][​IMG][​IMG]
    • 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!
    The bad news:
    • I've so far only done this for Wing Commander 1 and its add-ons (update: now with playable WC2 in a very early state!). I haven't yet touched WC2, or WC3. It's a lot of work, but it's not impossible that I'll get around to the others.
    • The patch only works for the version of Wing Commander 1 distributed with the Secret Missions pack (available here). If you haven't installed the Secret Missions pack, the patch will do you no good.
    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 folder and copy it 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. Copy wcdx.dll, wcpatch.exe, and patchmusic.exe into the directory containing Wing1.exe.
    4. Open a command prompt and run this command: wcpatch Wing1.exe Wing1_wcdx.exe
    5. For Secret Missions support, repeat step 4 for SM1.EXE, SM2.EXE and TRANSFER.EXE.
    6. Run this other command: patchmusic streams\mission.str
    7. 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.
     

    Attached Files:

    Last edited: Sep 6, 2015
    Salk, IcedFreon, wcnut and 3 others like this.
  2. delMar

    delMar Rear Admiral

    Messages:
    274
    Likes Received:
    43
    Trophy Points:
    22,635
    Gender:
    Male
    Location:
    Austria
    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?
     
  3. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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.
     
  4. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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.
     
  5. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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.
     
  6. Dundradal

    Dundradal Frog Blast the Vent Core!

    Messages:
    6,474
    Likes Received:
    145
    Trophy Points:
    51,985
    Location:
    Seattle, Washington, USA
    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!
     
  7. Whistler

    Whistler Commodore

    Messages:
    848
    Likes Received:
    138
    Trophy Points:
    16,685
    Gender:
    Male
    Location:
    Orbit
    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.
     
  8. Mace

    Mace Vice Admiral

    Messages:
    1,589
    Likes Received:
    34
    Trophy Points:
    35,135
    Location:
    Netherlands
    Can this also be applied with the free KS-WC1 that was on some demo disk and has been hosted here?
     
  9. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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.
     
  10. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    I've just fixed a bug that could cause a crash on entering autopilot. Updated release attached to original message.
     
  11. StaticReturn

    StaticReturn Spaceman

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    125
    This is awesome! Thanks for all of your hard work!
     
  12. Salk

    Salk Rear Admiral

    Messages:
    44
    Likes Received:
    5
    Trophy Points:
    21,885
    Location:
    Italy
    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: http://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: Dec 29, 2014
  13. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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.
     
  14. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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.
     
  15. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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.
     
  16. Salk

    Salk Rear Admiral

    Messages:
    44
    Likes Received:
    5
    Trophy Points:
    21,885
    Location:
    Italy
    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.
     
  17. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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!
     
    Whistler and ChrisReid like this.
  18. MartySheen

    MartySheen Rear Admiral

    Messages:
    121
    Likes Received:
    1
    Trophy Points:
    22,035
    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?
     
  19. LeHah

    LeHah 212 Squadron - "The Old Man's Eyes And Ears"

    Messages:
    7,877
    Likes Received:
    48
    Trophy Points:
    59,485
    Gender:
    Male
    Location:
    Ixion, Helios System
    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
     
  20. Stinger

    Stinger Vice Admiral

    Messages:
    823
    Likes Received:
    93
    Trophy Points:
    28,685
    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?
     

Share This Page