Breaking Eggs And Making Omelettes

Topics On Multimedia Technology and Reverse Engineering


Archives:

Xan Binary Decoding

March 18th, 2006 by Multimedia Mike

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.

Posted in Open Source Multimedia, Origin Xan, Reverse Engineering | 10 Comments »

10 Responses

  1. Diego Biurrun Says:

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

  2. compn Says:

    how about a challenge for xine? make it work on win32 like mplayer!
    haHA!

  3. compn Says:

    doh, and i heard you are working for macromedia/on2 now? :)

    it must be a secret plot to hire reverse engineering people and make them sign NDA’s so they cant RE anything anymore just like dvdjon!

    any chance you could add the codec id to the lavf demuxer so mplayer can use the binary vp6 codec?

    http://mplayerhq.hu/pipermail/ffmpeg-devel/2006-March/009115.html

  4. Multimedia Mike Says:

    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?

  5. Multimedia Mike Says:

    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.

  6. Diego Biurrun Says:

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

  7. compn Says:

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

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

  8. Multimedia Mike Says:

    Diego: The pages in question are here:

    http://wiki.multimedia.cx/index.php?title=Wing_Commander_III_MVE
    http://wiki.multimedia.cx/index.php?title=Wing_Commander_III_MVE_Video_Codec

    and both link to samples in the MPlayer archive. I suppose the latter page could use a link to the Xan page, and vice versa.

  9. Diego Biurrun Says:

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

  10. Multimedia Mike Says:

    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.