From 563138937e0494c0278bfd3a72fb7677f3937907 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sat, 23 Apr 2022 23:26:47 +0100 Subject: [PATCH] Fix set_background_palette (not sure why dma wasn't working) --- agb/src/display/tiled/vram_manager.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index 5b5f798d..bedbe801 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -348,12 +348,8 @@ impl VRamManager { } fn set_background_palette(&mut self, pal_index: u8, palette: &palette16::Palette16) { - unsafe { - dma_copy16( - palette.colours.as_ptr(), - PALETTE_BACKGROUND.as_ptr().add(16 * pal_index as usize), - palette.colours.len(), - ); + for (colour_index, &colour) in palette.colours.iter().enumerate() { + PALETTE_BACKGROUND.set(colour_index + 16 * pal_index as usize, colour); } }