From abee6efc82681ac69a34558a6e2a4332292399e9 Mon Sep 17 00:00:00 2001 From: ry755 Date: Thu, 27 Jan 2022 16:57:54 -0800 Subject: [PATCH] fox32: Use ../fox32rom/fox32.rom if ./fox32.rom doesn't exist --- src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 50ed330..c389d90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,6 +41,15 @@ pub struct Overlay { framebuffer_pointer: u32, } +fn read_rom() -> Vec { + read("fox32.rom").unwrap_or_else(|_| { + println!("fox32.rom not found, attempting to open ../fox32rom/fox32.rom instead"); + read("../fox32rom/fox32.rom").unwrap_or_else(|_| { + panic!("oh fuck"); + }) + }) +} + fn main() { let args: Vec = env::args().collect(); /*if args.len() != 2 { @@ -61,7 +70,7 @@ fn main() { let mut cpu = { let cpu_shared_memory = Arc::clone(&shared_memory); let cpu_overlays = Arc::clone(&display.overlays); - let cpu_read_only_memory = read("fox32.rom").expect("fox32.rom not found!"); + let cpu_read_only_memory = read_rom(); // 32 MiB of CPU-only memory let memory = Memory::new(0x02000000, cpu_shared_memory, cpu_overlays, cpu_read_only_memory);