chore: use zig slices for fun

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-02-13 04:39:18 -04:00
parent e5a76a3c02
commit 338122ed43
1 changed files with 2 additions and 5 deletions

View File

@ -73,9 +73,7 @@ pub const Ppu = struct {
}, },
0x3 => { 0x3 => {
const start = framebuf_pitch * @as(usize, scanline); const start = framebuf_pitch * @as(usize, scanline);
const end = start + framebuf_pitch; std.mem.copy(u8, self.framebuf[start..][0..framebuf_pitch], self.vram.buf[start..][0..framebuf_pitch]);
std.mem.copy(u8, self.framebuf[start..end], self.vram.buf[start..end]);
}, },
0x4 => { 0x4 => {
const select = self.dispcnt.frame_select.read(); const select = self.dispcnt.frame_select.read();
@ -90,8 +88,7 @@ pub const Ppu = struct {
const id = byte * 2; const id = byte * 2;
const j = i * @sizeOf(u16); const j = i * @sizeOf(u16);
self.framebuf[buf_start + j + 1] = self.palette.buf[id + 1]; std.mem.copy(u8, self.framebuf[(buf_start + j)..][0..2], self.palette.buf[id..][0..2]);
self.framebuf[buf_start + j] = self.palette.buf[id];
} }
}, },
else => std.debug.panic("[PPU] TODO: Implement BG Mode {}", .{bg_mode}), else => std.debug.panic("[PPU] TODO: Implement BG Mode {}", .{bg_mode}),