PDA

View Full Version : Really horrible pack file problems



tux
07-09-2004, 04:31 PM
(i feel this doesnt belong in the other pack file thread because this isnt a "whats the best way to make my pack files" etc :) )


ive got a new game called richard burns rally. and im now trying to load the pack files what come in it. ive figured out the file format and how to load it etc. and i have successfully extracted a single file. but im really struggling to extract all the files because of the pack file's folder structure.

basicly the stucture is

header string (CHELALIC)
number of files
first file offset

file offset (0 if its a folder)
file size (0 if its a folder)
owner folder
folder id (0 if its a file)
length of the "filename" string
"filename" string

repeat until last file.


now the really horrible part is only the first file in the folder has the "owner folder" assigned to it the rest are 0 (but they are still in that folder other wise we get lots of duplicate files in root folder :P ) and then if theres a sub folder that has the owner folder as 0 as well but it has a folder id.

now the horrible part is. when that sub folder is finished. the folder id goes back to the same as the last main folder.

(this package has the cars inside it) so the c_xsara folder has id of 9, then theres a setup folder inside there with id 3. then the h_accent folder (another car in teh game) has id of 9 and its setup folder has id of 3 as well.

ive uploaded a demo of this to http://www.vadertrophy.com/~files/package.rar

my types are....


const
TRallyPackHeader = 'CHELALIC';

Type
TPackItem =packed record
dwFileOffset : DWord;
dwFileSize : DWord;

dwOwnerFolderID : DWord;
dwFolderID : DWord;

dwNameLength : DWord;
arrName : Array of Char;
strName : String;
end;

TRallyPack =packed record
arrHeader : Array[0..7] of Char;
dwNumFiles : DWord;
dwFirstOffset : DWord;

Items : Array of TPackItem;
end;

var
RallyPack: TRallyPack;

my origional plan was to get this done in a few days, but so far ive had 3 headaches from it :(

just to recap...

what im trying to do is biuld a list of the folder structure so i can extract all the files and retaining the folder structure.

i also typed out what i think is the correct structure into a rtf file and put it in the rar. physics.dat also in teh rar is the actual package.


please help before i have a sezure from it :D (And sorry for the long post ;) but i was trying to give as much info as possible)

tux
07-09-2004, 04:58 PM
im starting to doubt ive got the format right. because in another one (audio.dat) if i go by my current method then all 3593 files are sub folders...

anyway, dont worry ill just post in the game's forum what i found and abandon the project (not in the mood for this atm :P )