Tool for expansion and compression of the Huffman files
Posted: Wed Dec 07, 2011 11:28 am
I've written a tool in Python now that can expand and compress the Huffman files. If you're interested you can download it from: http://www.file-upload.net/download-393 ... l.zip.html
You should put the files bttool.py and btfile.py into your msdos bt1 directory, then make a backup copy of your files, and then you can try e.g.
This will expand the levs file into a bunch of 'levs-00.hex, levs-01.hex, ...' files that you can edit with a normal ascii editor. If you leave out the 'hex' option you'll get binary files 'levs-00.bin, levs-01.bin, ...' that are better if you want to edit programmatically. When you're done just invoke
and it will compress all levels again, and put them together into the levs file. To get some help on the program just invoke it with no options at all.
There is also an 'identity' option, which expands and directly recompresses the given file with no compression at all, using an "identity Huffman table". If you use that you can directly edit the Huffman encoded files, as the encoding is one to one.
If you want to see how you can use the API directly from Python, take a look at the files "example_8a.py"-"example_8c.py".
Have fun!
PS: As I go on vacation today, I won't be here for the next 10 days or so. When I'm back, I plan to explain in a short series exactly what's going on in the code.
PPS: There are tools to convert Python scripts directly into exe files (pyexe, pyinstaller,...). I haven't gotten around to do that, but maybe somebody else could do that, so that also the windows people here can use the tool easily?
You should put the files bttool.py and btfile.py into your msdos bt1 directory, then make a backup copy of your files, and then you can try e.g.
Code: Select all
./bttools.py expand fileid=level hex
Code: Select all
./bttools.py compress fileid=level hex
There is also an 'identity' option, which expands and directly recompresses the given file with no compression at all, using an "identity Huffman table". If you use that you can directly edit the Huffman encoded files, as the encoding is one to one.
If you want to see how you can use the API directly from Python, take a look at the files "example_8a.py"-"example_8c.py".
Have fun!
PS: As I go on vacation today, I won't be here for the next 10 days or so. When I'm back, I plan to explain in a short series exactly what's going on in the code.
PPS: There are tools to convert Python scripts directly into exe files (pyexe, pyinstaller,...). I haven't gotten around to do that, but maybe somebody else could do that, so that also the windows people here can use the tool easily?