Skip to content

Commit

Permalink
Merge branch 'joamag/audio-tests' into 'master'
Browse files Browse the repository at this point in the history
Make dmg-audio tests pass

See merge request joamag/boytacean!26
  • Loading branch information
joamag committed Jul 23, 2023
2 parents d59985b + 5e13cd2 commit aaa99da
Show file tree
Hide file tree
Showing 22 changed files with 223 additions and 81 deletions.
2 changes: 1 addition & 1 deletion frontends/sdl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ cargo vcpkg -v build
It's possible to run the emulator in headless mode using the `--headless` parameter:

```bash
cargo run -- --rom-path ../../res/roms/test/blargg/cpu/cpu_instrs.gb --cycles 100000000 --headless --device stdout --unlimited
cargo run -- --rom-path ../../res/roms/test/blargg/cpu/cpu_instrs.gb --cycles 100000000 --headless --device stdout --unlimited
```

## Features
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions frontends/sdl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,13 @@ struct Args {
#[arg(short, long, default_value_t = String::from("printer"), help = "Serial device to be used")]
device: String,

#[arg(
long,
default_value_t = false,
help = "If set no boot ROM will be loaded"
)]
no_boot: bool,

#[arg(long, default_value_t = false, help = "If set no PPU will be used")]
no_ppu: bool,

Expand Down Expand Up @@ -740,7 +747,7 @@ fn main() {
// parses the provided command line arguments and uses them to
// obtain structured values
let args = Args::parse();
let mode: GameBoyMode = if args.mode == "auto" {
let mode = if args.mode == "auto" {
GameBoyMode::Dmg
} else {
GameBoyMode::from_string(&args.mode)
Expand All @@ -760,7 +767,7 @@ 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(true);
game_boy.load(!args.no_boot);

// prints the current version of the emulator (informational message)
println!("========= Boytacean =========\n{}", game_boy);
Expand Down
28 changes: 27 additions & 1 deletion frontends/sdl/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,37 @@ mod tests {
Some(50000000),
TestOptions::default(),
);
compare_images(&result, "res/test/blargg/instr_timing/instr_timing.png");
let image_result = compare_images(&result, "res/test/blargg/instr_timing/instr_timing.png");
assert_eq!(image_result, true);
}

#[test]
fn test_blargg_dmg_sound() {
let result: [u8; FRAME_BUFFER_SIZE] = run_image_test(
"../../res/roms/test/blargg/dmg_sound/01-registers.gb",
Some(50000000),
TestOptions::default(),
);
let image_result = compare_images(&result, "res/test/blargg/dmg_sound/01-registers.png");
assert_eq!(image_result, true);

let result: [u8; FRAME_BUFFER_SIZE] = run_image_test(
"../../res/roms/test/blargg/dmg_sound/02-len ctr.gb",
Some(50000000),
TestOptions::default(),
);
let image_result = compare_images(&result, "res/test/blargg/dmg_sound/02-len ctr.png");
assert_eq!(image_result, true);

let result: [u8; FRAME_BUFFER_SIZE] = run_image_test(
"../../res/roms/test/blargg/dmg_sound/03-trigger.gb",
Some(100000000),
TestOptions::default(),
);
let image_result = compare_images(&result, "res/test/blargg/dmg_sound/03-trigger.png");
assert_eq!(image_result, true);
}

#[test]
fn test_dmg_acid2() {
let result: [u8; FRAME_BUFFER_SIZE] = run_image_test(
Expand Down
Binary file added res/roms/test/blargg/dmg_sound/01-registers.gb
Binary file not shown.
Binary file added res/roms/test/blargg/dmg_sound/02-len ctr.gb
Binary file not shown.
Binary file added res/roms/test/blargg/dmg_sound/03-trigger.gb
Binary file not shown.
Binary file added res/roms/test/blargg/dmg_sound/04-sweep.gb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit aaa99da

Please sign in to comment.