menu

Binary Packaging Continued – Now with fancy pictures!

Well, they’re just command prompt pictures, but hey it’s better than nothing right?

I’ve continued to develop my binary packaging system, awkwardly titled the ‘Binpressor’. It has now come fairly far into a stable release. Files can be packaged, and the utility can also unpackage files. Lets step through that.

Here I have a folder that contains all the images I use as part of a Uni project. 84 textures, some of which are high resolution hence the folder size of 54.6MB. Let’s give the utility a test drive by packaging the contents of this folder!

Files are recursively added into a list of prepared files. A header file is then generated based on various settings pre-defined in the program (such as buffer sizes for file names) and each file generates its own descriptor that tells the binary program how large a file is, what the file name is and what type of file it is. Now that we have a fancy little package, let’s now unpackage it, made possible by the handy descriptors that we’ve exported.

I can now open up the folder and verify that the image data has been correctly extracted by the fact that the thumbnails are all correctly generated. Upon hovering my mouse over a file, the file details look correct, and opening any of these files results in the correct display of the image. I have actually taken this a step further, and actually packaged the package utility itself, then unpackaged it, then successfully managed to use the unpackaged file to package another file!

One thing you might have noticed is that the utility lists ‘compressing’ and ‘uncompressing’ lines. Yep, that’s a new feature that I’ve added in today. I’ve integrated a C-wrapper around the LZMA SDK, meaning I have access to fast and efficient compression features. You’ll notice some strange scenarios where the compressed file is actually larger than the uncompressed file, but this can be safely ignored due to the very tiny byte differences.

Here I’m compressing a virtual machine settings file down from a small 104 kilobytes (106,496 bytes) down to an even smaller 223 bytes. Mind you that the size information at the bottom of the window does not take into account compression information at the moment.