fix: Apply changes for Allocgate
This commit is contained in:
@@ -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,
|
||||
|
||||
2
third_party/SDL.zig
vendored
2
third_party/SDL.zig
vendored
Submodule third_party/SDL.zig updated: 4ca8e851ea...d6db7e0681
Reference in New Issue
Block a user