michalss wrote:ok made a binary template for this and made some modigications also you have a small mistake in struct :
In line with 8 Int32e File Data ID is wrong need to be Int64e
I see that now and fixed the post above, also had another error with a skip to. I wonder if this may have changed with Rogue and is the reason why my Unity routines won't open the files. Just to clarify, for anyone not following, I am referring to an
issue loriscangini is having with the PC version of Rogue.
Actually, just checked a Unity forge file again and it looks like that should be 64-bit also. I'll have to see if that changes anything. Good eye michalss
michalss wrote:also there is some kind of crc, do you anything about it pls ?
Not sure what you are referring to. Where at in the file?
Continuing on...
Next we tackle the individual "datafiles". Some of these will be compressed, some will not. This is also where things switch to big-endian.
We'll start with the compressed datafiles (3 out of the 4 datafiles in this forge file are compressed):
Code: Select all
Location Type Notes
0 Int64E 17,179,869,184 - Not sure what this, not always present in the PC version
8 Int64E 1,154,322,941,026,740,787 - This signifies a compressed chunk, may be more than one per datafile
16 Int16E Compression Type 1 = lzo1x
2 = lzo2a
5 = lzo1c
18 Byte Unknown
19 UInt16E Min Size (appears to always be 32,768)
21 UInt16E Max Size (appears to always be 32,768)
23 UInt16E LZO Block Count
LZO Blocks (repeat equal to LZO Block Count)
0 UInt16E Uncompressed block size
2 UInt16E Compressed block size
Compressed data (repeat equal to LZO Block Count)
0 Int32E Possible checksum
4 Byte[xx] Compressed data xx = Compressed block size for each respective LZO Block
At this point, if you are not beyond the file data size I would read another UInt64E. If it matches the compressed chunk signature, repeat the decompression routine. ARchive_neXt decompresses all chunks to a single file (original AC:1 information stated that wasn't necessary, but I find it easier to read if it's a single uncompressed file). If uncompressed size equals compressed size, there is no need to decompress that data. Also not positive all three of those compression types are valid for forge files, but they are the ones that I use in my dll. However, I believe you will only find that one type of compression is used throughout the game (in this case it should be lzo1x).
Uncompressed "datafiles":
Without looking at more all I can tell you is if the first UInt64E does not equal 17,179,869,184 or 1,154,322,941,026,740,787 back up 8 bytes and read it as uncompressed data equal to the file data size for the respective datafile.
For this forge file, the first datafile located at 3083 is not compressed, so starting at 3083 read 280 bytes and that would be the contents of "GlobalMetaFile". I have never figured out what these files are, every forge file has one.
Hope this helps somewhat. Next up I'll tackle reading the expanded datafiles.
--MDA