DirectDraw Hack

The Terran Knowledge Bank
Jump to: navigation, search
ddhack10.zip
Ddhack1.png
Creator Jari Komppa
Download Download
Filesize 56 kB


Works with Kilrathi Saga editions of Wing Commanders 1, 2 & 3 - plus the Windows version of Wing Commander 4. The program has come a long way since the initial release that added bilinear smoothing to the classic graphics. The latest edition adds several other filters, including a new deinterlacer for Wing Commander 3. On top of all this, the patch fixes some significant compatibility/palette problems that some people have experienced in recent versions of Windows.

Author's Description

In the Beginning

It all started about a month ago, when one friend of mine had decided to follow his dreams and was moving to the states, and he had to get rid of a lot of stuff. Among his discard pile was a bunch of Wing Commander games, which I bought off him, figuring they might be interesting research material, as I'm planning on a game with similar game play structure (as in story combined with game play, not a 3d space shooter).

So, I found myself in the possession of Wing Commanders 1, 2, 3 and 4, all Windows versions - the Kilrathi Saga and WC4CD to be specific. I installed the first and tried it out. My Win7 switched to 256 colors at a 640x480 resolution, but the game ran.. with completely wrong palette.

Bugged by this I played with the compatibility options, and got the game to almost work well, with the palette going wrong at some points.. so the game was sort of playable, but I hated the fact that Windows changed to 256 colors and I couldn't see my mailbox properly in the other screen, etc.

I also tried WC2 and WC3, and they had similar - or worse - problems. I even learned the steps to get WC3 to work properly:

  1. Find the WC3W.EXE executable, turn on (basically) all the compatibility options.
  2. Start task manager.
  3. Find and kill all instances of explorer.exe. Your desktop will disappear, along with the task bar.
  4. Using task manager, launch WC3W.EXE

Naturally the screen resolution and color mode will be 640x480 and 256 colors, but if you've bent backwards that much, you probably don't care all that much.

Seeing that the games use DirectDraw, I decided to roll my own.

Archive Contents

  • ddhack.cfg
  • ddhack.txt
  • ddraw.dll

ddraw.txt

DDHack v1.0
DirectDraw DLL replacement
http://iki.fi/sol/

** USE AT YOUR OWN RISK **

Copyright (C) 2010 Jari Komppa

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

-- - ---- -- --- -- ---


WHAT?
-----

This is a replacement ddraw.dll designed to work better with the host environment.
Meaning, no palette corruption, no switching the whole system to a different
graphics mode, no 256 color mode windows, no need to kill explorer.exe, etc.

Technically, it's a DLL that implements the directdraw interface (directdraw, 
directdraw2, directdrawsurface and directdrawpalette) - or well, the parts of it
that I have implemented so far.

Then it takes what the game wants to display, dumps it into an OpenGL texture and
renders this on screen.

ddhack is still at a very early stage, and may be somewhat unstable. It has
been mainly tested with the 'kilrathi saga' wing commander 1, wing commander 2,
wing commander 3 and wing commander 4 CD. If any other directdraw programs work, 
it's a miracle!

Comments appreciated.

I'll be releasing the sources once I'm somewhat satisfied with it.

Cheers,
   Sol

-- - ---- -- --- -- ---


USAGE
-----

Copy to the application directory (next to the .exe). Play. 
Optionally: edit ddhack.cfg to tweak behavior.

-- - ---- -- --- -- ---


CONFIGURATION
-------------

Edit ddhack.cfg, a plain text file. ddhack recognizes the following configuration options:
(these should be in the file separated by spaces. No newlines, nothing extra, please).

bilinear      - smoothed graphics
halfnhalf     - first upscaled, then bilinear interpolated graphics (wc1/wc2 only)
showlogo      - keep the ddhack logo on screen
subtleoldlcd  - subtle trails on graphics
oldlcd        - trails on graphics
veryoldlcd    - very trippy trails on graphics
wc3scandouble - scan-double deinterlace wc3 videos
wc3blurvideo  - run a box blur filter on video
wc3smallvid   - render videos in smaller resolution surrounded by black borders (-no_interlace only)
altwinpos     - alternate window position; may help if you get a black screen

The logo is on the screen for two seconds after start to show that ddhack is active.


Example config:

-- 8< -- 8< --
halfnhalf showlogo wc3smallvid subtleoldlcd
-- 8< -- 8< --

that should be the only content of ddhack.cfg.

-- - ---- -- --- -- ---


VERSION HISTORY
---------------

1.0 - Public release
    - Half'n'half mode was broken, fixed

0.8 - Tweaked GDI output a bit, resulting in slightly better working savegame naming and
      the "change CD" display to work. Without this, the "change CD" display seems to just have hung.

0.7 - Wing Commander 4 support. Other wing commanders untested, so some things *may* have broken.
      Known issue: briefing screen (green grid, white text) blinks until all text has been "written".
      Only version tested so far is wc4cd, no idea if dvd version does something different.
      8bit and 16bit videos work.

0.6 - wc3 -no_interlace option support, wc3 video blur option, wc3 small video option,
      scan-double should no longer mess up text
      
0.5 - Wing commander 3 support(!), wc3 scan doubling for videos, 
      couple alternate window position settings for troubleshooting.

0.4 - Wing commander 2 fixes, options moved from keyboard to config file

0.3 - Added half'n'half and 'old LCD' modes

0.2 - added delay loading of OpenGL library to run on winxp (and a kludge to make THAT
      work with win7).

0.1 - original release


-- - ---- -- --- -- ---

Gallery


Additional Files

Older Versions