Don't panic if the emulator doesn't have frames ready to render, use angrylion with parallel-n64
This commit is contained in:
parent
ee9678af68
commit
7c03aac388
|
@ -13,6 +13,8 @@ use ferretro::retro;
|
|||
use ferretro::retro::ffi::{PixelFormat, GameGeometry, SystemAvInfo, SystemInfo};
|
||||
use ferretro::retro::wrapper::{LibretroWrapper, Handler};
|
||||
|
||||
use ferretro::retro::wrapped_types::{Variable2};
|
||||
|
||||
use ffmpeg::{ChannelLayout, Packet, codec, filter, format, frame, media};
|
||||
use ffmpeg::util::rational::Rational;
|
||||
|
||||
|
@ -278,7 +280,8 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
|
|||
self.frame += 1;
|
||||
self.retro.run();
|
||||
|
||||
let mut vframe = self.video_frames.pop_front().unwrap();
|
||||
match self.video_frames.pop_front() {
|
||||
Some(mut vframe) => {
|
||||
vframe.set_pts(Some(frame));
|
||||
eprintln!("🎞 queue frame pts {:?}", vframe.pts());
|
||||
self.video_filter.get("in").unwrap().source().add(&vframe).unwrap();
|
||||
|
@ -303,7 +306,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Assumption: if there is a video frame, there is an audio frame.
|
||||
let mut aframe = frame::Audio::new(
|
||||
format::Sample::I16(format::sample::Type::Packed),
|
||||
self.audio_buf.len(),
|
||||
|
@ -343,6 +346,11 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
None => println!("Video not ready during frame {}", self.frame)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -468,9 +476,25 @@ impl retro::wrapper::Handler for MyEmulator {
|
|||
}
|
||||
|
||||
|
||||
fn get_variable(&mut self, key: &str) -> Option<String> {
|
||||
match key {
|
||||
"beetle_saturn_analog_stick_deadzone" => Some("15%".to_string()),
|
||||
"parallel-n64-gfxplugin" => Some("angrylion".to_string()),
|
||||
"parallel-n64-astick-deadzone" => Some("15%".to_string()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn set_variables(&mut self, variables: Vec<Variable2>) -> bool {
|
||||
for v in variables {
|
||||
eprintln!("{:?}", v);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn log_print(&mut self, level: retro::ffi::LogLevel, msg: &str) {
|
||||
eprint!("🕹️ [{:?}] {}", level, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(StructOpt)]
|
||||
|
|
Loading…
Reference in New Issue