Merge pull request #265 from gwilymk/gc-vram-at-the-correct-time

Run the GC after copying the tiles rather than before
This commit is contained in:
Gwilym Kuiper 2022-07-30 23:22:07 +01:00 committed by GitHub
commit 3ec95a0277
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,14 +112,9 @@ impl RegularMap {
self.bg_h_offset().set(self.x_scroll); self.bg_h_offset().set(self.x_scroll);
self.bg_v_offset().set(self.y_scroll); self.bg_v_offset().set(self.y_scroll);
vram.gc();
if !self.tiles_dirty {
return;
}
let screenblock_memory = self.screenblock_memory(); let screenblock_memory = self.screenblock_memory();
if self.tiles_dirty {
unsafe { unsafe {
dma_copy16( dma_copy16(
self.tiles.as_ptr() as *const u16, self.tiles.as_ptr() as *const u16,
@ -127,6 +122,9 @@ impl RegularMap {
self.size.num_tiles(), self.size.num_tiles(),
); );
} }
}
vram.gc();
self.tiles_dirty = false; self.tiles_dirty = false;
} }