Grouping Files (paks, zip, etc)

Started by
3 comments, last by oWen 23 years, 9 months ago
I have a pretty basic idea on howto make grouped files, I was wondering if someone could explain it to me through their experience, or how they would do it.
Advertisement
Look it up in the programming reference section:
Resource Files Explained was the name of the article I think.
Put at the start of the file a list of headers then the data. For example:
// beginning of the fileDWORD NumHeaders;           // this is the total number of headers// then the list of headersstruct {DWORD NameLen;              // length of the namechar  *Name;                // files nameDWORD DataStart;            // start of the files dataDWORD DataEnd;              // end of the data};// then file data 

Hope that was what you wanted.

------------------------------

"My sword is like a menacing cloud, but instead of rain, blood will pour in its path." - Sehabeddin, Turkish Military Commander 1438.

Edited by - UraniumRod on July 25, 2000 1:28:18 AM
------------------------------"My sword is like a menacing cloud, but instead of rain, blood will pour in its path." - Sehabeddin, Turkish Military Commander 1438.
Why oh why does this message board truncate my spaces.....

My code looked all nice and neat too evenly spaced out and every thing


Ahhh.... never mind I finally wanet and read the FAQ ;P

------------------------------

"My sword is like a menacing cloud, but instead of rain, blood will pour in its path." - Sehabeddin, Turkish Military Commander 1438.

Edited by - UraniumRod on July 25, 2000 1:30:18 AM
------------------------------"My sword is like a menacing cloud, but instead of rain, blood will pour in its path." - Sehabeddin, Turkish Military Commander 1438.
well I''ve said to hell with using zips and rar.... there not ment for game programing... there kinda on the slow side to decompress so eather learn there format and add files with no compression or create your own achive file type(its what I did)....
basacly to write your own decide what is needed.... do you need a directory structure or can it be a flat format(no directorys/folders)? how many files are going to be in there? is compression going to be something your realy need? ect...

then basicaly write up a design doc for it... then make it....

for my own format I decided to have a directory structure and have it so you could use compression and encryption(this is an artical in its self... actualy several), but no required...

then with the first version I organized it something like this:

Header
an ID how many files/dirs in the root directory/some other stuff

then in the body
I organized first by folders then files following directly after the folder they belong to
I used classes to handle everything....

so lets say he have something like this we want in the archive...

file1.fil
Dir1
Dir1\file2.fil
Dir1\Dir2
file3.fil

ok....
header
Dir1\
Dir1\Dir2\
Dir1\file2.fil
file1.fil
file2.fil

to get them back out....
read header

read Dir1... it has one sub-folder and one file read in directorys then files

read Dir2... no files or directorys Done...

back in Dir1.... now read the file (file2.fil)... nothing left in Dir1 so back to root to read files there....
read file1.fil
read file3.fil

to add a file... just read the origanal file into memory... do any compressing and encryption... then when it comes to write the file into the archive... write it....

to extract a file... find and read the header for that file... then read the data... write it into a file/memory....

exactly how all this is done is up to you and your needs....

if you want source then heres source for my first version of my archive format... sorry its realy sloppy... but it might help...
get it here

I''m working on fixing it up... its a major overhaul... but its still a good starting point.... or you could just use my format =)

Great Milenko

Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."


http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech

The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."

This topic is closed to new replies.

Advertisement