Sign in to follow this  
ekrax

file packer, design question

Recommended Posts

hello, i am writing a simple file packer to be used in future projects so i can simplify content loading, and i just have a few design questions. for creating and saving a pack file (my program just creates a file that has a header showing each file name and size, and then all the bytes of each file are copied to the single packf file) so right now i have coded it so you add files to the pack and then when you save, it reads all the files into a single buffer then outputs the header and then the buffer and then clears the buffer. and for loading i dont know what i should do becasue i want it so the buffer does not exsist in memory unless i am saving or loading. but i also do not what to extract the files as soon as i load a pack, but i guess i have to do one or the other. so my question is ... should i (a) create a buffer when loading a pack. so when the user saves i create the files from the buffer or just clear the buffer if the user decides they do not want to extract the pack. or should i (b) save temp copies of the files contained in the pack as soon as the pack is loaded, and either move the files if extracted or delete them if not. so should i use memory or the hard disk for this? thanks for any suggestions in advance.

Share this post


Link to post
Share on other sites
why not create the buffer when loading a file from the pack (e.g. a buffer of 64kb should be enough) and delete it after file loading

locate the files in your pack on the fly

Share this post


Link to post
Share on other sites
If it was me, (For reading during the game) Id keep a copy of the File location table (or whatever you have) but keep the files on the disc. Then id simply load the individual files as needed (I might cache them but lets keep it simple for now eh ;) ).

Share this post


Link to post
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

Sign in to follow this