1use crate::ppu::{Ppu, gba_color_to_rgb8};
2use jgenesis_common::debug::{DebugBytesView, DebugMemoryView, DebugWordsView, Endian};
3use jgenesis_common::frontend::Color;
4
5impl Ppu {
6    pub fn debug_vram_view(&mut self) -> impl DebugMemoryView {
7        DebugBytesView(self.vram.as_mut_slice())
8    }
9
10    pub fn debug_palette_view(&mut self) -> impl DebugMemoryView {
11        DebugWordsView(self.palette_ram.as_mut_slice(), Endian::Little)
12    }
13
14    pub fn debug_oam_view(&mut self) -> impl DebugMemoryView {
15        DebugWordsView(self.oam.as_mut_slice(), Endian::Little)
16    }
17
18    pub fn copy_palette_ram(&self, out: &mut [Color]) {
19        for (i, &color) in self.palette_ram.iter().enumerate() {
20            out[i] = gba_color_to_rgb8(color);
21        }
22    }
23}