From dc46cfef45a8c692d05de364dc5fbbfd88bac699 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 22 Aug 2023 20:15:26 +0100 Subject: [PATCH 01/47] If r2 < 4 don't overwrite all memory --- agb/src/sound/mixer/mixer.s | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agb/src/sound/mixer/mixer.s b/agb/src/sound/mixer/mixer.s index fa59156f..9fafa4fc 100644 --- a/agb/src/sound/mixer/mixer.s +++ b/agb/src/sound/mixer/mixer.s @@ -64,6 +64,9 @@ agb_arm_func \fn_name bne 4b 5: + cmp r2, #0 + beq 3f + .irp reg, r7,r8,r9,r10 mov \reg, #0 .endr From 8158bc1ff3572a6df682e76ff9894a5b231edee9 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 13:16:57 +0100 Subject: [PATCH 02/47] Allow deduplicating background tiles --- agb-image-converter/src/lib.rs | 19 +++++++++++++++++++ examples/combo/src/lib.rs | 8 ++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/agb-image-converter/src/lib.rs b/agb-image-converter/src/lib.rs index 6e227d1d..af3ab982 100644 --- a/agb-image-converter/src/lib.rs +++ b/agb-image-converter/src/lib.rs @@ -36,6 +36,7 @@ struct BackgroundGfxOption { module_name: String, file_name: String, colours: Colours, + deduplicate: bool, } impl config::Image for BackgroundGfxOption { @@ -72,12 +73,30 @@ impl Parse for BackgroundGfxOption { Colours::Colours16 }; + let lookahead = input.lookahead1(); + + let deduplicate = if lookahead.peek(syn::Ident) { + let deduplicate: syn::Ident = input.parse()?; + + if deduplicate == "deduplicate" { + true + } else { + return Err(syn::Error::new_spanned( + deduplicate, + "Must either be the literal deduplicate or missing", + )); + } + } else { + false + }; + let file_name: syn::LitStr = input.parse()?; Ok(Self { module_name: module_name.to_string(), file_name: file_name.value(), colours, + deduplicate, }) } } diff --git a/examples/combo/src/lib.rs b/examples/combo/src/lib.rs index 67dd4263..69f495ae 100644 --- a/examples/combo/src/lib.rs +++ b/examples/combo/src/lib.rs @@ -47,10 +47,10 @@ impl Game { include_background_gfx!( games, "121105", - hat => "gfx/hat.png", - purple => "gfx/purple.png", - hyperspace => "gfx/hyperspace.png", - amplitude => "gfx/amplitude.png" + hat => deduplicate "gfx/hat.png", + purple => deduplicate "gfx/purple.png", + hyperspace => deduplicate "gfx/hyperspace.png", + amplitude => deduplicate "gfx/amplitude.png" ); fn get_game(gba: &mut agb::Gba) -> Game { From f097e152cc13bbb3724c05b02c601862cbd32e7c Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 13:18:14 +0100 Subject: [PATCH 03/47] Pass deduplicate one step further --- agb-image-converter/src/config.rs | 1 + agb-image-converter/src/lib.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/agb-image-converter/src/config.rs b/agb-image-converter/src/config.rs index 814fced2..39d8936c 100644 --- a/agb-image-converter/src/config.rs +++ b/agb-image-converter/src/config.rs @@ -11,4 +11,5 @@ pub(crate) trait Config { pub(crate) trait Image { fn filename(&self) -> String; fn colours(&self) -> Colours; + fn deduplicate(&self) -> bool; } diff --git a/agb-image-converter/src/lib.rs b/agb-image-converter/src/lib.rs index af3ab982..a247e04a 100644 --- a/agb-image-converter/src/lib.rs +++ b/agb-image-converter/src/lib.rs @@ -47,6 +47,10 @@ impl config::Image for BackgroundGfxOption { fn colours(&self) -> Colours { self.colours } + + fn deduplicate(&self) -> bool { + self.deduplicate + } } impl Parse for BackgroundGfxOption { From b5af3a3aff4d76d9af6b66f655a625d6edb5da53 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 14:07:19 +0100 Subject: [PATCH 04/47] Generate tile settings instead of palette assignments --- agb-image-converter/src/image_loader.rs | 9 +++++ agb-image-converter/src/lib.rs | 3 ++ agb-image-converter/src/rust_generator.rs | 40 ++++++++++++++++++++--- agb/src/display/example_logo.rs | 12 ++++--- agb/src/display/tile_data.rs | 8 +++-- 5 files changed, 59 insertions(+), 13 deletions(-) diff --git a/agb-image-converter/src/image_loader.rs b/agb-image-converter/src/image_loader.rs index a7909ce0..5c95ad67 100644 --- a/agb-image-converter/src/image_loader.rs +++ b/agb-image-converter/src/image_loader.rs @@ -4,6 +4,7 @@ use image::{DynamicImage, GenericImageView}; use crate::colour::Colour; +#[derive(Clone)] pub(crate) struct Image { pub width: usize, pub height: usize, @@ -42,6 +43,14 @@ impl Image { } } + pub fn from_colour_data(colour_data: Vec) -> Self { + Self { + height: colour_data.len() / 8, + colour_data, + width: 8, + } + } + pub fn colour(&self, x: usize, y: usize) -> Colour { self.colour_data[x + y * self.width] } diff --git a/agb-image-converter/src/lib.rs b/agb-image-converter/src/lib.rs index a247e04a..16f19adb 100644 --- a/agb-image-converter/src/lib.rs +++ b/agb-image-converter/src/lib.rs @@ -15,6 +15,7 @@ use quote::{format_ident, quote, ToTokens}; mod aseprite; mod colour; mod config; +mod deduplicator; mod font_loader; mod image_loader; mod palette16; @@ -429,6 +430,7 @@ fn convert_image( ) -> proc_macro2::TokenStream { let image_filename = &parent.join(settings.filename()); let image = Image::load_from_file(image_filename); + let deduplicate = settings.deduplicate(); rust_generator::generate_code( variable_name, @@ -437,6 +439,7 @@ fn convert_image( &image_filename.to_string_lossy(), crate_prefix.to_owned(), assignment_offset, + deduplicate, ) } diff --git a/agb-image-converter/src/rust_generator.rs b/agb-image-converter/src/rust_generator.rs index 9a7de049..3ea5da90 100644 --- a/agb-image-converter/src/rust_generator.rs +++ b/agb-image-converter/src/rust_generator.rs @@ -1,3 +1,4 @@ +use crate::deduplicator::{DeduplicatedData, Transformation}; use crate::palette16::Palette16OptimisationResults; use crate::{add_image_256_to_tile_data, add_image_to_tile_data, collapse_to_4bpp}; use crate::{image_loader::Image, ByteString}; @@ -40,14 +41,32 @@ pub(crate) fn generate_code( image_filename: &str, crate_prefix: String, assignment_offset: Option, + deduplicate: bool, ) -> TokenStream { let crate_prefix = format_ident!("{}", crate_prefix); let output_variable_name = format_ident!("{}", output_variable_name); + let (image, dedup_data) = if deduplicate { + let (new_image, dedup_data) = + crate::deduplicator::deduplicate_image(image, assignment_offset.is_some()); + + (new_image, dedup_data) + } else { + ( + image.clone(), + (0..(image.width * image.height / 8 / 8)) + .map(|i| DeduplicatedData { + new_index: i, + transformation: Transformation::none(), + }) + .collect(), + ) + }; + let (tile_data, assignments) = if let Some(assignment_offset) = assignment_offset { let mut tile_data = Vec::new(); - add_image_to_tile_data(&mut tile_data, image, results, assignment_offset, false); + add_image_to_tile_data(&mut tile_data, &image, results, assignment_offset, false); let tile_data = collapse_to_4bpp(&tile_data); @@ -65,11 +84,22 @@ pub(crate) fn generate_code( } else { let mut tile_data = Vec::new(); - add_image_256_to_tile_data(&mut tile_data, image, results); + add_image_256_to_tile_data(&mut tile_data, &image, results); (tile_data, vec![]) }; + let tile_settings = dedup_data.iter().map(|data| { + let palette_assignment = assignments.get(data.new_index).unwrap_or(&0); + let vflipped = data.transformation.vflip; + let hflipped = data.transformation.hflip; + let index= data.new_index as u16; + + quote! { + #crate_prefix::display::tiled::TileSetting::new(#index, #hflipped, #vflipped, #palette_assignment) + } + }); + let data = ByteString(&tile_data); quote! { @@ -91,11 +121,11 @@ pub(crate) fn generate_code( &ALIGNED.bytes }; - const PALETTE_ASSIGNMENT: &[u8] = &[ - #(#assignments),* + const TILE_SETTINGS: &[#crate_prefix::display::tiled::TileSetting] = &[ + #(#tile_settings),* ]; - #crate_prefix::display::tile_data::TileData::new(TILE_DATA, PALETTE_ASSIGNMENT) + #crate_prefix::display::tile_data::TileData::new(TILE_DATA, TILE_SETTINGS) }; } } diff --git a/agb/src/display/example_logo.rs b/agb/src/display/example_logo.rs index 351d80ab..240f6638 100644 --- a/agb/src/display/example_logo.rs +++ b/agb/src/display/example_logo.rs @@ -1,4 +1,4 @@ -use super::tiled::{RegularMap, TileFormat, TileSet, TileSetting, TiledMap, VRamManager}; +use super::tiled::{RegularMap, TileFormat, TileSet, TiledMap, VRamManager}; crate::include_background_gfx!(crate, agb_logo, test_logo => "gfx/test_logo.png"); @@ -11,10 +11,12 @@ pub fn display_logo(map: &mut RegularMap, vram: &mut VRamManager) { for x in 0..30 { let tile_id = y * 30 + x; - let palette_entry = agb_logo::test_logo.palette_assignments[tile_id as usize]; - let tile_setting = TileSetting::new(tile_id, false, false, palette_entry); - - map.set_tile(vram, (x, y).into(), &background_tilemap, tile_setting); + map.set_tile( + vram, + (x as u16, y as u16).into(), + &background_tilemap, + agb_logo::test_logo.tile_settings[tile_id], + ); } } diff --git a/agb/src/display/tile_data.rs b/agb/src/display/tile_data.rs index cc51ef9b..c1193417 100644 --- a/agb/src/display/tile_data.rs +++ b/agb/src/display/tile_data.rs @@ -1,15 +1,17 @@ +use super::tiled::TileSetting; + #[non_exhaustive] pub struct TileData { pub tiles: &'static [u8], - pub palette_assignments: &'static [u8], + pub tile_settings: &'static [TileSetting], } impl TileData { #[must_use] - pub const fn new(tiles: &'static [u8], palette_assignments: &'static [u8]) -> Self { + pub const fn new(tiles: &'static [u8], tile_settings: &'static [TileSetting]) -> Self { TileData { tiles, - palette_assignments, + tile_settings, } } } From 3d7d3f25a2f7f500f0774a1bcc18b3d137854196 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 14:13:40 +0100 Subject: [PATCH 05/47] Update agb repo --- agb-image-converter/src/rust_generator.rs | 2 +- agb/examples/animated_background.rs | 4 ++-- agb/src/display/example_logo.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/agb-image-converter/src/rust_generator.rs b/agb-image-converter/src/rust_generator.rs index 3ea5da90..aad0b001 100644 --- a/agb-image-converter/src/rust_generator.rs +++ b/agb-image-converter/src/rust_generator.rs @@ -93,7 +93,7 @@ pub(crate) fn generate_code( let palette_assignment = assignments.get(data.new_index).unwrap_or(&0); let vflipped = data.transformation.vflip; let hflipped = data.transformation.hflip; - let index= data.new_index as u16; + let index = data.new_index as u16; quote! { #crate_prefix::display::tiled::TileSetting::new(#index, #hflipped, #vflipped, #palette_assignment) diff --git a/agb/examples/animated_background.rs b/agb/examples/animated_background.rs index 31ef37b1..398932b7 100644 --- a/agb/examples/animated_background.rs +++ b/agb/examples/animated_background.rs @@ -3,7 +3,7 @@ use agb::{ display::{ - tiled::{RegularBackgroundSize, TileFormat, TileSet, TileSetting, TiledMap}, + tiled::{RegularBackgroundSize, TileFormat, TileSet, TiledMap}, Priority, }, include_background_gfx, @@ -32,7 +32,7 @@ fn main(mut gba: agb::Gba) -> ! { &mut vram, (x, y).into(), &tileset, - TileSetting::new(0, false, false, 0), + water_tiles::water_tiles.tile_settings[0], ); } } diff --git a/agb/src/display/example_logo.rs b/agb/src/display/example_logo.rs index 240f6638..5c008a29 100644 --- a/agb/src/display/example_logo.rs +++ b/agb/src/display/example_logo.rs @@ -1,6 +1,6 @@ use super::tiled::{RegularMap, TileFormat, TileSet, TiledMap, VRamManager}; -crate::include_background_gfx!(crate, agb_logo, test_logo => "gfx/test_logo.png"); +crate::include_background_gfx!(crate, agb_logo, test_logo => deduplicate "gfx/test_logo.png"); pub fn display_logo(map: &mut RegularMap, vram: &mut VRamManager) { vram.set_background_palettes(agb_logo::PALETTES); From 6d56e72d662a97334ed4573fab736755d4715ad4 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 14:39:41 +0100 Subject: [PATCH 06/47] Fix palette assignment --- agb-image-converter/src/lib.rs | 12 ++++++++-- agb-image-converter/src/rust_generator.rs | 27 +++++++++++++++++------ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/agb-image-converter/src/lib.rs b/agb-image-converter/src/lib.rs index 16f19adb..d5fa34e4 100644 --- a/agb-image-converter/src/lib.rs +++ b/agb-image-converter/src/lib.rs @@ -494,7 +494,14 @@ fn palette_tile_data( let mut tile_data = Vec::new(); for (image_idx, image) in images.iter().enumerate() { - add_image_to_tile_data(&mut tile_data, image, optimiser, image_idx, true) + add_image_to_tile_data( + &mut tile_data, + image, + optimiser, + image_idx, + true, + &(0..images.len()).collect::>(), + ); } let tile_data = collapse_to_4bpp(&tile_data); @@ -517,6 +524,7 @@ fn add_image_to_tile_data( optimiser: &Palette16OptimisationResults, assignment_offset: usize, is_sprite: bool, + remap_index: &[usize], ) { let tile_size = 8; let tiles_x = image.width / tile_size; @@ -527,7 +535,7 @@ fn add_image_to_tile_data( let assignment = if is_sprite { assignment_offset } else { - y * tiles_x + x + assignment_offset + remap_index[y * tiles_x + x] + assignment_offset }; let palette_index = optimiser.assignments[assignment]; diff --git a/agb-image-converter/src/rust_generator.rs b/agb-image-converter/src/rust_generator.rs index aad0b001..bd6f243c 100644 --- a/agb-image-converter/src/rust_generator.rs +++ b/agb-image-converter/src/rust_generator.rs @@ -6,6 +6,7 @@ use crate::{image_loader::Image, ByteString}; use proc_macro2::TokenStream; use quote::{format_ident, quote}; +use std::collections::BTreeMap; use std::iter; pub(crate) fn generate_palette_code( @@ -63,21 +64,33 @@ pub(crate) fn generate_code( ) }; + let remap_index = dedup_data + .iter() + .enumerate() + .map(|(i, data)| (data.new_index, i)) + .collect::>(); // BTreeMap so that values below is in order + + let remap_index = remap_index.values().cloned().collect::>(); + let (tile_data, assignments) = if let Some(assignment_offset) = assignment_offset { let mut tile_data = Vec::new(); - add_image_to_tile_data(&mut tile_data, &image, results, assignment_offset, false); + add_image_to_tile_data( + &mut tile_data, + &image, + results, + assignment_offset, + false, + &remap_index, + ); let tile_data = collapse_to_4bpp(&tile_data); let num_tiles = image.width * image.height / 8usize.pow(2); - let assignments = results - .assignments - .iter() - .skip(assignment_offset) - .take(num_tiles) - .map(|&x| x as u8) + let all_assignments = &results.assignments[assignment_offset..]; + let assignments = (0..num_tiles) + .map(|tile_id| all_assignments[remap_index[tile_id]] as u8) .collect(); (tile_data, assignments) From b39f99990c9318f757f62aa1929bc41a47d8e271 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 14:52:20 +0100 Subject: [PATCH 07/47] Use deduplication in hyperspace roll --- agb-image-converter/src/deduplicator.rs | 152 +++++++++++++++++++++ examples/hyperspace-roll/src/background.rs | 42 ++---- 2 files changed, 166 insertions(+), 28 deletions(-) create mode 100644 agb-image-converter/src/deduplicator.rs diff --git a/agb-image-converter/src/deduplicator.rs b/agb-image-converter/src/deduplicator.rs new file mode 100644 index 00000000..cb20608b --- /dev/null +++ b/agb-image-converter/src/deduplicator.rs @@ -0,0 +1,152 @@ +use std::{collections::HashMap, hash::BuildHasher}; + +use crate::{colour::Colour, image_loader::Image}; + +pub struct Transformation { + pub vflip: bool, + pub hflip: bool, +} + +impl Transformation { + pub fn none() -> Self { + Self { + vflip: false, + hflip: false, + } + } + + pub fn vflipped() -> Self { + Self { + vflip: true, + hflip: false, + } + } + + pub fn hflipped() -> Self { + Self { + vflip: false, + hflip: true, + } + } + + pub fn vhflipped() -> Self { + Self { + vflip: true, + hflip: true, + } + } +} + +pub struct DeduplicatedData { + pub new_index: usize, + pub transformation: Transformation, +} + +#[derive(Clone, PartialEq, Eq, Hash)] +struct Tile { + data: [Colour; 64], +} + +impl Tile { + fn split_image(input: &Image) -> Vec { + let mut ret = vec![]; + + for y in 0..(input.height / 8) { + for x in 0..(input.width / 8) { + let mut tile_data = Vec::with_capacity(64); + + for j in 0..8 { + for i in 0..8 { + tile_data.push(input.colour(x * 8 + i, y * 8 + j)); + } + } + + ret.push(Tile { + data: tile_data.try_into().unwrap(), + }); + } + } + + ret + } + + fn vflipped(&self) -> Self { + let mut new_data = self.data; + for y in 0..8 { + for x in 0..8 { + new_data.swap(y * 8 + x, (7 - y) * 8 + x); + } + } + + Self { data: new_data } + } + + fn hflipped(&self) -> Self { + let mut new_data = self.data; + + for y in 0..8 { + for x in 0..8 { + new_data.swap(y * 8 + x, y * 8 + (7 - x)); + } + } + + Self { data: new_data } + } +} + +pub(crate) fn deduplicate_image(input: &Image, can_flip: bool) -> (Image, Vec) { + let mut resulting_tiles = vec![]; + let mut deduplication_data = vec![]; + + let all_tiles = Tile::split_image(input); + let mut existing_tiles = HashMap::new(); + + let hasher = std::collections::hash_map::RandomState::new(); + + for tile in all_tiles { + let (tile, transformation) = if can_flip { + let vflipped = tile.vflipped(); + let hflipped = tile.hflipped(); + let vhflipped = vflipped.hflipped(); + + // find the one with the smallest hash + let tile_hash = hasher.hash_one(&tile); + let vflipped_hash = hasher.hash_one(&vflipped); + let hflipped_hash = hasher.hash_one(&hflipped); + let vhflipped_hash = hasher.hash_one(&vhflipped); + + let minimum = tile_hash + .min(vflipped_hash) + .min(hflipped_hash) + .min(vhflipped_hash); + + if minimum == tile_hash { + (tile, Transformation::none()) + } else if minimum == vflipped_hash { + (vflipped, Transformation::vflipped()) + } else if minimum == hflipped_hash { + (hflipped, Transformation::hflipped()) + } else { + (vhflipped, Transformation::vhflipped()) + } + } else { + (tile, Transformation::none()) + }; + + let index = *existing_tiles.entry(tile.clone()).or_insert_with(|| { + resulting_tiles.push(tile); + resulting_tiles.len() - 1 + }); + + deduplication_data.push(DeduplicatedData { + new_index: index, + transformation, + }); + } + + let image_data = resulting_tiles + .iter() + .flat_map(|tile| tile.data) + .collect::>(); + (Image::from_colour_data(image_data), deduplication_data) +} diff --git a/examples/hyperspace-roll/src/background.rs b/examples/hyperspace-roll/src/background.rs index 61035ce1..fa0ea199 100644 --- a/examples/hyperspace-roll/src/background.rs +++ b/examples/hyperspace-roll/src/background.rs @@ -6,11 +6,11 @@ use agb::{ use crate::sfx::Sfx; include_background_gfx!(backgrounds, "121105", - stars => "gfx/stars.aseprite", - title => "gfx/title-screen.aseprite", - help => "gfx/help-text.aseprite", - descriptions1 => "gfx/descriptions1.png", - descriptions2 => "gfx/descriptions2.png", + stars => deduplicate "gfx/stars.aseprite", + title => deduplicate "gfx/title-screen.aseprite", + help => deduplicate "gfx/help-text.aseprite", + descriptions1 => deduplicate "gfx/descriptions1.png", + descriptions2 => deduplicate "gfx/descriptions2.png", ); pub fn load_palettes(vram: &mut VRamManager) { @@ -35,12 +35,7 @@ pub(crate) fn load_help_text( vram, (x + at_tile.0, at_tile.1).into(), &help_tileset, - TileSetting::new( - tile_id, - false, - false, - backgrounds::help.palette_assignments[tile_id as usize], - ), + backgrounds::help.tile_settings[tile_id as usize], ) } } @@ -50,13 +45,13 @@ pub(crate) fn load_description( descriptions_map: &mut RegularMap, vram: &mut VRamManager, ) { - let (tileset, palette_assignments) = if face_id < 10 { + let (tileset, tile_settings) = if face_id < 10 { ( TileSet::new( backgrounds::descriptions1.tiles, agb::display::tiled::TileFormat::FourBpp, ), - backgrounds::descriptions1.palette_assignments, + backgrounds::descriptions1.tile_settings, ) } else { ( @@ -64,7 +59,7 @@ pub(crate) fn load_description( backgrounds::descriptions2.tiles, agb::display::tiled::TileFormat::FourBpp, ), - backgrounds::descriptions2.palette_assignments, + backgrounds::descriptions2.tile_settings, ) }; @@ -75,7 +70,7 @@ pub(crate) fn load_description( vram, (x, y).into(), &tileset, - TileSetting::new(tile_id, false, false, palette_assignments[tile_id as usize]), + tile_settings[tile_id as usize], ) } } @@ -87,16 +82,12 @@ fn create_background_map(map: &mut RegularMap, vram: &mut VRamManager, stars_til for y in 0..32u16 { let blank = rng::gen().rem_euclid(32) < 30; - let (tile_id, palette_id) = if blank { - ((1 << 10) - 1, 0) + let tile_setting = if blank { + TileSetting::new((1 << 10) - 1, false, false, 0) } else { let tile_id = rng::gen().rem_euclid(64) as u16; - ( - tile_id, - backgrounds::stars.palette_assignments[tile_id as usize], - ) + backgrounds::stars.tile_settings[tile_id as usize] }; - let tile_setting = TileSetting::new(tile_id, false, false, palette_id); map.set_tile(vram, (x, y).into(), stars_tileset, tile_setting); } @@ -121,12 +112,7 @@ pub fn show_title_screen(background: &mut RegularMap, vram: &mut VRamManager, sf vram, (x, y).into(), &tile_set, - TileSetting::new( - tile_id, - false, - false, - backgrounds::title.palette_assignments[tile_id as usize], - ), + backgrounds::title.tile_settings[tile_id as usize], ); } From 201a1276732f4e87e61ad1a53fd2d5aa6350a06f Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 14:55:23 +0100 Subject: [PATCH 08/47] Use deduplicated tiles for hatwiz splash screens --- .../src/splash_screen.rs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/examples/the-hat-chooses-the-wizard/src/splash_screen.rs b/examples/the-hat-chooses-the-wizard/src/splash_screen.rs index fb90190f..2c13a1ac 100644 --- a/examples/the-hat-chooses-the-wizard/src/splash_screen.rs +++ b/examples/the-hat-chooses-the-wizard/src/splash_screen.rs @@ -1,9 +1,9 @@ use super::sfx::SfxPlayer; -use agb::display::tiled::{RegularMap, TileFormat, TileSet, TileSetting, TiledMap, VRamManager}; +use agb::display::tiled::{RegularMap, TileFormat, TileSet, TiledMap, VRamManager}; agb::include_background_gfx!(splash_screens, - splash => "gfx/splash.png", - thanks_for_playing => "gfx/thanks_for_playing.png", + splash => deduplicate "gfx/splash.png", + thanks_for_playing => deduplicate "gfx/thanks_for_playing.png", ); pub enum SplashScreen { @@ -18,12 +18,18 @@ pub fn show_splash_screen( vram: &mut VRamManager, ) { map.set_scroll_pos((0i16, 0i16).into()); - let tileset = match which { - SplashScreen::Start => TileSet::new(splash_screens::splash.tiles, TileFormat::FourBpp), + let (tileset, settings) = match which { + SplashScreen::Start => ( + TileSet::new(splash_screens::splash.tiles, TileFormat::FourBpp), + splash_screens::splash.tile_settings, + ), - SplashScreen::End => TileSet::new( - splash_screens::thanks_for_playing.tiles, - TileFormat::FourBpp, + SplashScreen::End => ( + TileSet::new( + splash_screens::thanks_for_playing.tiles, + TileFormat::FourBpp, + ), + splash_screens::thanks_for_playing.tile_settings, ), }; @@ -40,7 +46,7 @@ pub fn show_splash_screen( vram, (x, y).into(), &tileset, - TileSetting::from_raw(y * 30 + x), + settings[(y * 30 + x) as usize], ); } From a73e817f0215c5b6db0717269862fc85ceb82888 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 15:05:57 +0100 Subject: [PATCH 09/47] Deduplicate everything in hatwiz --- agb-image-converter/src/deduplicator.rs | 4 +-- .../src/level_display.rs | 15 +++++----- .../the-hat-chooses-the-wizard/src/lib.rs | 29 +++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/agb-image-converter/src/deduplicator.rs b/agb-image-converter/src/deduplicator.rs index cb20608b..92498b6d 100644 --- a/agb-image-converter/src/deduplicator.rs +++ b/agb-image-converter/src/deduplicator.rs @@ -72,7 +72,7 @@ impl Tile { fn vflipped(&self) -> Self { let mut new_data = self.data; - for y in 0..8 { + for y in 0..4 { for x in 0..8 { new_data.swap(y * 8 + x, (7 - y) * 8 + x); } @@ -85,7 +85,7 @@ impl Tile { let mut new_data = self.data; for y in 0..8 { - for x in 0..8 { + for x in 0..4 { new_data.swap(y * 8 + x, y * 8 + (7 - x)); } } diff --git a/examples/the-hat-chooses-the-wizard/src/level_display.rs b/examples/the-hat-chooses-the-wizard/src/level_display.rs index 3e87f58b..268d31af 100644 --- a/examples/the-hat-chooses-the-wizard/src/level_display.rs +++ b/examples/the-hat-chooses-the-wizard/src/level_display.rs @@ -3,10 +3,10 @@ use agb::display::{ HEIGHT, WIDTH, }; -const LEVEL_START: u16 = 12 * 28; -const NUMBERS_START: u16 = 12 * 28 + 3; -const HYPHEN: u16 = 12 * 28 + 11; -pub const BLANK: u16 = 11 * 28; +const LEVEL_START: usize = 12 * 28; +const NUMBERS_START: usize = 12 * 28 + 3; +const HYPHEN: usize = 12 * 28 + 11; +pub const BLANK: usize = 11 * 28; pub fn write_level( map: &mut RegularMap, @@ -14,15 +14,16 @@ pub fn write_level( level: u32, tileset: &'_ TileSet<'_>, vram: &mut VRamManager, + tile_settings: &[TileSetting], ) { for (i, &tile) in [ LEVEL_START, LEVEL_START + 1, LEVEL_START + 2, BLANK, - world as u16 + NUMBERS_START - 1, + world as usize + NUMBERS_START - 1, HYPHEN, - level as u16 + NUMBERS_START - 1, + level as usize + NUMBERS_START - 1, ] .iter() .enumerate() @@ -31,7 +32,7 @@ pub fn write_level( vram, (i as u16, 0).into(), tileset, - TileSetting::from_raw(tile), + tile_settings[tile as usize], ); } diff --git a/examples/the-hat-chooses-the-wizard/src/lib.rs b/examples/the-hat-chooses-the-wizard/src/lib.rs index 5a03e89c..7dd67e99 100644 --- a/examples/the-hat-chooses-the-wizard/src/lib.rs +++ b/examples/the-hat-chooses-the-wizard/src/lib.rs @@ -11,7 +11,7 @@ use agb::{ object::{Graphics, OamManaged, Object, Tag, TagMap}, tiled::{ InfiniteScrolledMap, PartialUpdateStatus, RegularBackgroundSize, TileFormat, TileSet, - TileSetting, TiledMap, VRamManager, + TiledMap, VRamManager, }, Priority, HEIGHT, WIDTH, }, @@ -101,7 +101,7 @@ mod map_tiles { } } -agb::include_background_gfx!(tile_sheet, "2ce8f4", background => "gfx/tile_sheet.png"); +agb::include_background_gfx!(tile_sheet, "2ce8f4", background => deduplicate "gfx/tile_sheet.png"); const GRAPHICS: &Graphics = agb::include_aseprite!("gfx/sprites.aseprite"); const TAG_MAP: &TagMap = GRAPHICS.tags(); @@ -801,7 +801,7 @@ pub fn main(mut agb: agb::Gba) -> ! { &mut vram, (x, y).into(), &tileset, - TileSetting::from_raw(level_display::BLANK), + tile_sheet::background.tile_settings[level_display::BLANK], ); } } @@ -846,6 +846,7 @@ pub fn main(mut agb: agb::Gba) -> ! { current_level % 8 + 1, &tileset, &mut vram, + tile_sheet::background.tile_settings, ); world_display.commit(&mut vram); @@ -865,12 +866,11 @@ pub fn main(mut agb: agb::Gba) -> ! { let level = &map_tiles::LEVELS[map_current_level as usize]; ( &tileset, - TileSetting::from_raw( - *level - .background - .get((pos.y * level.dimensions.x as i32 + pos.x) as usize) - .unwrap_or(&0), - ), + tile_sheet::background.tile_settings[*level + .background + .get((pos.y * level.dimensions.x as i32 + pos.x) as usize) + .unwrap_or(&0) + as usize], ) }), ); @@ -884,12 +884,11 @@ pub fn main(mut agb: agb::Gba) -> ! { let level = &map_tiles::LEVELS[map_current_level as usize]; ( &tileset, - TileSetting::from_raw( - *level - .foreground - .get((pos.y * level.dimensions.x as i32 + pos.x) as usize) - .unwrap_or(&0), - ), + tile_sheet::background.tile_settings[*level + .foreground + .get((pos.y * level.dimensions.x as i32 + pos.x) as usize) + .unwrap_or(&0) + as usize], ) }), ); From c9bf56755ac35494c6d2279e4b6b7ddd4bb40025 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 15:17:50 +0100 Subject: [PATCH 10/47] Also deduplicate for the dungeon puzzler --- agb/src/display/tiled/mod.rs | 12 +++++++++++ examples/the-dungeon-puzzlers-lament/build.rs | 13 +++++------- .../src/backgrounds.rs | 20 +++++++++---------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/agb/src/display/tiled/mod.rs b/agb/src/display/tiled/mod.rs index 7248e380..8120c763 100644 --- a/agb/src/display/tiled/mod.rs +++ b/agb/src/display/tiled/mod.rs @@ -165,6 +165,8 @@ impl Tile { pub struct TileSetting(u16); impl TileSetting { + pub const BLANK: Self = TileSetting::new(1023, false, false, 0); + #[must_use] pub const fn new(tile_id: u16, hflip: bool, vflip: bool, palette_id: u8) -> Self { Self( @@ -180,6 +182,16 @@ impl TileSetting { Self(raw) } + #[must_use] + pub const fn hflip(self, should_flip: bool) -> Self { + Self(self.0 ^ ((should_flip as u16) << 10)) + } + + #[must_use] + pub const fn vflip(self, should_flip: bool) -> Self { + Self(self.0 ^ ((should_flip as u16) << 11)) + } + fn index(self) -> u16 { self.0 & ((1 << 10) - 1) } diff --git a/examples/the-dungeon-puzzlers-lament/build.rs b/examples/the-dungeon-puzzlers-lament/build.rs index 7e4a297a..62b68f75 100644 --- a/examples/the-dungeon-puzzlers-lament/build.rs +++ b/examples/the-dungeon-puzzlers-lament/build.rs @@ -331,12 +331,10 @@ fn export_tiles(map: &tiled::Map, background: TokenStream) -> TokenStream { tile_tileset_x * 2 + x_offset + tile_tileset_y * 9 * 4 + y_offset * 9 * 2; let gba_tile_id = gba_tile_id as u16; - let palette_id = - quote! { backgrounds::#background.palette_assignments[#gba_tile_id as usize] }; - quote! { TileSetting::new(#gba_tile_id, #hflip, #vflip, #palette_id) } + quote! { backgrounds::#background.tile_settings[#gba_tile_id as usize].hflip(#hflip).vflip(#vflip) } } None => { - quote! { TileSetting::new(1023, false, false, 0) } + quote! { TileSetting::BLANK } } } }); @@ -361,12 +359,11 @@ fn export_ui_tiles(map: &tiled::Map, background: TokenStream) -> TokenStream { let tile_id = tile.id() as u16; let vflip = tile.flip_v; let hflip = tile.flip_h; - let palette_id = - quote! { backgrounds::#background.palette_assignments[#tile_id as usize] }; - quote! { TileSetting::new(#tile_id, #hflip, #vflip, #palette_id) } + + quote! { backgrounds::#background.tile_settings[#tile_id as usize].hflip(#hflip).vflip(#vflip) } } None => { - quote! { TileSetting::new(1023, false, false, 0) } + quote! { TileSetting::BLANK } } } }); diff --git a/examples/the-dungeon-puzzlers-lament/src/backgrounds.rs b/examples/the-dungeon-puzzlers-lament/src/backgrounds.rs index d2ac283c..9d31a94e 100644 --- a/examples/the-dungeon-puzzlers-lament/src/backgrounds.rs +++ b/examples/the-dungeon-puzzlers-lament/src/backgrounds.rs @@ -1,12 +1,12 @@ use agb::{ - display::tiled::{RegularMap, TileFormat, TileSet, TileSetting, VRamManager}, + display::tiled::{RegularMap, TileFormat, TileSet, VRamManager}, include_background_gfx, }; include_background_gfx!(backgrounds, "1e151b", - ui => "maps/ui_tiles.png", - level => "maps/level.png", - ending => "gfx/ending_page.aseprite", + ui => deduplicate "maps/ui_tiles.png", + level => deduplicate "maps/level.png", + ending => deduplicate "gfx/ending_page.aseprite", ); mod tilemaps { @@ -56,13 +56,13 @@ pub fn load_ending_page(map: &mut RegularMap, vram_manager: &mut VRamManager) { for y in 0..20u16 { for x in 0..30u16 { let tile_pos = y * 30 + x; - let tile_setting = TileSetting::new( - tile_pos, - false, - false, - backgrounds::ending.palette_assignments[tile_pos as usize], + + map.set_tile( + vram_manager, + (x, y).into(), + &ending_tileset, + backgrounds::ending.tile_settings[tile_pos as usize], ); - map.set_tile(vram_manager, (x, y).into(), &ending_tileset, tile_setting); } } } From c25cd74f4305379289fed65f65a2c6a18192aba7 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 15:20:41 +0100 Subject: [PATCH 11/47] Correctly use deduplication for combo rom --- examples/combo/src/lib.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/examples/combo/src/lib.rs b/examples/combo/src/lib.rs index 69f495ae..faaaa6f2 100644 --- a/examples/combo/src/lib.rs +++ b/examples/combo/src/lib.rs @@ -8,7 +8,7 @@ use alloc::boxed::Box; use agb::{ display::{ - tiled::{InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet, TileSetting}, + tiled::{InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet}, Priority, }, fixnum::{Num, Vector2D}, @@ -66,11 +66,11 @@ fn get_game(gba: &mut agb::Gba) -> Game { let tiles = [hat, purple, hyperspace, amplitude]; - let palette_assignments = &[ - games::hat.palette_assignments, - games::purple.palette_assignments, - games::hyperspace.palette_assignments, - games::amplitude.palette_assignments, + let tile_settings = &[ + games::hat.tile_settings, + games::purple.tile_settings, + games::hyperspace.tile_settings, + games::amplitude.tile_settings, ]; vram.set_background_palettes(games::PALETTES); @@ -87,15 +87,7 @@ fn get_game(gba: &mut agb::Gba) -> Game { let game = (pos.x).rem_euclid(tiles.len() as i32 * 30) as usize / 30; let tile_id = (y * 30 + x) as usize; - ( - &tiles[game], - TileSetting::new( - tile_id as u16, - false, - false, - palette_assignments[game][tile_id], - ), - ) + (&tiles[game], tile_settings[game][tile_id]) }), ); From 9db4230aeedfbeec1aaf1827ab6becb79d1db886 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 15:34:07 +0100 Subject: [PATCH 12/47] Better error if we run out of VRam --- agb/src/display/tiled/vram_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index c9220f73..bb5bb200 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -302,7 +302,7 @@ impl VRamManager { let new_reference: NonNull = unsafe { TILE_ALLOCATOR.alloc(layout_of(tile_set.format)) } - .unwrap() + .expect("Ran out of video RAM for tiles") .cast(); let tile_reference = TileReference(new_reference); reference.or_insert(tile_reference); From a865240308ba8a6886fc40487746f3fa82d9e983 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:07:50 +0100 Subject: [PATCH 13/47] Start fixing 256 colours --- agb/src/display/tiled/map.rs | 33 ++++++++++++++------------- agb/src/display/tiled/mod.rs | 4 ++-- agb/src/display/tiled/vram_manager.rs | 19 +++------------ examples/combo/src/lib.rs | 18 +++++++-------- 4 files changed, 31 insertions(+), 43 deletions(-) diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index ea1cdac4..5023a3e9 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -10,7 +10,7 @@ use crate::memory_mapped::MemoryMapped; use super::{ AffineBackgroundSize, BackgroundID, BackgroundSize, BackgroundSizePrivate, - RegularBackgroundSize, Tile, TileFormat, TileIndex, TileSet, TileSetting, VRamManager, + RegularBackgroundSize, Tile, TileFormat, TileSet, TileSetting, VRamManager, }; use alloc::{vec, vec::Vec}; @@ -20,10 +20,9 @@ pub trait TiledMapTypes: private::Sealed { } trait TiledMapPrivate: TiledMapTypes { - type TileType: Into + Copy + Default + Eq + PartialEq; type AffineMatrix; - fn tiles_mut(&mut self) -> &mut [Self::TileType]; + fn tiles_mut(&mut self) -> &mut [Tile]; fn tiles_dirty(&mut self) -> &mut bool; fn colours(&self) -> TileFormat; @@ -59,9 +58,11 @@ where T::Size: BackgroundSizePrivate, { fn clear(&mut self, vram: &mut VRamManager) { + let colours = self.colours(); + for tile in self.tiles_mut() { if *tile != Default::default() { - vram.remove_tile((*tile).into()); + vram.remove_tile(tile.tile_index(colours)); } *tile = Default::default(); @@ -134,10 +135,9 @@ impl TiledMapTypes for RegularMap { } impl TiledMapPrivate for RegularMap { - type TileType = Tile; type AffineMatrix = (); - fn tiles_mut(&mut self) -> &mut [Self::TileType] { + fn tiles_mut(&mut self) -> &mut [Tile] { &mut self.tiles } fn tiles_dirty(&mut self) -> &mut bool { @@ -195,11 +195,12 @@ impl RegularMap { tileset: &TileSet<'_>, tile_setting: TileSetting, ) { - if tileset.format() != self.colours() { + let colours = self.colours(); + if tileset.format() != colours { panic!( "Cannot set a {:?} colour tile on a {:?} colour background", tileset.format(), - self.colours() + colours ); } @@ -207,7 +208,7 @@ impl RegularMap { let old_tile = self.tiles_mut()[pos]; if old_tile != Tile::default() { - vram.remove_tile(old_tile.into()); + vram.remove_tile(old_tile.tile_index(colours)); } let tile_index = tile_setting.index(); @@ -254,7 +255,7 @@ pub struct AffineMap { transform: AffineMatrixBackground, - tiles: Vec, + tiles: Vec, tiles_dirty: bool, } @@ -263,10 +264,9 @@ impl TiledMapTypes for AffineMap { } impl TiledMapPrivate for AffineMap { - type TileType = u8; type AffineMatrix = AffineMatrixBackground; - fn tiles_mut(&mut self) -> &mut [Self::TileType] { + fn tiles_mut(&mut self) -> &mut [Tile] { &mut self.tiles } fn tiles_dirty(&mut self) -> &mut bool { @@ -320,19 +320,20 @@ impl AffineMap { tile_id: u8, ) { let pos = self.map_size().gba_offset(pos); + let colours = self.colours(); let old_tile = self.tiles_mut()[pos]; - if old_tile != 0 { - vram.remove_tile(old_tile.into()); + if old_tile != Tile::default() { + vram.remove_tile(old_tile.tile_index(colours)); } let tile_index = tile_id as u16; let new_tile = if tile_index != TRANSPARENT_TILE_INDEX { let new_tile_idx = vram.add_tile(tileset, tile_index); - new_tile_idx.raw_index() as u8 + Tile::new(new_tile_idx, TileSetting(0)) } else { - 0 + Tile::default() }; if old_tile == new_tile { diff --git a/agb/src/display/tiled/mod.rs b/agb/src/display/tiled/mod.rs index 8120c763..7c289a3f 100644 --- a/agb/src/display/tiled/mod.rs +++ b/agb/src/display/tiled/mod.rs @@ -156,8 +156,8 @@ impl Tile { Self(idx.raw_index() | setting.setting()) } - fn tile_index(self) -> TileIndex { - TileIndex::new(self.0 as usize & ((1 << 10) - 1), TileFormat::FourBpp) + fn tile_index(self, format: TileFormat) -> TileIndex { + TileIndex::new(self.0 as usize & ((1 << 10) - 1), format) } } diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index bb5bb200..d98c968d 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -2,7 +2,6 @@ use core::{alloc::Layout, ptr::NonNull}; use alloc::{slice, vec::Vec}; -use crate::display::tiled::Tile; use crate::{ agb_alloc::{block_allocator::BlockAllocator, bump_allocator::StartEnd}, display::palette16, @@ -66,21 +65,21 @@ impl<'a> TileSet<'a> { #[derive(Debug, Clone, Copy)] pub enum TileIndex { FourBpp(u16), - EightBpp(u8), + EightBpp(u16), } impl TileIndex { pub(crate) const fn new(index: usize, format: TileFormat) -> Self { match format { TileFormat::FourBpp => Self::FourBpp(index as u16), - TileFormat::EightBpp => Self::EightBpp(index as u8), + TileFormat::EightBpp => Self::EightBpp(index as u16), } } pub(crate) const fn raw_index(self) -> u16 { match self { TileIndex::FourBpp(x) => x, - TileIndex::EightBpp(x) => x as u16, + TileIndex::EightBpp(x) => x, } } @@ -99,18 +98,6 @@ impl TileIndex { } } -impl From for TileIndex { - fn from(tile: Tile) -> Self { - tile.tile_index() - } -} - -impl From for TileIndex { - fn from(index: u8) -> TileIndex { - TileIndex::new(usize::from(index), TileFormat::EightBpp) - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] struct TileReference(NonNull); diff --git a/examples/combo/src/lib.rs b/examples/combo/src/lib.rs index faaaa6f2..213f9301 100644 --- a/examples/combo/src/lib.rs +++ b/examples/combo/src/lib.rs @@ -47,10 +47,10 @@ impl Game { include_background_gfx!( games, "121105", - hat => deduplicate "gfx/hat.png", - purple => deduplicate "gfx/purple.png", - hyperspace => deduplicate "gfx/hyperspace.png", - amplitude => deduplicate "gfx/amplitude.png" + hat => 256 deduplicate "gfx/hat.png", + purple => 256 deduplicate "gfx/purple.png", + hyperspace => 256 deduplicate "gfx/hyperspace.png", + amplitude => 256 deduplicate "gfx/amplitude.png" ); fn get_game(gba: &mut agb::Gba) -> Game { @@ -59,10 +59,10 @@ fn get_game(gba: &mut agb::Gba) -> Game { let (tile, mut vram) = gba.display.video.tiled0(); - let hat = TileSet::new(games::hat.tiles, TileFormat::FourBpp); - let purple = TileSet::new(games::purple.tiles, TileFormat::FourBpp); - let hyperspace = TileSet::new(games::hyperspace.tiles, TileFormat::FourBpp); - let amplitude = TileSet::new(games::amplitude.tiles, TileFormat::FourBpp); + let hat = TileSet::new(games::hat.tiles, TileFormat::EightBpp); + let purple = TileSet::new(games::purple.tiles, TileFormat::EightBpp); + let hyperspace = TileSet::new(games::hyperspace.tiles, TileFormat::EightBpp); + let amplitude = TileSet::new(games::amplitude.tiles, TileFormat::EightBpp); let tiles = [hat, purple, hyperspace, amplitude]; @@ -79,7 +79,7 @@ fn get_game(gba: &mut agb::Gba) -> Game { tile.background( Priority::P0, RegularBackgroundSize::Background32x32, - TileFormat::FourBpp, + TileFormat::EightBpp, ), Box::new(|pos| { let y = pos.y.rem_euclid(20); From b5991d3ccc7a48ed19c9b828916dc85cdba258ec Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:14:05 +0100 Subject: [PATCH 14/47] Copy all the tiles for a 256 colour map --- agb/src/display/tiled/map.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index 5023a3e9..367f111b 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -83,18 +83,18 @@ where fn commit(&mut self, vram: &mut VRamManager) { let screenblock_memory = self.screenblock_memory(); - let tile_count_divisor = self.colours().tile_size() / TileFormat::FourBpp.tile_size(); + if *self.tiles_dirty() { unsafe { dma_copy16( self.tiles_mut().as_ptr() as *const u16, screenblock_memory, - self.map_size().num_tiles() / tile_count_divisor, + self.map_size().num_tiles(), ); } } - let tile_colour_flag: u16 = (tile_count_divisor == 2).into(); + let tile_colour_flag: u16 = (self.colours() == TileFormat::EightBpp).into(); let new_bg_control_value = (self.priority() as u16) | ((self.screenblock() as u16) << 8) From 3eb7aabe374a91eb4e2c1c659185b49d41cc9e04 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:17:14 +0100 Subject: [PATCH 15/47] Add dungeon puzzler to combo --- examples/combo/Cargo.lock | 304 ++++++++++++++++++++++++- examples/combo/Cargo.toml | 1 + examples/combo/gfx/dungeon_puzzler.png | Bin 0 -> 8022 bytes examples/combo/src/lib.rs | 12 +- 4 files changed, 305 insertions(+), 12 deletions(-) create mode 100644 examples/combo/gfx/dungeon_puzzler.png diff --git a/examples/combo/Cargo.lock b/examples/combo/Cargo.lock index b1a7c38f..3898d9ee 100644 --- a/examples/combo/Cargo.lock +++ b/examples/combo/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ "image", "proc-macro2", "quote", - "syn", + "syn 2.0.28", ] [[package]] @@ -61,7 +61,7 @@ version = "0.16.0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.28", ] [[package]] @@ -71,7 +71,47 @@ dependencies = [ "hound", "proc-macro2", "quote", - "syn", + "syn 2.0.28", +] + +[[package]] +name = "agb_tracker" +version = "0.16.0" +dependencies = [ + "agb", + "agb_tracker_interop", + "agb_xm", +] + +[[package]] +name = "agb_tracker_interop" +version = "0.16.0" +dependencies = [ + "agb_fixnum", + "proc-macro2", + "quote", +] + +[[package]] +name = "agb_xm" +version = "0.16.0" +dependencies = [ + "agb_xm_core", + "proc-macro-error", + "proc-macro2", +] + +[[package]] +name = "agb_xm_core" +version = "0.16.0" +dependencies = [ + "agb_fixnum", + "agb_tracker_interop", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.28", + "xmrs", ] [[package]] @@ -133,6 +173,12 @@ dependencies = [ "byteorder", ] +[[package]] +name = "base64" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" + [[package]] name = "bilge" version = "0.2.0" @@ -153,7 +199,16 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.28", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", ] [[package]] @@ -199,6 +254,7 @@ dependencies = [ "agb", "amplitude", "hyperspace-roll", + "the-dungeon-puzzlers-lament", "the-hat-chooses-the-wizard", "the-purple-night", ] @@ -228,6 +284,12 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "flate2" version = "1.0.26" @@ -244,7 +306,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0793f5137567643cf65ea42043a538804ff0fbf288649e2141442b602d81f9bc" dependencies = [ - "hashbrown", + "hashbrown 0.13.2", "ttf-parser", ] @@ -257,6 +319,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "hashbrown" version = "0.13.2" @@ -266,6 +339,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "hound" version = "3.5.0" @@ -294,6 +373,16 @@ dependencies = [ "png", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "itertools" version = "0.11.0" @@ -309,6 +398,12 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + [[package]] name = "libflate" version = "0.1.27" @@ -321,12 +416,38 @@ dependencies = [ "take_mut", ] +[[package]] +name = "libflate" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ff4ae71b685bbad2f2f391fe74f6b7659a34871c08b210fdc039e43bee07d18" +dependencies = [ + "adler32", + "crc32fast", + "libflate_lz77", +] + +[[package]] +name = "libflate_lz77" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a52d3a8bfc85f250440e4424db7d857e241a3aebbbe301f3eb606ab15c39acbf" +dependencies = [ + "rle-decode-fast", +] + [[package]] name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "memchr" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae" + [[package]] name = "miniz_oxide" version = "0.3.7" @@ -392,6 +513,27 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.28", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -410,6 +552,22 @@ dependencies = [ "miniz_oxide 0.3.7", ] +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -419,6 +577,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", + "syn 1.0.109", "version_check", ] @@ -451,6 +610,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "rle-decode-fast" version = "1.0.3" @@ -478,6 +667,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-big-array" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.183" @@ -486,7 +684,7 @@ checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.28", ] [[package]] @@ -500,6 +698,25 @@ dependencies = [ "serde", ] +[[package]] +name = "slotmap" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +dependencies = [ + "version_check", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.28" @@ -517,6 +734,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +[[package]] +name = "the-dungeon-puzzlers-lament" +version = "0.1.0" +dependencies = [ + "agb", + "agb_tracker", + "proc-macro2", + "quote", + "slotmap", + "tiled 0.11.1", +] + [[package]] name = "the-hat-chooses-the-wizard" version = "0.1.0" @@ -533,7 +762,7 @@ dependencies = [ "agb", "generational-arena", "quote", - "tiled", + "tiled 0.9.4", ] [[package]] @@ -542,11 +771,39 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d2c30aeea9d8159cb461a17dba23ad28980a2a9c217a6784a14e931e4979d6f" dependencies = [ - "base64", - "libflate", + "base64 0.10.1", + "libflate 0.1.27", "xml-rs", ] +[[package]] +name = "tiled" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "181e2402be287d74e951a8e81c8798d0737cc94b1a089237bb3b838be76c6b5b" +dependencies = [ + "base64 0.21.3", + "libflate 1.4.0", + "xml-rs", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + [[package]] name = "ttf-parser" version = "0.15.2" @@ -565,8 +822,37 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winnow" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +dependencies = [ + "memchr", +] + [[package]] name = "xml-rs" version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" + +[[package]] +name = "xmrs" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fa1ec7c01e6bb4c716f84a418f4ced5f4a735b2ae6364f4bb5850da61321d16" +dependencies = [ + "bincode", + "libflate 1.4.0", + "num_enum", + "rand", + "serde", + "serde-big-array", +] diff --git a/examples/combo/Cargo.toml b/examples/combo/Cargo.toml index d21d703b..4027ef61 100644 --- a/examples/combo/Cargo.toml +++ b/examples/combo/Cargo.toml @@ -11,6 +11,7 @@ the-purple-night = { path = "../the-purple-night" } the-hat-chooses-the-wizard = { path = "../the-hat-chooses-the-wizard" } hyperspace-roll = { path = "../hyperspace-roll" } amplitude = { path = "../amplitude" } +the-dungeon-puzzlers-lament = { path = "../the-dungeon-puzzlers-lament" } [profile.dev] opt-level = 3 diff --git a/examples/combo/gfx/dungeon_puzzler.png b/examples/combo/gfx/dungeon_puzzler.png new file mode 100644 index 0000000000000000000000000000000000000000..7f820ac4e1bc4c0e890337727c804c241d7868a8 GIT binary patch literal 8022 zcmV-cAF1GpP)^muYM@s_9dCI|8Oi9FN4u-UCBD3=2TYV>1Sa7;aJ|nKV?*{ zd^5zKUN+X@MSVRHwcBdB-5%mkZZ$3zxH0GtLOvrda~=Ij>DBbgaxskt#v^B+f?%PI zsC+XVeOHxhltq2L+-3A#RX;+zJ?wU?@;bWRsv>thZ zePu&C)k5dIvh2lz)3**bigFRa%IpuRZd2vH*SRX?l8mN0BDCx-0odqDkAeit^)ie) z%|h|CABeAB*)+8ypuil+{z>J7kW4Z@Bjalz*YGYG??(1k<0<$S?zDF5Xe0(fc-D8V zZResf%VE1B%CQh|l*96;p8<|?;1*O1twhHP6j&`pgyv7VwU)2uR0ctP(7)~LC}1~| zMxo{5Fl*nm0#+dk+Z8RX0_%Z@(3YF$0tIp+wWn}ZP;)AUH*$TXS+tBW+)Y-_kCh~J z&8g^%1+5p3c6&JdZp`Iu<}I(X+>55Y04qaiN#eRQPzJEnodJ z$|T-_>=$4)2n{wfgAY&JbksdOZAY6?KI&p=5Y#CqJ!w8kVa`_wN^d#df#G+<3{Kll zXi4RoTXLMz?q1{K+{4z3b8mOAfx_Ww`{LXSf{^?H#iWl9Q@;#Ge5gTCFFbGiA>EP) zAGU}n{7}u{bXGpJC15tU4q7xxV*bx8ZymJIJ&s*!Zt3u}U3UiTv0#xjN4$UnV?y%{ zR}Mc^<)2(X{BAs3KD1SU^}RUvynaw~OW>~84;oF!>jy*x+kEMVM4sc6h(fmFjM!so zt4A-ObwniA@xvC@WcaVkt6UmPxYuEQi`Q4bFB>g%R{E&Tz>pho+E@Y9C!*fV9ud`@ z0eo&aCv?<>hg~2QKb4t4L==9gD)d@*Wj&YJuM>gIzoy1IY`4&t!HB3%M_sV9=9Vt~ zu+cOGO)veh<|fIdho|l5VlT%jNzePHE`Md9#Gyf^A$^=MiYYW&YGp3B+e7d^gUz%O zJ~Y6;xMVGx=O75#bwYee|=9;!-Osdrhrub#fB7+Xg|s zK@(q}Yyl@GciJw>@f8#S5P+>|9?mVVvfOKG9eZ64&Dl(_u~8`7YR`|l9CD^O0Eb^6q}*~{A`0I7&Q4Uo%Hvr7jyGY= zmg}O9R45FBu=lcO&o6L`*ghW<(bZnoXxThn~9n7HkVg< z4%kj;w9=4|0T`vunWhS@NpKx3XEt-kIDnwXX7-AwW+pMx^EQ`Pc|O=nXwKrmB8TdL zB)gvyzDm=p*z7d0dFI4DV57{l-Wry@&cJa>HJ2!MHc-LY zaba{NrXJf;;orkbrQK zcCtlCM5S^)c$Ah}Xfg8YBgtr59F%x2 z#}o?UN(K{=v*XfE#ABn`E?~q=d7I0tJO?Z#Gy^>;G?^>s^#dcDiIS!v91reQ!AfVx zl|~xx2|O7-3s!EF51ox{aoZcKJQa9?_7WQ6xvhg1M;;18iImuqREilPz12 z5}eG`XgYXX3~C?>AbAI@7j?Fq-n z-woVdfu+JyA9@f(T`FF`OYzu2WG3lR4y8YZh_=5@%MD1TfZ8_!i#YV^!csy@ z)dA^1gVT!pq4>nxUk~Zaaqr(ot^YPV3_PzFIE^7&Y@T=b8eTsVIoOV~I?11<#MV zk6*NjQUe#Q&vxm{)U$9nkH-yQz08NEO|sBy(|$;1!Mfe+$cFLqkPa#r6I%Zim45l4 z?$!M@d@80(UpdcQ&NCTGLtj=@|3g_T_>C8Q*9fv^Wku z-^CZWU04^kE9&L8JqA_JEH6+I#w^iE-UUKJ=QwQbGfAyf>f>CFCL8 zoSwm5hEM<0I{s^K;&2pF+yztQL$51rBsA3a2SI)ChKL9=Im-%-X6gA+7b-IhP#LNQ za78ME&%JQaC?&Sm3zJDLqCw+v5}%$Ay-`Nm@~A+5BtEoN?ZV4oBtvG>_l1_%;b~iO zpwTE~U5-Dr44s9IQoZ92-On$UblC-N9o97pCG;>bx(VSxOUFQlI6nIRcIAwSs$X|W zSY=)VKHYk^BetpM04h}_wQxT`HiT^hhAG) zZK2U?h>$P{2hQn@Hkln-D$}sPOW-t-v7lhX^P$%X_F8C8BBfZDLrOs_V+x5T#-T8| zbt?OR-zAfN5|@z=9gWV~458??X%Ujmga)L<44^BVGbEc~q!|!Az?edg+;LXwQZ9XU zuui{#)h>s`r60;Z>Y7_(#{=PKWxTiC1aNjgOYVC8KsE;z8OQ>w2ulgg{zmJd=d3S4@xm++R_k);^KEh)4p7E{Ped(#Do4!b zf&g9sW;5ndmWSnO4l&{EWw1r*m^HL#XDHCNkMnh4ZgiM||fe?3G_sk7q}b>*-tw*3qwco_3Yjf{kUf_S;|0?b# zp@GhM*w~56$wN91&-UUeI)yL|&s>Ouw+>nuVZOW90F^OXmNZgw-VzT2fGvlEboTkh zO!Ws3$5gaF7YBO@onIeXde4fnNj!?!NIN_3;}`VoLDIx*9khBcdmu4uHPzh6LJQeQ zaq75*igC4a7V(->ovD7^35wR|0%7$$g_pr-5Y%Db5Rm`{r9L!!&zK~rA!G1g4>y?A0acBu$9~zkG z{`e`EGL;hMqxdxrf+)_7?iKkpU=1hUMX}{U5Mm8piCOCxSQPLmEzO5c1MIY%LNn?{ z`EpE?>PI<0IH=4Tr?Mv!N8pK9*pE-M<-^;yIj{8sP?1MaibZMnou^^0M-3xw5#mI-$hbAppDrg9o=?hLny5}$+v9q8-U zC%-}}DJPVY$oeN?uytEbvClng{Q?Vwy-^OSK}urmDtEO^n7W_Jbnl8Lqa0_|D-^u< zL|=}X)6X7s!KzC?RKnYGZh(vz#%Rkke72nR)7phM5CB;Thcg>i_Y_L(?lpQZd%c%E zC2@2jUFpj)ozpKtn*t)D&Q5P~HlWznzV{Kf>;8wDmCBNNSVX=xOF82G(K~mz%x?&c z?i}^WA5g5{ATO*4>dge(37tP5`pRiP{;xBXpZ&h`g_Grw#Jwtp*f#P@QPw*V8M-ac z=<&&@&qKe^M#M*nb$)Lq62fQMe`v2Xe>V6QY$r5>jTvknVjai*C=A#BN2~R_&PCtb zZAPuJUxL_v2Sg6F|3O_!CJ=(q~a=nZaqWt(pTaNf*Y`N|n^-)Gm4BF)m#ih#o)||?t&!*2BuM_U(k(1&?WFw)u zZ3J&p>L=kt%wh&i!7m;TL1>`&bHwS^?>fDo&+z}3A0{ST3f}wGrdgolYSdBIF#Drq zz4RAj*7_hc3+*YE58ovO0T<3}Rxaib%j$w}!A6$@%1J1*Va~{h4#&hF9U|)ed^URP z6H(>U37&yTtS4P>>C1`y?#LCdHrDFcA96N{#Un$!s>!=!BTx_<}^17)AFIgq|sZyN0C(? zz4f1d@@VwVtBe}2em=vd(OaMXY@QO2&m~_Z(wva;k7MtT-HX0Q0qxV_|J1)SN;i>k zpwHfKQA!rSuItX6CZVTuaqfZBH#4cgs~;?#+bRP}L)J!pXd_^~_{Ed?(Czl{=_il& zN3GFYfArShr~2rfSNWttMEj!_#T0MVBY#nv=W50O!VRhwp9@4(b1Lvgn6m8qqS4uV zH%>;%oR2HNdYy2XjK-b(F`0<+ZISFW&LG-oI{Y#>n$GfcLh8=o(Pu+;rZKfE{-Yqv zN*%eCp>I{nO3jQz&2bAhx*QTy^P$1!<98<{rrISUaC-F4i`Sn#{p8W^_DOG$*y(D; zH{?%~KO7~qzX7E(UG0^({}zQr#`haoDb04rIehg#IT}&O6a;+@%4VjCL!(XNo5`8k zH;i_Bh?!owpde!_o&~R0ruddmD(&F&!Cpe=&xZ!O-KuWtDxWmyotpO}z2~(2X&7mU zdu*RauJhGiRf;8WdAHfP=zG0)W7<|Ppwsj({ZJpqBFW9Box^zybnD!}JVx?InA=ij zK+fsST<4VwnelrCX2IfCOWhebP6@NjOGyJ~$Hmlx0GRQt)O#F8s^+lVMpP?)TK+T} zX=lg1^Ov5q!Dr(t^ZRUEm1g^DuYpD?(#dTE_nwt{M0EV_v6Cl#>DoLvX@x*T<9z~k@$*imLP+GNJwKCkiz{FiPkW8~J7RZ2&KC~RG!YUSxW=UpoL~)NDmuSL^sKiuZPVZCQ3kNjU z2b_Ik5)Hxa4-|#(lgr8L z!RcXtmpx-<^C+f7BVL4gz8ZBvxXWNv#n7y%=_aWb(xeZqGz7OlOawYgP4(iX1j41S z7QB8`kh>&v2DnM0F!Jmo9go?SBR3P45?V=y=JlLADl5mFzQ=3WyFlCni>&Fdi2ECH zEXrsI@}d&RlhptoG>{)W;tPwAZlYL~=7xI;R~q)}LsLAypS?-gX&wLq0wKxsYUE-n zHwDaWPI2a3`Y79coV_9ktdToL# z)>&vhuaZP>uyi?K2$?HvclFtW5D#H}Xx`;%^IK_6IjvcN(upGnq_77}F-I|CWv2Ra z5>c5%N|QmDBE*pg))CqWxpE3vtT9f;Cz>22E1?W-MaV_6RyYh@ zsM^g`pR}Nj9CAmA++z{8n+_YLz|i_p)RLy|C1+RJa$SA6tE4rD0y%?%Vpd@d3(dnulu^*e1PRR12C$ETHFEqZ#Wowx z283pmLn*-%BS#hJiez)t$4e#ej&Gbpmdl=%s}MY2I-s|b#%X<0ED{Dd98*Bi>{!yD zWZ3W8AQoJ?Dl<5*cuL8(kcGuBtfGvlf#4p~w$CD$ylI?5r( zdjkp~V20UmX2=$yv*Uu_SgE8eBZMLaWpv|hG+>v0i0pe=ZI1dzl`vRt4m=lB&JP>A zzVZA9LH*=S6$wM=3T`wVWbMF?>QOdj!a|xf+msShV+(EQ$)=#G{H92GBr z*7_ONq+s(*u#wP2bQz4~gOvFUoNxyhSrS*7QWk4uH6375?`1EIbGv(u-Mxm_518)U zyu;hYt_5G}O!XP;nIKE4a5LtErGy3yqe|oP{WRHBQs%5@C=<)-0F4|cm2-$ffL@%- zYLvl6irlRA=x0pJptBA+}&%SIjHXoK@2^K zg3bBvUIUI0)-;;Vto76HyTClKF%Hc@uOT`P`CCjWVJvBkIjq5pT!yldlrTl#avJ9- z_J8nRNg?!0KjeK`#CneUMil0GK3E#Iqe;C+@IbOKZA>A%)Y4kBtY{DkkS1LoEQ=_o zS_{O)n@lVof=)z9?wda#3cY^!@U)F6+pP5mL7n^o3)o$pdue00mIn(1Tyw)-LIXMV zp_PW9v5Y#()X1cXjPX`o-bGl=h^dKp0m>eAiMD2{e;I5M)u}(Y6)73O!jJRZusRMc zk*yC6I6H23Od}54b&cZ06!nG>5w#9laof)D={NZUb&B{pbNvZho?5>^E?8=zGxVW> zs7a>`4|(sWQCVNF&vL?fs+WFv>Ccu>KPv^5`UQip4^=tIp6?EFIe5?tx>PvVhx_3U zPus?h5(SDvGtxC#yB1x|QO#JUo0o#PaWRe%NTC=g@~XwgP1tiOAf!cq@9$ z1(u45IJ9jEgv_Mg%O0-HnAZky5)z3nL#3<($^j@#xsRLFV=l08tb;zZF`ZxLMk{M> zSC6^CQek^fVe6nJ#gizW=~b_(N9be@G^}`jJ?86PcY#}ijXpFmt3EVz`HhEChI!kd z$7~g>@;0vtdkIbX^r6}4vW&STVl?kWEL|>Pi5{~Ju;1a#58GW1nx+p8NH%|bP{H5s z>w91%&zZu(JA3q)3oHtFj+Q1T)tpMrsdRQef>@Ynm8U91HzC_;_w$6!yRQ?uneP8? zeSA>43`UN--Dox-dv1i0)094&{Q6;Sybh~f4$7wwom6%z7hjFquRrpdi?4obG#i0` z<+#c8CpPFY7g!SPB{b_pbC0(&LYAX%{@-`mNQ2XS5Uh0EZLjaK8?EaxFZ*5!+!*X7 zGzooZG7To>(cL5@8{w-&ySv*&QmDb@#1v=ISRudYT%A7AMIW2u? zm}*dV!cp#zi0Eq6QBv@Xddw6HVr*a#dTktNvXjs==|e02Lu83#K(IMU?bs1#DfF0Q ztdrAaY1j_qmoVm(1H&w2A!W5B^b{p!I&KC}0YSn(HJZ-hX&e8Gu-%HnQbNN*gI;ny zr^Ti1h>?Z5E{8JwTN%OS^#de|+?XD7fhEDl5i95*96TJenM```V(mlbw2~67XFn@? zG?wTw+Xj1{{xxBv4=s@qhn8}*G%3RzP@?oKTZ9;+Rp>FVF)VdCD1Dy7Ac*47tX0m6 zw3IH18;{tp*JoWFOMeK zyf$CnjfK@Nhb}>jXtb_vAdx1+EEjKAkJ&b?(`#%sp<4$n$=wun&|EUiGK{Tn+HgH) z3qQ_tBk`dvd`+Jpb(P^NM%_+{Y)M?>5qKgZ$kHKTw>fNHGuYcG%+pu5yVuAm!>ml5 zUFb2dD=f{2W>&G0Hg={!4H4y>GR%xZk6FUP@AG`H*FsZlq$O(=TB9+SM~0cFmMZj^ zjj+m`T?dxxa*&vqg8yWf9-w5#6*9~Pq9})*6MON9z_<_GU`1FljEGtXM3EKmu}&_D zc-+);6Y@8D_TSCvV2LuE$(pc~}`jqpJ^*Y4(FP-#0_H zIf4y(%mtQ*)gUz6-AjKW`(DaA(i9oyM46z_V_svd0HJjQEcuts#mTMMeKd8i4TOa) zsQC~PT37$J5Z7d3LE=ro%BYVPD3Av>j#w#>0VPYj`0OZ9U5+BF-F{%`0}-9|r_ac- zX;3>>Uj2|clW>9C#{R>U840d|b^16@X%tqz84}UxyQ*B-ZV!p5+pX%0Tt-1Ja~*jE z{fyZsRmyt7cn!wWWt?5P68TdYH_2m}qvi@rrq4*&;hP82{r}PvmJ|bXrRoR!&E70tpewyTpa^#Gso^cIRU#c|s zU9Qx<=QK{IdG`AC&vcQDwV~i*ai_IYM;OR)N+)lsMU=yG>^~gKu-!G|&`8Z)>8H;> z2yWp{YiEOGHrE4196AGciKx>|Bsz^v!!!W^r4B+R{9oD8sN|B}5?#`H`3T09%R8@r z5Cv(K<$5MDwm$l7sMN`MUY-*=+jY_JI{SdjI8NG+rr*L@-@Ti0GRnMR<4>k&YU!7f z^M_dKd6|X!VePqJ`L^iwzdC*N`sjqxnKAXe8P}Y#V>Y+)U%;%#$@uY=qunJUuOA%u zpRn%RB=WaB7TZQy_IcCxvgdxojI;2=5@UX6y`H3g`qR(a>v}b>c^q{m-$LO-7g#I& YKmYKbp=f the_hat_chooses_the_wizard::main(gba), Game::ThePurpleNight => the_purple_night::main(gba), Game::HyperspaceRoll => hyperspace_roll::main(gba), + Game::TheDungeonPuzzlersLament => the_dungeon_puzzlers_lament::entry(gba), Game::Amplitude => amplitude::main(gba), } } @@ -39,7 +41,8 @@ impl Game { 0 => Game::TheHatChoosesTheWizard, 1 => Game::ThePurpleNight, 2 => Game::HyperspaceRoll, - 3 => Game::Amplitude, + 3 => Game::TheDungeonPuzzlersLament, + 4 => Game::Amplitude, _ => unreachable!("game out of index in an unreachable manner"), } } @@ -50,7 +53,8 @@ include_background_gfx!( hat => 256 deduplicate "gfx/hat.png", purple => 256 deduplicate "gfx/purple.png", hyperspace => 256 deduplicate "gfx/hyperspace.png", - amplitude => 256 deduplicate "gfx/amplitude.png" + dungeon_puzzler => 256 deduplicate "gfx/dungeon_puzzler.png", + amplitude => 256 deduplicate "gfx/amplitude.png", ); fn get_game(gba: &mut agb::Gba) -> Game { @@ -62,14 +66,16 @@ fn get_game(gba: &mut agb::Gba) -> Game { let hat = TileSet::new(games::hat.tiles, TileFormat::EightBpp); let purple = TileSet::new(games::purple.tiles, TileFormat::EightBpp); let hyperspace = TileSet::new(games::hyperspace.tiles, TileFormat::EightBpp); + let dungeon_puzzler = TileSet::new(games::dungeon_puzzler.tiles, TileFormat::EightBpp); let amplitude = TileSet::new(games::amplitude.tiles, TileFormat::EightBpp); - let tiles = [hat, purple, hyperspace, amplitude]; + let tiles = [hat, purple, hyperspace, dungeon_puzzler, amplitude]; let tile_settings = &[ games::hat.tile_settings, games::purple.tile_settings, games::hyperspace.tile_settings, + games::dungeon_puzzler.tile_settings, games::amplitude.tile_settings, ]; From eede8c371942aa44b96137ad4af28a9b33ac9fcd Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:19:15 +0100 Subject: [PATCH 16/47] Add changelog entries --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 224ebb0e..44821e13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,14 +12,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - New tracker for playing XM files (see the `agb-tracker` crate). - You can now declare where looping sound channels should restart. - Fixnums now have constructors from_f32 and from_f64. This is mainly useful if using agb-fixnum outside of the Game Boy Advance e.g. in build scripts or macros. +- New option when loading a background to automatically deduplicate tiles. ### Changed - Sound channel panning and volume options are now `Num` rather than `Num` for improved precision and sound quality. - Due to dependency changes, agb-gbafix is now released under MPL rather than GPL. +- `include_background_gfx!` now produces tile settings directly rather than palette assigments. ### Fixed +- 256-colour backgrounds are better supported. - Mono looping samples will now correctly play to the end if it doesn't perfectly align with a buffer boundry and short samples now also loop correctly. ## [0.16.0] - 2023/07/18 From 9abfa7f8e1ca42066bb31bc93c65c459395fe926 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:20:54 +0100 Subject: [PATCH 17/47] Update documentation --- agb/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agb/src/lib.rs b/agb/src/lib.rs index c4e57618..cd4762f6 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -33,7 +33,7 @@ //! //! To get started with agb, you should clone the [template repo](https://github.com/agbrs/template) and work from there. -/// This macro is used to convert a png or bmp into a format usable by the Game Boy Advance. +/// This macro is used to convert a png, bmp or aseprite file into a format usable by the Game Boy Advance. /// /// Suppose you have a file in `examples/water_tiles.png` which contains some tiles you'd like to use. /// @@ -89,7 +89,7 @@ /// &mut vram, /// (x, y).into(), /// &tileset, -/// TileSetting::new(0, false, false, 0), +/// water_tiles::tiles.tile_settings[0], /// ); /// } /// } From b25ebf4a948c01aca56d3777ae513316fe591ff4 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:21:28 +0100 Subject: [PATCH 18/47] Add a changelog entry about the new flip methods --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44821e13..8931515e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - You can now declare where looping sound channels should restart. - Fixnums now have constructors from_f32 and from_f64. This is mainly useful if using agb-fixnum outside of the Game Boy Advance e.g. in build scripts or macros. - New option when loading a background to automatically deduplicate tiles. +- Methods on tile_setting to toggle its hflip and vflip status. ### Changed From 345a27a7d946e0ac863ea4b15528cf8db2328c42 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:25:16 +0100 Subject: [PATCH 19/47] Remove useless cast --- examples/the-hat-chooses-the-wizard/src/level_display.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/the-hat-chooses-the-wizard/src/level_display.rs b/examples/the-hat-chooses-the-wizard/src/level_display.rs index 268d31af..006a8941 100644 --- a/examples/the-hat-chooses-the-wizard/src/level_display.rs +++ b/examples/the-hat-chooses-the-wizard/src/level_display.rs @@ -28,12 +28,7 @@ pub fn write_level( .iter() .enumerate() { - map.set_tile( - vram, - (i as u16, 0).into(), - tileset, - tile_settings[tile as usize], - ); + map.set_tile(vram, (i as u16, 0).into(), tileset, tile_settings[tile]); } map.set_scroll_pos((-(WIDTH / 2 - 7 * 8 / 2) as i16, -(HEIGHT / 2 - 4) as i16).into()); From 54237c0fcec1401884994dcec83b71d2f339f4f3 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:28:57 +0100 Subject: [PATCH 20/47] Remove trailing whitespace --- examples/the-dungeon-puzzlers-lament/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/the-dungeon-puzzlers-lament/build.rs b/examples/the-dungeon-puzzlers-lament/build.rs index 62b68f75..ae98913d 100644 --- a/examples/the-dungeon-puzzlers-lament/build.rs +++ b/examples/the-dungeon-puzzlers-lament/build.rs @@ -359,7 +359,7 @@ fn export_ui_tiles(map: &tiled::Map, background: TokenStream) -> TokenStream { let tile_id = tile.id() as u16; let vflip = tile.flip_v; let hflip = tile.flip_h; - + quote! { backgrounds::#background.tile_settings[#tile_id as usize].hflip(#hflip).vflip(#vflip) } } None => { From 6422ed63f1f0a916539300f176a5f55ab8f0cadf Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 16:33:11 +0100 Subject: [PATCH 21/47] Give purple night the deduplication treatment --- examples/the-purple-night/src/lib.rs | 34 ++++++++++++---------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/examples/the-purple-night/src/lib.rs b/examples/the-purple-night/src/lib.rs index 754216df..65b75f45 100644 --- a/examples/the-purple-night/src/lib.rs +++ b/examples/the-purple-night/src/lib.rs @@ -15,10 +15,7 @@ use alloc::{boxed::Box, vec::Vec}; use agb::{ display::{ object::{Graphics, OamManaged, Object, Sprite, Tag, TagMap}, - tiled::{ - InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet, TileSetting, - VRamManager, - }, + tiled::{InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet, VRamManager}, Priority, HEIGHT, WIDTH, }, fixnum::{num, FixedNum, Rect, Vector2D}, @@ -57,7 +54,7 @@ const SWORDLESS_JUMP: &Tag = TAG_MAP.get("jump swordless"); const SWORDLESS_ATTACK: &Tag = KNIFE_ATTACK; const SWORDLESS_JUMP_ATTACK: &Tag = KNIFE_JUMP_ATTACK; -agb::include_background_gfx!(background, "53269a", background => "gfx/background.aseprite"); +agb::include_background_gfx!(background, "53269a", background => deduplicate "gfx/background.aseprite"); type Number = FixedNum<8>; @@ -2207,11 +2204,10 @@ fn game_with_level(gba: &mut agb::Gba) { Box::new(|pos| { ( &tileset, - TileSetting::from_raw( - *tilemap::BACKGROUND_MAP - .get((pos.x + tilemap::WIDTH * pos.y) as usize) - .unwrap_or(&0), - ), + background::background.tile_settings[*tilemap::BACKGROUND_MAP + .get((pos.x + tilemap::WIDTH * pos.y) as usize) + .unwrap_or(&0) + as usize], ) }), ); @@ -2225,11 +2221,10 @@ fn game_with_level(gba: &mut agb::Gba) { Box::new(|pos| { ( &tileset, - TileSetting::from_raw( - *tilemap::FOREGROUND_MAP - .get((pos.x + tilemap::WIDTH * pos.y) as usize) - .unwrap_or(&0), - ), + background::background.tile_settings[*tilemap::FOREGROUND_MAP + .get((pos.x + tilemap::WIDTH * pos.y) as usize) + .unwrap_or(&0) + as usize], ) }), ); @@ -2243,11 +2238,10 @@ fn game_with_level(gba: &mut agb::Gba) { Box::new(|pos| { ( &tileset, - TileSetting::from_raw( - *tilemap::CLOUD_MAP - .get((pos.x + tilemap::WIDTH * pos.y) as usize) - .unwrap_or(&0), - ), + background::background.tile_settings[*tilemap::CLOUD_MAP + .get((pos.x + tilemap::WIDTH * pos.y) as usize) + .unwrap_or(&0) + as usize], ) }), ); From 5cfa64030aad7265b51e0b37e6b93a2f798df2f0 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 30 Aug 2023 16:08:43 +0100 Subject: [PATCH 22/47] Generate the tileset directly --- agb-image-converter/src/rust_generator.rs | 9 ++++++++- agb/examples/affine_background.rs | 4 ++-- agb/examples/animated_background.rs | 6 +++--- agb/src/display/example_logo.rs | 6 +++--- agb/src/display/tile_data.rs | 6 +++--- agb/src/display/tiled/vram_manager.rs | 11 ++++++----- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/agb-image-converter/src/rust_generator.rs b/agb-image-converter/src/rust_generator.rs index bd6f243c..4d8b4d5c 100644 --- a/agb-image-converter/src/rust_generator.rs +++ b/agb-image-converter/src/rust_generator.rs @@ -114,6 +114,11 @@ pub(crate) fn generate_code( }); let data = ByteString(&tile_data); + let tile_format = if assignment_offset.is_some() { + quote! { #crate_prefix::display::tiled::TileFormat::FourBpp } + } else { + quote! { #crate_prefix::display::tiled::TileFormat::EightBpp } + }; quote! { #[allow(non_upper_case_globals)] @@ -134,11 +139,13 @@ pub(crate) fn generate_code( &ALIGNED.bytes }; + const TILE_SET: #crate_prefix::display::tiled::TileSet = #crate_prefix::display::tiled::TileSet::new(TILE_DATA, #tile_format); + const TILE_SETTINGS: &[#crate_prefix::display::tiled::TileSetting] = &[ #(#tile_settings),* ]; - #crate_prefix::display::tile_data::TileData::new(TILE_DATA, TILE_SETTINGS) + #crate_prefix::display::tile_data::TileData::new(TILE_SET, TILE_SETTINGS) }; } } diff --git a/agb/examples/affine_background.rs b/agb/examples/affine_background.rs index a0bdd1ab..2f8d37ff 100644 --- a/agb/examples/affine_background.rs +++ b/agb/examples/affine_background.rs @@ -4,7 +4,7 @@ use agb::{ display::{ affine::AffineMatrixBackground, - tiled::{AffineBackgroundSize, TileFormat, TileSet, TiledMap}, + tiled::{AffineBackgroundSize, TiledMap}, Priority, }, fixnum::{num, Num}, @@ -18,7 +18,7 @@ fn main(mut gba: agb::Gba) -> ! { let (gfx, mut vram) = gba.display.video.tiled2(); let vblank = agb::interrupt::VBlank::get(); - let tileset = TileSet::new(affine_tiles::water_tiles.tiles, TileFormat::EightBpp); + let tileset = affine_tiles::water_tiles.tiles; vram.set_background_palettes(affine_tiles::PALETTES); diff --git a/agb/examples/animated_background.rs b/agb/examples/animated_background.rs index 398932b7..c3632390 100644 --- a/agb/examples/animated_background.rs +++ b/agb/examples/animated_background.rs @@ -3,7 +3,7 @@ use agb::{ display::{ - tiled::{RegularBackgroundSize, TileFormat, TileSet, TiledMap}, + tiled::{RegularBackgroundSize, TiledMap}, Priority, }, include_background_gfx, @@ -16,14 +16,14 @@ fn main(mut gba: agb::Gba) -> ! { let (gfx, mut vram) = gba.display.video.tiled0(); let vblank = agb::interrupt::VBlank::get(); - let tileset = TileSet::new(water_tiles::water_tiles.tiles, TileFormat::FourBpp); + let tileset = water_tiles::water_tiles.tiles; vram.set_background_palettes(water_tiles::PALETTES); let mut bg = gfx.background( Priority::P0, RegularBackgroundSize::Background32x32, - TileFormat::FourBpp, + tileset.format(), ); for y in 0..20u16 { diff --git a/agb/src/display/example_logo.rs b/agb/src/display/example_logo.rs index 5c008a29..e7374789 100644 --- a/agb/src/display/example_logo.rs +++ b/agb/src/display/example_logo.rs @@ -1,11 +1,11 @@ -use super::tiled::{RegularMap, TileFormat, TileSet, TiledMap, VRamManager}; +use super::tiled::{RegularMap, TiledMap, VRamManager}; crate::include_background_gfx!(crate, agb_logo, test_logo => deduplicate "gfx/test_logo.png"); pub fn display_logo(map: &mut RegularMap, vram: &mut VRamManager) { vram.set_background_palettes(agb_logo::PALETTES); - let background_tilemap = TileSet::new(agb_logo::test_logo.tiles, TileFormat::FourBpp); + let background_tilemap = agb_logo::test_logo.tiles; for y in 0..20 { for x in 0..30 { @@ -37,7 +37,7 @@ mod tests { let mut map = gfx.background( Priority::P0, RegularBackgroundSize::Background32x32, - TileFormat::FourBpp, + agb_logo::test_logo.tiles.format(), ); display_logo(&mut map, &mut vram); diff --git a/agb/src/display/tile_data.rs b/agb/src/display/tile_data.rs index c1193417..0e01397d 100644 --- a/agb/src/display/tile_data.rs +++ b/agb/src/display/tile_data.rs @@ -1,14 +1,14 @@ -use super::tiled::TileSetting; +use super::tiled::{TileSet, TileSetting}; #[non_exhaustive] pub struct TileData { - pub tiles: &'static [u8], + pub tiles: TileSet<'static>, pub tile_settings: &'static [TileSetting], } impl TileData { #[must_use] - pub const fn new(tiles: &'static [u8], tile_settings: &'static [TileSetting]) -> Self { + pub const fn new(tiles: TileSet<'static>, tile_settings: &'static [TileSetting]) -> Self { TileData { tiles, tile_settings, diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index d98c968d..e14b259e 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -49,17 +49,18 @@ pub struct TileSet<'a> { impl<'a> TileSet<'a> { #[must_use] - pub fn new(tiles: &'a [u8], format: TileFormat) -> Self { + pub const fn new(tiles: &'a [u8], format: TileFormat) -> Self { Self { tiles, format } } + #[must_use] + pub const fn format(&self) -> TileFormat { + self.format + } + fn reference(&self) -> NonNull<[u8]> { self.tiles.into() } - - pub(crate) fn format(&self) -> TileFormat { - self.format - } } #[derive(Debug, Clone, Copy)] From 6853d36a9cbe0b76ade86795c8d1ac99f0d34c51 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 30 Aug 2023 16:14:51 +0100 Subject: [PATCH 23/47] Dynamic tile can also return the setting directly --- agb/examples/dynamic_tiles.rs | 4 ++-- agb/examples/mixer_32768.rs | 6 ++---- agb/examples/stereo_sound.rs | 6 ++---- agb/examples/text_render.rs | 4 ++-- agb/src/display/font.rs | 6 +++--- agb/src/display/tiled/vram_manager.rs | 8 ++++++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/agb/examples/dynamic_tiles.rs b/agb/examples/dynamic_tiles.rs index aaa284b1..4871638b 100644 --- a/agb/examples/dynamic_tiles.rs +++ b/agb/examples/dynamic_tiles.rs @@ -3,7 +3,7 @@ use agb::display::{ palette16::Palette16, - tiled::{RegularBackgroundSize, TileFormat, TileSetting, TiledMap}, + tiled::{RegularBackgroundSize, TileFormat, TiledMap}, Priority, }; @@ -42,7 +42,7 @@ fn main(mut gba: agb::Gba) -> ! { &mut vram, (x as u16, y as u16).into(), &dynamic_tile.tile_set(), - TileSetting::from_raw(dynamic_tile.tile_index()), + dynamic_tile.tile_setting(), ); vram.remove_dynamic_tile(dynamic_tile); diff --git a/agb/examples/mixer_32768.rs b/agb/examples/mixer_32768.rs index b1ac9fc2..5ab57941 100644 --- a/agb/examples/mixer_32768.rs +++ b/agb/examples/mixer_32768.rs @@ -3,9 +3,7 @@ use agb::{ display::{ - tiled::{ - RegularBackgroundSize, RegularMap, TileFormat, TileSetting, TiledMap, VRamManager, - }, + tiled::{RegularBackgroundSize, RegularMap, TileFormat, TiledMap, VRamManager}, Font, Priority, }, include_font, include_wav, @@ -110,7 +108,7 @@ fn init_background(bg: &mut RegularMap, vram: &mut VRamManager) { vram, (x, y).into(), &background_tile.tile_set(), - TileSetting::from_raw(background_tile.tile_index()), + background_tile.tile_setting(), ); } } diff --git a/agb/examples/stereo_sound.rs b/agb/examples/stereo_sound.rs index c6ccc27b..23ed339c 100644 --- a/agb/examples/stereo_sound.rs +++ b/agb/examples/stereo_sound.rs @@ -3,9 +3,7 @@ use agb::{ display::{ - tiled::{ - RegularBackgroundSize, RegularMap, TileFormat, TileSetting, TiledMap, VRamManager, - }, + tiled::{RegularBackgroundSize, RegularMap, TileFormat, TiledMap, VRamManager}, Font, Priority, }, include_font, include_wav, @@ -98,7 +96,7 @@ fn init_background(bg: &mut RegularMap, vram: &mut VRamManager) { vram, (x, y).into(), &background_tile.tile_set(), - TileSetting::from_raw(background_tile.tile_index()), + background_tile.tile_setting(), ); } } diff --git a/agb/examples/text_render.rs b/agb/examples/text_render.rs index 4f0afa18..0d86a4b4 100644 --- a/agb/examples/text_render.rs +++ b/agb/examples/text_render.rs @@ -3,7 +3,7 @@ use agb::{ display::{ - tiled::{RegularBackgroundSize, TileFormat, TileSetting, TiledMap}, + tiled::{RegularBackgroundSize, TileFormat, TiledMap}, Font, Priority, }, include_font, @@ -37,7 +37,7 @@ fn main(mut gba: agb::Gba) -> ! { &mut vram, (x, y).into(), &background_tile.tile_set(), - TileSetting::from_raw(background_tile.tile_index()), + background_tile.tile_setting(), ); } } diff --git a/agb/src/display/font.rs b/agb/src/display/font.rs index e37a77a2..e70e66e0 100644 --- a/agb/src/display/font.rs +++ b/agb/src/display/font.rs @@ -3,7 +3,7 @@ use core::fmt::{Error, Write}; use crate::fixnum::Vector2D; use crate::hash_map::HashMap; -use super::tiled::{DynamicTile, RegularMap, TileSetting, VRamManager}; +use super::tiled::{DynamicTile, RegularMap, VRamManager}; /// The text renderer renders a variable width fixed size /// bitmap font using dynamic tiles as a rendering surface. @@ -230,7 +230,7 @@ impl<'a, 'b> TextRenderer<'b> { vram_manager, (self.tile_pos.x + *x as u16, self.tile_pos.y + *y as u16).into(), &tile.tile_set(), - TileSetting::from_raw(tile.tile_index()), + tile.tile_setting(), ); } } @@ -294,7 +294,7 @@ mod tests { &mut vram, (x, y).into(), &background_tile.tile_set(), - TileSetting::from_raw(background_tile.tile_index()), + background_tile.tile_setting(), ); } } diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index e14b259e..3d8c04aa 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -10,6 +10,8 @@ use crate::{ memory_mapped::MemoryMapped1DArray, }; +use super::TileSetting; + const TILE_RAM_START: usize = 0x0600_0000; const PALETTE_BACKGROUND: MemoryMapped1DArray = @@ -189,9 +191,11 @@ impl DynamicTile<'_> { } #[must_use] - pub fn tile_index(&self) -> u16 { + pub fn tile_setting(&self) -> TileSetting { let difference = self.tile_data.as_ptr() as usize - TILE_RAM_START; - (difference / TileFormat::FourBpp.tile_size()) as u16 + let tile_id = (difference / TileFormat::FourBpp.tile_size()) as u16; + + TileSetting::new(tile_id, false, false, 0) } } From f0ddfc96b4a213fbe481af4367e75e05ad489731 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 30 Aug 2023 16:18:08 +0100 Subject: [PATCH 24/47] Reference the TRANSPARENT_TILE_INDEX in the definition of BLANK --- agb/src/display/tiled/map.rs | 2 +- agb/src/display/tiled/mod.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index 367f111b..b2a83013 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -128,7 +128,7 @@ pub struct RegularMap { tiles_dirty: bool, } -pub const TRANSPARENT_TILE_INDEX: u16 = (1 << 10) - 1; +pub(crate) const TRANSPARENT_TILE_INDEX: u16 = (1 << 10) - 1; impl TiledMapTypes for RegularMap { type Size = RegularBackgroundSize; diff --git a/agb/src/display/tiled/mod.rs b/agb/src/display/tiled/mod.rs index 7c289a3f..e9f20881 100644 --- a/agb/src/display/tiled/mod.rs +++ b/agb/src/display/tiled/mod.rs @@ -16,6 +16,8 @@ pub use tiled1::Tiled1; pub use tiled2::Tiled2; pub use vram_manager::{DynamicTile, TileFormat, TileIndex, TileSet, VRamManager}; +use map::TRANSPARENT_TILE_INDEX; + // affine layers start at BG2 pub(crate) const AFFINE_BG_ID_OFFSET: usize = 2; @@ -165,7 +167,7 @@ impl Tile { pub struct TileSetting(u16); impl TileSetting { - pub const BLANK: Self = TileSetting::new(1023, false, false, 0); + pub const BLANK: Self = TileSetting::new(TRANSPARENT_TILE_INDEX, false, false, 0); #[must_use] pub const fn new(tile_id: u16, hflip: bool, vflip: bool, palette_id: u8) -> Self { From 3a1f8ed8ed08216efadc11d60379fec9883b86cd Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 30 Aug 2023 16:22:55 +0100 Subject: [PATCH 25/47] Add a convienence fill_with method --- agb/src/display/example_logo.rs | 15 +-------------- agb/src/display/tiled/map.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/agb/src/display/example_logo.rs b/agb/src/display/example_logo.rs index e7374789..ba92c2ad 100644 --- a/agb/src/display/example_logo.rs +++ b/agb/src/display/example_logo.rs @@ -5,20 +5,7 @@ crate::include_background_gfx!(crate, agb_logo, test_logo => deduplicate "gfx/te pub fn display_logo(map: &mut RegularMap, vram: &mut VRamManager) { vram.set_background_palettes(agb_logo::PALETTES); - let background_tilemap = agb_logo::test_logo.tiles; - - for y in 0..20 { - for x in 0..30 { - let tile_id = y * 30 + x; - - map.set_tile( - vram, - (x as u16, y as u16).into(), - &background_tilemap, - agb_logo::test_logo.tile_settings[tile_id], - ); - } - } + map.fill_with(vram, &agb_logo::test_logo); map.commit(vram); map.show(); diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index b2a83013..48ca05f5 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -3,6 +3,7 @@ use core::ops::{Deref, DerefMut}; use crate::bitarray::Bitarray; use crate::display::affine::AffineMatrixBackground; +use crate::display::tile_data::TileData; use crate::display::{Priority, DISPLAY_CONTROL}; use crate::dma::dma_copy16; use crate::fixnum::Vector2D; @@ -188,6 +189,25 @@ impl RegularMap { } } + pub fn fill_with(&mut self, vram: &mut VRamManager, tile_data: &TileData) { + assert!( + tile_data.tile_settings.len() >= 20 * 30, + "Don't have a full screen's worth of tile data" + ); + + for y in 0..20u16 { + for x in 0..30u16 { + let tile_id = y * 30 + x; + self.set_tile( + vram, + (x, y).into(), + &tile_data.tiles, + tile_data.tile_settings[tile_id as usize], + ); + } + } + } + pub fn set_tile( &mut self, vram: &mut VRamManager, From 11fe4d92acbede732ac75b4541abcc2c0f99f638 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 30 Aug 2023 16:25:16 +0100 Subject: [PATCH 26/47] Delete the old toml file --- agb/examples/water_tiles.toml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 agb/examples/water_tiles.toml diff --git a/agb/examples/water_tiles.toml b/agb/examples/water_tiles.toml deleted file mode 100644 index 9981e521..00000000 --- a/agb/examples/water_tiles.toml +++ /dev/null @@ -1,5 +0,0 @@ -version = "1.0" - -[image.water_tiles] -filename = "water_tiles.png" -tile_size = "8x8" \ No newline at end of file From dc0478566924648cb396f32ebe82047630f839c5 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 30 Aug 2023 16:46:05 +0100 Subject: [PATCH 27/47] Fix doc examples --- .../display/tiled/infinite_scrolled_map.rs | 30 +++++++++---------- agb/src/lib.rs | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/agb/src/display/tiled/infinite_scrolled_map.rs b/agb/src/display/tiled/infinite_scrolled_map.rs index 8b637a85..fa1c9e96 100644 --- a/agb/src/display/tiled/infinite_scrolled_map.rs +++ b/agb/src/display/tiled/infinite_scrolled_map.rs @@ -44,25 +44,23 @@ use crate::{ /// # 0, 1, 2]; /// pub const WIDTH: i32 = // set it to some width /// # 12; -/// pub const MAP_TILES: &[u8] = &[ // probably load this from a file -/// # 0]; /// } /// +/// agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); +/// /// # fn foo(mut gba: agb::Gba) { /// let (gfx, mut vram) = gba.display.video.tiled0(); /// -/// let tileset = TileSet::new(&tilemap::MAP_TILES, TileFormat::FourBpp); +/// let tileset = water_tiles::tiles.tiles; /// /// let mut backdrop = InfiniteScrolledMap::new( /// gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// Box::new(|pos| { /// ( /// &tileset, -/// TileSetting::from_raw( -/// *tilemap::BACKGROUND_MAP +/// water_tiles.tile_settings[*tilemap::BACKGROUND_MAP /// .get((pos.x + tilemap::WIDTH * pos.y) as usize) -/// .unwrap_or(&0), -/// ), +/// .unwrap_or(&0)] /// ) /// }), /// ); @@ -140,21 +138,22 @@ impl<'a> InfiniteScrolledMap<'a> { /// # pub const MAP_TILES: &[u8] = &[0]; /// # } /// # + /// # agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); + /// # /// # fn foo(mut gba: agb::Gba) { /// # let (gfx, mut vram) = gba.display.video.tiled0(); /// # - /// # let tileset = TileSet::new(&tilemap::MAP_TILES, TileFormat::FourBpp); + /// # let tileset = water_tiles.tiles; /// # /// # let mut backdrop = InfiniteScrolledMap::new( /// # gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// # Box::new(|pos| { /// # ( /// # &tileset, - /// # TileSetting::from_raw( + /// # tileset.tile_settings[ /// # *tilemap::BACKGROUND_MAP /// # .get((pos.x + tilemap::WIDTH * pos.y) as usize) - /// # .unwrap_or(&0), - /// # ), + /// # .unwrap_or(&0)] /// # ) /// # }), /// # ); @@ -215,21 +214,22 @@ impl<'a> InfiniteScrolledMap<'a> { /// # pub const MAP_TILES: &[u8] = &[0]; /// # } /// # + /// # agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); + /// # /// # fn foo(mut gba: agb::Gba) { /// # let (gfx, mut vram) = gba.display.video.tiled0(); /// # - /// # let tileset = TileSet::new(&tilemap::MAP_TILES, TileFormat::FourBpp); + /// # let tileset = water_tiles.tiles; /// # /// # let mut backdrop = InfiniteScrolledMap::new( /// # gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// # Box::new(|pos| { /// # ( /// # &tileset, - /// # TileSetting::from_raw( + /// # tileset.tile_settings[ /// # *tilemap::BACKGROUND_MAP /// # .get((pos.x + tilemap::WIDTH * pos.y) as usize) - /// # .unwrap_or(&0), - /// # ), + /// # .unwrap_or(&0)] /// # ) /// # }), /// # ); diff --git a/agb/src/lib.rs b/agb/src/lib.rs index cd4762f6..73963fcc 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -77,11 +77,11 @@ /// agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); /// /// # fn load_tileset(mut gfx: Tiled0, mut vram: VRamManager) { -/// let tileset = TileSet::new(water_tiles::tiles.tiles, TileFormat::FourBpp); +/// let tileset = water_tiles::tiles.tiles; /// /// vram.set_background_palettes(water_tiles::PALETTES); /// -/// let mut bg = gfx.background(Priority::P0, RegularBackgroundSize::Background32x32, TileFormat::FourBpp); +/// let mut bg = gfx.background(Priority::P0, RegularBackgroundSize::Background32x32, tileset.format()); /// /// for y in 0..20u16 { /// for x in 0..30u16 { From 2c556f9ce893615538a8c268eb429bac2c286e72 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 30 Aug 2023 17:02:06 +0100 Subject: [PATCH 28/47] Fix docs for real this time --- .../display/tiled/infinite_scrolled_map.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/agb/src/display/tiled/infinite_scrolled_map.rs b/agb/src/display/tiled/infinite_scrolled_map.rs index fa1c9e96..c9b76d4a 100644 --- a/agb/src/display/tiled/infinite_scrolled_map.rs +++ b/agb/src/display/tiled/infinite_scrolled_map.rs @@ -40,7 +40,7 @@ use crate::{ /// use agb::display::Priority; /// /// mod tilemap { -/// pub const BACKGROUND_MAP: &[u16] = &[ // Probably load this from a file +/// pub const BACKGROUND_MAP: &[usize] = &[ // Probably load this from a file /// # 0, 1, 2]; /// pub const WIDTH: i32 = // set it to some width /// # 12; @@ -51,14 +51,14 @@ use crate::{ /// # fn foo(mut gba: agb::Gba) { /// let (gfx, mut vram) = gba.display.video.tiled0(); /// -/// let tileset = water_tiles::tiles.tiles; +/// let tile_data = water_tiles::tiles; /// /// let mut backdrop = InfiniteScrolledMap::new( /// gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// Box::new(|pos| { /// ( -/// &tileset, -/// water_tiles.tile_settings[*tilemap::BACKGROUND_MAP +/// &tile_data.tiles, +/// tile_data.tile_settings[*tilemap::BACKGROUND_MAP /// .get((pos.x + tilemap::WIDTH * pos.y) as usize) /// .unwrap_or(&0)] /// ) @@ -133,7 +133,7 @@ impl<'a> InfiniteScrolledMap<'a> { /// # use agb::display::Priority; /// # /// # mod tilemap { - /// # pub const BACKGROUND_MAP: &[u16] = &[0, 1, 2]; + /// # pub const BACKGROUND_MAP: &[usize] = &[0, 1, 2]; /// # pub const WIDTH: i32 = 12; /// # pub const MAP_TILES: &[u8] = &[0]; /// # } @@ -143,14 +143,14 @@ impl<'a> InfiniteScrolledMap<'a> { /// # fn foo(mut gba: agb::Gba) { /// # let (gfx, mut vram) = gba.display.video.tiled0(); /// # - /// # let tileset = water_tiles.tiles; + /// # let tile_data = water_tiles::tiles; /// # /// # let mut backdrop = InfiniteScrolledMap::new( /// # gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// # Box::new(|pos| { /// # ( - /// # &tileset, - /// # tileset.tile_settings[ + /// # &tile_data.tiles, + /// # tile_data.tile_settings[ /// # *tilemap::BACKGROUND_MAP /// # .get((pos.x + tilemap::WIDTH * pos.y) as usize) /// # .unwrap_or(&0)] @@ -209,7 +209,7 @@ impl<'a> InfiniteScrolledMap<'a> { /// # use agb::display::Priority; /// # /// # mod tilemap { - /// # pub const BACKGROUND_MAP: &[u16] = &[0, 1, 2]; + /// # pub const BACKGROUND_MAP: &[usize] = &[0, 1, 2]; /// # pub const WIDTH: i32 = 12; /// # pub const MAP_TILES: &[u8] = &[0]; /// # } @@ -219,14 +219,14 @@ impl<'a> InfiniteScrolledMap<'a> { /// # fn foo(mut gba: agb::Gba) { /// # let (gfx, mut vram) = gba.display.video.tiled0(); /// # - /// # let tileset = water_tiles.tiles; + /// # let tile_data = water_tiles::tiles; /// # /// # let mut backdrop = InfiniteScrolledMap::new( /// # gfx.background(Priority::P2, RegularBackgroundSize::Background32x32, TileFormat::FourBpp), /// # Box::new(|pos| { /// # ( - /// # &tileset, - /// # tileset.tile_settings[ + /// # &tile_data.tiles, + /// # tile_data.tile_settings[ /// # *tilemap::BACKGROUND_MAP /// # .get((pos.x + tilemap::WIDTH * pos.y) as usize) /// # .unwrap_or(&0)] From 4642a74a0f8dac39f22943d5a952314bfcd46e76 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 30 Aug 2023 17:07:14 +0100 Subject: [PATCH 29/47] Update the examples with the new tileset importing --- examples/combo/src/lib.rs | 24 +++----- examples/hyperspace-roll/src/background.rs | 60 +++++-------------- .../src/backgrounds.rs | 21 ++----- .../the-hat-chooses-the-wizard/src/lib.rs | 6 +- .../src/splash_screen.rs | 32 ++-------- examples/the-purple-night/src/lib.rs | 4 +- 6 files changed, 36 insertions(+), 111 deletions(-) diff --git a/examples/combo/src/lib.rs b/examples/combo/src/lib.rs index 33a63a14..05528f39 100644 --- a/examples/combo/src/lib.rs +++ b/examples/combo/src/lib.rs @@ -8,7 +8,7 @@ use alloc::boxed::Box; use agb::{ display::{ - tiled::{InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet}, + tiled::{InfiniteScrolledMap, RegularBackgroundSize, TileFormat}, Priority, }, fixnum::{Num, Vector2D}, @@ -63,20 +63,12 @@ fn get_game(gba: &mut agb::Gba) -> Game { let (tile, mut vram) = gba.display.video.tiled0(); - let hat = TileSet::new(games::hat.tiles, TileFormat::EightBpp); - let purple = TileSet::new(games::purple.tiles, TileFormat::EightBpp); - let hyperspace = TileSet::new(games::hyperspace.tiles, TileFormat::EightBpp); - let dungeon_puzzler = TileSet::new(games::dungeon_puzzler.tiles, TileFormat::EightBpp); - let amplitude = TileSet::new(games::amplitude.tiles, TileFormat::EightBpp); - - let tiles = [hat, purple, hyperspace, dungeon_puzzler, amplitude]; - - let tile_settings = &[ - games::hat.tile_settings, - games::purple.tile_settings, - games::hyperspace.tile_settings, - games::dungeon_puzzler.tile_settings, - games::amplitude.tile_settings, + let tiles = [ + games::hat, + games::purple, + games::hyperspace, + games::dungeon_puzzler, + games::amplitude, ]; vram.set_background_palettes(games::PALETTES); @@ -93,7 +85,7 @@ fn get_game(gba: &mut agb::Gba) -> Game { let game = (pos.x).rem_euclid(tiles.len() as i32 * 30) as usize / 30; let tile_id = (y * 30 + x) as usize; - (&tiles[game], tile_settings[game][tile_id]) + (&tiles[game].tiles, tiles[game].tile_settings[tile_id]) }), ); diff --git a/examples/hyperspace-roll/src/background.rs b/examples/hyperspace-roll/src/background.rs index fa0ea199..9b30c837 100644 --- a/examples/hyperspace-roll/src/background.rs +++ b/examples/hyperspace-roll/src/background.rs @@ -1,5 +1,5 @@ use agb::{ - display::tiled::{RegularMap, TileFormat, TileSet, TileSetting, TiledMap, VRamManager}, + display::tiled::{RegularMap, TileSet, TileSetting, TiledMap, VRamManager}, include_background_gfx, rng, }; @@ -23,10 +23,7 @@ pub(crate) fn load_help_text( help_text_line: u16, at_tile: (u16, u16), ) { - let help_tileset = TileSet::new( - backgrounds::help.tiles, - agb::display::tiled::TileFormat::FourBpp, - ); + let help_tiledata = backgrounds::help; for x in 0..16 { let tile_id = help_text_line * 16 + x; @@ -34,8 +31,8 @@ pub(crate) fn load_help_text( background.set_tile( vram, (x + at_tile.0, at_tile.1).into(), - &help_tileset, - backgrounds::help.tile_settings[tile_id as usize], + &help_tiledata.tiles, + help_tiledata.tile_settings[tile_id as usize], ) } } @@ -45,22 +42,10 @@ pub(crate) fn load_description( descriptions_map: &mut RegularMap, vram: &mut VRamManager, ) { - let (tileset, tile_settings) = if face_id < 10 { - ( - TileSet::new( - backgrounds::descriptions1.tiles, - agb::display::tiled::TileFormat::FourBpp, - ), - backgrounds::descriptions1.tile_settings, - ) + let description_data = if face_id < 10 { + backgrounds::descriptions1 } else { - ( - TileSet::new( - backgrounds::descriptions2.tiles, - agb::display::tiled::TileFormat::FourBpp, - ), - backgrounds::descriptions2.tile_settings, - ) + backgrounds::descriptions2 }; for y in 0..11 { @@ -69,8 +54,8 @@ pub(crate) fn load_description( descriptions_map.set_tile( vram, (x, y).into(), - &tileset, - tile_settings[tile_id as usize], + &description_data.tiles, + description_data.tile_settings[tile_id as usize], ) } } @@ -83,7 +68,7 @@ fn create_background_map(map: &mut RegularMap, vram: &mut VRamManager, stars_til let blank = rng::gen().rem_euclid(32) < 30; let tile_setting = if blank { - TileSetting::new((1 << 10) - 1, false, false, 0) + TileSetting::BLANK } else { let tile_id = rng::gen().rem_euclid(64) as u16; backgrounds::stars.tile_settings[tile_id as usize] @@ -99,26 +84,10 @@ fn create_background_map(map: &mut RegularMap, vram: &mut VRamManager, stars_til pub fn show_title_screen(background: &mut RegularMap, vram: &mut VRamManager, sfx: &mut Sfx) { background.set_scroll_pos((0i16, 0).into()); vram.set_background_palettes(backgrounds::PALETTES); - let tile_set = TileSet::new( - backgrounds::title.tiles, - agb::display::tiled::TileFormat::FourBpp, - ); + background.hide(); - for x in 0..30u16 { - for y in 0..20u16 { - let tile_id = y * 30 + x; - background.set_tile( - vram, - (x, y).into(), - &tile_set, - backgrounds::title.tile_settings[tile_id as usize], - ); - } - - sfx.frame(); - } - + background.fill_with(vram, &backgrounds::title); background.commit(vram); sfx.frame(); background.show(); @@ -138,9 +107,8 @@ impl<'a> StarBackground<'a> { background2: &'a mut RegularMap, vram: &'_ mut VRamManager, ) -> Self { - let stars_tileset = TileSet::new(backgrounds::stars.tiles, TileFormat::FourBpp); - create_background_map(background1, vram, &stars_tileset); - create_background_map(background2, vram, &stars_tileset); + create_background_map(background1, vram, &backgrounds::stars.tiles); + create_background_map(background2, vram, &backgrounds::stars.tiles); Self { background1, diff --git a/examples/the-dungeon-puzzlers-lament/src/backgrounds.rs b/examples/the-dungeon-puzzlers-lament/src/backgrounds.rs index 9d31a94e..a965c653 100644 --- a/examples/the-dungeon-puzzlers-lament/src/backgrounds.rs +++ b/examples/the-dungeon-puzzlers-lament/src/backgrounds.rs @@ -1,5 +1,5 @@ use agb::{ - display::tiled::{RegularMap, TileFormat, TileSet, VRamManager}, + display::tiled::{RegularMap, VRamManager}, include_background_gfx, }; @@ -19,7 +19,7 @@ pub fn load_palettes(vram_manager: &mut VRamManager) { } pub fn load_ui(map: &mut RegularMap, vram_manager: &mut VRamManager) { - let ui_tileset = TileSet::new(backgrounds::ui.tiles, TileFormat::FourBpp); + let ui_tileset = backgrounds::ui.tiles; for y in 0..20u16 { for x in 0..30u16 { @@ -38,7 +38,7 @@ pub fn load_level_background( ) { let level_map = &tilemaps::LEVELS_MAP[level_number]; - let level_tileset = TileSet::new(backgrounds::level.tiles, TileFormat::FourBpp); + let level_tileset = backgrounds::level.tiles; for y in 0..20u16 { for x in 0..22u16 { @@ -51,18 +51,5 @@ pub fn load_level_background( } pub fn load_ending_page(map: &mut RegularMap, vram_manager: &mut VRamManager) { - let ending_tileset = TileSet::new(backgrounds::ending.tiles, TileFormat::FourBpp); - - for y in 0..20u16 { - for x in 0..30u16 { - let tile_pos = y * 30 + x; - - map.set_tile( - vram_manager, - (x, y).into(), - &ending_tileset, - backgrounds::ending.tile_settings[tile_pos as usize], - ); - } - } + map.fill_with(vram_manager, &backgrounds::ending); } diff --git a/examples/the-hat-chooses-the-wizard/src/lib.rs b/examples/the-hat-chooses-the-wizard/src/lib.rs index 7dd67e99..f27a42c8 100644 --- a/examples/the-hat-chooses-the-wizard/src/lib.rs +++ b/examples/the-hat-chooses-the-wizard/src/lib.rs @@ -10,8 +10,8 @@ use agb::{ display::{ object::{Graphics, OamManaged, Object, Tag, TagMap}, tiled::{ - InfiniteScrolledMap, PartialUpdateStatus, RegularBackgroundSize, TileFormat, TileSet, - TiledMap, VRamManager, + InfiniteScrolledMap, PartialUpdateStatus, RegularBackgroundSize, TileFormat, TiledMap, + VRamManager, }, Priority, HEIGHT, WIDTH, }, @@ -793,7 +793,7 @@ pub fn main(mut agb: agb::Gba) -> ! { TileFormat::FourBpp, ); - let tileset = TileSet::new(tile_sheet::background.tiles, TileFormat::FourBpp); + let tileset = tile_sheet::background.tiles; for y in 0..32u16 { for x in 0..32u16 { diff --git a/examples/the-hat-chooses-the-wizard/src/splash_screen.rs b/examples/the-hat-chooses-the-wizard/src/splash_screen.rs index 2c13a1ac..a6d739bf 100644 --- a/examples/the-hat-chooses-the-wizard/src/splash_screen.rs +++ b/examples/the-hat-chooses-the-wizard/src/splash_screen.rs @@ -1,5 +1,5 @@ use super::sfx::SfxPlayer; -use agb::display::tiled::{RegularMap, TileFormat, TileSet, TiledMap, VRamManager}; +use agb::display::tiled::{RegularMap, TiledMap, VRamManager}; agb::include_background_gfx!(splash_screens, splash => deduplicate "gfx/splash.png", @@ -18,19 +18,9 @@ pub fn show_splash_screen( vram: &mut VRamManager, ) { map.set_scroll_pos((0i16, 0i16).into()); - let (tileset, settings) = match which { - SplashScreen::Start => ( - TileSet::new(splash_screens::splash.tiles, TileFormat::FourBpp), - splash_screens::splash.tile_settings, - ), - - SplashScreen::End => ( - TileSet::new( - splash_screens::thanks_for_playing.tiles, - TileFormat::FourBpp, - ), - splash_screens::thanks_for_playing.tile_settings, - ), + let tile_data = match which { + SplashScreen::Start => splash_screens::splash, + SplashScreen::End => splash_screens::thanks_for_playing, }; let vblank = agb::interrupt::VBlank::get(); @@ -40,19 +30,7 @@ pub fn show_splash_screen( sfx.frame(); vblank.wait_for_vblank(); - for y in 0..20u16 { - for x in 0..30u16 { - map.set_tile( - vram, - (x, y).into(), - &tileset, - settings[(y * 30 + x) as usize], - ); - } - - sfx.frame(); - vblank.wait_for_vblank(); - } + map.fill_with(vram, &tile_data); map.commit(vram); vram.set_background_palettes(splash_screens::PALETTES); diff --git a/examples/the-purple-night/src/lib.rs b/examples/the-purple-night/src/lib.rs index 65b75f45..4d664bb4 100644 --- a/examples/the-purple-night/src/lib.rs +++ b/examples/the-purple-night/src/lib.rs @@ -15,7 +15,7 @@ use alloc::{boxed::Box, vec::Vec}; use agb::{ display::{ object::{Graphics, OamManaged, Object, Sprite, Tag, TagMap}, - tiled::{InfiniteScrolledMap, RegularBackgroundSize, TileFormat, TileSet, VRamManager}, + tiled::{InfiniteScrolledMap, RegularBackgroundSize, TileFormat, VRamManager}, Priority, HEIGHT, WIDTH, }, fixnum::{num, FixedNum, Rect, Vector2D}, @@ -2191,7 +2191,7 @@ fn game_with_level(gba: &mut agb::Gba) { let (background, mut vram) = gba.display.video.tiled0(); vram.set_background_palettes(background::PALETTES); - let tileset = TileSet::new(background::background.tiles, TileFormat::FourBpp); + let tileset = background::background.tiles; let object = gba.display.object.get_managed(); loop { From d3c32ce35146e9be60720dca424905070496baf1 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Thu, 31 Aug 2023 07:53:01 +0100 Subject: [PATCH 30/47] Minor optimisation for the show entire screen case --- agb/src/display/tiled/map.rs | 45 +++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index 48ca05f5..84a52d0b 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -195,14 +195,23 @@ impl RegularMap { "Don't have a full screen's worth of tile data" ); - for y in 0..20u16 { - for x in 0..30u16 { + assert_eq!( + tile_data.tiles.format(), + self.colours(), + "Cannot set a {:?} colour tile on a {:?} colour background", + tile_data.tiles.format(), + self.colours() + ); + + for y in 0..20 { + for x in 0..30 { let tile_id = y * 30 + x; - self.set_tile( + let tile_pos = y * 32 + x; + self.set_tile_at_pos( vram, - (x, y).into(), + tile_pos, &tile_data.tiles, - tile_data.tile_settings[tile_id as usize], + tile_data.tile_settings[tile_id], ); } } @@ -215,20 +224,28 @@ impl RegularMap { tileset: &TileSet<'_>, tile_setting: TileSetting, ) { - let colours = self.colours(); - if tileset.format() != colours { - panic!( - "Cannot set a {:?} colour tile on a {:?} colour background", - tileset.format(), - colours - ); - } + assert_eq!( + tileset.format(), + self.colours(), + "Cannot set a {:?} colour tile on a {:?} colour background", + tileset.format(), + self.colours() + ); let pos = self.map_size().gba_offset(pos); + self.set_tile_at_pos(vram, pos, tileset, tile_setting); + } + fn set_tile_at_pos( + &mut self, + vram: &mut VRamManager, + pos: usize, + tileset: &TileSet<'_>, + tile_setting: TileSetting, + ) { let old_tile = self.tiles_mut()[pos]; if old_tile != Tile::default() { - vram.remove_tile(old_tile.tile_index(colours)); + vram.remove_tile(old_tile.tile_index(self.colours())); } let tile_index = tile_setting.index(); From 7431086b14781c82040059e78372c385ec74ce4e Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Thu, 31 Aug 2023 07:53:08 +0100 Subject: [PATCH 31/47] Try using memcpy4 for copying the tile data --- agb/src/agbabi/mod.rs | 8 ++++++++ agb/src/display/tiled/vram_manager.rs | 12 ++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/agb/src/agbabi/mod.rs b/agb/src/agbabi/mod.rs index a53823cf..1f3df5a1 100644 --- a/agb/src/agbabi/mod.rs +++ b/agb/src/agbabi/mod.rs @@ -4,6 +4,14 @@ global_asm!(include_str!("macros.inc")); global_asm!(include_str!("memcpy.s")); global_asm!(include_str!("memset.s")); +extern "C" { + fn __aeabi_memcpy4(dest: *mut u32, src: *const u32, n: usize); +} + +pub(crate) unsafe fn memcpy(dest: *mut u32, src: *const u32, n: usize) { + __aeabi_memcpy4(dest, src, n); +} + #[cfg(test)] mod test { mod memset { diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index 3d8c04aa..8ef68717 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -4,6 +4,7 @@ use alloc::{slice, vec::Vec}; use crate::{ agb_alloc::{block_allocator::BlockAllocator, bump_allocator::StartEnd}, + agbabi, display::palette16, dma::dma_copy16, hash_map::{Entry, HashMap}, @@ -380,17 +381,12 @@ impl VRamManager { let tile_offset = (tile_id as usize) * tile_size; let tile_slice = &tile_set.tiles[tile_offset..(tile_offset + tile_size)]; - let tile_size_in_half_words = tile_slice.len() / 2; - + let tile_size = tile_slice.len(); let target_location = tile_reference.0.as_ptr() as *mut _; unsafe { - dma_copy16( - tile_slice.as_ptr() as *const u16, - target_location, - tile_size_in_half_words, - ); - }; + agbabi::memcpy(target_location, tile_slice.as_ptr() as *const _, tile_size); + } } /// Copies raw palettes to the background palette without any checks. From c0964d23b1eca81adba9fc3e848317f72e787b71 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 12:35:54 +0000 Subject: [PATCH 32/47] Update actions/checkout action to v4 --- .github/workflows/build-and-test.yml | 2 +- .github/workflows/publish-agb.yml | 2 +- .github/workflows/update-lockfiles.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e3c8d0b5..7a2dc695 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -25,7 +25,7 @@ jobs: rustup toolchain install nightly --component miri rustup override set nightly cargo miri setup - - uses: actions/checkout@v3 + - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - name: Cache uses: actions/cache@v3 with: diff --git a/.github/workflows/publish-agb.yml b/.github/workflows/publish-agb.yml index 779a1944..495336de 100644 --- a/.github/workflows/publish-agb.yml +++ b/.github/workflows/publish-agb.yml @@ -13,7 +13,7 @@ jobs: - name: Install build tools run: sudo apt-get update && sudo apt-get install build-essential zip -y - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 with: fetch-depth: 0 - name: Login to crates.io diff --git a/.github/workflows/update-lockfiles.yml b/.github/workflows/update-lockfiles.yml index a94ec815..daebb1dc 100644 --- a/.github/workflows/update-lockfiles.yml +++ b/.github/workflows/update-lockfiles.yml @@ -16,7 +16,7 @@ jobs: - name: Set CARGO_TARGET_DIR run: echo "CARGO_TARGET_DIR=$HOME/target" >> $GITHUB_ENV - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - uses: extractions/setup-just@v1 - name: Update lock files run: just update-lockfiles --commit From ab07ed31dbf1b1b468d1e65aab9eb02696399ffe Mon Sep 17 00:00:00 2001 From: GBA bot Date: Mon, 4 Sep 2023 12:36:38 +0000 Subject: [PATCH 33/47] Update lockfiles --- agb-gbafix/Cargo.lock | 139 +++-------- book/games/pong/Cargo.lock | 12 +- emulator/Cargo.lock | 218 +++++++++++------- examples/amplitude/Cargo.lock | 12 +- examples/combo/Cargo.lock | 42 ++-- examples/hyperspace-roll/Cargo.lock | 12 +- .../the-dungeon-puzzlers-lament/Cargo.lock | 46 ++-- .../the-hat-chooses-the-wizard/Cargo.lock | 24 +- examples/the-purple-night/Cargo.lock | 12 +- tools/Cargo.lock | 172 ++++---------- 10 files changed, 288 insertions(+), 401 deletions(-) diff --git a/agb-gbafix/Cargo.lock b/agb-gbafix/Cargo.lock index a0b0fb74..c7d554e4 100644 --- a/agb-gbafix/Cargo.lock +++ b/agb-gbafix/Cargo.lock @@ -13,24 +13,23 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" [[package]] name = "anstyle-parse" @@ -52,9 +51,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", "windows-sys", @@ -62,39 +61,24 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" - -[[package]] -name = "bitflags" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - -[[package]] -name = "cc" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" -dependencies = [ - "libc", -] +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "clap" -version = "4.3.21" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" dependencies = [ "anstream", "anstyle", @@ -104,9 +88,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "colorchoice" @@ -120,69 +104,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2b183d6ce6ca4cf30e3db37abf5b52568b5f9015c97d9fbdd7026aa5dcdd758" -[[package]] -name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys", -] - -[[package]] -name = "libc" -version = "0.2.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" - -[[package]] -name = "linux-raw-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" - -[[package]] -name = "rustix" -version = "0.38.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - [[package]] name = "strsim" version = "0.10.0" @@ -206,9 +127,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -221,42 +142,42 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/book/games/pong/Cargo.lock b/book/games/pong/Cargo.lock index 3678ef29..4dd1716a 100644 --- a/book/games/pong/Cargo.lock +++ b/book/games/pong/Cargo.lock @@ -203,9 +203,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide 0.7.1", @@ -390,9 +390,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -405,9 +405,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", diff --git a/emulator/Cargo.lock b/emulator/Cargo.lock index 4220e632..e8408908 100644 --- a/emulator/Cargo.lock +++ b/emulator/Cargo.lock @@ -19,33 +19,32 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8f9420f797f2d9e935edf629310eb938a0d839f984e25327f3c7eed22300c" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" dependencies = [ "memchr", ] [[package]] name = "anstream" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" [[package]] name = "anstyle-parse" @@ -67,9 +66,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", "windows-sys", @@ -77,9 +76,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "autocfg" @@ -136,9 +135,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -171,20 +170,19 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.21" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" dependencies = [ "anstream", "anstyle", @@ -194,9 +192,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", @@ -206,9 +204,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "cmake" @@ -240,6 +238,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys", +] + [[package]] name = "either" version = "1.9.0" @@ -254,9 +273,9 @@ checksum = "e2b183d6ce6ca4cf30e3db37abf5b52568b5f9015c97d9fbdd7026aa5dcdd758" [[package]] name = "errno" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -284,14 +303,25 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide", ] +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "glob" version = "0.3.1" @@ -304,12 +334,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - [[package]] name = "image" version = "0.24.7" @@ -324,17 +348,6 @@ dependencies = [ "png", ] -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -377,9 +390,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "mgba" @@ -472,6 +485,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "peeking_take_while" version = "0.1.2" @@ -486,9 +505,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "png" -version = "0.17.9" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59871cc5b6cce7eaccca5a802b4173377a1c2ba90654246789a8fa2334426d11" +checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" dependencies = [ "bitflags 1.3.2", "crc32fast", @@ -499,9 +518,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" +checksum = "8832c0f9be7e3cae60727e6256cfd2cd3c3e2b6cd5dad4190ecb2fd658c9030b" dependencies = [ "proc-macro2", "syn", @@ -518,18 +537,38 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] -name = "regex" -version = "1.9.3" +name = "redox_syscall" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom", + "redox_syscall", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", @@ -539,9 +578,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ "aho-corasick", "memchr", @@ -550,9 +589,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rustc-hash" @@ -562,9 +601,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453" dependencies = [ "bitflags 2.4.0", "errno", @@ -593,9 +632,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", @@ -604,18 +643,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", @@ -635,14 +674,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] -name = "which" -version = "4.4.0" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "which" +version = "4.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ad25fe5717e59ada8ea33511bbbf7420b11031730a24c65e82428766c307006" dependencies = [ + "dirs", "either", - "libc", "once_cell", + "rustix", ] [[package]] @@ -678,9 +724,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -693,42 +739,42 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/examples/amplitude/Cargo.lock b/examples/amplitude/Cargo.lock index 8bd46339..f6b7dfe1 100644 --- a/examples/amplitude/Cargo.lock +++ b/examples/amplitude/Cargo.lock @@ -210,9 +210,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide 0.7.1", @@ -390,9 +390,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -405,9 +405,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", diff --git a/examples/combo/Cargo.lock b/examples/combo/Cargo.lock index 3898d9ee..ff7e0fa9 100644 --- a/examples/combo/Cargo.lock +++ b/examples/combo/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ "image", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -61,7 +61,7 @@ version = "0.16.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -71,7 +71,7 @@ dependencies = [ "hound", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -110,7 +110,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", "xmrs", ] @@ -199,7 +199,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -292,9 +292,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide 0.7.1", @@ -444,9 +444,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.1" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "miniz_oxide" @@ -531,7 +531,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -603,9 +603,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -660,9 +660,9 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -678,20 +678,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ "itoa", "ryu", @@ -719,9 +719,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", diff --git a/examples/hyperspace-roll/Cargo.lock b/examples/hyperspace-roll/Cargo.lock index 409016bb..25cf7443 100644 --- a/examples/hyperspace-roll/Cargo.lock +++ b/examples/hyperspace-roll/Cargo.lock @@ -203,9 +203,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide 0.7.1", @@ -390,9 +390,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -405,9 +405,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", diff --git a/examples/the-dungeon-puzzlers-lament/Cargo.lock b/examples/the-dungeon-puzzlers-lament/Cargo.lock index 46b80ca8..6d980d5a 100644 --- a/examples/the-dungeon-puzzlers-lament/Cargo.lock +++ b/examples/the-dungeon-puzzlers-lament/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ "image", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -61,7 +61,7 @@ version = "0.16.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -71,7 +71,7 @@ dependencies = [ "hound", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -110,7 +110,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", "xmrs", ] @@ -159,9 +159,9 @@ checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" [[package]] name = "bilge" @@ -183,7 +183,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -264,9 +264,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide 0.7.1", @@ -382,9 +382,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "miniz_oxide" @@ -469,7 +469,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -541,9 +541,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -592,9 +592,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -610,13 +610,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.31", ] [[package]] @@ -640,9 +640,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", @@ -715,9 +715,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "winnow" -version = "0.5.10" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5504cc7644f4b593cbc05c4a55bf9bd4e94b867c3c0bd440934174d50482427d" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ "memchr", ] diff --git a/examples/the-hat-chooses-the-wizard/Cargo.lock b/examples/the-hat-chooses-the-wizard/Cargo.lock index 13ca68e1..3e9ca3e9 100644 --- a/examples/the-hat-chooses-the-wizard/Cargo.lock +++ b/examples/the-hat-chooses-the-wizard/Cargo.lock @@ -203,9 +203,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide 0.7.1", @@ -389,9 +389,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -410,18 +410,18 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", @@ -430,9 +430,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ "itoa", "ryu", @@ -441,9 +441,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", diff --git a/examples/the-purple-night/Cargo.lock b/examples/the-purple-night/Cargo.lock index 212aae34..dd7fe356 100644 --- a/examples/the-purple-night/Cargo.lock +++ b/examples/the-purple-night/Cargo.lock @@ -212,9 +212,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide 0.7.1", @@ -413,9 +413,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -434,9 +434,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", diff --git a/tools/Cargo.lock b/tools/Cargo.lock index c3603a25..09d2d7da 100644 --- a/tools/Cargo.lock +++ b/tools/Cargo.lock @@ -19,24 +19,23 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" [[package]] name = "anstyle-parse" @@ -58,9 +57,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", "windows-sys", @@ -72,12 +71,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "bitflags" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - [[package]] name = "bumpalo" version = "3.13.0" @@ -86,9 +79,9 @@ checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "cc" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -101,9 +94,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" dependencies = [ "android-tzdata", "iana-time-zone", @@ -111,23 +104,23 @@ dependencies = [ "num-traits", "time", "wasm-bindgen", - "winapi", + "windows-targets", ] [[package]] name = "clap" -version = "4.3.21" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" dependencies = [ "anstream", "anstyle", @@ -137,9 +130,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "colorchoice" @@ -168,27 +161,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -201,24 +173,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - [[package]] name = "iana-time-zone" version = "0.1.57" @@ -242,16 +202,6 @@ dependencies = [ "cc", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.0.0" @@ -259,18 +209,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", - "hashbrown 0.14.0", -] - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys", + "hashbrown", ] [[package]] @@ -288,12 +227,6 @@ version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" -[[package]] -name = "linux-raw-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" - [[package]] name = "log" version = "0.4.20" @@ -302,9 +235,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "num-traits" @@ -323,12 +256,12 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "petgraph" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 1.9.3", + "indexmap", ] [[package]] @@ -342,26 +275,13 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] -[[package]] -name = "rustix" -version = "0.38.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - [[package]] name = "strsim" version = "0.10.0" @@ -370,9 +290,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "2.0.28" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", @@ -402,7 +322,7 @@ version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap 2.0.0", + "indexmap", "toml_datetime", "winnow", ] @@ -532,9 +452,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -547,51 +467,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.10" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5504cc7644f4b593cbc05c4a55bf9bd4e94b867c3c0bd440934174d50482427d" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ "memchr", ] From 0c19988699e3ae1f837bf6b7abb181f5b4b22189 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 5 Sep 2023 23:22:50 +0100 Subject: [PATCH 34/47] Use 32768Hz for the tracker --- .../the-dungeon-puzzlers-lament/src/lib.rs | 2 +- .../the-dungeon-puzzlers-lament/src/sfx.rs | 23 ++++++++++++------- tracker/agb-tracker/examples/basic.rs | 2 +- tracker/agb-tracker/examples/timing.rs | 2 +- tracker/agb-xm-core/src/lib.rs | 2 +- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/examples/the-dungeon-puzzlers-lament/src/lib.rs b/examples/the-dungeon-puzzlers-lament/src/lib.rs index 91a7926a..2ab0b021 100644 --- a/examples/the-dungeon-puzzlers-lament/src/lib.rs +++ b/examples/the-dungeon-puzzlers-lament/src/lib.rs @@ -109,7 +109,7 @@ pub fn entry(mut gba: agb::Gba) -> ! { let _ = save::save_max_level(&mut gba.save, 0); } - let mut mixer = gba.mixer.mixer(Frequency::Hz18157); + let mut mixer = gba.mixer.mixer(Frequency::Hz32768); let sfx = Sfx::new(&mut mixer); let mut g = Agb { diff --git a/examples/the-dungeon-puzzlers-lament/src/sfx.rs b/examples/the-dungeon-puzzlers-lament/src/sfx.rs index b4b9cd18..f73d8e62 100644 --- a/examples/the-dungeon-puzzlers-lament/src/sfx.rs +++ b/examples/the-dungeon-puzzlers-lament/src/sfx.rs @@ -1,4 +1,5 @@ use agb::{ + fixnum::num, include_wav, sound::mixer::{Mixer, SoundChannel}, }; @@ -37,38 +38,38 @@ impl<'a> Sfx<'a> { } pub fn bad_selection(&mut self) { - self.mixer.play_sound(SoundChannel::new(BAD_SELECTION)); + self.play_effect(BAD_SELECTION); } pub fn select(&mut self) { - self.mixer.play_sound(SoundChannel::new(SELECT)); + self.play_effect(SELECT); } pub fn place(&mut self) { - self.mixer.play_sound(SoundChannel::new(PLACE)); + self.play_effect(PLACE); } pub fn play_sound_effect(&mut self, effect: Option) { if let Some(effect) = effect { match effect { SoundEffect::WallHit => { - self.mixer.play_sound(SoundChannel::new(WALL_HIT)); + self.play_effect(WALL_HIT); } SoundEffect::SlimeDie => { - self.mixer.play_sound(SoundChannel::new(SLIME_DEATH)); + self.play_effect(SLIME_DEATH); } SoundEffect::HeroDie => {} SoundEffect::SquidDie => {} SoundEffect::SwordPickup => { - self.mixer.play_sound(SoundChannel::new(SWORD_PICKUP)); + self.play_effect(SWORD_PICKUP); } SoundEffect::SwordKill => {} SoundEffect::KeyPickup => {} SoundEffect::DoorOpen => { - self.mixer.play_sound(SoundChannel::new(DOOR_OPEN)); + self.play_effect(DOOR_OPEN); } SoundEffect::SwitchToggle => { - self.mixer.play_sound(SoundChannel::new(SWICTH_TOGGLES[0])); + self.play_effect(SWICTH_TOGGLES[0]); } SoundEffect::KeyDrop => {} SoundEffect::SwordDrop => {} @@ -77,6 +78,12 @@ impl<'a> Sfx<'a> { } } } + + fn play_effect(&mut self, effect: &'static [u8]) { + let mut channel = SoundChannel::new(effect); + channel.playback(num!(0.5)); + self.mixer.play_sound(channel); + } } #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] diff --git a/tracker/agb-tracker/examples/basic.rs b/tracker/agb-tracker/examples/basic.rs index bab1e138..023a1b1f 100644 --- a/tracker/agb-tracker/examples/basic.rs +++ b/tracker/agb-tracker/examples/basic.rs @@ -12,7 +12,7 @@ const DB_TOFFE: Track = include_xm!("examples/db_toffe.xm"); fn main(mut gba: Gba) -> ! { let vblank_provider = agb::interrupt::VBlank::get(); - let mut mixer = gba.mixer.mixer(Frequency::Hz18157); + let mut mixer = gba.mixer.mixer(Frequency::Hz32768); mixer.enable(); let mut tracker = Tracker::new(&DB_TOFFE); diff --git a/tracker/agb-tracker/examples/timing.rs b/tracker/agb-tracker/examples/timing.rs index f676ba76..7bc70bd7 100644 --- a/tracker/agb-tracker/examples/timing.rs +++ b/tracker/agb-tracker/examples/timing.rs @@ -18,7 +18,7 @@ fn main(mut gba: Gba) -> ! { timer.set_enabled(true); timer2.set_cascade(true).set_enabled(true); - let mut mixer = gba.mixer.mixer(Frequency::Hz18157); + let mut mixer = gba.mixer.mixer(Frequency::Hz32768); mixer.enable(); let mut tracker = Tracker::new(&DB_TOFFE); diff --git a/tracker/agb-xm-core/src/lib.rs b/tracker/agb-xm-core/src/lib.rs index dd7c0636..36e9a749 100644 --- a/tracker/agb-xm-core/src/lib.rs +++ b/tracker/agb-xm-core/src/lib.rs @@ -475,7 +475,7 @@ fn note_to_speed( FrequencyType::AmigaFrequencies => note_to_frequency_amega(note, fine_tune, relative_note), }; - let gba_audio_frequency = 18157f64; + let gba_audio_frequency = 32768f64; let speed = frequency / gba_audio_frequency; Num::from_f64(speed) From c04d674101ca0f11328d994d89ff4ee2fba7d036 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 5 Sep 2023 23:24:53 +0100 Subject: [PATCH 35/47] Extend changelog entry to allow for tile set --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8931515e..e89a98a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Sound channel panning and volume options are now `Num` rather than `Num` for improved precision and sound quality. - Due to dependency changes, agb-gbafix is now released under MPL rather than GPL. -- `include_background_gfx!` now produces tile settings directly rather than palette assigments. +- `include_background_gfx!` now produces tile sets and tile settings directly. ### Fixed From e504b93fe35976506a6a4e5542d5b459d64c5b5a Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 5 Sep 2023 23:52:35 +0100 Subject: [PATCH 36/47] Write a custom tile copy command --- agb/src/agbabi/mod.rs | 8 -------- agb/src/display/tiled/tile_copy.s | 27 +++++++++++++++++++++++++++ agb/src/display/tiled/vram_manager.rs | 12 +++++++++--- agb/src/global_asm.rs | 1 + 4 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 agb/src/display/tiled/tile_copy.s diff --git a/agb/src/agbabi/mod.rs b/agb/src/agbabi/mod.rs index 1f3df5a1..a53823cf 100644 --- a/agb/src/agbabi/mod.rs +++ b/agb/src/agbabi/mod.rs @@ -4,14 +4,6 @@ global_asm!(include_str!("macros.inc")); global_asm!(include_str!("memcpy.s")); global_asm!(include_str!("memset.s")); -extern "C" { - fn __aeabi_memcpy4(dest: *mut u32, src: *const u32, n: usize); -} - -pub(crate) unsafe fn memcpy(dest: *mut u32, src: *const u32, n: usize) { - __aeabi_memcpy4(dest, src, n); -} - #[cfg(test)] mod test { mod memset { diff --git a/agb/src/display/tiled/tile_copy.s b/agb/src/display/tiled/tile_copy.s new file mode 100644 index 00000000..866c0af8 --- /dev/null +++ b/agb/src/display/tiled/tile_copy.s @@ -0,0 +1,27 @@ +agb_arm_func copy_tile_8bpp + @ Arguments + @ r0 - pointer to the image data beginning + @ r1 - pointer to the target in vram + push {{r4-r8}} + +.rept 2 + ldmia r0!, {{r2-r8, r12}} + stmia r1!, {{r2-r8, r12}} +.endr + + pop {{r4-r8}} + bx lr +agb_arm_end copy_tile_8bpp + +agb_arm_func copy_tile_4bpp + @ Arguments + @ r0 - pointer to the image data beginning + @ r1 - pointer to the target in vram + push {{r4-r8}} + + ldmia r0!, {{r2-r8, r12}} + stmia r1!, {{r2-r8, r12}} + + pop {{r4-r8}} + bx lr +agb_arm_end copy_tile_4bpp \ No newline at end of file diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index 8ef68717..c2113983 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -4,7 +4,6 @@ use alloc::{slice, vec::Vec}; use crate::{ agb_alloc::{block_allocator::BlockAllocator, bump_allocator::StartEnd}, - agbabi, display::palette16, dma::dma_copy16, hash_map::{Entry, HashMap}, @@ -381,11 +380,13 @@ impl VRamManager { let tile_offset = (tile_id as usize) * tile_size; let tile_slice = &tile_set.tiles[tile_offset..(tile_offset + tile_size)]; - let tile_size = tile_slice.len(); let target_location = tile_reference.0.as_ptr() as *mut _; unsafe { - agbabi::memcpy(target_location, tile_slice.as_ptr() as *const _, tile_size); + match tile_set.format { + TileFormat::FourBpp => copy_tile_4bpp(tile_slice.as_ptr().cast(), target_location), + TileFormat::EightBpp => copy_tile_8bpp(tile_slice.as_ptr().cast(), target_location), + } } } @@ -409,3 +410,8 @@ impl VRamManager { } } } + +extern "C" { + fn copy_tile_4bpp(src: *const u32, dest: *mut u32); + fn copy_tile_8bpp(src: *const u32, dest: *mut u32); +} diff --git a/agb/src/global_asm.rs b/agb/src/global_asm.rs index b16f19b2..0af2e00e 100644 --- a/agb/src/global_asm.rs +++ b/agb/src/global_asm.rs @@ -6,3 +6,4 @@ global_asm!(include_str!("crt0.s")); global_asm!(include_str!("interrupt_handler.s")); global_asm!(include_str!("sound/mixer/mixer.s")); global_asm!(include_str!("save/asm_routines.s")); +global_asm!(include_str!("display/tiled/tile_copy.s")); From 77445b304f19c99fe77d7785ce78d8637b45e7eb Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 6 Sep 2023 00:21:27 +0100 Subject: [PATCH 37/47] Custom assembly as thumb --- agb-image-converter/src/rust_generator.rs | 2 +- agb/src/display/tiled/tile_copy.s | 27 ---------------- agb/src/display/tiled/vram_manager.rs | 38 +++++++++++++++-------- agb/src/global_asm.rs | 1 - 4 files changed, 26 insertions(+), 42 deletions(-) delete mode 100644 agb/src/display/tiled/tile_copy.s diff --git a/agb-image-converter/src/rust_generator.rs b/agb-image-converter/src/rust_generator.rs index 4d8b4d5c..a382580f 100644 --- a/agb-image-converter/src/rust_generator.rs +++ b/agb-image-converter/src/rust_generator.rs @@ -131,7 +131,7 @@ pub(crate) fn generate_code( pub bytes: Bytes, } - const ALIGNED: &AlignedAs = &AlignedAs { + const ALIGNED: &AlignedAs = &AlignedAs { _align: [], bytes: *#data, }; diff --git a/agb/src/display/tiled/tile_copy.s b/agb/src/display/tiled/tile_copy.s deleted file mode 100644 index 866c0af8..00000000 --- a/agb/src/display/tiled/tile_copy.s +++ /dev/null @@ -1,27 +0,0 @@ -agb_arm_func copy_tile_8bpp - @ Arguments - @ r0 - pointer to the image data beginning - @ r1 - pointer to the target in vram - push {{r4-r8}} - -.rept 2 - ldmia r0!, {{r2-r8, r12}} - stmia r1!, {{r2-r8, r12}} -.endr - - pop {{r4-r8}} - bx lr -agb_arm_end copy_tile_8bpp - -agb_arm_func copy_tile_4bpp - @ Arguments - @ r0 - pointer to the image data beginning - @ r1 - pointer to the target in vram - push {{r4-r8}} - - ldmia r0!, {{r2-r8, r12}} - stmia r1!, {{r2-r8, r12}} - - pop {{r4-r8}} - bx lr -agb_arm_end copy_tile_4bpp \ No newline at end of file diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index c2113983..b92e00de 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -29,9 +29,10 @@ const fn layout_of(format: TileFormat) -> Layout { } #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(C)] pub enum TileFormat { - FourBpp, - EightBpp, + FourBpp = 0, + EightBpp = 1, } impl TileFormat { @@ -376,17 +377,33 @@ impl VRamManager { tile_id: u16, tile_reference: TileReference, ) { - let tile_size = tile_set.format.tile_size(); + let tile_format = tile_set.format; + let tile_size = tile_format.tile_size(); let tile_offset = (tile_id as usize) * tile_size; - let tile_slice = &tile_set.tiles[tile_offset..(tile_offset + tile_size)]; + let tile_data_start = unsafe { tile_set.tiles.as_ptr().add(tile_offset) }; let target_location = tile_reference.0.as_ptr() as *mut _; unsafe { - match tile_set.format { - TileFormat::FourBpp => copy_tile_4bpp(tile_slice.as_ptr().cast(), target_location), - TileFormat::EightBpp => copy_tile_8bpp(tile_slice.as_ptr().cast(), target_location), - } + core::arch::asm!( + "cmp r2, #0", + "beq 1f", + "ldmia r0!, {{r2-r5}}", + "stmia r1!, {{r2-r5}}", + "ldmia r0!, {{r2-r5}}", + "stmia r1!, {{r2-r5}}", + "1:", + "ldmia r0!, {{r2-r5}}", + "stmia r1!, {{r2-r5}}", + "ldmia r0!, {{r2-r5}}", + "stmia r1!, {{r2-r5}}", + inout("r0") tile_data_start => _, + inout("r1") target_location => _, + inout("r2") tile_format as u32 => _, + out("r3") _, + out("r4") _, + out("r5") _, + ); } } @@ -410,8 +427,3 @@ impl VRamManager { } } } - -extern "C" { - fn copy_tile_4bpp(src: *const u32, dest: *mut u32); - fn copy_tile_8bpp(src: *const u32, dest: *mut u32); -} diff --git a/agb/src/global_asm.rs b/agb/src/global_asm.rs index 0af2e00e..b16f19b2 100644 --- a/agb/src/global_asm.rs +++ b/agb/src/global_asm.rs @@ -6,4 +6,3 @@ global_asm!(include_str!("crt0.s")); global_asm!(include_str!("interrupt_handler.s")); global_asm!(include_str!("sound/mixer/mixer.s")); global_asm!(include_str!("save/asm_routines.s")); -global_asm!(include_str!("display/tiled/tile_copy.s")); From bb57298c54e8aa2aac90abcea64557074e8d0462 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 6 Sep 2023 00:37:23 +0100 Subject: [PATCH 38/47] This has better code generation --- agb/src/display/tiled/vram_manager.rs | 45 ++++++++++++++++----------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index b92e00de..e133f4e2 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -385,25 +385,32 @@ impl VRamManager { let target_location = tile_reference.0.as_ptr() as *mut _; unsafe { - core::arch::asm!( - "cmp r2, #0", - "beq 1f", - "ldmia r0!, {{r2-r5}}", - "stmia r1!, {{r2-r5}}", - "ldmia r0!, {{r2-r5}}", - "stmia r1!, {{r2-r5}}", - "1:", - "ldmia r0!, {{r2-r5}}", - "stmia r1!, {{r2-r5}}", - "ldmia r0!, {{r2-r5}}", - "stmia r1!, {{r2-r5}}", - inout("r0") tile_data_start => _, - inout("r1") target_location => _, - inout("r2") tile_format as u32 => _, - out("r3") _, - out("r4") _, - out("r5") _, - ); + match tile_format { + TileFormat::FourBpp => core::arch::asm!( + ".rept 2", + "ldmia r0!, {{r2-r5}}", + "stmia r1!, {{r2-r5}}", + ".endr", + inout("r0") tile_data_start => _, + inout("r1") target_location => _, + out("r2") _, + out("r3") _, + out("r4") _, + out("r5") _, + ), + TileFormat::EightBpp => core::arch::asm!( + ".rept 4", + "ldmia r0!, {{r2-r5}}", + "stmia r1!, {{r2-r5}}", + ".endr", + inout("r0") tile_data_start => _, + inout("r1") target_location => _, + out("r2") _, + out("r3") _, + out("r4") _, + out("r5") _, + ), + } } } From ed2e7dec5cb44fb915b6b9c544fffcf20860deaf Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 6 Sep 2023 08:34:14 +0100 Subject: [PATCH 39/47] Let rust do the register allocation --- agb/src/display/tiled/vram_manager.rs | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index e133f4e2..d5526d35 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -388,27 +388,27 @@ impl VRamManager { match tile_format { TileFormat::FourBpp => core::arch::asm!( ".rept 2", - "ldmia r0!, {{r2-r5}}", - "stmia r1!, {{r2-r5}}", + "ldmia {src}!, {{{tmp1},{tmp2},{tmp3},{tmp4}}}", + "stmia {dest}!, {{{tmp1},{tmp2},{tmp3},{tmp4}}}", ".endr", - inout("r0") tile_data_start => _, - inout("r1") target_location => _, - out("r2") _, - out("r3") _, - out("r4") _, - out("r5") _, + src = inout(reg) tile_data_start => _, + dest = inout(reg) target_location => _, + tmp1 = out(reg) _, + tmp2 = out(reg) _, + tmp3 = out(reg) _, + tmp4 = out(reg) _, ), TileFormat::EightBpp => core::arch::asm!( ".rept 4", - "ldmia r0!, {{r2-r5}}", - "stmia r1!, {{r2-r5}}", + "ldmia {src}!, {{{tmp1},{tmp2},{tmp3},{tmp4}}}", + "stmia {dest}!, {{{tmp1},{tmp2},{tmp3},{tmp4}}}", ".endr", - inout("r0") tile_data_start => _, - inout("r1") target_location => _, - out("r2") _, - out("r3") _, - out("r4") _, - out("r5") _, + src = inout(reg) tile_data_start => _, + dest = inout(reg) target_location => _, + tmp1 = out(reg) _, + tmp2 = out(reg) _, + tmp3 = out(reg) _, + tmp4 = out(reg) _, ), } } From 5b3248ec5a985a753b88b59d3c63b9dff4971d21 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 6 Sep 2023 08:51:47 +0100 Subject: [PATCH 40/47] Massively improve the code generation around tile sizes --- agb/src/display/tiled/vram_manager.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index d5526d35..059e8a8e 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -29,19 +29,15 @@ const fn layout_of(format: TileFormat) -> Layout { } #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[repr(C)] pub enum TileFormat { - FourBpp = 0, - EightBpp = 1, + FourBpp = 5, + EightBpp = 6, } impl TileFormat { /// Returns the size of the tile in bytes pub(crate) const fn tile_size(self) -> usize { - match self { - TileFormat::FourBpp => 8 * 8 / 2, - TileFormat::EightBpp => 8 * 8, - } + 1 << self as usize } } From 0900121273fecb5ca16999f48ff9e6aff340a2ef Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 6 Sep 2023 09:41:13 +0100 Subject: [PATCH 41/47] Update docs --- tracker/agb-tracker/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tracker/agb-tracker/src/lib.rs b/tracker/agb-tracker/src/lib.rs index f0593618..47ca4b69 100644 --- a/tracker/agb-tracker/src/lib.rs +++ b/tracker/agb-tracker/src/lib.rs @@ -35,7 +35,7 @@ //! fn main(mut gba: Gba) -> ! { //! let vblank_provider = agb::interrupt::VBlank::get(); //! -//! let mut mixer = gba.mixer.mixer(Frequency::Hz18157); +//! let mut mixer = gba.mixer.mixer(Frequency::Hz32768); //! mixer.enable(); //! //! let mut tracker = Tracker::new(&DB_TOFFE); @@ -49,7 +49,7 @@ //! } //! ``` //! -//! Note that currently you have to select 18157Hz as the frequency for the mixer. +//! Note that currently you have to select 32768Hz as the frequency for the mixer. //! This restriction will be lifted in a future version. //! //! # Concepts From f2a407975bb361c82ad8c64524b7706263d48940 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:29:19 +0000 Subject: [PATCH 42/47] Update Rust crate bindgen to 0.68 --- emulator/Cargo.lock | 4 ++-- emulator/mgba-sys/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/emulator/Cargo.lock b/emulator/Cargo.lock index e8408908..7e882847 100644 --- a/emulator/Cargo.lock +++ b/emulator/Cargo.lock @@ -88,9 +88,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bindgen" -version = "0.66.1" +version = "0.68.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ "bitflags 2.4.0", "cexpr", diff --git a/emulator/mgba-sys/Cargo.toml b/emulator/mgba-sys/Cargo.toml index 1661fae5..7a5bfb2e 100644 --- a/emulator/mgba-sys/Cargo.toml +++ b/emulator/mgba-sys/Cargo.toml @@ -15,6 +15,6 @@ exclude = [ [build-dependencies] -bindgen = "0.66" +bindgen = "0.68" pkg-config = "0.3.27" cmake = "0.1" \ No newline at end of file From 17a62bf0f23ca369ab610394e3d7650e4634526c Mon Sep 17 00:00:00 2001 From: GBA bot Date: Wed, 6 Sep 2023 21:29:51 +0000 Subject: [PATCH 43/47] Update lockfiles --- book/games/pong/Cargo.lock | 4 +- emulator/Cargo.lock | 87 ++++--------------- examples/amplitude/Cargo.lock | 4 +- examples/combo/Cargo.lock | 8 +- examples/hyperspace-roll/Cargo.lock | 4 +- .../the-dungeon-puzzlers-lament/Cargo.lock | 8 +- .../the-hat-chooses-the-wizard/Cargo.lock | 4 +- examples/the-purple-night/Cargo.lock | 8 +- tools/Cargo.lock | 4 +- 9 files changed, 38 insertions(+), 93 deletions(-) diff --git a/book/games/pong/Cargo.lock b/book/games/pong/Cargo.lock index 4dd1716a..4629c556 100644 --- a/book/games/pong/Cargo.lock +++ b/book/games/pong/Cargo.lock @@ -154,9 +154,9 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" diff --git a/emulator/Cargo.lock b/emulator/Cargo.lock index 7e882847..eb18e236 100644 --- a/emulator/Cargo.lock +++ b/emulator/Cargo.lock @@ -123,9 +123,9 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" @@ -238,27 +238,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys", -] - [[package]] name = "either" version = "1.9.0" @@ -311,17 +290,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "glob" version = "0.3.1" @@ -334,6 +302,15 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "image" version = "0.24.7" @@ -485,12 +462,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -544,26 +515,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", -] - [[package]] name = "regex" version = "1.9.5" @@ -614,9 +565,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "simd-adler32" @@ -673,20 +624,14 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "which" -version = "4.4.1" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad25fe5717e59ada8ea33511bbbf7420b11031730a24c65e82428766c307006" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ - "dirs", "either", + "home", "once_cell", "rustix", ] diff --git a/examples/amplitude/Cargo.lock b/examples/amplitude/Cargo.lock index f6b7dfe1..01ea47b9 100644 --- a/examples/amplitude/Cargo.lock +++ b/examples/amplitude/Cargo.lock @@ -161,9 +161,9 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" diff --git a/examples/combo/Cargo.lock b/examples/combo/Cargo.lock index ff7e0fa9..4d02b968 100644 --- a/examples/combo/Cargo.lock +++ b/examples/combo/Cargo.lock @@ -225,9 +225,9 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" @@ -839,9 +839,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" +checksum = "1eee6bf5926be7cf998d7381a9a23d833fd493f6a8034658a9505a4dc4b20444" [[package]] name = "xmrs" diff --git a/examples/hyperspace-roll/Cargo.lock b/examples/hyperspace-roll/Cargo.lock index 25cf7443..0537fc4d 100644 --- a/examples/hyperspace-roll/Cargo.lock +++ b/examples/hyperspace-roll/Cargo.lock @@ -154,9 +154,9 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" diff --git a/examples/the-dungeon-puzzlers-lament/Cargo.lock b/examples/the-dungeon-puzzlers-lament/Cargo.lock index 6d980d5a..cc8426ae 100644 --- a/examples/the-dungeon-puzzlers-lament/Cargo.lock +++ b/examples/the-dungeon-puzzlers-lament/Cargo.lock @@ -209,9 +209,9 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" @@ -724,9 +724,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" +checksum = "1eee6bf5926be7cf998d7381a9a23d833fd493f6a8034658a9505a4dc4b20444" [[package]] name = "xmrs" diff --git a/examples/the-hat-chooses-the-wizard/Cargo.lock b/examples/the-hat-chooses-the-wizard/Cargo.lock index 3e9ca3e9..a7052c45 100644 --- a/examples/the-hat-chooses-the-wizard/Cargo.lock +++ b/examples/the-hat-chooses-the-wizard/Cargo.lock @@ -154,9 +154,9 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" diff --git a/examples/the-purple-night/Cargo.lock b/examples/the-purple-night/Cargo.lock index dd7fe356..e63b7430 100644 --- a/examples/the-purple-night/Cargo.lock +++ b/examples/the-purple-night/Cargo.lock @@ -163,9 +163,9 @@ checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" @@ -490,6 +490,6 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "xml-rs" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" +checksum = "1eee6bf5926be7cf998d7381a9a23d833fd493f6a8034658a9505a4dc4b20444" diff --git a/tools/Cargo.lock b/tools/Cargo.lock index 09d2d7da..f13993a0 100644 --- a/tools/Cargo.lock +++ b/tools/Cargo.lock @@ -94,9 +94,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" +checksum = "d87d9d13be47a5b7c3907137f1290b0459a7f80efb26be8c52afb11963bccb02" dependencies = [ "android-tzdata", "iana-time-zone", From 8828137aeb907b079823398d0808f7092626c61f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 13:17:10 +0000 Subject: [PATCH 44/47] Update Rust crate libc to 0.2.148 --- emulator/Cargo.lock | 4 ++-- emulator/mgba/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/emulator/Cargo.lock b/emulator/Cargo.lock index eb18e236..d42ec1d1 100644 --- a/emulator/Cargo.lock +++ b/emulator/Cargo.lock @@ -339,9 +339,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libloading" diff --git a/emulator/mgba/Cargo.toml b/emulator/mgba/Cargo.toml index d5b152f0..7be70767 100644 --- a/emulator/mgba/Cargo.toml +++ b/emulator/mgba/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -libc = "0.2.147" +libc = "0.2.148" mgba-sys = { version = "0.1.0", path = "../mgba-sys" } thiserror = "1" \ No newline at end of file From c7540a440db40ad11bee8b2d5cea88fca92313c2 Mon Sep 17 00:00:00 2001 From: GBA bot Date: Wed, 13 Sep 2023 13:17:49 +0000 Subject: [PATCH 45/47] Update lockfiles --- agb-gbafix/Cargo.lock | 8 +-- book/games/pong/Cargo.lock | 8 +-- emulator/Cargo.lock | 28 ++++---- examples/amplitude/Cargo.lock | 8 +-- examples/combo/Cargo.lock | 44 ++++++------ examples/hyperspace-roll/Cargo.lock | 8 +-- .../the-dungeon-puzzlers-lament/Cargo.lock | 38 +++++------ .../the-hat-chooses-the-wizard/Cargo.lock | 12 ++-- examples/the-purple-night/Cargo.lock | 12 ++-- tools/Cargo.lock | 68 ++++--------------- 10 files changed, 97 insertions(+), 137 deletions(-) diff --git a/agb-gbafix/Cargo.lock b/agb-gbafix/Cargo.lock index c7d554e4..0a97bb4d 100644 --- a/agb-gbafix/Cargo.lock +++ b/agb-gbafix/Cargo.lock @@ -27,9 +27,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" [[package]] name = "anstyle-parse" @@ -67,9 +67,9 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "clap" -version = "4.4.2" +version = "4.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" +checksum = "84ed82781cea27b43c9b106a979fe450a13a31aab0500595fb3fc06616de08e6" dependencies = [ "clap_builder", ] diff --git a/book/games/pong/Cargo.lock b/book/games/pong/Cargo.lock index 4629c556..13008ddd 100644 --- a/book/games/pong/Cargo.lock +++ b/book/games/pong/Cargo.lock @@ -405,9 +405,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -422,9 +422,9 @@ checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" diff --git a/emulator/Cargo.lock b/emulator/Cargo.lock index d42ec1d1..955efcd0 100644 --- a/emulator/Cargo.lock +++ b/emulator/Cargo.lock @@ -42,9 +42,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" [[package]] name = "anstyle-parse" @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.2" +version = "4.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" +checksum = "84ed82781cea27b43c9b106a979fe450a13a31aab0500595fb3fc06616de08e6" dependencies = [ "clap_builder", "clap_derive", @@ -355,9 +355,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" [[package]] name = "log" @@ -489,9 +489,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8832c0f9be7e3cae60727e6256cfd2cd3c3e2b6cd5dad4190ecb2fd658c9030b" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", "syn", @@ -552,9 +552,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.11" +version = "0.38.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453" +checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" dependencies = [ "bitflags 2.4.0", "errno", @@ -583,9 +583,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -614,9 +614,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "utf8parse" diff --git a/examples/amplitude/Cargo.lock b/examples/amplitude/Cargo.lock index 01ea47b9..cff58630 100644 --- a/examples/amplitude/Cargo.lock +++ b/examples/amplitude/Cargo.lock @@ -405,9 +405,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -422,9 +422,9 @@ checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" diff --git a/examples/combo/Cargo.lock b/examples/combo/Cargo.lock index 4d02b968..1f5df465 100644 --- a/examples/combo/Cargo.lock +++ b/examples/combo/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ "image", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -61,7 +61,7 @@ version = "0.16.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -71,7 +71,7 @@ dependencies = [ "hound", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -110,7 +110,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", "xmrs", ] @@ -175,9 +175,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.3" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bilge" @@ -199,7 +199,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -400,9 +400,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libflate" @@ -531,7 +531,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -684,14 +684,14 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2" dependencies = [ "itoa", "ryu", @@ -719,9 +719,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -782,7 +782,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "181e2402be287d74e951a8e81c8798d0737cc94b1a089237bb3b838be76c6b5b" dependencies = [ - "base64 0.21.3", + "base64 0.21.4", "libflate 1.4.0", "xml-rs", ] @@ -795,9 +795,9 @@ checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap", "toml_datetime", @@ -812,9 +812,9 @@ checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" @@ -839,9 +839,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.17" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eee6bf5926be7cf998d7381a9a23d833fd493f6a8034658a9505a4dc4b20444" +checksum = "bab77e97b50aee93da431f2cee7cd0f43b4d1da3c408042f2d7d164187774f0a" [[package]] name = "xmrs" diff --git a/examples/hyperspace-roll/Cargo.lock b/examples/hyperspace-roll/Cargo.lock index 0537fc4d..1390d644 100644 --- a/examples/hyperspace-roll/Cargo.lock +++ b/examples/hyperspace-roll/Cargo.lock @@ -405,9 +405,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -422,9 +422,9 @@ checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" diff --git a/examples/the-dungeon-puzzlers-lament/Cargo.lock b/examples/the-dungeon-puzzlers-lament/Cargo.lock index cc8426ae..97dbbc0e 100644 --- a/examples/the-dungeon-puzzlers-lament/Cargo.lock +++ b/examples/the-dungeon-puzzlers-lament/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ "image", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -61,7 +61,7 @@ version = "0.16.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -71,7 +71,7 @@ dependencies = [ "hound", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -110,7 +110,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", "xmrs", ] @@ -159,9 +159,9 @@ checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" [[package]] name = "base64" -version = "0.21.3" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bilge" @@ -183,7 +183,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -350,9 +350,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libflate" @@ -469,7 +469,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -616,7 +616,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.32", ] [[package]] @@ -640,9 +640,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -680,9 +680,9 @@ checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap", "toml_datetime", @@ -697,9 +697,9 @@ checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" @@ -724,9 +724,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.17" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eee6bf5926be7cf998d7381a9a23d833fd493f6a8034658a9505a4dc4b20444" +checksum = "bab77e97b50aee93da431f2cee7cd0f43b4d1da3c408042f2d7d164187774f0a" [[package]] name = "xmrs" diff --git a/examples/the-hat-chooses-the-wizard/Cargo.lock b/examples/the-hat-chooses-the-wizard/Cargo.lock index a7052c45..e5ab629e 100644 --- a/examples/the-hat-chooses-the-wizard/Cargo.lock +++ b/examples/the-hat-chooses-the-wizard/Cargo.lock @@ -430,9 +430,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2" dependencies = [ "itoa", "ryu", @@ -441,9 +441,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -467,9 +467,9 @@ checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" diff --git a/examples/the-purple-night/Cargo.lock b/examples/the-purple-night/Cargo.lock index e63b7430..b7ba9c12 100644 --- a/examples/the-purple-night/Cargo.lock +++ b/examples/the-purple-night/Cargo.lock @@ -434,9 +434,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -478,9 +478,9 @@ checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" @@ -490,6 +490,6 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "xml-rs" -version = "0.8.17" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eee6bf5926be7cf998d7381a9a23d833fd493f6a8034658a9505a4dc4b20444" +checksum = "bab77e97b50aee93da431f2cee7cd0f43b4d1da3c408042f2d7d164187774f0a" diff --git a/tools/Cargo.lock b/tools/Cargo.lock index f13993a0..6bd0711c 100644 --- a/tools/Cargo.lock +++ b/tools/Cargo.lock @@ -33,9 +33,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" [[package]] name = "anstyle-parse" @@ -94,24 +94,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.29" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87d9d13be47a5b7c3907137f1290b0459a7f80efb26be8c52afb11963bccb02" +checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", - "time", "wasm-bindgen", "windows-targets", ] [[package]] name = "clap" -version = "4.4.2" +version = "4.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" +checksum = "84ed82781cea27b43c9b106a979fe450a13a31aab0500595fb3fc06616de08e6" dependencies = [ "clap_builder", ] @@ -223,9 +222,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "log" @@ -290,26 +289,15 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "2.0.31" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi", - "winapi", -] - [[package]] name = "toml_datetime" version = "0.6.3" @@ -318,9 +306,9 @@ checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap", "toml_datetime", @@ -340,9 +328,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "utf8parse" @@ -350,12 +338,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasm-bindgen" version = "0.2.87" @@ -410,28 +392,6 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows" version = "0.48.0" From c12ae4b5d9350e9efda946622cc09e8f7f288c8c Mon Sep 17 00:00:00 2001 From: Corwin Date: Thu, 14 Sep 2023 12:44:26 +0100 Subject: [PATCH 46/47] add safety comments to public unsafe functions --- agb/src/lib.rs | 4 ++++ agb/src/sync/mod.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/agb/src/lib.rs b/agb/src/lib.rs index 73963fcc..7cbe83d6 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -231,6 +231,10 @@ pub struct Gba { impl Gba { #[doc(hidden)] #[must_use] + /// # Safety + /// + /// May only be called a single time. It is not needed to call this due to + /// it being called internally by the [`entry`] macro. pub unsafe fn new_in_entry() -> Self { Self::single_new() } diff --git a/agb/src/sync/mod.rs b/agb/src/sync/mod.rs index 17dad495..826a8326 100644 --- a/agb/src/sync/mod.rs +++ b/agb/src/sync/mod.rs @@ -33,6 +33,8 @@ pub fn memory_write_hint(val: *mut T) { /// This seems to be a problem caused by Rust issue #62256: /// /// +/// # Safety +/// /// **WARNING FOR ANYONE WHO FINDS THIS**: This implementation will *only* be /// correct on the GBA, and should not be used on any other platform. The GBA /// is very old, and has no atomics to begin with - only a main thread and From 473181718be08ddbc7730f85265d8eec6086f385 Mon Sep 17 00:00:00 2001 From: Corwin Date: Thu, 14 Sep 2023 13:28:00 +0100 Subject: [PATCH 47/47] remove outer loop --- agb/examples/object_text_render.rs | 106 ++++++++++++++--------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/agb/examples/object_text_render.rs b/agb/examples/object_text_render.rs index d5323724..f3df935a 100644 --- a/agb/examples/object_text_render.rs +++ b/agb/examples/object_text_render.rs @@ -24,76 +24,74 @@ fn entry(gba: agb::Gba) -> ! { fn main(mut gba: agb::Gba) -> ! { let (mut unmanaged, _sprites) = gba.display.object.get_unmanaged(); - loop { - let mut palette = [0x0; 16]; - palette[1] = 0xFF_FF; - palette[2] = 0x00_FF; - let palette = Palette16::new(palette); - let palette = PaletteVram::new(&palette).unwrap(); + let mut palette = [0x0; 16]; + palette[1] = 0xFF_FF; + palette[2] = 0x00_FF; + let palette = Palette16::new(palette); + let palette = PaletteVram::new(&palette).unwrap(); - let timer = gba.timers.timers(); - let mut timer: agb::timer::Timer = timer.timer2; + let timer = gba.timers.timers(); + let mut timer: agb::timer::Timer = timer.timer2; - timer.set_enabled(true); - timer.set_divider(agb::timer::Divider::Divider256); + timer.set_enabled(true); + timer.set_divider(agb::timer::Divider::Divider256); - let mut wr = ObjectTextRender::new(&FONT, Size::S16x16, palette); - let start = timer.value(); + let mut wr = ObjectTextRender::new(&FONT, Size::S16x16, palette); + let start = timer.value(); - let player_name = "You"; - let _ = writeln!( + let player_name = "You"; + let _ = writeln!( wr, "Woah!{change2} {player_name}! {change1}Hey there! I have a bunch of text I want to show you. However, you will find that the amount of text I can display is limited. Who'd have thought! Good thing that my text system supports scrolling! It only took around 20 jank versions to get here!", change2 = ChangeColour::new(2), change1 = ChangeColour::new(1), ); - let end = timer.value(); + let end = timer.value(); - agb::println!( - "Write took {} cycles", - 256 * (end.wrapping_sub(start) as u32) - ); + agb::println!( + "Write took {} cycles", + 256 * (end.wrapping_sub(start) as u32) + ); - let vblank = agb::interrupt::VBlank::get(); - let mut input = agb::input::ButtonController::new(); + let vblank = agb::interrupt::VBlank::get(); + let mut input = agb::input::ButtonController::new(); + + let start = timer.value(); + + wr.layout((WIDTH, 40).into(), TextAlignment::Justify, 2); + let end = timer.value(); + + agb::println!( + "Layout took {} cycles", + 256 * (end.wrapping_sub(start) as u32) + ); + + let mut line_done = false; + let mut frame = 0; + + loop { + vblank.wait_for_vblank(); + input.update(); + let oam = &mut unmanaged.iter(); + wr.commit(oam); let start = timer.value(); - - wr.layout((WIDTH, 40).into(), TextAlignment::Justify, 2); + if frame % 4 == 0 { + line_done = !wr.next_letter_group(); + } + if line_done && input.is_just_pressed(Button::A) { + line_done = false; + wr.pop_line(); + } + wr.update((0, HEIGHT - 40).into()); let end = timer.value(); + frame += 1; + agb::println!( - "Layout took {} cycles", - 256 * (end.wrapping_sub(start) as u32) + "Took {} cycles, line done {}", + 256 * (end.wrapping_sub(start) as u32), + line_done ); - - let mut line_done = false; - let mut frame = 0; - - loop { - vblank.wait_for_vblank(); - input.update(); - let oam = &mut unmanaged.iter(); - wr.commit(oam); - - let start = timer.value(); - if frame % 4 == 0 { - line_done = !wr.next_letter_group(); - } - if line_done && input.is_just_pressed(Button::A) { - line_done = false; - wr.pop_line(); - } - wr.update((0, HEIGHT - 40).into()); - let end = timer.value(); - - frame += 1; - - agb::println!( - "Took {} cycles, line done {}", - 256 * (end.wrapping_sub(start) as u32), - line_done - ); - } } }