fix: reimplement grabbing ROM title if provided via cmd arg

This commit is contained in:
2023-03-27 16:22:07 -05:00
parent b879c76510
commit 1d8b21d6b4
4 changed files with 10 additions and 8 deletions

View File

@@ -31,12 +31,12 @@ pub const State = struct {
fps_hist: RingBuffer(u32),
should_quit: bool = false,
pub fn init(allocator: Allocator) !@This() {
/// if zba is initialized with a ROM already provided, this initializer should be called
/// with `title_opt` being non-null
pub fn init(allocator: Allocator, title_opt: ?*const [12]u8) !@This() {
const history = try allocator.alloc(u32, histogram_len);
var title: [12:0]u8 = [_:0]u8{0} ** 12;
std.mem.copy(u8, &title, "[No Title]");
const title: [12:0]u8 = if (title_opt) |t| t.* ++ [_:0]u8{} else "[No Title]\x00\x00".*;
return .{ .title = title, .fps_hist = RingBuffer(u32).init(history) };
}