I am currently working on a project that involves storing data in appvars. The structure of the data being stored in the appvar is as follows:

| identifier string for using ti_Detect() | compressed image data | more irrelevant data |

I know the offset for where the compressed image data begins, but I am wondering if there is a way to know how large this data is. This number cannot be hardcoded because the appvars will serve as level packs which will have different images in them.

This is using compressed images, so reading the first two bytes of the image (width and height) won't tell me how much data to read in. Correct me if I am wrong.

Edit: I have been told the compressed size is desired and not the decompressed size so… disregard this or something.
Can store the image(s) last instead of first? Then it doesn't matter lol.
Sizeof ?
Just making a quick post here to recap the solutions that were discussed in case anyone has this problem later:
LogicalJoe: As discussed in IRC last night (which I'm sure you've already seen), this would get the decompressed size. The compressed size is what's needed, at least based on what Mateo said. This (may?) be a viable solution though, if there has been some miscommunication.
Alvajoy: That won't even come close to working.

As for solving it, there are a few things you could do. If the appvar only contains a single sprite or tileset with known dimensions, you could just use the appvar size, presumably subtracted by the size of the header string (solution discussed in IRC). If you really need the offsets of the different images, what I'd suggest doing is using convimg's LUT options, which will allow you to, at the start of the appvar, include a look up table that gives you the offsets of all of the sprites in the appvar, even if they are compressed. You could use this in conjunction with the compressed sprite size functions LogicalJoe linked to find both the number of tiles and each of their decompressed sizes/widths/heights as well. This issue was very useful in helping me understand the format of the table, so I'd recommend reading that as well.

Please let me know if you have additional questions, as (I think) I solved a very similar issue for VYSION 2's wallpaper sprites. Good luck!
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum