feat: upgrade to Zig v0.13.0
This commit is contained in:
@@ -96,7 +96,7 @@ pub fn read(bus: *const Bus, comptime T: type, address: u32) ?T {
|
||||
0x0400_0128 => util.io.read.todo(log, "Read {} from SIOCNT", .{T}),
|
||||
|
||||
// Keypad Input
|
||||
0x0400_0130 => bus.io.keyinput.load(.Monotonic),
|
||||
0x0400_0130 => bus.io.keyinput.load(.monotonic),
|
||||
|
||||
// Serial Communication 2
|
||||
0x0400_0134 => util.io.read.todo(log, "Read {} from RCNT", .{T}),
|
||||
@@ -392,7 +392,7 @@ const AtomicKeyInput = struct {
|
||||
|
||||
pub inline fn load(self: *const Self, comptime ordering: AtomicOrder) u16 {
|
||||
return switch (ordering) {
|
||||
.AcqRel, .Release => @compileError("not supported for atomic loads"),
|
||||
.acq_rel, .release => @compileError("not supported for atomic loads"),
|
||||
else => @atomicLoad(u16, &self.inner.raw, ordering),
|
||||
};
|
||||
}
|
||||
|
@@ -90,9 +90,9 @@ fn inner(comptime kind: RunKind, audio_sync: bool, cpu: *Arm7tdmi, scheduler: *S
|
||||
.Unlimited, .UnlimitedFPS => {
|
||||
log.info("Emulation w/out video sync", .{});
|
||||
|
||||
while (!sync.should_quit.load(.Monotonic)) {
|
||||
while (!sync.should_quit.load(.monotonic)) {
|
||||
handleChannel(cpu, &sync.ch);
|
||||
if (sync.paused.load(.Monotonic)) continue;
|
||||
if (sync.paused.load(.monotonic)) continue;
|
||||
|
||||
runFrame(scheduler, cpu);
|
||||
audioSync(audio_sync, bus_ptr.apu.stream, &bus_ptr.apu.is_buffer_full);
|
||||
@@ -105,9 +105,9 @@ fn inner(comptime kind: RunKind, audio_sync: bool, cpu: *Arm7tdmi, scheduler: *S
|
||||
var timer = Timer.start() catch @panic("failed to initalize std.timer.Timer");
|
||||
var wake_time: u64 = frame_period;
|
||||
|
||||
while (!sync.should_quit.load(.Monotonic)) {
|
||||
while (!sync.should_quit.load(.monotonic)) {
|
||||
handleChannel(cpu, &sync.ch);
|
||||
if (sync.paused.load(.Monotonic)) continue;
|
||||
if (sync.paused.load(.monotonic)) continue;
|
||||
|
||||
runFrame(scheduler, cpu);
|
||||
const new_wake_time = videoSync(&timer, wake_time);
|
||||
|
@@ -344,7 +344,7 @@ pub fn draw(state: *State, sync: *Synchro, dim: Dimensions, cpu: *const Arm7tdmi
|
||||
const Event = std.meta.Child(@TypeOf(sched_ptr.queue.items));
|
||||
|
||||
var items: [20]Event = undefined;
|
||||
const len = @min(sched_ptr.queue.len, items.len);
|
||||
const len = @min(sched_ptr.queue.items.len, items.len);
|
||||
|
||||
@memcpy(items[0..len], sched_ptr.queue.items[0..len]);
|
||||
std.mem.sort(Event, items[0..len], {}, widgets.eventDesc(Event));
|
||||
|
@@ -230,5 +230,5 @@ fn exitln(comptime format: []const u8, args: anytype) noreturn {
|
||||
const stderr = std.io.getStdErr().writer();
|
||||
stderr.print(format, args) catch {}; // Just exit already...
|
||||
stderr.writeByte('\n') catch {};
|
||||
std.os.exit(1);
|
||||
std.process.exit(1);
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@ pub const Gui = struct {
|
||||
emu_loop: while (true) {
|
||||
// Outside of `SDL.SDL_QUIT` below, the DearImgui UI might signal that the program
|
||||
// should exit, in which case we should also handle this
|
||||
if (self.state.should_quit or sync.should_quit.load(.Monotonic)) break :emu_loop;
|
||||
if (self.state.should_quit or sync.should_quit.load(.monotonic)) break :emu_loop;
|
||||
|
||||
var event: SDL.SDL_Event = undefined;
|
||||
while (SDL.SDL_PollEvent(&event) != 0) {
|
||||
@@ -153,7 +153,7 @@ pub const Gui = struct {
|
||||
else => {},
|
||||
}
|
||||
|
||||
bus_ptr.io.keyinput.fetchAnd(~keyinput.raw, .Monotonic);
|
||||
bus_ptr.io.keyinput.fetchAnd(~keyinput.raw, .monotonic);
|
||||
},
|
||||
SDL.SDL_KEYUP => {
|
||||
// TODO: Make use of compare_and_xor?
|
||||
@@ -174,7 +174,7 @@ pub const Gui = struct {
|
||||
else => {},
|
||||
}
|
||||
|
||||
bus_ptr.io.keyinput.fetchOr(keyinput.raw, .Monotonic);
|
||||
bus_ptr.io.keyinput.fetchOr(keyinput.raw, .monotonic);
|
||||
},
|
||||
SDL.SDL_WINDOWEVENT => {
|
||||
if (event.window.event == SDL.SDL_WINDOWEVENT_RESIZED) {
|
||||
@@ -193,7 +193,7 @@ pub const Gui = struct {
|
||||
switch (self.state.emulation) {
|
||||
.Transition => |inner| switch (inner) {
|
||||
.Active => {
|
||||
sync.paused.store(false, .Monotonic);
|
||||
sync.paused.store(false, .monotonic);
|
||||
if (!config.config().host.mute) SDL.SDL_PauseAudioDevice(self.audio.device, 0);
|
||||
|
||||
self.state.emulation = .Active;
|
||||
@@ -201,7 +201,7 @@ pub const Gui = struct {
|
||||
.Inactive => {
|
||||
// Assert that double pausing is impossible
|
||||
SDL.SDL_PauseAudioDevice(self.audio.device, 1);
|
||||
sync.paused.store(true, .Monotonic);
|
||||
sync.paused.store(true, .monotonic);
|
||||
|
||||
self.state.emulation = .Inactive;
|
||||
},
|
||||
@@ -243,7 +243,7 @@ pub const Gui = struct {
|
||||
SDL.SDL_GL_SwapWindow(self.window);
|
||||
}
|
||||
|
||||
sync.should_quit.store(true, .Monotonic);
|
||||
sync.should_quit.store(true, .monotonic);
|
||||
}
|
||||
|
||||
fn glGetProcAddress(ctx: SDL.SDL_GLContext, proc: [:0]const u8) ?*anyopaque {
|
||||
|
@@ -23,12 +23,12 @@ pub const FpsTracker = struct {
|
||||
}
|
||||
|
||||
pub fn tick(self: *Self) void {
|
||||
_ = self.count.fetchAdd(1, .Monotonic);
|
||||
_ = self.count.fetchAdd(1, .monotonic);
|
||||
}
|
||||
|
||||
pub fn value(self: *Self) u32 {
|
||||
if (self.timer.read() >= std.time.ns_per_s) {
|
||||
self.fps = self.count.swap(0, .Monotonic);
|
||||
self.fps = self.count.swap(0, .monotonic);
|
||||
self.timer.reset();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user