Align tiles to a 2 byte boundary (#337)

Tiles are not aligned to a 2 byte boundary despite calling dma_copy16
which requires this.

In future, should make dma_copy16 panic if arguments are not aligned in
debug mode.
This commit is contained in:
Corwin 2022-10-22 12:52:35 +01:00 committed by GitHub
commit 9b06d32c6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,7 +79,19 @@ pub(crate) fn generate_code(
pub const #output_variable_name: #crate_prefix::display::tile_data::TileData = {
const _: &[u8] = include_bytes!(#image_filename);
const TILE_DATA: &[u8] = #data;
const TILE_DATA: &[u8] = {
pub struct AlignedAs<Align, Bytes: ?Sized> {
pub _align: [Align; 0],
pub bytes: Bytes,
}
const ALIGNED: &AlignedAs<u16, [u8]> = &AlignedAs {
_align: [],
bytes: *#data,
};
&ALIGNED.bytes
};
const PALETTE_ASSIGNMENT: &[u8] = &[
#(#assignments),*