From 14e371c91150f35013723759069d42a6108e46c8 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sat, 30 Jul 2022 22:42:01 +0100 Subject: [PATCH] Run the GC after copying the tiles rather than before --- agb/src/display/tiled/map.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index fbe5b698..c1519e4e 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -112,22 +112,20 @@ impl RegularMap { self.bg_h_offset().set(self.x_scroll); self.bg_v_offset().set(self.y_scroll); - vram.gc(); - - if !self.tiles_dirty { - return; - } - let screenblock_memory = self.screenblock_memory(); - unsafe { - dma_copy16( - self.tiles.as_ptr() as *const u16, - screenblock_memory, - self.size.num_tiles(), - ); + if self.tiles_dirty { + unsafe { + dma_copy16( + self.tiles.as_ptr() as *const u16, + screenblock_memory, + self.size.num_tiles(), + ); + } } + vram.gc(); + self.tiles_dirty = false; }