RSC file format from Warcraft Adventures

Discuss game modding
Post Reply
User avatar
IllidanS4
4-bit nibble
Posts: 17
Joined: November 4th, 2014, 1:41 pm

RSC file format from Warcraft Adventures

Post by IllidanS4 »

Hi, I've got some archive files from Warcraft Adventures, and I can't find out the format. They are resource packs, each for one game screen. The signature is "LBRC". The entries' count is probably located at index 0x10 (32-bit int), but I can't find out where are entries' length or actual position. The entries appear uncompressed, but aside from simple text, the bitmap or sound format isn't familiar to me. Could you please help me with the format? I don't have the exe, so I can't check how it reacts to modifications.
The files can be downloaded here.
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: RSC file format from Warcraft Adventures

Post by Malvineous »

It looks like there is a uint32le at offset 0x04 and again at 0x14 (same value) which contains the offset where the file data starts.

This would mean that all the data up until that point, which appears to be a number of records (each 20 bytes long), is part of the entry list. It looks like each of these records starts with a uint32le which contains the file offset, followed by another uint32le containing the file size. Then there are three more uint32le entries, one is always zero, the next is unknown, then zero again, bringing the total length to 20 bytes. In warcr125.rsc, the first entry starts at offset 0x54.

WARCR100.rsc actually seems to be two of these .rsc files joined together, because if you seek to the last entry's offset, then jump ahead by its size, you end up with a lot of remaining data and a structure that appears to be in the same format as the start of the file. Reading out the entries and seeking to the last file again puts you very near the end of the file. I'm not sure whether this is correct (that the .rsc files can contain multiple files) or whether you ripped the files and accidentally included two in one sample file. I don't have the game so can't check.

You'd probably have to figure this out before you could start with reverse-engineering the inner file formats, otherwise you won't know where one file stops and the next one starts.
User avatar
IllidanS4
4-bit nibble
Posts: 17
Joined: November 4th, 2014, 1:41 pm

Re: RSC file format from Warcraft Adventures

Post by IllidanS4 »

The files weren't ripped, they are physical files in the game directory. It appears that Warcr001 is also composed of multiple chunks, if you add two uint32le at 0x04 and 0x08, you'll get the offset of another similar structure which is also located at offset 0x10 of any file. It starts with uint32le of "tags". These are BMAP, WAVE, ANIM, EVNT, WMAP, VARI etc. These RSC files probably represent each room in the adventure. BMAP are graphics, WAVE sounds, ANIM sprites, EVNT some scripts, WMAP could be walk map and so on. Each "tag" is followed by uint32le (or preceded? if so, the first one is always 0) with unknown meaning.
Where exactly are the 20-byte records located? It can't start on 0x54 in warcr125, because it would intersect with "WAVE" and "VARI" tags. It could start on 0x68, because it would be then exactly 1140 (20*57) bytes to the start of the data (0x4DC).
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: RSC file format from Warcraft Adventures

Post by Malvineous »

Oh sorry, I must have written the wrong number down. In warcr125.rsc the 20-byte fields start at 0x68. They start immediately after the last tag+uint32le.

Those "tags" (BMAP, etc.) are definitely followed by a uint32le, but I'm also not sure what the value means. I was wondering whether it's a file type (e.g. BMAP<10> means the first 10 files are in BMAP format) except the values don't seem to add up properly. If you look at the offsets in the 20-byte fields, some of those files also contain these tags (e.g. "ANIM").
User avatar
IllidanS4
4-bit nibble
Posts: 17
Joined: November 4th, 2014, 1:41 pm

Re: RSC file format from Warcraft Adventures

Post by IllidanS4 »

