From 679a2ec99781517375dbf8c8210b7c645a9aba55 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 20:58:04 +0000 Subject: [PATCH 01/25] Add cspell words for things we use --- .vscode/settings.json | 89 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..50076eb2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,89 @@ +{ + "cSpell.words": [ + "aeabi", + "agbabi", + "asefile", + "aseprite", + "Atmel", + "behaviour", + "bindgen", + "bitarray", + "bitflags", + "bitmask", + "boing", + "boops", + "chipsets", + "chrono", + "clonable", + "collidable", + "Colour", + "Colours", + "constness", + "COOLDOWN", + "cooldowns", + "cstring", + "Customise", + "Datelike", + "dealloc", + "EABI", + "EEPROM", + "ewram", + "fixnum", + "fontdue", + "fract", + "FRAM", + "gameboy", + "Gamepak", + "hadamard", + "Hasher", + "healthbar", + "hflip", + "hurtbox", + "initialisation", + "initialise", + "Initialises", + "iwram", + "justfile", + "Knockback", + "lateout", + "Macronix", + "mgba", + "normalise", + "normalised", + "Optimisation", + "optimise", + "optimised", + "Optimiser", + "Paks", + "prioritised", + "replacen", + "repr", + "Respawn", + "rustc", + "rustdoc", + "Sanyo", + "screenblock", + "screenblocks", + "signum", + "SRAM", + "subcrates", + "subpat", + "syscall", + "syscalls", + "THUMBV", + "tilemap", + "tileset", + "tonc", + "trunc", + "Uninit", + "uninitialised", + "vblank", + "vdraw", + "vflip", + "vram", + "Woah", + "WRAM", + "xmin", + "ymin" + ] +} \ No newline at end of file From 55c754138641175d10ad6b4fbf1b891e439b027e Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:00:51 +0000 Subject: [PATCH 02/25] backc is not a word --- agb/examples/wave.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/agb/examples/wave.rs b/agb/examples/wave.rs index f89cd6df..602b2ff8 100644 --- a/agb/examples/wave.rs +++ b/agb/examples/wave.rs @@ -32,10 +32,10 @@ fn main(mut gba: agb::Gba) -> ! { let back = Mutex::new(RefCell::new(BackCosines { cosines, row: 0 })); let _a = agb::interrupt::add_interrupt_handler(Interrupt::HBlank, |key: CriticalSection| { - let mut backc = back.borrow(key).borrow_mut(); - let deflection = backc.cosines[backc.row % 32]; + let mut back = back.borrow(key).borrow_mut(); + let deflection = back.cosines[back.row % 32]; unsafe { ((0x0400_0010) as *mut u16).write_volatile(deflection) } - backc.row += 1; + back.row += 1; }); let vblank = agb::interrupt::VBlank::get(); @@ -43,10 +43,10 @@ fn main(mut gba: agb::Gba) -> ! { loop { vblank.wait_for_vblank(); free(|key| { - let mut backc = back.borrow(key).borrow_mut(); - backc.row = 0; + let mut back = back.borrow(key).borrow_mut(); + back.row = 0; time += 1; - for (r, a) in backc.cosines.iter_mut().enumerate() { + for (r, a) in back.cosines.iter_mut().enumerate() { let n: FixedNum<8> = (FixedNum::new(r as i32) / 32 + FixedNum::new(time) / 128) .cos() * (256 * 4 - 1) From b37ce0b9b6a01cbb1a655350930ff7676e662270 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:03:32 +0000 Subject: [PATCH 03/25] Fix spelling errors in block_allocator --- agb/src/agb_alloc/block_allocator.rs | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/agb/src/agb_alloc/block_allocator.rs b/agb/src/agb_alloc/block_allocator.rs index 5e7b45f8..929174df 100644 --- a/agb/src/agb_alloc/block_allocator.rs +++ b/agb/src/agb_alloc/block_allocator.rs @@ -67,9 +67,9 @@ impl BlockAllocator { let mut count = 0; let mut list_ptr = &mut state.first_free_block; - while let Some(mut curr) = list_ptr { + while let Some(mut current) = list_ptr { count += 1; - list_ptr = &mut curr.as_mut().next; + list_ptr = &mut current.as_mut().next; } count @@ -89,18 +89,18 @@ impl BlockAllocator { let mut list_ptr = &mut state.first_free_block; - while let Some(mut curr) = list_ptr { - if let Some(next_elem) = curr.as_mut().next { + while let Some(mut current) = list_ptr { + if let Some(next_elem) = current.as_mut().next { let difference = next_elem .as_ptr() .cast::<u8>() - .offset_from(curr.as_ptr().cast::<u8>()); + .offset_from(current.as_ptr().cast::<u8>()); let usize_difference: usize = difference .try_into() .expect("distances in alloc'd blocks must be positive"); - if usize_difference == curr.as_mut().size { - let current = curr.as_mut(); + if usize_difference == current.as_mut().size { + let current = current.as_mut(); let next = next_elem.as_ref(); current.size += next.size; @@ -108,7 +108,7 @@ impl BlockAllocator { continue; } } - list_ptr = &mut curr.as_mut().next; + list_ptr = &mut current.as_mut().next; } }); } @@ -128,18 +128,18 @@ impl BlockAllocator { // This iterates the free list until it either finds a block that // is the exact size requested or a block that can be split into // one with the desired size and another block header. - while let Some(mut curr) = current_block { - let curr_block = curr.as_mut(); - if curr_block.size == full_layout.size() { - *list_ptr = curr_block.next; - return Some(curr.cast()); - } else if curr_block.size >= block_after_layout.size() { + while let Some(mut current) = current_block { + let block_to_examine = current.as_mut(); + if block_to_examine.size == full_layout.size() { + *list_ptr = block_to_examine.next; + return Some(current.cast()); + } else if block_to_examine.size >= block_after_layout.size() { // can split block let split_block = Block { - size: curr_block.size - block_after_layout_offset, - next: curr_block.next, + size: block_to_examine.size - block_after_layout_offset, + next: block_to_examine.next, }; - let split_ptr = curr + let split_ptr = current .as_ptr() .cast::<u8>() .add(block_after_layout_offset) @@ -147,10 +147,10 @@ impl BlockAllocator { *split_ptr = split_block; *list_ptr = NonNull::new(split_ptr).map(SendNonNull); - return Some(curr.cast()); + return Some(current.cast()); } - current_block = curr_block.next; - list_ptr = &mut curr_block.next; + current_block = block_to_examine.next; + list_ptr = &mut block_to_examine.next; } self.new_block(layout, key) From 140442fe0bbc53ad30d078a0bf5f2699bf85983a Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:04:32 +0000 Subject: [PATCH 04/25] Fix spellings in affine.rs --- agb/src/display/affine.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/agb/src/display/affine.rs b/agb/src/display/affine.rs index 2773a3a3..38412619 100644 --- a/agb/src/display/affine.rs +++ b/agb/src/display/affine.rs @@ -1,50 +1,50 @@ #![deny(missing_docs)] -//! # Affine matricies for the Game Boy Advance +//! # Affine matrices for the Game Boy Advance //! //! An affine matrix represents an affine transformation, an affine //! transformation being one which preserves parallel lines (note that this //! therefore cannot represent perspective seen in games like Super Mario Kart). -//! Affine matricies are used in two places on the GBA, for affine backgrounds +//! Affine matrices are used in two places on the GBA, for affine backgrounds //! and for affine objects. //! //! # Linear Algebra //! As a matrix, they can be manipulated using linear algebra. The short version //! of this section is to beware that the matrix is the inverse of the normal -//! transformation matricies. +//! transformation matrices. //! //! One quick thing to point out at the start as it will become very relevant is //! that matrix-matrix multiplication is not commutative, meaning swapping the //! order changes the result, or **A** × **B** ≢ **B** × **A**. However, -//! matricies are, at least in the case they are used here, associative, meaning +//! matrices are, at least in the case they are used here, associative, meaning //! (**AB**)**C** = **A**(**BC**). //! -//! ## Normal (wrong on GBA!) transformation matricies +//! ## Normal (wrong on GBA!) transformation matrices //! -//! As a start, normal transformation matricies will transform a shape from it's +//! As a start, normal transformation matrices will transform a shape from it's //! original position to it's new position. Generally when people talk about -//! transformation matricies they are talking about them in this sense. +//! transformation matrices they are talking about them in this sense. //! -//! > If **A** and **B** are transformation matricies, then matrix **C** = **A** +//! > If **A** and **B** are transformation matrices, then matrix **C** = **A** //! > × **B** represents the transformation **A** performed on **B**, or //! > alternatively **C** is transformation **B** followed by transformation //! > **A**. //! //! This is not what they represent on the GBA! If you are looking up more -//! information about tranformation matricies bear this in mind. +//! information about transformation matrices bear this in mind. //! -//! ## Correct (on GBA) transformation matricies +//! ## Correct (on GBA) transformation matrices //! //! On the GBA, the affine matrix works the other way around. The GBA wants to //! know for each pixel what colour it should render, to do this it applies the //! affine transformation matrix to the pixel it is rendering to lookup correct //! pixel in the texture. //! -//! This describes the inverse of the previously given transformation matricies. +//! This describes the inverse of the previously given transformation matrices. //! //! Above I described the matrix **C** = **A** × **B**, but what the GBA wants //! is the inverse of **C**, or **C**<sup>-1</sup> = (**AB**)<sup>-1</sup> = //! **B**<sup>-1</sup> × **A**<sup>-1</sup>. This means that if we have the -//! matricies **I** and **J** in the form the GBA expects then +//! matrices **I** and **J** in the form the GBA expects then //! //! > Transformation **K** = **I** × **J** is the transformation **I** followed //! > by the transformation **J**. @@ -278,7 +278,7 @@ impl AffineMatrixBackground { #[must_use] /// Creates a transformation matrix using GBA specific syscalls. - /// This can be done using the standard transformation matricies like + /// This can be done using the standard transformation matrices like /// /// ```rust,no_run /// # #![no_std] From 32a8b213fb81c43f52e2fc6af58caff819473c88 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:04:53 +0000 Subject: [PATCH 05/25] disp -> display --- agb/src/display/bitmap4.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agb/src/display/bitmap4.rs b/agb/src/display/bitmap4.rs index cd2debc3..b40eff9c 100644 --- a/agb/src/display/bitmap4.rs +++ b/agb/src/display/bitmap4.rs @@ -58,10 +58,10 @@ impl Bitmap4 { /// index whose colour is specified in the background palette. Panics if (x, /// y) is out of the bounds of the screen. pub fn draw_point(&mut self, x: i32, y: i32, colour: u8) { - let disp = DISPLAY_CONTROL.get(); + let display = DISPLAY_CONTROL.get(); // get other page - let page = if disp & GraphicsSettings::PAGE_SELECT.bits() != 0 { + let page = if display & GraphicsSettings::PAGE_SELECT.bits() != 0 { Page::Front } else { Page::Back @@ -78,8 +78,8 @@ impl Bitmap4 { /// Flips page, changing the Gameboy advance to draw the contents of the /// other page pub fn flip_page(&mut self) { - let disp = DISPLAY_CONTROL.get(); - let swapped = disp ^ GraphicsSettings::PAGE_SELECT.bits(); + let display = DISPLAY_CONTROL.get(); + let swapped = display ^ GraphicsSettings::PAGE_SELECT.bits(); DISPLAY_CONTROL.set(swapped); } } From cc879a094e8b1ce34f5797f036baa47079593ab0 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:05:26 +0000 Subject: [PATCH 06/25] Fix spellings in blend.rs --- agb/src/display/blend.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agb/src/display/blend.rs b/agb/src/display/blend.rs index 5275242b..f44c8ded 100644 --- a/agb/src/display/blend.rs +++ b/agb/src/display/blend.rs @@ -3,7 +3,7 @@ //! For now a description of how blending can be used is found on [the tonc page //! for graphic //! effects](https://www.coranac.com/tonc/text/gfx.htm#ssec-bld-gba). See the -//! [Blend] struct for all the functions to manage blend effects. You accquire +//! [Blend] struct for all the functions to manage blend effects. You acquire //! the Blend struct through the [Display][super::Display] struct. //! ```no_run //! # #![no_main] @@ -28,12 +28,12 @@ pub enum Layer { Bottom = 1, } -/// The different blend modes avaliable on the GBA +/// The different blend modes available on the GBA #[derive(Clone, Copy, Debug)] pub enum BlendMode { // No blending Off = 0, - // Aditive blending, use the [Blend::set_blend_weight] function to use this + // Additive blending, use the [Blend::set_blend_weight] function to use this Normal = 0b01, // Brighten, use the [Blend::set_fade] to use this FadeToWhite = 0b10, @@ -129,7 +129,7 @@ impl Blend { self } - /// Reset targers, blend weights, and fades + /// Reset targets, blend weights, and fades pub fn reset(&mut self) -> &mut Self { self.reset_targets().reset_fades().reset_weights() } From 6274827f58e4fad183a79c7b06fd97dce90eba84 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:07:03 +0000 Subject: [PATCH 07/25] Fix spellings in display/mod.rs --- .vscode/settings.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 50076eb2..b52864a3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ "behaviour", "bindgen", "bitarray", + "Bitfield", "bitflags", "bitmask", "boing", @@ -32,10 +33,13 @@ "fontdue", "fract", "FRAM", + "framebuffer", + "framebuffers", "gameboy", "Gamepak", "hadamard", "Hasher", + "HBLANK", "healthbar", "hflip", "hurtbox", @@ -55,6 +59,7 @@ "optimised", "Optimiser", "Paks", + "paletted", "prioritised", "replacen", "repr", @@ -78,6 +83,7 @@ "Uninit", "uninitialised", "vblank", + "VCOUNT", "vdraw", "vflip", "vram", From 0d6e6c709c45ec9cadf18f5a95d4a370b6a3933c Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:10:11 +0000 Subject: [PATCH 08/25] Fix spellings in object.rs --- .vscode/settings.json | 2 ++ agb/src/display/object.rs | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b52864a3..7726307a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -58,6 +58,7 @@ "optimise", "optimised", "Optimiser", + "optimises", "Paks", "paletted", "prioritised", @@ -73,6 +74,7 @@ "SRAM", "subcrates", "subpat", + "synchronisation", "syscall", "syscalls", "THUMBV", diff --git a/agb/src/display/object.rs b/agb/src/display/object.rs index 4f3b18ab..896728a9 100644 --- a/agb/src/display/object.rs +++ b/agb/src/display/object.rs @@ -26,7 +26,7 @@ use attributes::*; /// Include this type if you call `get_object_controller` in impl block. This /// helps you use the right lifetimes and doesn't impl Sync (using from two -/// "threads" without syncronisation is not safe), but sending to another +/// "threads" without synchronisation is not safe), but sending to another /// "thread" is safe. #[derive(Clone, Copy)] struct ObjectControllerReference<'a> { @@ -314,7 +314,7 @@ impl TagMap { /// Gets a tag associated with the name. A tag in aseprite refers to a /// sequence of sprites with some metadata for how to animate it. You should - /// call this in a constant context so it is evalulated at compile time. It + /// call this in a constant context so it is evaluated at compile time. It /// is inefficient to call this elsewhere. /// ```rust,no_run /// # #![no_std] @@ -376,7 +376,7 @@ impl Tag { unsafe { slice::from_raw_parts(self.sprites, self.len) } } - /// A single sprite refered to by index in the animation sequence. + /// A single sprite referred to by index in the animation sequence. #[must_use] pub const fn sprite(&self, idx: usize) -> &'static Sprite { if idx >= self.len { @@ -667,7 +667,7 @@ struct ObjectInner { } struct ObjectControllerStatic { - _free_affine_matricies: Vec<u8>, + _free_affine_matrices: Vec<u8>, free_object: Vec<u8>, shadow_oam: Vec<Option<ObjectInner>>, z_order: Vec<u8>, @@ -680,7 +680,7 @@ impl ObjectControllerStatic { shadow_oam: (0..128).map(|_| None).collect(), z_order: (0..128).collect(), free_object: (0..128).collect(), - _free_affine_matricies: (0..32).collect(), + _free_affine_matrices: (0..32).collect(), sprite_controller: SpriteControllerInner::new(), } } @@ -1033,7 +1033,7 @@ impl<'a> Object<'a> { self } - /// Sets the z priority of the sprite. Higher priority will be dislayed + /// Sets the z priority of the sprite. Higher priority will be displayed /// above background layers with lower priorities. No change will be seen /// until [ObjectController::commit] is called. pub fn set_priority(&mut self, priority: Priority) -> &mut Self { @@ -1067,7 +1067,7 @@ impl<'a> Object<'a> { } /// Sets the z position of the sprite, this controls which sprites are above - /// eachother. No change will be seen until [ObjectController::commit] is + /// each other. No change will be seen until [ObjectController::commit] is /// called. pub fn set_z(&mut self, z: i32) -> &mut Self { { From aa29b52b6b6bd34a1eefd155aea4f998a6595e8f Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:10:26 +0000 Subject: [PATCH 09/25] PingPong is 2 words --- agb/src/display/object.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agb/src/display/object.rs b/agb/src/display/object.rs index 896728a9..6e617127 100644 --- a/agb/src/display/object.rs +++ b/agb/src/display/object.rs @@ -348,7 +348,7 @@ impl TagMap { enum Direction { Forward, Backward, - Pingpong, + PingPong, } impl Direction { @@ -356,7 +356,7 @@ impl Direction { match a { 0 => Direction::Forward, 1 => Direction::Backward, - 2 => Direction::Pingpong, + 2 => Direction::PingPong, _ => panic!("Invalid direction, this is a bug in image converter or agb"), } } @@ -400,7 +400,7 @@ impl Tag { match self.direction { Direction::Forward => self.sprite(idx % self.len), Direction::Backward => self.sprite(len_sub_1 - (idx % self.len)), - Direction::Pingpong => self.sprite( + Direction::PingPong => self.sprite( (((idx + len_sub_1) % (len_sub_1 * 2)) as isize - len_sub_1 as isize) .unsigned_abs(), ), From c8ff3b43591bcbdb0c9ef441df85203aada7a933 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:10:56 +0000 Subject: [PATCH 10/25] blnd -> blend --- agb/src/display/window.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/agb/src/display/window.rs b/agb/src/display/window.rs index 7c11bdab..1f8e41b1 100644 --- a/agb/src/display/window.rs +++ b/agb/src/display/window.rs @@ -128,8 +128,8 @@ impl Window { /// Sets whether the blend is enabled inside of this window, must call /// [Windows::commit] for this change to be seen. #[inline(always)] - pub fn set_blend_enable(&mut self, blnd: bool) -> &mut Self { - self.set_bit(5, blnd); + pub fn set_blend_enable(&mut self, blend: bool) -> &mut Self { + self.set_bit(5, blend); self } @@ -204,8 +204,8 @@ impl MovableWindow { /// Sets whether the blend is enabled inside of this window, must call /// [Windows::commit] for this change to be seen. #[inline(always)] - pub fn set_blend_enable(&mut self, blnd: bool) -> &mut Self { - self.inner.set_blend_enable(blnd); + pub fn set_blend_enable(&mut self, blend: bool) -> &mut Self { + self.inner.set_blend_enable(blend); self } /// Sets whether the given background will be rendered inside this window, From 51a8ec4d95044c754d35b91ece8b59d1535ff02a Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:12:18 +0000 Subject: [PATCH 11/25] xfer -> transfer --- agb/src/save/asm_routines.s | 6 +++--- agb/src/save/asm_utils.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/agb/src/save/asm_routines.s b/agb/src/save/asm_routines.s index f257a524..91128bf4 100644 --- a/agb/src/save/asm_routines.s +++ b/agb/src/save/asm_routines.s @@ -36,14 +36,14 @@ agb_thumb_end agb_rs__WramVerifyBuf @ -@ void WramXferBuf(const char* source, char* dest, int count); +@ void WramTransferBuf(const char* source, char* dest, int count); @ @ A routine that copies one buffer into another. @ -agb_thumb_func agb_rs__WramXferBuf +agb_thumb_func agb_rs__WramTransferBuf 0: sub r2, #1 ldrb r3, [r0,r2] strb r3, [r1,r2] bne 0b bx lr -agb_thumb_end agb_rs__WramXferBuf +agb_thumb_end agb_rs__WramTransferBuf diff --git a/agb/src/save/asm_utils.rs b/agb/src/save/asm_utils.rs index 577d99f0..e5c85c58 100644 --- a/agb/src/save/asm_utils.rs +++ b/agb/src/save/asm_utils.rs @@ -3,7 +3,7 @@ //! performed via code in WRAM and cannot be accessed by DMA. extern "C" { - fn agb_rs__WramXferBuf(src: *const u8, dst: *mut u8, count: usize); + fn agb_rs__WramTransferBuf(src: *const u8, dst: *mut u8, count: usize); fn agb_rs__WramReadByte(src: *const u8) -> u8; fn agb_rs__WramVerifyBuf(buf1: *const u8, buf2: *const u8, count: usize) -> bool; } @@ -18,7 +18,7 @@ extern "C" { #[inline(always)] pub unsafe fn read_raw_buf(dst: &mut [u8], src: usize) { if !dst.is_empty() { - agb_rs__WramXferBuf(src as _, dst.as_mut_ptr(), dst.len()); + agb_rs__WramTransferBuf(src as _, dst.as_mut_ptr(), dst.len()); } } @@ -31,7 +31,7 @@ pub unsafe fn read_raw_buf(dst: &mut [u8], src: usize) { #[inline(always)] pub unsafe fn write_raw_buf(dst: usize, src: &[u8]) { if !src.is_empty() { - agb_rs__WramXferBuf(src.as_ptr(), dst as _, src.len()); + agb_rs__WramTransferBuf(src.as_ptr(), dst as _, src.len()); } } From da0ea524d927725fe58a038265bfd47e2d5419a6 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:13:22 +0000 Subject: [PATCH 12/25] Fix spelling errors in save --- agb/src/save/eeprom.rs | 8 ++++---- agb/src/save/mod.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/agb/src/save/eeprom.rs b/agb/src/save/eeprom.rs index d2f7258a..6511b201 100644 --- a/agb/src/save/eeprom.rs +++ b/agb/src/save/eeprom.rs @@ -61,14 +61,14 @@ impl BufferData { /// Reads a number from the input buffer. fn read_num(&mut self, off: usize, count: usize) -> u32 { - let mut accum = 0; + let mut accumulator = 0; unsafe { for i in 0..count { - accum <<= 1; - accum |= self.data.bits[off + i] as u32; + accumulator <<= 1; + accumulator |= self.data.bits[off + i] as u32; } } - accum + accumulator } /// Receives a number of words into the input buffer. diff --git a/agb/src/save/mod.rs b/agb/src/save/mod.rs index 78041dce..b240efad 100644 --- a/agb/src/save/mod.rs +++ b/agb/src/save/mod.rs @@ -44,8 +44,8 @@ //! [`SaveManager::access_with_timer`] methods to create a new [`SaveData`] //! object. Its methods are used to read or write save media. //! -//! Reading data from the savegame is simple. Use [`read`] to copy data from an -//! offset in the savegame into a buffer in memory. +//! Reading data from the save media is simple. Use [`read`] to copy data from an +//! offset in the save media into a buffer in memory. //! //! Writing to save media requires you to prepare the area for writing by //! calling the [`prepare_write`] method to return a [`SavePreparedBlock`], @@ -185,7 +185,7 @@ fn set_save_implementation(access_impl: &'static dyn RawSaveAccess) { let mut access = CURRENT_SAVE_ACCESS.lock(); assert!( access.is_none(), - "Cannot initialize the savegame engine more than once." + "Cannot initialize the save media engine more than once." ); *access = Some(access_impl); } @@ -202,7 +202,7 @@ pub struct SaveData { timeout: utils::Timeout, } impl SaveData { - /// Creates a new save accessor around the current save implementaiton. + /// Creates a new save accessor around the current save implementation. fn new(timer: Option<Timer>) -> Result<SaveData, Error> { match get_save_implementation() { Some(access) => Ok(SaveData { From dce5f40c2686ec48f6de596df4f63d737246c726 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:14:38 +0000 Subject: [PATCH 13/25] Fix spellings in sound --- agb/src/sound/mixer/hw.rs | 8 ++++---- agb/src/sound/mixer/mod.rs | 2 +- agb/src/sound/mod.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/agb/src/sound/mixer/hw.rs b/agb/src/sound/mixer/hw.rs index ab24b520..f2dcf45c 100644 --- a/agb/src/sound/mixer/hw.rs +++ b/agb/src/sound/mixer/hw.rs @@ -22,8 +22,8 @@ const DMA2_SOURCE_ADDR: MemoryMapped<u32> = unsafe { MemoryMapped::new(dma_sourc const DMA2_DEST_ADDR: MemoryMapped<u32> = unsafe { MemoryMapped::new(dma_dest_addr(2)) }; const DMA2_CONTROL: MemoryMapped<u16> = unsafe { MemoryMapped::new(dma_control_addr(2)) }; -const FIFOA_DEST_ADDR: u32 = 0x0400_00a0; -const FIFOB_DEST_ADDR: u32 = 0x0400_00a4; +const FIFO_A_DEST_ADDR: u32 = 0x0400_00a0; +const FIFO_B_DEST_ADDR: u32 = 0x0400_00a4; const SOUND_CONTROL: MemoryMapped<u16> = unsafe { MemoryMapped::new(0x0400_0082) }; const SOUND_CONTROL_X: MemoryMapped<u16> = unsafe { MemoryMapped::new(0x0400_0084) }; @@ -56,14 +56,14 @@ pub(super) fn enable_dma_for_sound(sound_memory: &[i8], lr: LeftOrRight) { fn enable_dma1_for_sound(sound_memory: &[i8]) { DMA1_CONTROL.set(0); DMA1_SOURCE_ADDR.set(sound_memory.as_ptr() as u32); - DMA1_DEST_ADDR.set(FIFOA_DEST_ADDR); + DMA1_DEST_ADDR.set(FIFO_A_DEST_ADDR); DMA1_CONTROL.set(DMA_CONTROL_SETTING_FOR_SOUND); } fn enable_dma2_for_sound(sound_memory: &[i8]) { DMA2_CONTROL.set(0); DMA2_SOURCE_ADDR.set(sound_memory.as_ptr() as u32); - DMA2_DEST_ADDR.set(FIFOB_DEST_ADDR); + DMA2_DEST_ADDR.set(FIFO_B_DEST_ADDR); DMA2_CONTROL.set(DMA_CONTROL_SETTING_FOR_SOUND); } diff --git a/agb/src/sound/mixer/mod.rs b/agb/src/sound/mixer/mod.rs index 64b82c46..e0f0ca3b 100644 --- a/agb/src/sound/mixer/mod.rs +++ b/agb/src/sound/mixer/mod.rs @@ -306,7 +306,7 @@ impl SoundChannel { /// Creates a new high priority [`SoundChannel`]. /// /// A high priority sound channel will override low priority ones if - /// the mixer runs out of channels. They will also never be overriden + /// the mixer runs out of channels. They will also never be overridden /// by other high priority channels. /// /// High priority channels are intended for background music and for diff --git a/agb/src/sound/mod.rs b/agb/src/sound/mod.rs index f72600e2..edfee4f7 100644 --- a/agb/src/sound/mod.rs +++ b/agb/src/sound/mod.rs @@ -6,7 +6,7 @@ //! which allows for Game Boy and Game Boy Color style sound effects, or the mixer //! which allows for more advanced sounds. //! -//! The [`dmg`](crate::sound::dmg) module is very rudimentry and doesn't support most of the possible +//! The [`dmg`](crate::sound::dmg) module is very rudimentary and doesn't support most of the possible //! sounds possible. However, it may be expanded in the future. //! //! The [`mixer`](crate::sound::mixer) module is high performance, and allows for playing wav files at From 7621f476442d2f746f145a39b0170a3c036fc225 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:15:23 +0000 Subject: [PATCH 14/25] fix spelling errors in sync --- .vscode/settings.json | 1 + agb/src/sync/locks.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7726307a..a3fc0b2f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -54,6 +54,7 @@ "mgba", "normalise", "normalised", + "nostack", "Optimisation", "optimise", "optimised", diff --git a/agb/src/sync/locks.rs b/agb/src/sync/locks.rs index ce93465d..a1a0cf3f 100644 --- a/agb/src/sync/locks.rs +++ b/agb/src/sync/locks.rs @@ -26,7 +26,7 @@ impl RawMutex { /// Locks the mutex and returns whether a lock was successfully acquired. fn raw_lock(&self) -> bool { if self.0.replace(true) { - // value was already true, opps. + // value was already true, oops. false } else { // prevent any weird reordering, and continue From 45431615dc647e37a7922017fcba712942078d29 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:15:48 +0000 Subject: [PATCH 15/25] Fix spelling errors in hash_map --- agb/src/hash_map.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agb/src/hash_map.rs b/agb/src/hash_map.rs index d537b4cf..59b71ad8 100644 --- a/agb/src/hash_map.rs +++ b/agb/src/hash_map.rs @@ -27,7 +27,7 @@ type HashType = u32; // The key concept is to keep the distance from the initial bucket chosen for a given // key to a minimum. We shall call this distance the "distance to the initial bucket" // or DIB for short. With each key - value pair, we store its DIB. When inserting -// a value into the hashtable, we check to see if there is an element in the initial +// a value into the hash table, we check to see if there is an element in the initial // bucket. If there is, we move onto the next value. Then, we check to see if there // is already a value there and if there is, we check its DIB. If our DIB is greater // than or equal to the DIB of the value that is already there, we swap the working @@ -942,7 +942,7 @@ impl<K, V> Node<K, V> { let old_value = mem::replace(&mut self.value, MaybeUninit::new(value)); unsafe { old_value.assume_init() } } else { - panic!("Cannot replace an unininitalised node"); + panic!("Cannot replace an uninitialised node"); } } From deb907b9eba15dfe1ec030911ba73f3f0d3e8844 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:16:40 +0000 Subject: [PATCH 16/25] Fix remaining spelling errors in agb --- agb/src/input.rs | 2 +- agb/src/interrupt.rs | 2 +- agb/src/lib.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/agb/src/input.rs b/agb/src/input.rs index 22b3e3dd..a2da38d8 100644 --- a/agb/src/input.rs +++ b/agb/src/input.rs @@ -66,7 +66,7 @@ bitflags! { const BUTTON_INPUT: *mut u16 = (0x04000130) as *mut u16; -// const BUTTON_INTURRUPT: *mut u16 = (0x04000132) as *mut u16; +// const BUTTON_INTERRUPT: *mut u16 = (0x04000132) as *mut u16; /// Helper to make it easy to get the current state of the GBA's buttons. /// diff --git a/agb/src/interrupt.rs b/agb/src/interrupt.rs index 6aba025c..f728f7e4 100644 --- a/agb/src/interrupt.rs +++ b/agb/src/interrupt.rs @@ -312,7 +312,7 @@ where pub struct VBlank {} impl VBlank { - /// Handles setting up everything reqired to be able to use the wait for + /// Handles setting up everything required to be able to use the wait for /// interrupt syscall. #[must_use] pub fn get() -> Self { diff --git a/agb/src/lib.rs b/agb/src/lib.rs index 1aeae5fc..b873c560 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -437,11 +437,11 @@ mod test { let address = iwram_ptr as usize; assert!( (0x0300_0000..0x0300_8000).contains(&address), - "iwram is located beween 0x0300_0000 and 0x0300_8000, but was actually found to be at {:#010X}", + "iwram is located between 0x0300_0000 and 0x0300_8000, but was actually found to be at {:#010X}", address ); let c = iwram_ptr.read_volatile(); - assert_eq!(c, 9, "exctected content to be 9"); + assert_eq!(c, 9, "expected content to be 9"); iwram_ptr.write_volatile(u32::MAX); let c = iwram_ptr.read_volatile(); assert_eq!(c, u32::MAX, "expected content to be {}", u32::MAX); @@ -460,7 +460,7 @@ mod test { address ); let c = iwram_ptr.read_volatile(); - assert_eq!(c, 9, "exctected content to be 9"); + assert_eq!(c, 9, "expected content to be 9"); iwram_ptr.write_volatile(u32::MAX); let c = iwram_ptr.read_volatile(); assert_eq!(c, u32::MAX, "expected content to be {}", u32::MAX); From 648a544ea88e76bace101202c69a7288a904e22d Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:17:52 +0000 Subject: [PATCH 17/25] fix spelling errors in agb-fixnum --- .vscode/settings.json | 2 ++ agb-fixnum/src/lib.rs | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a3fc0b2f..7720ac62 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,6 +30,7 @@ "EEPROM", "ewram", "fixnum", + "fixnums", "fontdue", "fract", "FRAM", @@ -54,6 +55,7 @@ "mgba", "normalise", "normalised", + "Normalises", "nostack", "Optimisation", "optimise", diff --git a/agb-fixnum/src/lib.rs b/agb-fixnum/src/lib.rs index 2accff36..85745b61 100644 --- a/agb-fixnum/src/lib.rs +++ b/agb-fixnum/src/lib.rs @@ -424,7 +424,7 @@ impl<I: FixedWidthUnsignedInteger, const N: usize> Num<I, N> { impl<const N: usize> Num<i32, N> { #[must_use] - /// Returns the square root of a number, it is calcuated a digit at a time. + /// Returns the square root of a number, it is calculated a digit at a time. /// ``` /// # use agb_fixnum::*; /// let n: Num<i32, 8> = num!(16.); @@ -530,7 +530,7 @@ impl<I: FixedWidthUnsignedInteger, const N: usize> Display for Num<I, N> { let mut fractional = self.0 & mask; - // Negative fix nums are awkward to print if they have non zero fractional part. + // Negative fixnums are awkward to print if they have non zero fractional part. // This is because you can think of them as `number + non negative fraction`. // // But if you think of a negative number, you'd like it to be `negative number - non negative fraction` @@ -569,7 +569,7 @@ impl<I: FixedWidthUnsignedInteger, const N: usize> Debug for Num<I, N> { } } -/// A vector of two points: (x, y) represened by integers or fixed point numbers +/// A vector of two points: (x, y) represented by integers or fixed point numbers #[derive(Clone, Copy, PartialEq, Eq, Debug, Default)] pub struct Vector2D<T: Number> { /// The x coordinate @@ -675,7 +675,7 @@ impl<I: FixedWidthUnsignedInteger, const N: usize> Vector2D<Num<I, N>> { } #[must_use] - /// Floors the x and y coordnate, see [Num::floor] + /// Floors the x and y coordinate, see [Num::floor] /// ``` /// # use agb_fixnum::*; /// let v1: Vector2D<Num<i32, 8>> = Vector2D::new(num!(1.56), num!(-2.2)); @@ -984,7 +984,7 @@ impl<T: Number> Vector2D<T> { Vector2D { x, y } } - /// Returns the tuple of the coorinates + /// Returns the tuple of the coordinates /// ``` /// # use agb_fixnum::*; /// let v = Vector2D::new(1, 2); From 6b149c1e31c087f52ff877837a7ff44f088f4591 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:18:54 +0000 Subject: [PATCH 18/25] Fix spelling errors in agb-image-converter --- agb-image-converter/src/config.rs | 4 ++-- agb-image-converter/src/lib.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/agb-image-converter/src/config.rs b/agb-image-converter/src/config.rs index 7379a6d5..826b9e67 100644 --- a/agb-image-converter/src/config.rs +++ b/agb-image-converter/src/config.rs @@ -28,7 +28,7 @@ pub(crate) trait Config { pub(crate) trait Image { fn filename(&self) -> String; - fn tilesize(&self) -> TileSize; + fn tile_size(&self) -> TileSize; fn colours(&self) -> Colours; } @@ -84,7 +84,7 @@ impl Image for ImageV1 { self.filename.clone() } - fn tilesize(&self) -> TileSize { + fn tile_size(&self) -> TileSize { self.tile_size.into() } diff --git a/agb-image-converter/src/lib.rs b/agb-image-converter/src/lib.rs index 39ae0a92..a70b801c 100644 --- a/agb-image-converter/src/lib.rs +++ b/agb-image-converter/src/lib.rs @@ -84,7 +84,7 @@ pub fn include_gfx(input: TokenStream) -> TokenStream { match settings.colours() { Colours::Colours16 => { - let tile_size = settings.tilesize().to_size(); + let tile_size = settings.tile_size().to_size(); if image.width % tile_size != 0 || image.height % tile_size != 0 { panic!("Image size not a multiple of tile size"); } @@ -96,7 +96,7 @@ pub fn include_gfx(input: TokenStream) -> TokenStream { config.transparent_colour(), ); - let num_tiles = image.width * image.height / settings.tilesize().to_size().pow(2); + let num_tiles = image.width * image.height / settings.tile_size().to_size().pow(2); assignment_offsets.insert(name, assignment_offset); assignment_offset += num_tiles; } @@ -183,7 +183,7 @@ pub fn include_aseprite_inner(input: TokenStream) -> TokenStream { let height = frame.height(); assert!( valid_sprite_size(width, height), - "File {} contains sprites with unrepresentable size {}x{}", + "File {} contains sprites with size {}x{} which cannot be represented on the GameBoy Advance", filename.display(), width, height @@ -290,7 +290,7 @@ fn convert_image( optimisation_results, &image, &image_filename.to_string_lossy(), - settings.tilesize(), + settings.tile_size(), crate_prefix.to_owned(), assignment_offset, ) From 6eeb1d3203e47f0e6f54e3597ff245317b905dbf Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:20:56 +0000 Subject: [PATCH 19/25] Fix spelling errors in the book --- .vscode/settings.json | 7 +++++++ book/src/setup/setup.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7720ac62..e8431d85 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,14 @@ { "cSpell.words": [ "aeabi", + "agb", "agbabi", "asefile", "aseprite", "Atmel", "behaviour", "bindgen", + "binutils", "bitarray", "Bitfield", "bitflags", @@ -38,6 +40,7 @@ "framebuffers", "gameboy", "Gamepak", + "gbafix", "hadamard", "Hasher", "HBLANK", @@ -57,11 +60,13 @@ "normalised", "Normalises", "nostack", + "objcopy", "Optimisation", "optimise", "optimised", "Optimiser", "optimises", + "pacman", "Paks", "paletted", "prioritised", @@ -70,11 +75,13 @@ "Respawn", "rustc", "rustdoc", + "rustup", "Sanyo", "screenblock", "screenblocks", "signum", "SRAM", + "struct", "subcrates", "subpat", "synchronisation", diff --git a/book/src/setup/setup.md b/book/src/setup/setup.md index 72ee45c6..2ad59c7f 100644 --- a/book/src/setup/setup.md +++ b/book/src/setup/setup.md @@ -3,4 +3,4 @@ Environment setup will depend on the platform you are using. agb's requirements are [rust nightly](https://www.rust-lang.org/) edition and the gnu binutils for `arm-none-eabi`. -See the subpages here for platform specific setup guides. +See the sub-pages here for platform specific setup guides. From f6b5bb69b08c06ac4a2a625e0992b4b0d313313c Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:22:14 +0000 Subject: [PATCH 20/25] Fix spelling errors in hyperspace-roll --- examples/hyperspace-roll/src/customise.rs | 4 ++-- examples/hyperspace-roll/src/graphics.rs | 8 ++++---- examples/hyperspace-roll/src/save.rs | 17 ++++++++++------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/examples/hyperspace-roll/src/customise.rs b/examples/hyperspace-roll/src/customise.rs index ac0e9a96..407797af 100644 --- a/examples/hyperspace-roll/src/customise.rs +++ b/examples/hyperspace-roll/src/customise.rs @@ -280,12 +280,12 @@ pub(crate) fn customise_screen( } } CustomiseState::Upgrade => { - let old_updade = cursor.upgrade; + let old_upgrade = cursor.upgrade; cursor.upgrade = (cursor.upgrade as isize + ud as isize) .rem_euclid(upgrades.len() as isize) as usize; if (upgrades[cursor.upgrade] as u32) < 17 { - if cursor.upgrade != old_updade { + if cursor.upgrade != old_upgrade { load_description( upgrades[cursor.upgrade] as usize, descriptions_map, diff --git a/examples/hyperspace-roll/src/graphics.rs b/examples/hyperspace-roll/src/graphics.rs index bab60ae6..f9b75ff9 100644 --- a/examples/hyperspace-roll/src/graphics.rs +++ b/examples/hyperspace-roll/src/graphics.rs @@ -37,8 +37,8 @@ impl FaceSprites { const S_MALFUNCTION: &Sprite = SPRITES.tags().get("malfunction").sprite(0); const S_HEAL: &Sprite = SPRITES.tags().get("player_heal").sprite(0); const S_BYPASS: &Sprite = SPRITES.tags().get("shield bypass").sprite(0); - const S_DOUBLESHOT: &Sprite = SPRITES.tags().get("double shoot").sprite(0); - const S_TRIPLESHOT: &Sprite = SPRITES.tags().get("triple shoot").sprite(0); + const S_DOUBLE_SHOT: &Sprite = SPRITES.tags().get("double shoot").sprite(0); + const S_TRIPLE_SHOT: &Sprite = SPRITES.tags().get("triple shoot").sprite(0); const S_BLANK: &Sprite = SPRITES.tags().get("blank").sprite(0); const S_DISRUPT: &Sprite = SPRITES.tags().get("disruption").sprite(0); const S_MALFUNCTION_SHOOT: &Sprite = SPRITES.tags().get("malfunction shot").sprite(0); @@ -57,8 +57,8 @@ impl FaceSprites { S_MALFUNCTION, S_HEAL, S_BYPASS, - S_DOUBLESHOT, - S_TRIPLESHOT, + S_DOUBLE_SHOT, + S_TRIPLE_SHOT, S_BLANK, S_DISRUPT, S_MALFUNCTION_SHOOT, diff --git a/examples/hyperspace-roll/src/save.rs b/examples/hyperspace-roll/src/save.rs index 0db839de..804fa4bb 100644 --- a/examples/hyperspace-roll/src/save.rs +++ b/examples/hyperspace-roll/src/save.rs @@ -1,8 +1,8 @@ -use agb::Gba; use agb::save::Error; use agb::sync::Static; +use agb::Gba; -static HIGHSCORE: Static<u32> = Static::new(0); +static HIGH_SCORE: Static<u32> = Static::new(0); pub fn init_save(gba: &mut Gba) -> Result<(), Error> { gba.save.init_sram(); @@ -22,9 +22,9 @@ pub fn init_save(gba: &mut Gba) -> Result<(), Error> { let high_score = u32::from_le_bytes(buffer); if high_score > 100 { - HIGHSCORE.write(0) + HIGH_SCORE.write(0) } else { - HIGHSCORE.write(high_score) + HIGH_SCORE.write(high_score) } } @@ -32,11 +32,14 @@ pub fn init_save(gba: &mut Gba) -> Result<(), Error> { } pub fn load_high_score() -> u32 { - HIGHSCORE.read() + HIGH_SCORE.read() } pub fn save_high_score(gba: &mut Gba, score: u32) -> Result<(), Error> { - gba.save.access()?.prepare_write(1..5)?.write(1, &score.to_le_bytes())?; - HIGHSCORE.write(score); + gba.save + .access()? + .prepare_write(1..5)? + .write(1, &score.to_le_bytes())?; + HIGH_SCORE.write(score); Ok(()) } From 51a315cb549b337d104eb018f4021445f21028ca Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:23:05 +0000 Subject: [PATCH 21/25] Fix spelling errors in the hat chooses the wizard --- examples/the-hat-chooses-the-wizard/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/the-hat-chooses-the-wizard/build.rs b/examples/the-hat-chooses-the-wizard/build.rs index bf20316e..5e5b04d3 100644 --- a/examples/the-hat-chooses-the-wizard/build.rs +++ b/examples/the-hat-chooses-the-wizard/build.rs @@ -49,7 +49,7 @@ mod tiled_export { }) .collect(); - let tile_info = (0..tilemap.tilecount) + let tile_info = (0..tilemap.tile_count) .map(|id| *tile_data.get(&id).unwrap_or(&0)) .map(|tile_type| tile_type.to_string()) .collect::<Vec<String>>() @@ -222,7 +222,7 @@ mod tiled_export { #[derive(Deserialize)] struct TiledTilemap { tiles: Vec<TiledTile>, - tilecount: i32, + tile_count: i32, } #[derive(Deserialize)] From 495042239c49c5348cebab125babeeb463aaab34 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:24:34 +0000 Subject: [PATCH 22/25] Fix spelling errors in the-purple-night --- .vscode/settings.json | 1 + examples/the-purple-night/build.rs | 4 +-- examples/the-purple-night/src/main.rs | 50 +++++++++++++-------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e8431d85..daaf25bc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -90,6 +90,7 @@ "THUMBV", "tilemap", "tileset", + "tilesets", "tonc", "trunc", "Uninit", diff --git a/examples/the-purple-night/build.rs b/examples/the-purple-night/build.rs index 3d933036..5391a09c 100644 --- a/examples/the-purple-night/build.rs +++ b/examples/the-purple-night/build.rs @@ -77,8 +77,8 @@ fn extract_tiles(layer: &'_ tiled::LayerData) -> impl Iterator<Item = u16> + '_ .map(get_map_id) } -fn get_map_id(tileid: u32) -> u16 { - match tileid { +fn get_map_id(tile_id: u32) -> u16 { + match tile_id { 0 => 0, i => i as u16 - 1, } diff --git a/examples/the-purple-night/src/main.rs b/examples/the-purple-night/src/main.rs index a4ea3ae2..2cda306e 100644 --- a/examples/the-purple-night/src/main.rs +++ b/examples/the-purple-night/src/main.rs @@ -33,17 +33,17 @@ use sfx::Sfx; const GRAPHICS: &Graphics = agb::include_aseprite!("gfx/objects.aseprite", "gfx/boss.aseprite"); const TAG_MAP: &TagMap = GRAPHICS.tags(); -const LONGSWORD_IDLE: &Tag = TAG_MAP.get("Idle - longsword"); -const LONGSWORD_WALK: &Tag = TAG_MAP.get("Walk - longsword"); -const LONGSWORD_JUMP: &Tag = TAG_MAP.get("Jump - longsword"); -const LONGSWORD_ATTACK: &Tag = TAG_MAP.get("Attack - longsword"); -const LONGSWORD_JUMP_ATTACK: &Tag = TAG_MAP.get("Jump attack - longsword"); +const LONG_SWORD_IDLE: &Tag = TAG_MAP.get("Idle - longsword"); +const LONG_SWORD_WALK: &Tag = TAG_MAP.get("Walk - longsword"); +const LONG_SWORD_JUMP: &Tag = TAG_MAP.get("Jump - longsword"); +const LONG_SWORD_ATTACK: &Tag = TAG_MAP.get("Attack - longsword"); +const LONG_SWORD_JUMP_ATTACK: &Tag = TAG_MAP.get("Jump attack - longsword"); -const SHORTSWORD_IDLE: &Tag = TAG_MAP.get("Idle - shortsword"); -const SHORTSWORD_WALK: &Tag = TAG_MAP.get("Walk - shortsword"); -const SHORTSWORD_JUMP: &Tag = TAG_MAP.get("jump - shortsword"); -const SHORTSWORD_ATTACK: &Tag = TAG_MAP.get("attack - shortsword"); -const SHORTSWORD_JUMP_ATTACK: &Tag = TAG_MAP.get("jump attack - shortsword"); +const SHORT_SWORD_IDLE: &Tag = TAG_MAP.get("Idle - shortsword"); +const SHORT_SWORD_WALK: &Tag = TAG_MAP.get("Walk - shortsword"); +const SHORT_SWORD_JUMP: &Tag = TAG_MAP.get("jump - shortsword"); +const SHORT_SWORD_ATTACK: &Tag = TAG_MAP.get("attack - shortsword"); +const SHORT_SWORD_JUMP_ATTACK: &Tag = TAG_MAP.get("jump attack - shortsword"); const KNIFE_IDLE: &Tag = TAG_MAP.get("idle - knife"); const KNIFE_WALK: &Tag = TAG_MAP.get("walk - knife"); @@ -166,7 +166,7 @@ struct Entity<'a> { impl<'a> Entity<'a> { fn new(object_controller: &'a ObjectController, collision_mask: Rect<u16>) -> Self { - let s = object_controller.sprite(LONGSWORD_IDLE.sprite(0)); + let s = object_controller.sprite(LONG_SWORD_IDLE.sprite(0)); let mut sprite = object_controller.object(s); sprite.set_priority(Priority::P1); Entity { @@ -353,16 +353,16 @@ impl SwordState { fn idle_animation(self, counter: u16) -> &'static Sprite { let counter = counter as usize; match self { - SwordState::LongSword => LONGSWORD_IDLE.animation_sprite(counter / 8), - SwordState::ShortSword => SHORTSWORD_IDLE.animation_sprite(counter / 8), + SwordState::LongSword => LONG_SWORD_IDLE.animation_sprite(counter / 8), + SwordState::ShortSword => SHORT_SWORD_IDLE.animation_sprite(counter / 8), SwordState::Dagger => KNIFE_IDLE.animation_sprite(counter / 8), SwordState::Swordless => SWORDLESS_IDLE.animation_sprite(counter / 8), } } fn jump_tag(self) -> &'static Tag { match self { - SwordState::LongSword => LONGSWORD_JUMP, - SwordState::ShortSword => SHORTSWORD_JUMP, + SwordState::LongSword => LONG_SWORD_JUMP, + SwordState::ShortSword => SHORT_SWORD_JUMP, SwordState::Dagger => KNIFE_JUMP, SwordState::Swordless => SWORDLESS_JUMP, } @@ -370,8 +370,8 @@ impl SwordState { fn walk_animation(self, counter: u16) -> &'static Sprite { let counter = counter as usize; match self { - SwordState::LongSword => LONGSWORD_WALK.animation_sprite(counter / 4), - SwordState::ShortSword => SHORTSWORD_WALK.animation_sprite(counter / 4), + SwordState::LongSword => LONG_SWORD_WALK.animation_sprite(counter / 4), + SwordState::ShortSword => SHORT_SWORD_WALK.animation_sprite(counter / 4), SwordState::Dagger => KNIFE_WALK.animation_sprite(counter / 4), SwordState::Swordless => SWORDLESS_WALK.animation_sprite(counter / 4), } @@ -402,8 +402,8 @@ impl SwordState { } fn jump_attack_tag(self) -> &'static Tag { match self { - SwordState::LongSword => LONGSWORD_JUMP_ATTACK, - SwordState::ShortSword => SHORTSWORD_JUMP_ATTACK, + SwordState::LongSword => LONG_SWORD_JUMP_ATTACK, + SwordState::ShortSword => SHORT_SWORD_JUMP_ATTACK, SwordState::Dagger => KNIFE_JUMP_ATTACK, SwordState::Swordless => SWORDLESS_JUMP_ATTACK, } @@ -425,8 +425,8 @@ impl SwordState { } fn attack_tag(self) -> &'static Tag { match self { - SwordState::LongSword => LONGSWORD_ATTACK, - SwordState::ShortSword => SHORTSWORD_ATTACK, + SwordState::LongSword => LONG_SWORD_ATTACK, + SwordState::ShortSword => SHORT_SWORD_ATTACK, SwordState::Dagger => KNIFE_ATTACK, SwordState::Swordless => SWORDLESS_ATTACK, } @@ -539,7 +539,7 @@ impl<'a> Player<'a> { object_controller, Rect::new((0_u16, 0_u16).into(), (4_u16, 12_u16).into()), ); - let s = object_controller.sprite(LONGSWORD_IDLE.sprite(0)); + let s = object_controller.sprite(LONG_SWORD_IDLE.sprite(0)); entity.sprite.set_sprite(s); entity.sprite.show(); entity.position = (144, 0).into(); @@ -739,7 +739,7 @@ impl<'a> Player<'a> { instruction } - // retuns true if the player is alive and false otherwise + // returns true if the player is alive and false otherwise fn damage(&mut self) -> (bool, bool) { if self.damage_cooldown != 0 { return (true, false); @@ -1284,9 +1284,9 @@ impl EmuData { let gravity = gravity / 16; entity.velocity.y += gravity; - let distance_travelled = entity.update_position(level); + let distance_traveled = entity.update_position(level); - if distance_travelled.x == 0.into() { + if distance_traveled.x == 0.into() { sfx.emu_crash(); self.state = EmuState::Knockback; entity.velocity = (-direction / 2, Number::new(-1)).into(); From 9a68ff24a56d07864debf19347e0eb698bf1a663 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:25:06 +0000 Subject: [PATCH 23/25] Fix spelling errors in mgba-test-runner --- mgba-test-runner/build.rs | 2 +- mgba-test-runner/src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mgba-test-runner/build.rs b/mgba-test-runner/build.rs index 79c6e149..db088f35 100644 --- a/mgba-test-runner/build.rs +++ b/mgba-test-runner/build.rs @@ -26,7 +26,7 @@ fn main() { .compile("test-runner"); println!("cargo:rustc-link-search={}", out_path.to_str().unwrap()); - println!("cargo:rustc-link-lib=static={}", "mgba-cycle"); + println!("cargo:rustc-link-lib=static=mgba-cycle"); println!("cargo:rustc-link-lib=elf"); let bindings = bindgen::Builder::default() diff --git a/mgba-test-runner/src/main.rs b/mgba-test-runner/src/main.rs index e50ad5dc..a7b6ec66 100644 --- a/mgba-test-runner/src/main.rs +++ b/mgba-test-runner/src/main.rs @@ -14,7 +14,7 @@ use std::path::Path; enum Status { Running, Failed, - Sucess, + Success, } enum Timing { @@ -84,7 +84,7 @@ fn test_file(file_to_run: &str) -> Status { } if out == "Tests finished successfully" { - finished = Status::Sucess; + finished = Status::Success; } } }); @@ -111,7 +111,7 @@ fn main() -> Result<(), Error> { match output { Status::Failed => Err(anyhow!("Tests failed!")), - Status::Sucess => Ok(()), + Status::Success => Ok(()), _ => { unreachable!("very bad thing happened"); } From 1aef441f1f51d37beed0ec54c6847acbcca23fb4 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:25:34 +0000 Subject: [PATCH 24/25] Fix spelling error in release.sh --- tools/src/release.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/src/release.rs b/tools/src/release.rs index 290e5f04..029d3268 100644 --- a/tools/src/release.rs +++ b/tools/src/release.rs @@ -129,7 +129,7 @@ fn update_to_version( toml_edit::Item::None => continue, _ => { return Err(Error::InvalidToml(format!( - "{:?} while seaching dependencies in {}", + "{:?} while searching dependencies in {}", this_dep, cargo_toml_file.to_string_lossy() ))) From 4ece844ecf5eef363114390cb8bcc2003bceb283 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper <email@gwilym.dev> Date: Thu, 17 Nov 2022 21:34:41 +0000 Subject: [PATCH 25/25] must be tilecount because that's the name of the property in tiled --- examples/the-hat-chooses-the-wizard/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/the-hat-chooses-the-wizard/build.rs b/examples/the-hat-chooses-the-wizard/build.rs index 5e5b04d3..bf20316e 100644 --- a/examples/the-hat-chooses-the-wizard/build.rs +++ b/examples/the-hat-chooses-the-wizard/build.rs @@ -49,7 +49,7 @@ mod tiled_export { }) .collect(); - let tile_info = (0..tilemap.tile_count) + let tile_info = (0..tilemap.tilecount) .map(|id| *tile_data.get(&id).unwrap_or(&0)) .map(|tile_type| tile_type.to_string()) .collect::<Vec<String>>() @@ -222,7 +222,7 @@ mod tiled_export { #[derive(Deserialize)] struct TiledTilemap { tiles: Vec<TiledTile>, - tile_count: i32, + tilecount: i32, } #[derive(Deserialize)]