Skip to content

Commit

Permalink
Merge pull request #65 from alloncm/feature/configure_bootrom
Browse files Browse the repository at this point in the history
Add a feature to specify a bootrom path in the cmd
  • Loading branch information
alloncm authored Nov 20, 2021
2 parents 7e400d1 + 9be6045 commit fd01e3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ magenboy [path_to_rom] [other_optional_flags]
```

### Optional flags

* `--log` - Print logs in debug mode to a file
* `--file-audio` - Saves the audio to a file
* `--no-vsync` - Disable vsync
* `--bootrom [path to bootrom file]` - Specify the path for a bootrom (If not specified the emualtor will look for `dmg_boot.bin` at the cwd)

## GameBoy

Expand Down
9 changes: 8 additions & 1 deletion gb/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ fn emulation_thread_main(args: Vec<String>, program_name: String, spsc_gfx_devic
let audio_devices = MultiAudioDevice::new(devices);
let mut mbc = initialize_mbc(&program_name);
let joypad_provider = SdlJoypadProvider::new(buttons_mapper);
let mut gameboy = match fs::read("Dependencies/Init/dmg_boot.bin"){
let bootrom_path = if check_for_terminal_feature_flag(&args, "--bootrom"){
let index = args.iter().position(|v| *v == String::from("--bootrom")).unwrap();
args.get(index + 1).expect("Error! you must specify a value for the --bootrom parameter").clone()
}else{
String::from("dmg_boot.bin")
};

let mut gameboy = match fs::read(bootrom_path){
Result::Ok(file)=>{
info!("found bootrom!");

Expand Down

0 comments on commit fd01e3c

Please sign in to comment.