Fudge Packing
Well, I thought I should probably make use of this journal, considering I have it. Well, I finished making my pack library, which is nice. It has the cheerful name of Fudge Packer. Blame ravuya for the name. You can pack files using 4 types of compression; None (Ok, that doesn't really count as a level of compression), zlib (fastest compression), zlib (best compression), or bzip2.
Here's some lovely screenshots of the pack utility in action, packing some data for my bomberman clone:



Accessing data in the pack file is easy, the pack reader manages an internal buffer for you, so you can extract files into the buffer, and then just get a BYTE* to the uncompressed data. Here's some sample code:
Well, this'll do for now I think. If you want to play around with Fudge Packer, you can Download the dll, lib and header file and give it a go.
Here's some lovely screenshots of the pack utility in action, packing some data for my bomberman clone:



Accessing data in the pack file is easy, the pack reader manages an internal buffer for you, so you can extract files into the buffer, and then just get a BYTE* to the uncompressed data. Here's some sample code:
// Create reader and open the file //
IPackReader* pReader = CreateReader();
if(!pReader->OpenFile("Data.pak"))
{
DestroyInstance(pReader);
return -1;
}
// Get a handle (index) to the file //
DWORD dwHandle = pReader->GetFileIndex("Data/Test.txt");
if(dwHandle == INVALID_PAK_HANDLE)
{
DestroyInstance(pReader);
return -1;
}
// Get it's length and extract it //
DWORD dwLength = pReader->GetFileSize(dwHandle);
BYTE* pTempBuff = pReader->ExtractFile(dwHandle);
// Do something with the buffer here //
// Cleanup //
pReader->CloseFile();
DestroyInstance(pReader);
return 0;
Well, this'll do for now I think. If you want to play around with Fudge Packer, you can Download the dll, lib and header file and give it a go.
0
Sign in to follow this
Followers
0
3 Comments
Recommended Comments
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 accountSign in
Already have an account? Sign in here.
Sign In Now