diff --git a/Cargo.toml b/Cargo.toml index e74a10b..3b7658c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,3 +20,6 @@ itertools = "0.10" rand = "0.8" rand_xoshiro = "0.6" regex = "1.5" + +[features] +static = ["ferretro_components/static"] diff --git a/lib/README.txt b/lib/README.txt new file mode 100644 index 0000000..37acf4d --- /dev/null +++ b/lib/README.txt @@ -0,0 +1 @@ +put "libretro.a" here if you wish to compile with the "static" feature. diff --git a/lib/libretro.a b/lib/libretro.a new file mode 100644 index 0000000..3db188e Binary files /dev/null and b/lib/libretro.a differ diff --git a/src/main.rs b/src/main.rs index 3cafa77..c61d750 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,11 +37,11 @@ mod gui; #[derive(StructOpt)] 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))] - core: PathBuf, + core: Option, /// ROM to load using the core. - #[structopt(short, long, parse(from_os_str))] + #[structopt(parse(from_os_str))] rom: PathBuf, /// System directory, often containing BIOS files #[structopt(short, long, parse(from_os_str))] @@ -65,7 +65,11 @@ struct Zretro { impl Zretro { fn new(opt: Opt) -> Result { - 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 title = format!( @@ -83,7 +87,7 @@ impl Zretro { emu.register_component(PathBufComponent { sys_path: opt.system.clone(), - libretro_path: Some(opt.core.to_path_buf()), + libretro_path: opt.core.clone(), core_assets_path: None, save_path: Some(std::env::temp_dir()), })?;