From d5a79546375454b19a86495818da6c61f0960cb3 Mon Sep 17 00:00:00 2001 From: Corwin Date: Sat, 22 Oct 2022 12:41:58 +0100 Subject: [PATCH] align tiles to a 2 byte boundary --- agb-image-converter/src/rust_generator.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/agb-image-converter/src/rust_generator.rs b/agb-image-converter/src/rust_generator.rs index e15cae6d..374e6832 100644 --- a/agb-image-converter/src/rust_generator.rs +++ b/agb-image-converter/src/rust_generator.rs @@ -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 { + pub _align: [Align; 0], + pub bytes: Bytes, + } + + const ALIGNED: &AlignedAs = &AlignedAs { + _align: [], + bytes: *#data, + }; + + &ALIGNED.bytes + }; const PALETTE_ASSIGNMENT: &[u8] = &[ #(#assignments),*