Crash on imageset format
Closed this issue · 6 comments
Trying to use a larger palette for tilesets. Palette has 96 colours. tilesets uses 16 of those 96 at 4bpp 16x16.
Any ideas?
LEEML0245013:egpyt mpe18$ ../../aloevera -p egypt.av palette import pyramid_pal3 ../palettes/egypt-96.png
20200226 14:07:59.364 INFO aloevera - This is Aloevera version 0.2.0, built for x86_64-apple-darwin by rustc 1.41.0.
20200226 14:07:59.366 INFO aloevera_vera::palette - Creating new palette from image palette
20200226 14:07:59.366 INFO aloevera_vera::palette - Palette creation successful
20200226 14:07:59.366 INFO aloevera::cmd::palette::command - Inserting palette into project: egypt.av
20200226 14:08:01.760 INFO aloevera - Command 'palette' completed successfully
20200226 14:08:01.760 INFO aloevera - Finished
LEEML0245013:egpyt mpe18$ ../../aloevera -p egypt.av imageset import bubble_text_set 16 16 ../fonts/kromasky_16x16.png
20200226 14:08:18.336 INFO aloevera - This is Aloevera version 0.2.0, built for x86_64-apple-darwin by rustc 1.41.0.
16, 16
20200226 14:08:18.360 INFO aloevera_vera::png_util - Parsing 118 frames
20200226 14:08:18.377 INFO aloevera_vera::imageset - Image parsed successfully
20200226 14:08:20.760 INFO aloevera - Command 'imageset' completed successfully
20200226 14:08:20.760 INFO aloevera - Finished
LEEML0245013:egpyt mpe18$ ../../aloevera -p egypt.av imageset format bubble_text_set pyramid_pal3 4
20200226 14:08:30.581 INFO aloevera - This is Aloevera version 0.2.0, built for x86_64-apple-darwin by rustc 1.41.0.
20200226 14:08:31.220 INFO aloevera_vera::imageset - Formatting imageset bubble_text_set to palette at depth of 4
20200226 14:08:31.302 ERROR aloevera_util::logger -
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1': /private/tmp/rust-20200213-70683-5td8lb/rustc-1.41.0-src/src/libcore/slice/mod.rs:2812stack backtrace:
0: backtrace::backtrace::trace_unsynchronized
1: backtrace::backtrace::trace
2: backtrace::capture::Backtrace::create
3: backtrace::capture::Backtrace::new
4: aloevera_util::logger::send_panic_to_log::{{closure}}
5: std::panicking::rust_panic_with_hook
6: rust_begin_unwind
7: core::panicking::panic_fmt
8: core::panicking::panic_bounds_check
9: <usize as core::slice::SliceIndex<[T]>>::index_mut
10: core::slice::<impl core::ops::index::IndexMut<I> for [T]>::index_mut
11: <alloc::vec::Vec<T> as core::ops::index::IndexMut<I>>::index_mut
12: aloevera_vera::imageset::find_optimal_range
13: aloevera_vera::imageset::VeraImageSet::format_indices
14: aloevera::cmd::imageset::command::imageset_format
15: aloevera::cmd::imageset::parse::execute_imageset_command
16: aloevera::cmd::execute::parse_and_execute
17: aloevera::cmd::execute::execute_command
18: aloevera::real_main
19: aloevera::main
20: std::rt::lang_start::{{closure}}
21: std::panicking::try::do_call
22: __rust_maybe_catch_panic
23: std::rt::lang_start_internal
24: std::rt::lang_start
25: main
Thread 'main' panicked with message:
"index out of bounds: the len is 1 but the index is 1"
The project file has the depth of the image as "8BPP" "depth": "BPP8",
One entry is:
{
"r": 238,
"g": 194,
"b": 156,
"pal_index": null,
"is_1bpp": false,
"is_on": false
}
I'm guessing pal_index is not populated until formatting is complete?
Yes, that's correct. I've just pushed a small change to master, if you could try it now (hopefully it hasn't broken anything).
Hi yes - got meaningful error message now. Just experimenting with palettes. Thanks - an error is better than a crash 👍
ERROR aloevera - Command failed: Vera module error: No range in palette found for frame pyramid_tiles_5 suiting bit depth 4 (all palette entries must be within 15 indices of a multiple of 16)
Sure, thanks! Just let me know if you run into anything else
Thanks - got them imported and formatted now so all good. The odd pixel here and there was out by 1 index, good to have them picked up before hand :)