fix: Apply changes for Allocgate
This commit is contained in:
parent
8b7c7fbb1a
commit
b550714dc3
|
@ -29,7 +29,7 @@ pub const Chip8 = struct {
|
|||
mem: [0x1000]u8,
|
||||
disp: Display,
|
||||
|
||||
pub fn fromFile(alloc: *Allocator, scheduler: *Scheduler, path: []const u8) !Chip8 {
|
||||
pub fn fromFile(alloc: Allocator, scheduler: *Scheduler, path: []const u8) !Chip8 {
|
||||
const file = try std.fs.cwd().openFile(path, .{ .read = true });
|
||||
defer file.close();
|
||||
|
||||
|
|
|
@ -17,14 +17,18 @@ const WINDOW_HEIGHT = CHIP8_HEIGHT * display.SCALE;
|
|||
const PIXELBUF_LEN = display.PIXELBUF_LEN;
|
||||
|
||||
pub fn main() anyerror!void {
|
||||
const alloc = std.heap.page_allocator;
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
// defer gpa.deinit();
|
||||
|
||||
const alloc = gpa.allocator();
|
||||
|
||||
var arg_it = std.process.args();
|
||||
|
||||
// Skip process name
|
||||
_ = arg_it.skip();
|
||||
|
||||
const os_string = try arg_it.next(alloc) orelse {
|
||||
std.debug.warn("Expected first argument to be path to CHIP-8 rom\n", .{});
|
||||
std.log.warn("Expected first argument to be path to CHIP-8 rom\n", .{});
|
||||
return;
|
||||
};
|
||||
const rom_path = try std.fs.path.resolve(alloc, &[_][]const u8{os_string});
|
||||
|
|
|
@ -15,7 +15,7 @@ pub const Scheduler = struct {
|
|||
timestamp: u64,
|
||||
queue: PriorityQueue(Event, lessThan),
|
||||
|
||||
pub fn new(alloc: *Allocator, pixels_ptr: *[PIXELBUF_LEN]u8) Scheduler {
|
||||
pub fn new(alloc: Allocator, pixels_ptr: *[PIXELBUF_LEN]u8) Scheduler {
|
||||
var queue = Scheduler{
|
||||
.timestamp = 0,
|
||||
.pixels_ptr = pixels_ptr,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4ca8e851ea1a0ba697e1ff9371d499e0937a22fb
|
||||
Subproject commit d6db7e068138565f3f054d19c3ea5f28d2145794
|
Loading…
Reference in New Issue