ladislav-zezula / StormLib

Official GitHub repository of the StormLib library created by Ladislav Zezula (author)
http://www.zezula.net/mpq.html
MIT License
561 stars 213 forks source link

Starcraft 1 Beta - different WAV compression #253

Closed KaitouHAX closed 2 years ago

KaitouHAX commented 2 years ago

Attempting to extract a wav file from a beta version of StarDat.mpq displays a "Failed to extract the file ... the file is corrupted and unreadable. " error message. After doing an amateurish investigation it looks like the compression method used after the first block is 0x11 instead of an expected 0x41 or 0x81.

While it does make me wonder if it could be huffman + bzip2, the comment in the source code that bzip2 was added in warcraft 3 makes me think this is something else.

I have found a couple of beta wav files out there that were successfully extracted but not the tool that was used to extract them. If need be, I can provide the beta.iso.

EDIT: I have tried MPQ Editors 4.0.0.872 and 3.5.1.816.

ladislav-zezula commented 2 years ago

Hi,   interesting. Could you somehow share me the MPQ? I'll look at it.   L.    

Attempting to extract a wav file from a beta version of StarDat.mpq displays a "Failed to extract the file ... the file is corrupted and unreadable. " error message. After doing an amateurish investigation it looks like the compression method used after the first block is 0x11 instead of an expected 0x41 or 0x81. While it does make me wonder if it could be huffman + bzip2, the comment in the source code that bzip2 was added in warcraft 3 makes me think this is something else. I have found a couple of wav files out there that were successfully extracted but not the tool that was used to extract them. If need be, I can provide the beta.iso. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

--  S pozdravem,  Ladislav Zezula @.***

KaitouHAX commented 2 years ago

Sure thing,

Here's the link with the beta StarDat.mpq, storm.dll and a wav file(File00001476.wav without a listfile) that i found already extracted. Starcraft Beta Drive

ladislav-zezula commented 2 years ago

Looks like this particular release of storm.dll has different bit values for the decompression routines.

0x10 = Decompress_ADPCM_mono
0x20 = Decompress_ADPCM_stereo

whilst in other releases of storm.dll (and in StormLib) is it:

0x80 = Decompress_ADPCM_mono
0x40 = Decompress_ADPCM_stereo

I'll see what can I do.

ladislav-zezula commented 2 years ago

Could you please also check the ISO? There should be music files, I want to know if they can't be extracted either.

KaitouHAX commented 2 years ago

Could you please also check the ISO? There should be music files, I want to know if they can't be extracted either.

Same extraction issue, but this time it wants 0x21. I've added INSTALL.EXE mpq file to the drive link.

ladislav-zezula commented 2 years ago

0x21 is stereo (understandable for soundtracks), 0x11 is mono (good enough for in-game sounds at the time when it was released).

Ooookey. So hard-coded check for just StarDat.mpq is not enough. I'll download it and refine the code. BTW, could you add the entire ISO? I'll add it to my collection of the Blizzard games :-)

KaitouHAX commented 2 years ago

I've added the iso to the drive. So after all, was switching those byte values enough to uncompress it?

ladislav-zezula commented 2 years ago

So after all, was switching those byte values enough to uncompress it?

No. Decompression succeeded, but the data is corrupt - different than the WAVE you sent and also different from what storm.dll extracts. I'll have to dig deeper into that BETA ADPCM decompression to see where's the difference.

ladislav-zezula commented 2 years ago

I implemented the decompression. Note that an attempt to compress the files back will lead to them being unreadable by the game. It's not merged yet, but you can already try the new build of MPQ Editor.

KaitouHAX commented 2 years ago

Ah, thank you. And no worries i have no plan to compress files back. I suppose this issue is closed now?

ladislav-zezula commented 2 years ago

It's not closed yet. I want a bit better integration, plus I still have to run regression tests against the new code.

ladislav-zezula commented 2 years ago

Merged. Thanks for the bug report.