From 2d9b03a7258b650622d7c8824e868ab1ac26315a Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:13:01 -0300 Subject: [PATCH] feat: add option to force-enable RTC --- src/core/bus/GamePak.zig | 4 +++- src/core/emu.zig | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/bus/GamePak.zig b/src/core/bus/GamePak.zig index 43667ef..ed90aba 100644 --- a/src/core/bus/GamePak.zig +++ b/src/core/bus/GamePak.zig @@ -6,6 +6,8 @@ const Bit = @import("bitfield").Bit; const Bitfield = @import("bitfield").Bitfield; const Backup = @import("backup.zig").Backup; const Allocator = std.mem.Allocator; + +const force_rtc = @import("../emu.zig").force_rtc; const log = std.log.scoped(.GamePak); const Self = @This(); @@ -23,7 +25,7 @@ pub fn init(allocator: Allocator, cpu: *Arm7tdmi, rom_path: []const u8, save_pat const file_buf = try file.readToEndAlloc(allocator, try file.getEndPos()); const title = file_buf[0xA0..0xAC].*; const kind = Backup.guessKind(file_buf); - const device = guessDevice(file_buf); + const device = if (force_rtc) .Rtc else guessDevice(file_buf); logHeader(file_buf, &title); diff --git a/src/core/emu.zig b/src/core/emu.zig index 6040d61..3559efd 100644 --- a/src/core/emu.zig +++ b/src/core/emu.zig @@ -18,6 +18,7 @@ const sync_video: RunKind = .LimitedFPS; // Configure Video Sync pub const win_scale = 3; // 1x, 2x, 3x, etc. Window Scaling pub const cpu_logging = false; // Enable detailed CPU logging pub const allow_unhandled_io = true; // Only relevant in Debug Builds +pub const force_rtc = false; // 228 Lines which consist of 308 dots (which are 4 cycles long) const cycles_per_frame: u64 = 228 * (308 * 4); //280896