ndless-nspire / Luna

Create TNS files from Lua and XML
Other
57 stars 13 forks source link

Bitmaps do not show up in the TI Script-Editor #14

Open johannes-wolf opened 1 year ago

johannes-wolf commented 1 year ago

BMP-Files added using Luna do not show up in the image tab of the TI-Nspire Script-Editor (Student Software).

I have added a bmp and a lua file using lua test.bmp test.lua. The lua file is correctly added to the tns, but the bmp does not show up.

Vogtinator commented 1 year ago

Yeah, that's a bit more complicated to do. The images need to be referenced by the problem XML document as img_info elements and a specially formatted _RES metadata item needs to be added to assign resource names to the image. It might be enough to add the img_info tags for making the script editor aware of it.

The Ndless installer for OS 3.9 is an example on how such a document looks: https://github.com/ndless-nspire/Ndless/blob/7ce6b732a6224ed9c017d1e9c36bb2429c947dbe/ndless/src/installer-3.9/Problem1_pre.xml

Alekuso commented 1 year ago

I'm a bit confused about the formatting of the _RES metadata. At some part of it, I can't really find a relation between the bmp and the res metadata. I need some help to see how I should name it depending on my images

With this image it will be easier to understand what I'm trying to mean. There are just some parts where I can't really find why they're like that and how I can "find" them image

Vogtinator commented 1 year ago

That's a custom format of a string list: Number of strings followed by length of string, then the string itself. The numbers are encoded as three capital letters from A(0)-P(15), which can be seen as alternate encoding for hex (0x0 - 0xF). For the value in the 3.9 installer this results in:

AAE -> 0x004 -> Four strings

ACE -> 0x024 -> 36 characters

1C86D1B39DEB85D42F438DE2C0C3BF78.BMP the string

AAG -> 0x006 -> 6 characters

device the string

ACE -> 0x024 -> 36 characters

BBF7096DCAF1CD03DE8364E14DB58939.BMP the string

AAE -> 0x004 -> 4 characters

plug the string

This results in 1C86D1B39DEB85D42F438DE2C0C3BF78.BMP using device and BBF7096DCAF1CD03DE8364E14DB58939.BMP using plug as resource name.

Alekuso commented 1 year ago

Thanks for helping me out. Everything is detected as it should, however I think I have some problem with my bitmaps, I don't really know if I converted it using the right format or anything as I get these kinds of results. image

When using the one on the ndless installer, it works fine. From what I see, the image viewer can't open the ndless bmp one but for some reasons it can open mines.

I wanted to see the hex data directly and I can't really find out why I don't get the "right" bmp image image

I tried to use multiple converters, however none of them work.

Vogtinator commented 1 year ago

The images have a specific BMP format. You can check https://github.com/ndless-nspire/Ndless/tree/master/ndless-sdk/tools/bmputil