DXMCI.dll
Version 0.1

MCI to DirectShow Interface
----------------------------

One of the first DVD-ROMs sold was Creative 2x DVD. It came with a hardware mpeg
decoder card (DXR2) because computers were not fast enough (and there was 
no software support) to decode DVD Video in real-time. This card had a great
TV-Out, but the picture on the monitor was rather poor because it used an
external loopback cable. Also, you got 2 bundled games, one of my favorite
ones - Wing Commander 4. I sold my DXR2 years ago (when I could still get some
$50 or so, but I kept the game. Unfortunately this game doesn't work on modern
computers...


Technical background:

Wing Commander 4 uses what is called a Media Control Interface (MCI) to
play DVD Video. This is a very old standard, dating from win3.1 and is
very inappropriate for DVD Playback. But the game was created before
DirectShow was, so there wasn't a lot of other options. But the problem is
that while WindowsXP does still contain MCI, DVD Video somehow does not play
even when MCI decoders are installed. MCI is contained in Winmm.dll.
A quick look at the wc4dvd.exe shows us that the file imports this dll, but
only for some uninteresting joystick functions. Hmm. It also uses mpeg2.dll.
It seems that wc4dvd.exe relies on this file to do the mpeg2 decoding. So...
if we had function prototypes this dll exports we could write a whole new
decoding dll...but we don't! Let's take a look at mpeg2.dll...this file also
imports winmm.dll - one of them a very interesting mciSendCommandA function.
Heh, we found our call to the MCI. So what next. First, I used hex editor to
change the name of the dll mpeg2.dll imports. We want it to load our dll,
not MCI :). This way we can control what mciSendCommandA will actually do.
The first phase of solution was to learn more about MCI. So I created a dll
that logged how mciSendCommandA was called, passed the same parameters to the
real MCI and record the responses. This involved setting up a working system,
which was an older P2-350 with windows98, quite sufficient for our purpose.
Note, that the interesting thing is WC4 DVD worked flawlessly with default
WinDVD2.1 install (for anybody that still wishes to use MCI instead of DShow!).

So here is the basic idea...mpeg2.dll will call mciSendCommandA which will
be in our dll not the default windows one. Our dll will then take care of
initializing and setting up DirectShow interface while feeding mpeg2.dll
responses it expects from a real MCI interface. Having external mpeg
decoding dll also helps us a lot. Some other game functions also rely on
the MCI interface (I guess sound & previously mentioned joystick), so our
dll does not have to emulate everything. I figured since this is only
1 function, it would be easy to implement it...but the fact is MCI is HUGE.
mciSendCommand can send about 45 commands, each with numerous different flags!
So the next thing was to cut it down. I started filtering commands I sent to
real MCI, down to where I could get almost complete functionality with the least
commands used. This includes about 5 basic commands, like open and play.

Next it was pretty easy to map this to DirectShow...open does open obviously,
play play's the video and so on. Here I wonder why Microsoft haven't done
this themselves, but it would probably take too much time to support obsolete
interface. It is a bit tricky to set all the parameters correctly (like where
to play the video & how to notify the game that playback has ended) so this
involved a lot of testing (I'm not really experienced at writing DirectShow
applications). But I think I have done it! When you launch the game, it will
set up DirectShow and play the video. This is of course the first release
version, so still might have some bugs :)

It really is a shame this DVD does not work on modern systems. I bet there
was a lot of work involved in shooting and then later transferring the movies,
so it deserves better than to sit on the shelf. So I hope this will help you
watch crystal clear video with Dolby Digital 5.1 sound as it was meant to be :)

Usage
-------

Install the game, copy the supplied .dll files into your wc4dvd directory,
set the executable to run in Windows 95/98 Mode and run the game.
But most importantly...enjoy it! If it crashes or something else bad happens...
what can I say - bad luck. :)

Q & A
-------

Q: Will this work for other DVD games??
A: No idea! This was specifically designed for Wing Commander 4. Perhaps some
games use similar approach, but I think most probably it will not work.

Q: I have no video or I don't hear any sound!
A: DLL file does not handle DirectShow errors, so it will not report things like
failed to build a graph. Make sure you have all the necessary filters installed!

Q: I have everything and it still doesn't work!
A: Well, a lot of things can go wrong. I can send you debug version of the
dxmci.dll, then you send me the log file...perhaps some bug slipped me.


gulikoza on WC CIC Forums

gulikoza@bojler.mine.nu
