Just found this site today, and it's been quite a fruitful day!
I am currently working on the Acclaim game Vexx on the GameCube system. Its disc architecture is very similar to that of Turok Evolution (based upon what was reported here last year: viewtopic.php?f=10&t=3881&p=33441 ), in that almost all of the game's data is locked up in one Supertree0.tre cabinet file.
Not surprisingly, the .tre file follows the same protocol with regards to its header:
[NUM_FILES long] [offset long, size long, unk long, unk long] x 4213 total files
So the script documented in the Turok Evolution thread worked and was able to extract all 4213 files. The two unknown longs do not confer any information regarding file names, which is a pain in the rear across 4200-some files.
However, the second file in the .tre archive after the header, called tempfiles.txt, contains a list of every filename in the archive, and, surprisingly, in the order of appearance! But the offset/size pairs in the header are in a seemingly random order. This calls for a sort operation if we are to have properly named/placed files be output. Since the files are ordered in tempfiles.txt, as a temporary solution I chose to name the files by their offset, let Windows sort them by name and establish the name correlation. But manually changing 4213 file names isn't fun!
Code: Select all
Endian big Get NUM_FILES long For I = 0 < NUM_FILES # File info Get OFFSET long Get SIZE long Get UNK long Get UNK long # Extract file Log OFFSET OFFSET SIZE Next I
Here is some pseudocode:
Code: Select all
Endian big Log TEMPORARY_FILE 0 0 Append #append on Get NUM_FILES long 0 For I = 0 < NUM_FILES # Walk through all 4213 files' offsets and save them to temp SavePos CurrentOffset 0 Get OFFSET long 0 Get SIZE long 0 Get UNK long 0 Get UNK long 0 # Save the two OFFSET/SIZE longs to temp file for later sorting Log TEMPORARY_FILE CurrentOffset 0x8 Next I Open "." TEMPORARY_FILE 1 # sort offsets/sizes so lowest offset appears first, corresponding to the correct order of files in the .tre archive # sort code goes here Append #append off #with the offsets sorted, dump files in order appearing in TEMPORARY_FILE, using the filenames after finding the tempfiles.txt offset #locate tempfiles.txt offset GoTo 0x0 0 FindLoc nameOffset string "C:\VexxDataGC_TreFiles" 0 "" If nameOffset == "" Clean Exit EndIf GoTo nameOffset 0 #nameOffset should be 0x00012473, the start of the tempfiles.txt file GoTo 0x0 1 For I = 0 < NUM_FILES Get OFFSET long 1 Get SIZE long 1 #step through the tempfiles.txt file, extracting the string for the folder\file.ext structure #not a null-terminated string, will need a bit of coding and an iterative step to cleave off C:\VexxDataGC_TreFiles which precedes every file GetDString NAME NAME_LENGTH 0 Log NAME OFFSET SIZE 0 Next I