diff --git a/build.zig b/build.zig index fc1ba0d..df47a68 100644 --- a/build.zig +++ b/build.zig @@ -1,13 +1,17 @@ const std = @import("std"); -pub fn setup_wasm(b: *std.build, optimize: std.builtin.Mode) void { - const lib = b.addSharedLibrary(.{ +pub fn setup_wasm(b: *std.Build, optimize: std.builtin.Mode) void { + const lib = b.addExecutable(.{ .name = "zpz6128", .version = .{ .major = 1, .minor = 0, .patch = 0 }, .optimize = optimize, - .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, + .target = b.resolveTargetQuery(.{ + .cpu_arch = .wasm32, + .os_tag = .freestanding, + }), .root_source_file = .{ .path = "src/zpz-wasm.zig" }, }); + lib.entry = .disabled; lib.addIncludePath(.{ .path = "./chips/" }); lib.addCSourceFiles(.{ .files = &.{"src/chips-impl.c"} }); // We need the libc because of the use of #include memset in `chips` diff --git a/src/sdl-adapter.zig b/src/sdl-adapter.zig index 41fadc1..b4100a4 100644 --- a/src/sdl-adapter.zig +++ b/src/sdl-adapter.zig @@ -134,7 +134,7 @@ pub const SDLAdapter = struct { } pub fn display(adapter: *IOAdapter, pixel_buffer: [*]c_uint, width: usize, height: usize) anyerror!void { - var self = @fieldParentPtr(SDLAdapter, "interface", adapter); + const self = @fieldParentPtr(SDLAdapter, "interface", adapter); try prepareScene(self, pixel_buffer, width, height); try renderScene(self); @@ -148,7 +148,7 @@ pub const SDLAdapter = struct { } fn prepareScene(self: *Self, pixel_buffer: [*]c_uint, width: usize, height: usize) anyerror!void { - var texture = self.texture; + const texture = self.texture; var buffer: [*c]u32 = undefined; var pitch: i32 = undefined; diff --git a/web/zpz6128.wasm b/web/zpz6128.wasm index e7df3eb..73d5e46 120000 --- a/web/zpz6128.wasm +++ b/web/zpz6128.wasm @@ -1 +1 @@ -../zig-out/lib/zpz6128.wasm \ No newline at end of file +../zig-out/bin/zpz6128.wasm \ No newline at end of file