From 3c6628138cf84b851ae9988682572126ab1fe4f1 Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Wed, 30 Sep 2020 00:47:30 +0300 Subject: [PATCH] platform: Minor fixes and adjustments from previous commit Former-commit-id: b8e8f73c8202f93e4bb2a575ee3d1b3083ddabb1 Former-commit-id: 355c634b4da8fbea1d228da8fc95e37012237bbd --- platform/rustboyadvance-libretro/Cargo.toml | 2 +- platform/rustboyadvance-libretro/src/lib.rs | 11 ++++------- platform/rustboyadvance-sdl2/Cargo.toml | 5 ++--- platform/rustboyadvance-wasm/src/emulator.rs | 8 +++++--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/platform/rustboyadvance-libretro/Cargo.toml b/platform/rustboyadvance-libretro/Cargo.toml index 17c2f6a..bfca404 100644 --- a/platform/rustboyadvance-libretro/Cargo.toml +++ b/platform/rustboyadvance-libretro/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] [dependencies] -rustboyadvance-core = { path = "../../core/" } +rustboyadvance-core = { path = "../../core/", features = ["no_video_interface"] } log = "0.4.8" libc = "0.2" libretro-sys = "0.1.1" diff --git a/platform/rustboyadvance-libretro/src/lib.rs b/platform/rustboyadvance-libretro/src/lib.rs index 303e53e..3201c3f 100644 --- a/platform/rustboyadvance-libretro/src/lib.rs +++ b/platform/rustboyadvance-libretro/src/lib.rs @@ -44,14 +44,12 @@ impl HwInterface { } } -// do nothing here, everything is handled in the libretro_backend::Core impl -impl VideoInterface for HwInterface {} - impl AudioInterface for HwInterface { - fn push_sample(&mut self, samples: StereoSample) { + fn push_sample(&mut self, samples: &[i16]) { let prod = self.audio_ring_buffer.producer(); - prod.push(samples.0).unwrap(); - prod.push(samples.1).unwrap(); + for s in samples.iter() { + let _ = prod.push(*s); + } } } @@ -124,7 +122,6 @@ impl libretro_backend::Core for RustBoyAdvanceCore { gamepak, hwif.clone(), hwif.clone(), - hwif.clone(), ); self.hwif = Some(hwif); diff --git a/platform/rustboyadvance-sdl2/Cargo.toml b/platform/rustboyadvance-sdl2/Cargo.toml index e967cf2..4abd808 100644 --- a/platform/rustboyadvance-sdl2/Cargo.toml +++ b/platform/rustboyadvance-sdl2/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Michel Heily "] edition = "2018" [dependencies] -rustboyadvance-core = { path = "../../core/", features = ["elf_support"] } +rustboyadvance-core = { path = "../../core/", features = ["elf_support", "arm7tdmi_dispatch_table"] } sdl2 = { version = "0.33.0", features = ["image"] } ringbuf = "0.2.2" bytesize = "1.0.0" @@ -20,5 +20,4 @@ winres = "0.1" [features] debugger = ["rustboyadvance-core/debugger"] -gdb = ["rustboyadvance-core/gdb"] -arm7tdmi_dispatch_table = ["rustboyadvance-core/arm7tdmi_dispatch_table"] +gdb = ["rustboyadvance-core/gdb"] \ No newline at end of file diff --git a/platform/rustboyadvance-wasm/src/emulator.rs b/platform/rustboyadvance-wasm/src/emulator.rs index 794704c..5cbc959 100644 --- a/platform/rustboyadvance-wasm/src/emulator.rs +++ b/platform/rustboyadvance-wasm/src/emulator.rs @@ -69,9 +69,11 @@ impl AudioInterface for Interface { self.sample_rate } - fn push_sample(&mut self, samples: StereoSample) { - self.audio_ring_buffer.producer().push(samples.0).unwrap(); - self.audio_ring_buffer.producer().push(samples.1).unwrap(); + fn push_sample(&mut self, samples: &[i16]) { + let prod = self.audio_ring_buffer.producer(); + for s in samples.iter() { + let _ = prod.push(*s); + } } }