chore: properly deallocate OAM buffer

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:12:29 -03:00
parent 22a8f67d81
commit 242627199b
1 changed files with 5 additions and 0 deletions

View File

@ -71,6 +71,7 @@ pub const Ppu = struct {
self.alloc.free(self.framebuf);
self.vram.deinit();
self.palette.deinit();
self.oam.deinit();
}
pub fn setBgOffsets(self: *Self, comptime n: u3, word: u32) void {
@ -517,6 +518,10 @@ const Oam = struct {
};
}
fn deinit(self: Self) void {
self.alloc.free(self.buf);
}
pub fn get32(self: *const Self, idx: usize) u32 {
return (@as(u32, self.buf[idx + 3]) << 24) | (@as(u32, self.buf[idx + 2]) << 16) | (@as(u32, self.buf[idx + 1]) << 8) | (@as(u32, self.buf[idx]));
}