style(imgui): use orelse instead of if () ||
This commit is contained in:
parent
a6a9e3ac72
commit
49b0620c48
|
@ -37,10 +37,7 @@ pub const State = struct {
|
||||||
var title: [12:0]u8 = [_:0]u8{0} ** 12;
|
var title: [12:0]u8 = [_:0]u8{0} ** 12;
|
||||||
std.mem.copy(u8, &title, "[No Title]");
|
std.mem.copy(u8, &title, "[No Title]");
|
||||||
|
|
||||||
return .{
|
return .{ .title = title, .fps_hist = RingBuffer(u32).init(history) };
|
||||||
.title = title,
|
|
||||||
.fps_hist = RingBuffer(u32).init(history),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: *@This(), allocator: Allocator) void {
|
pub fn deinit(self: *@This(), allocator: Allocator) void {
|
||||||
|
@ -67,17 +64,19 @@ pub fn draw(state: *State, tex_id: GLuint, cpu: *Arm7tdmi) void {
|
||||||
break :blk;
|
break :blk;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (maybe_path) |file_path| {
|
const file_path = maybe_path orelse {
|
||||||
defer nfd.freePath(file_path);
|
log.warn("did not receive a file path", .{});
|
||||||
log.info("user chose: \"{s}\"", .{file_path});
|
break :blk;
|
||||||
|
};
|
||||||
|
defer nfd.freePath(file_path);
|
||||||
|
|
||||||
emu.replaceGamepak(cpu, file_path) catch |e| {
|
log.info("user chose: \"{s}\"", .{file_path});
|
||||||
log.err("failed to replace GamePak: {}", .{e});
|
emu.replaceGamepak(cpu, file_path) catch |e| {
|
||||||
break :blk;
|
log.err("failed to replace GamePak: {}", .{e});
|
||||||
};
|
break :blk;
|
||||||
|
};
|
||||||
|
|
||||||
state.title = cpu.bus.pak.title ++ [_:0]u8{};
|
state.title = cpu.bus.pak.title ++ [_:0]u8{};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue