Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lzo compression?

Status
Not open for further replies.

jimk72

Programmer
Dec 10, 2005
4
US
I have been looking all over for any info on using this with delphi. I am translating a c++ app to delphi and they use lzo compression to load and save textures and I can't seem to find a delphi version anywhere? I have found minilzo.obj but has NO information or examples on how to use it, and every time I try it errors.

Thanks in advanced for any help!
 
i think componentace.com has that compression type

[bobafett] BobbaFet [bobafett]
Code:
if not Programming = 'Severe Migraine' then
                       ShowMessage('Eureka!');
 
Thanks for the reply! I checked and they have alot of compression types but not Lzo type. Thanks anyway for your time.
 
Yea thats the only thing I found that was helpfull, It seems he hasn't built a delphi version yet. Oh well I will just give up. I spent to much time already translating the original app to delphi, I cant translate another library just to get the app to work.

Thanks so much for your replys!

jimk
 
Why are you trying to translate the library to Delphi? Surely you can use the .dll directly (or if its not precompiled, download a free c/c++ compiler to do it for you - it shouldn't matter what language the library is written in.

I used to do a lot of work in various versions of Access. Whenever I needed to produce an external library I always used Delphi to write the .dll and never had any problems accessing it through Access.

Hope this helps.

[vampire][bat]
 
I tried but it kept giving me an access violation error.
In c++ you would do
BYTE *texture = new BYTE[datasize+headersize];
BYTE *unpackedtexture = new BYTE[unpackeddatasize+unpackedheadersize];
texture is then loaded from the file and sent to be uncompressed.

lzo1x_decompress(texture, fileHeader.PackedSize, unpackedtexture, fileHeader.unPackedSize, NULL);

texture is a pointer to where the byte array is allocated in the c++ source.
My translation was:
var
texture:array of byte;
unpackedtexture:array of byte;
begin
setlength(texture, datasize+headersize);
setlength(unpackedtexture, unpackeddatasize+unpackedheadersize);
I fill texture with the file to be uncompressed and send it to lzo the same way c++ source does.

lzo1x_decompress(@texture, fileHeader.PackedSize, @unpackedtexture, fileHeader.unPackedSize, NULL);

and Thats when I get the access violation?
as you can see you are supposed to send a pointer to the spot in memory where the texture is so I used @ to get the address.Since this did not work I tried using a pointer to point to texture and sending the pointer and the same result happens.


 
It could have something to do with your Delphi declaration of the dll.


Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top