fix: palette id is a u16 not a u8

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:12:24 -03:00
parent 02572dd15c
commit 02d2ff3e0c
1 changed files with 1 additions and 1 deletions

View File

@ -157,7 +157,7 @@ pub const Ppu = struct {
// Render Current Scanline // Render Current Scanline
for (self.vram.buf[start..end]) |byte, i| { for (self.vram.buf[start..end]) |byte, i| {
const id = byte * 2; const id = @as(u16, byte) * 2;
const j = i * @sizeOf(u16); const j = i * @sizeOf(u16);
std.mem.copy(u8, self.framebuf[(buf_start + j)..][0..2], self.palette.buf[id..][0..2]); std.mem.copy(u8, self.framebuf[(buf_start + j)..][0..2], self.palette.buf[id..][0..2]);