Jump to content

[CC64] How do I find compressed file's offset?


EagleEye

Recommended Posts

Does anyone know how to get the offset of the compressed files inside the C&C64 ROM? I know how to get the uncompressed file size, and how to get the filename, but not much else so far. If I could figure out how to get the compressed version, I may be able to figure out what the compression method Looking Glass used, and consequentially how to reinsert files.

 

You can find an extracted version of the file listing here in both it's unaltered binary format and a text format here.

Link to comment
Share on other sites

The offsets? Hmm, I looked into that, and that wasn't hard IIRC. But I never figured out the compression. All I found out is that's it's some kind of LZSS. All research about it can be found in this thread on the Xentax file formats forum.

 

In the end, I just extracted the files I wanted by replacing the "mission.ini" reference in the ROM by the filename I wanted, and then made a mem dump ("quick save") in the P64 emulator after opening the ingame briefing restate screen. After a few test dumps of the original brief file and some mission ini-files, finding the start point wasn't hard, and the uncompressed size was in the index, so I got the end point too. Tedious, but I extracted all the missions that way, and since you have the uncompressed size, you can normally use it for extracting any file you want.

 

[edit]

 

Looking at the index now... the first 4 bytes are very obviously a single int that is zero on the first file and increases down the list, so I'd say, that's probably your offset. The start is easy to find by simply looking for text from the start of a mission's ini file (like "; Scenario"), and then subtracting the offset found for that mission file from that position.

 

Heck, I got a 9 mb files.dat here on my disk, which is probably exactly that indexed chunk.

 

[edit]

 

It's possible the compressed files have some sort of compression-related prefix though... from what I can see I usually got six 00 bytes between 2 text files here. Might be a general separator, might be compression related. Either way, there's no real way of knowing if that's from the start or the end of the files around it.

 

[edit]

 

The files archive, with index, from my ROM. The files archive may have too many 00 bytes at the start, for the aforementioned reason.

http://nyerguds.arsaneus-design.com/N64Project/editing/cnc64files.rar

Link to comment
Share on other sites

I never expected that getting the offsets would be so hard. I wrote a utility that prints out where the first .INI file's stated offset (SCB22EB.INI at 0x2F65), then I searched for "; Scenario", which is first found at 0xA9CE12. Thing is, SCB22EB is Deceit, which starts with "; Scenario 31 control for house BadGuy.", while this file, unnamed, starts with "; Scenario 1 control for house BadGuy.". Anyway, I subtract 0x2F65 from 0xA9CE12 and get 0xA99EAD, which doesn't appear to have a single null (0x00) anywhere in the vicinity (the closest one downwards is 0x608 bytes away; don't know why I checked that). So I'm utterly confused by however Looking Glass did this. Hell, considering the 0xE178DD (14,776,541) empty bytes (~14 megabytes) at the end of the ROM, and that uncompressed, all the files are 12,144,460 bytes (~11.5 megabytes), I'm starting to think Looking Glass Studios got broken into one night by a Westwood Studios programmer. Also, I can't find a potential variable that's always smaller than the uncompressed file size, meaning it's quite possible that some (read: a lot of) files take up more space compressed than uncompressed.

 

TL;DR: Fired. Out a cannon. Into the sun.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...