From b48963b29274f5f1b6fc852d9e13f75c0392f695 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Thu, 9 Nov 2023 09:31:44 +0000
Subject: [PATCH] chore: custom boot ROM supported in SDL

---
 frontends/sdl/src/main.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/frontends/sdl/src/main.rs b/frontends/sdl/src/main.rs
index 5f82603b..bae8693c 100644
--- a/frontends/sdl/src/main.rs
+++ b/frontends/sdl/src/main.rs
@@ -845,6 +845,13 @@ struct Args {
     )]
     no_boot: bool,
 
+    #[arg(
+        long,
+        default_value_t = String::from(""),
+        help = "Path to Game Boy ROM file to be used in loading stage"
+    )]
+    boot_rom_path: String,
+
     #[arg(long, default_value_t = false, help = "If set no PPU will be used")]
     no_ppu: bool,
 
@@ -960,7 +967,10 @@ fn main() {
     game_boy.set_dma_enabled(!args.no_dma);
     game_boy.set_timer_enabled(!args.no_timer);
     game_boy.attach_serial(device);
-    game_boy.load(!args.no_boot);
+    game_boy.load(!args.no_boot && args.boot_rom_path == "");
+    if args.boot_rom_path != "" {
+        game_boy.load_boot_path(&args.boot_rom_path).unwrap();
+    }
 
     // prints the current version of the emulator (informational message)
     println!("========= {} =========\n{}", Info::name(), game_boy);
-- 
GitLab