Well, what I thought would be a simple job of writing a data packer is turning into a complete nightmare!
I am trying to compress/uncompress a bank. This code was posted a while ago:
but it does not seem to compress, and the uncompress function errors. Has anyone actually got this (or something similar) working?
I am trying to compress/uncompress a bank. This code was posted a while ago:
Import Pub.ZLib Function CompressBank:TBank( bank:TBank ) Local size=bank.Size() Local out_size=size+size/10+32 Local out:TBank=TBank.Create( out_size ) compress out.Buf()+4,out_size,bank.Buf(),size out.PokeByte 0,size out.PokeByte 1,size Shr 8 out.PokeByte 2,size Shr 16 out.PokeByte 3,size Shr 24 out.Resize out_size+4 Return out End Function Function UncompressBank:TBank( bank:TBank ) Local out_size out_size:|bank.PeekByte(0) out_size:|bank.PeekByte(1) Shl 8 out_size:|bank.PeekByte(2) Shl 16 out_size:|bank.PeekByte(3) Shl 24 Local out:TBank=TBank.Create( out_size ) uncompress out.Buf(),out_size,bank.Buf()+4,bank.Size()-4 Return out End Function
but it does not seem to compress, and the uncompress function errors. Has anyone actually got this (or something similar) working?