small fix for gambatte, which still doesn't work

This commit is contained in:
lif 2019-11-15 23:27:19 -08:00
parent 043806c713
commit c3cea12713

View file

@ -43,9 +43,9 @@ impl MyEmulator {
let lib = libloading::Library::new(core.as_ref()).unwrap(); let lib = libloading::Library::new(core.as_ref()).unwrap();
let raw_retro = retro::loading::LibretroApi::from_library(lib).unwrap(); let raw_retro = retro::loading::LibretroApi::from_library(lib).unwrap();
let retro = retro::wrapper::LibretroWrapper::from(raw_retro); let retro = retro::wrapper::LibretroWrapper::from(raw_retro);
println!("api version: {}", retro.as_ref().api_version());
println!( let title = format!(
"name: {}", "{} - rust libretro",
unsafe { CStr::from_ptr(retro.as_ref().get_system_info().library_name) } unsafe { CStr::from_ptr(retro.as_ref().get_system_info().library_name) }
.to_string_lossy() .to_string_lossy()
); );
@ -59,7 +59,7 @@ impl MyEmulator {
let window = sdl_context let window = sdl_context
.video() .video()
.unwrap() .unwrap()
.window("rust libretro", width, height) .window(title.as_str(), width, height)
.opengl() .opengl()
.build() .build()
.unwrap(); .unwrap();
@ -70,11 +70,14 @@ impl MyEmulator {
let (audio_sender, audio_receiver) = crossbeam_channel::bounded(2); let (audio_sender, audio_receiver) = crossbeam_channel::bounded(2);
let audio = sdl_context.audio().unwrap(); let audio = sdl_context.audio().unwrap();
let desired_spec = AudioSpecDesired { let mut desired_spec = AudioSpecDesired {
freq: Some(av_info.timing.sample_rate.round() as i32), freq: Some(av_info.timing.sample_rate.round() as i32),
channels: Some(2), channels: Some(2),
samples: None, samples: None,
}; };
if let Some(0) = desired_spec.freq {
desired_spec.freq = Some(32000); // old default, fix for cores that don't report it
}
let mut audio_spec = None; let mut audio_spec = None;
let audio_device = audio let audio_device = audio
.open_playback(None, &desired_spec, |spec| { .open_playback(None, &desired_spec, |spec| {