So, it seems the "joined" rsc files are actually part of the original file, as the entries (specified in the header) in the 001 file encompass the whole file (the same for other rsc files). The offsets of records are relative to the start of "subfile" data. The main subfile is located at 0x10 (starting with the number of tags). Still, this makes me wonder what is the uint32le at 0x08 used for...
Anyway, using the currently known structure, I've extracted the files in warcr100, but there is an interesting problem. If I add 0x10 to the offset, the entries looks good, especially the text ones (233 reads $0400 "Exit"), but the end address points after the end of the file (by 0x10 bytes), and so entry 173 is trimmed. Moreover, if I don't add 0x10 bytes, the text entries are wrong (233 reads "ventur"), but entries like 173 match the "subfile" structure, and nothing is trimmed or left.
The results are here (out is with 0x10, out2 is without).
The code is here.

Edit:
I think I've found whether to add 0x10 bytes or not - the byte at 0x0E in the record info (after offset and length) seems to "indicate" it. If it is 1, I can add 0x10 and it works for texts. If it is 3, it may be a structured subfile, and I don't have to add 0x10 (it doesn't appear to be anything else than 0 (for empty records), 1 and 3). The new results are here and the updated code is there.
User avatar
IllidanS4
4-bit nibble
Posts: 17
Joined: November 4th, 2014, 1:41 pm

Re: RSC file format from Warcraft Adventures

Post by IllidanS4 »

Managed to find some sound files, (warcr100, entry 715). I have applied the subfile format on one of the entries, and extracted a dozen of files that at least sound comprehensible when played in ffmpeg:

Code: Select all

ffmpeg -ar 22050 -f s8 -i "concat:120|121|122|123|124|125|126|127|128|129|130|131|132|133|134" sound.wav
There is some distortion, but I can at least understand what it says. See the results.

Edit:
The sound files are stored in "ADP1" format, I managed to extract them (some of the files are messed up, but most of them works).
Malvineous
8-bit mega nerd
Posts: 292
Joined: March 17th, 2007, 6:40 pm
Location: Brisbane, Australia
Contact:

Re: RSC file format from Warcraft Adventures

Post by Malvineous »

It looks like the first file (715) is encoded in ADPCM format. (This uses 4-bits per sample to get the same quality you'd have in a 14-bit sample - so only a little worse than 16-bit.)

Using the "sox" utility, I can convert them to .wav:

Code: Select all

sox -t ima -r 44100 -e u-law 715 -e signed-integer -b 16 out.wav
They are quite clear (footsteps then talking) except the volume goes up and down unpredictably and the audio cuts off, so still more work needed I think. sox prints some "ADPCM state errors" so it looks like it's not standard IMA-ADPCM or MS-ADPCM, but some other variant. The ADPCM link above suggests there are multiple ways of storing the data - given the volume changes it wouldn't surprise me if the 4-bit samples were packed into bytes in the opposite order to what sox is using.

EDIT: Attached output of 715 conversion (compressed as .ogg) so you can hear what the IMA-ADPCM decoder sounds like.
You do not have the required permissions to view the files attached to this post.
User avatar
IllidanS4
4-bit nibble
Posts: 17
Joined: November 4th, 2014, 1:41 pm

Re: RSC file format from Warcraft Adventures

Post by IllidanS4 »

Thank you; I'll try to make my own ADPCM decoder and investigate the differences. I have managed to sufficiently understand the overall RSC format, and now images come. They have some kind of compression, but I can't recognize it. Could you please look into it? I have managed to obtain two versions of the same (I hope) image, one compressed, one decompressed. It contains a 10-byte header (2b something, 2b height, 2b width, ...) and then the image data.

https://dl.dropboxusercontent.com/u/108 ... essed.BMAP
https://dl.dropboxusercontent.com/u/108 ... essed.BMAP

Thanks!
Sir Graham
Less than a nibble
Posts: 1
Joined: September 6th, 2016, 11:16 pm

Re: RSC file format from Warcraft Adventures

Post by Sir Graham »

If any of you have a copy of the game...I'd really love to play it.
User avatar
IllidanS4
4-bit nibble
Posts: 17
Joined: November 4th, 2014, 1:41 pm

Re: RSC file format from Warcraft Adventures

Post by IllidanS4 »

It's leaked now. Just search and you'll find it. All my research is here (needs .NET 4.0), just run in the root game folder.
Post Reply