News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Arnaud

CPCTelera 1.5.0 - File compression problem

Started by Arnaud, 19:26, 12 November 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arnaud

Hello,
i'm trying the version 1.5.0 of CPCTelera and i have problem with the new compression feature.

My goal is to convert an image into binary and compress it.
And in my code i want to deflate and display it.

But i have got a crash.

Second problem, when converting image to binary, CPCTelera convert automatically the binary into C file.
Thus i have the same image (compressed and not compressed) integrated two time in my build.
How avoid it ?

Thanks  :)
Arnaud

Here my project.

ronaldo

#1
Hi Arnaud,
   Whenever you use any new feature, you should first read the documentation  ;)

   I have reviewed your code and you are erroneously using cpct_zx7b_decrunch_s. This function requires pointers to the end of the memory arrays. You are passing pointers to the start of each array (sprite, compress). You need to pass pointers to the last byte of each (sprite + sizeof(sprite) - 1, compress_end). compress_end is a #define automatically generated in sprites/compress.h for this usage. With these parameters fixed, your example works flawlessly. zx7b means zx7 - backwards and is an optimization over zx7 algorithm that profits from working from end to start. That's why it needs pointers to the end.

   Your second problem does not happen at all. CPCtelera 1.5. does not convert binaries generated using any makefile utility. It includes these binaries in a list of generated items to explictly exclude them from automatic conversion. In fact, you don't need to generate the binary outside src/ folder as you did. You may create a subfolder called src/compressed_sprites (or whatever you like) and place generated binaries there. Take into account that this generated binaries are considered by the build system wherever you place them.

   I have tested your project, and binaries are not converted to C, as expected. If they were being converted to C in your system, that might be due to a bad update from CPCtelera 1.4.2 to CPCtelera 1.5 (i'm guessing here). However, I think this is not the case and you are being confused by the header files generated along with the binaries. You may also get confused by the compilation files (.lst .rel .rst. sym) that have been generated in your compress_gfx/ folder because you have placed it outside src/ folder. These files are generated for any CPCtelera intermediate object, but they do not include any definition, nor your binary data. As these files are from .h and .h.s files, which contain only declarations, they do not generate code.

   For your specific purpose, you also have now many examples in the games submitted to the contest. Many of them use CPCtelera 1.5. and compression. They compress complete screen images and decompress them directly to video memory, they compress complete level data and decompress into buffers, etc. Most of them are in assembler, but they should be very easy to follow and convert to C if that's what you need/want.

   Until I have enough time to complete the documentation, to include more examples and deeper explanations, please feel free to ask whatever you need to perfectly understand these features. Your doubts also help me write better documentation :) .

Enjoy!

Arnaud

Hi ronaldo,i have no excuses, it was clearly indicates in the doc  :-[

I have seen the arguments of cpct_zx7b_decrunch_s were prefixed by _END by i haven't realized why  ;D
Thanks !

Powered by SMFPacks Menu Editor Mod