Compare commits
4 Commits
49b0620c48
...
april-fool
Author | SHA1 | Date | |
---|---|---|---|
9844d657b0 | |||
1d8b21d6b4 | |||
b879c76510 | |||
0dbba2fb9a |
@@ -78,7 +78,7 @@ arm7wrestler GBA Fixed | [destoer](https://github.com/destoer)
|
||||
|
||||
## Compiling
|
||||
|
||||
Most recently built on Zig [v0.11.0-dev.1580+a5b34a61a](https://github.com/ziglang/zig/tree/a5b34a61a)
|
||||
Most recently built on Zig [v0.11.0-dev.2168+322ace70f](https://github.com/ziglang/zig/tree/322ace70f)
|
||||
|
||||
### Dependencies
|
||||
|
||||
|
14
build.zig
14
build.zig
@@ -6,9 +6,9 @@ const gdbstub = @import("lib/zba-gdbstub/build.zig");
|
||||
const zgui = @import("lib/zgui/build.zig");
|
||||
const nfd = @import("lib/nfd-zig/build.zig");
|
||||
|
||||
pub fn build(b: *std.build.Builder) void {
|
||||
pub fn build(b: *std.Build) void {
|
||||
// Minimum Zig Version
|
||||
const min_ver = std.SemanticVersion.parse("0.11.0-dev.1580+a5b34a61a") catch return; // https://github.com/ziglang/zig/commit/a5b34a61a
|
||||
const min_ver = std.SemanticVersion.parse("0.11.0-dev.2168+322ace70f") catch return; // https://github.com/ziglang/zig/commit/322ace70f
|
||||
if (builtin.zig_version.order(min_ver).compare(.lt)) {
|
||||
std.log.err("{s}", .{b.fmt("Zig v{} does not meet the minimum version requirement. (Zig v{})", .{ builtin.zig_version, min_ver })});
|
||||
std.os.exit(1);
|
||||
@@ -48,7 +48,8 @@ pub fn build(b: *std.build.Builder) void {
|
||||
exe.addAnonymousModule("zba-util", .{ .source_file = .{ .path = "lib/zba-util/src/lib.zig" } });
|
||||
|
||||
// gdbstub
|
||||
gdbstub.link(exe);
|
||||
exe.addModule("gdbstub", gdbstub.getModule(b));
|
||||
|
||||
// NativeFileDialog(ue) Bindings
|
||||
exe.linkLibrary(nfd.makeLib(b, target, optimize));
|
||||
exe.addModule("nfd", nfd.getModule(b));
|
||||
@@ -59,9 +60,10 @@ pub fn build(b: *std.build.Builder) void {
|
||||
exe.addModule("sdl2", sdk.getNativeModule());
|
||||
|
||||
// Dear ImGui bindings
|
||||
const zgui_pkg = zgui.package(b, .{ .options = .{ .backend = .sdl2_opengl3 } });
|
||||
exe.addModule("zgui", zgui_pkg.module);
|
||||
zgui.link(exe, zgui_pkg.options);
|
||||
|
||||
// .shared option should stay in sync with SDL.zig call above where true == .dynamic, and false == .static
|
||||
const zgui_pkg = zgui.package(b, target, optimize, .{ .options = .{ .backend = .sdl2_opengl3, .shared = true } });
|
||||
zgui_pkg.link(exe);
|
||||
|
||||
exe.install();
|
||||
|
||||
|
Submodule lib/SDL.zig updated: aa063fab40...cc3b023f50
Submodule lib/zba-gdbstub updated: acb59994fc...215e053b9a
2
lib/zgui
2
lib/zgui
Submodule lib/zgui updated: ceca3dd660...5b2b64a9de
Submodule lib/zig-clap updated: cb13519431...6310cbd576
@@ -205,6 +205,10 @@ pub const Backup = struct {
|
||||
const file_path = try self.savePath(allocator, path);
|
||||
defer allocator.free(file_path);
|
||||
|
||||
// FIXME: communicate edge case to the user?
|
||||
if (std.mem.eql(u8, &self.title, "ACE LIGHTNIN"))
|
||||
return;
|
||||
|
||||
switch (self.kind) {
|
||||
.Sram, .Flash, .Flash1M, .Eeprom => {
|
||||
const file = try std.fs.createFileAbsolute(file_path, .{});
|
||||
|
@@ -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) };
|
||||
}
|
||||
|
||||
|
@@ -90,8 +90,10 @@ pub fn main() void {
|
||||
cpu.fastBoot();
|
||||
}
|
||||
|
||||
const title_ptr = if (paths.rom != null) &bus.pak.title else null;
|
||||
|
||||
// TODO: Just copy the title instead of grabbing a pointer to it
|
||||
var gui = Gui.init(allocator, &bus.apu) catch |e| exitln("failed to init gui: {}", .{e});
|
||||
var gui = Gui.init(allocator, &bus.apu, title_ptr) catch |e| exitln("failed to init gui: {}", .{e});
|
||||
defer gui.deinit();
|
||||
|
||||
var quit = std.atomic.Atomic(bool).init(false);
|
||||
|
@@ -57,7 +57,7 @@ pub const Gui = struct {
|
||||
allocator: Allocator,
|
||||
program_id: gl.GLuint,
|
||||
|
||||
pub fn init(allocator: Allocator, apu: *Apu) !Self {
|
||||
pub fn init(allocator: Allocator, apu: *Apu, title_opt: ?*const [12]u8) !Self {
|
||||
if (SDL.SDL_Init(SDL.SDL_INIT_VIDEO | SDL.SDL_INIT_EVENTS | SDL.SDL_INIT_AUDIO) < 0) panic();
|
||||
if (SDL.SDL_GL_SetAttribute(SDL.SDL_GL_CONTEXT_PROFILE_MASK, SDL.SDL_GL_CONTEXT_PROFILE_CORE) < 0) panic();
|
||||
if (SDL.SDL_GL_SetAttribute(SDL.SDL_GL_CONTEXT_MAJOR_VERSION, 3) < 0) panic();
|
||||
@@ -91,7 +91,7 @@ pub const Gui = struct {
|
||||
.audio = Audio.init(apu),
|
||||
|
||||
.allocator = allocator,
|
||||
.state = try imgui.State.init(allocator),
|
||||
.state = try imgui.State.init(allocator, title_opt),
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user