Jump to content

Format80 decompression


401Kill

Recommended Posts

There must be a bug in your decoder. :P

Quite probably :P

What language are you using?

C#, but the Format80 decoder is pretty much a direct translation of Vladan Bato's decoder as seen here, with SHL and SHR implementations which behave as in Pascal (ie. do not preserve the sign bit).

Since every other CPS and WSA file works fine, it must be a fairly specific bug.

Attached the Decode80 routine, since pasting into a [ code ] block is mangling indentation  ???

EDIT: Seems saving as a text file has done no better - MonoDevelop is mangling indentation then :P

Decode80.cs.txt

Link to comment
Share on other sites

Thanks. I'm trying to find a reasonable cross-platform, automated approach - either CLI or a library would be best, since I don't think my format hacking skills are up to decoding it yet lol. Will look into any possible CLI interface to Winamp.

How about just extracting all music and converting it? It's not too hard... I've done it :P

Link to comment
Share on other sites

How about just extracting all music and converting it? It's not too hard... I've done it :P

I would like to have a complete set of libraries for dealing with all the Dune 2 data files. Unfortunately, given that I can't find any useful documentation on XMID, I suspect that I will end up having to follow that route.

Link to comment
Share on other sites

I would like to have a complete set of libraries for dealing with all the Dune 2 data files. Unfortunately, given that I can't find any useful documentation on XMID, I suspect that I will end up having to follow that route.

XMID = XMIDI ?

if so, your in luck...

http://scummvm.svn.sourceforge.net/viewvc/scummvm/scummvm/trunk/sound/midiparser_xmidi.cpp?revision=43126&view=markup&sortby=date&sortdir=down

Link to comment
Share on other sites

C#, but the Format80 decoder is pretty much a direct translation of Vladan Bato's decoder as seen here, with SHL and SHR implementations which behave as in Pascal (ie. do not preserve the sign bit).

Ah, C#. I've got one in C++. Have you compared the output of both to see the first 4096 bytes are identical?

Maybe it's not actually a bug in your code but other languages just don't detect the buffer overflow.

Link to comment
Share on other sites

XMID = XMIDI ?

Ahh yes, that would make sense! It's amazing how much better the results in Google are when you use the right search term :P I've only ever seen it referred to as XMID before.

Reading C++ is not my forte, but I think I can make reasonable sense of what this is doing. Thanks! :)

Ah, C#. I've got one in C++. Have you compared the output of both to see the first 4096 bytes are identical?

Not yet, but I really should. Will do so ASAP.

Maybe it's not actually a bug in your code but other languages just don't detect the buffer overflow.

Maybe, in which case I can compensate by dynamically resizing the buffer if required. What bothers me is that the second frame badly fails to decode (not a buffer overflow), which would suggest improper input, and therefore presumably a wrong offset?

Link to comment
Share on other sites

My mistake, the second frame was also buffer overflow. Several of the frames in Static.wsa overrun, the worst one by 485 bytes. However, the resulting bitmaps using the first 4096 bytes of each buffer seem to be correct.

Onto the .SHP files now, I think...

post-5163-1283323992917_thumb.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...