Compare commits

..

No commits in common. "49b0620c48632457a0647ce69261017f1802a96a" and "91aa98eef7ef5849820e9406c5758936694ae5bd" have entirely different histories.

5 changed files with 20 additions and 19 deletions

@ -1 +1 @@
Subproject commit aa063fab4031d12213dd95f1db5bec9d4f6727bc Subproject commit 59c90e8ea2135384410817ccfdcc15ce5f7a245e

@ -1 +1 @@
Subproject commit d13ba6137084e55f873f6afb67447fe8906cc951 Subproject commit 53fe3b676f32e59d46f4fd201d7ab200e5f6cb98

@ -1 +1 @@
Subproject commit cb13519431b916c05c6c783cb0ce3b232be5e400 Subproject commit 861de651f3e1314973b1273ac7856e96b2625ff3

@ -1 +1 @@
Subproject commit b570d61187a64a32067720aa0c2385061685428a Subproject commit bf0ae0c27cfe92fdd9a92c8f1ac6d1939ae60c77

View File

@ -21,8 +21,8 @@ const gba_height = @import("core/ppu.zig").height;
const log = std.log.scoped(.Imgui); const log = std.log.scoped(.Imgui);
// two seconds worth of fps values into the past // TODO: Document how I decided on this value (I forgot 😅)
const histogram_len = 0x80; const histogram_len = 0x400;
/// Immediate-Mode GUI State /// Immediate-Mode GUI State
pub const State = struct { pub const State = struct {
@ -37,7 +37,10 @@ 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 .{ .title = title, .fps_hist = RingBuffer(u32).init(history) }; return .{
.title = title,
.fps_hist = RingBuffer(u32).init(history),
};
} }
pub fn deinit(self: *@This(), allocator: Allocator) void { pub fn deinit(self: *@This(), allocator: Allocator) void {
@ -64,13 +67,10 @@ pub fn draw(state: *State, tex_id: GLuint, cpu: *Arm7tdmi) void {
break :blk; break :blk;
}; };
const file_path = maybe_path orelse { if (maybe_path) |file_path| {
log.warn("did not receive a file path", .{});
break :blk;
};
defer nfd.freePath(file_path); defer nfd.freePath(file_path);
log.info("user chose: \"{s}\"", .{file_path}); log.info("user chose: \"{s}\"", .{file_path});
emu.replaceGamepak(cpu, file_path) catch |e| { emu.replaceGamepak(cpu, file_path) catch |e| {
log.err("failed to replace GamePak: {}", .{e}); log.err("failed to replace GamePak: {}", .{e});
break :blk; break :blk;
@ -79,6 +79,7 @@ pub fn draw(state: *State, tex_id: GLuint, cpu: *Arm7tdmi) void {
state.title = cpu.bus.pak.title ++ [_:0]u8{}; state.title = cpu.bus.pak.title ++ [_:0]u8{};
} }
} }
}
if (zgui.beginMenu("Emulation", true)) { if (zgui.beginMenu("Emulation", true)) {
defer zgui.endMenu(); defer zgui.endMenu();
@ -129,7 +130,7 @@ pub fn draw(state: *State, tex_id: GLuint, cpu: *Arm7tdmi) void {
defer zgui.end(); defer zgui.end();
const tmp = blk: { const tmp = blk: {
var buf: [histogram_len]u32 = undefined; var buf: [0x400]u32 = undefined;
const len = state.fps_hist.copy(&buf); const len = state.fps_hist.copy(&buf);
break :blk .{ buf, len }; break :blk .{ buf, len };