support static libretro
This commit is contained in:
parent
76cab25acb
commit
1ea5a2a69b
|
@ -20,3 +20,6 @@ itertools = "0.10"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
rand_xoshiro = "0.6"
|
rand_xoshiro = "0.6"
|
||||||
regex = "1.5"
|
regex = "1.5"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
static = ["ferretro_components/static"]
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
put "libretro.a" here if you wish to compile with the "static" feature.
|
Binary file not shown.
14
src/main.rs
14
src/main.rs
|
@ -37,11 +37,11 @@ mod gui;
|
||||||
|
|
||||||
#[derive(StructOpt)]
|
#[derive(StructOpt)]
|
||||||
struct Opt {
|
struct Opt {
|
||||||
/// Core module to use.
|
/// Core module to use. If not provided, falls back to statically-linked core.
|
||||||
#[structopt(short, long, parse(from_os_str))]
|
#[structopt(short, long, parse(from_os_str))]
|
||||||
core: PathBuf,
|
core: Option<PathBuf>,
|
||||||
/// ROM to load using the core.
|
/// ROM to load using the core.
|
||||||
#[structopt(short, long, parse(from_os_str))]
|
#[structopt(parse(from_os_str))]
|
||||||
rom: PathBuf,
|
rom: PathBuf,
|
||||||
/// System directory, often containing BIOS files
|
/// System directory, often containing BIOS files
|
||||||
#[structopt(short, long, parse(from_os_str))]
|
#[structopt(short, long, parse(from_os_str))]
|
||||||
|
@ -65,7 +65,11 @@ struct Zretro {
|
||||||
|
|
||||||
impl Zretro {
|
impl Zretro {
|
||||||
fn new(opt: Opt) -> Result<Self> {
|
fn new(opt: Opt) -> Result<Self> {
|
||||||
let mut emu = RetroComponentBase::new(&opt.core);
|
let mut emu = match &opt.core {
|
||||||
|
Some(core_path) => RetroComponentBase::new(core_path),
|
||||||
|
None if cfg!(feature = "static") => RetroComponentBase::new_static(),
|
||||||
|
_ => panic!("--core is required when frontend is not built with the 'static' feature."),
|
||||||
|
};
|
||||||
|
|
||||||
let sys_info = emu.libretro_core().get_system_info();
|
let sys_info = emu.libretro_core().get_system_info();
|
||||||
let title = format!(
|
let title = format!(
|
||||||
|
@ -83,7 +87,7 @@ impl Zretro {
|
||||||
|
|
||||||
emu.register_component(PathBufComponent {
|
emu.register_component(PathBufComponent {
|
||||||
sys_path: opt.system.clone(),
|
sys_path: opt.system.clone(),
|
||||||
libretro_path: Some(opt.core.to_path_buf()),
|
libretro_path: opt.core.clone(),
|
||||||
core_assets_path: None,
|
core_assets_path: None,
|
||||||
save_path: Some(std::env::temp_dir()),
|
save_path: Some(std::env::temp_dir()),
|
||||||
})?;
|
})?;
|
||||||
|
|
Loading…
Reference in New Issue