Xan Binary Decoding

In the time-honored tradition of avoiding real work, I made an extension to xine that will decode Origin’s Xan codec (FourCC: Xxan). This is despite my long-standing policy that I will not invest any effort into making open source programs leverage closed, binary code in order to decode data.


Wing Commander IV Title

I have no intention of committing it to the xine codebase because, really, who cares? But let’s see MPlayer decode Xan data! Ha! Oh, why do I provoke them so? They’re going to have a workable decoder 20 minutes after I post this.

If you care, I posted the xine plugin code here: http://multimedia.cx/xan/. This is based on Mário Brito’s extensive Wing Commander research. It needs a very large table for decoding (128KB of data expressed in ASCII text) and that’s contained in xandata.h[.bz2]. Ideally, I think that table is supposed to be generated by some DLL function. Xan samples and the xanlib.dll are located at the MPlayer samples repository.

This particular plugin is based on one of my old reverse engineering experiments. The reason I took on this task is because loading xanlib.dll and calling into it isn’t especially difficult. At least, none of the relevant functions are dependent upon any external functions. Thus, I just used a few strategic mmap() functions and loaded the binary code directly into specific memory regions. Oh, the code only works on x86 architectures, of course.

10 thoughts on “Xan Binary Decoding

  1. Diego Biurrun

    Say, how is this related to libavcodec/xan.c? The Xxan entry in the multimedia Wiki is inconclusive…

  2. Multimedia Mike Post author

    compn: Answer #1: Not sure I get your question– The above was about making the Win32 binary decoder play back data under xine.

    Answer #2: Patently false– I do not work for Macromedia or On2. Where did you hear such absurd lies?

  3. Multimedia Mike Post author

    Diego: Presently, the lavc xan.c module decodes custom video data from the game Wing Commander III (.mve files). At least 3 other Origin titles use AVI files with Xxan data. This codec is a more advanced version of the WC3 codec but they use some of the same concepts. I have not finished RE’ing the details of Xxan. It should be so simple but I have never quite sorted it out.

  4. Diego Biurrun

    Do we have samples for the WC3 variety? If not, upload them. BTW, this should be clarified in the Wiki.

  5. compn

    mike: just some rumor in #mplayerdev it seems, i apologize.

    i meant get xine working on windows again, the entire xinelib in cygwin/mingw.

  6. Diego Biurrun

    Reimar just committed a fix for this to MPlayer. We can now play Xan WC4 samples, neat :-)

  7. Multimedia Mike Post author

    Good work. Though I’m determined to one day finish RE’ing this. The base decoding algorithm should be fairly straightforward. However, there is a huge data table that needs to be computed and I’m not sure how that operates.

Comments are closed.