#[cfg(feature = "tinywasm")] use std::path::{Path, PathBuf}; #[cfg(feature = "tinywasm")] use bpaf::Bpaf; #[cfg(feature = "tinywasm")] use tortuise::{apply_patches, file::FileManager, init_logger, script::wasm::WasmRunner}; #[derive(Debug, Clone, Bpaf)] #[bpaf(options)] #[cfg(feature = "tinywasm")] struct Options { module: PathBuf, } #[cfg(feature = "tinywasm")] fn main() { let mut files = FileManager::default(); let wasm_runner = WasmRunner::new(); let options = options().run(); let path: Box = options.module.into(); let manifest_script = files.load_file(path.clone(), &wasm_runner); let manifest_script = manifest_script.as_ref().as_ref().unwrap(); let mut manifest = wasm_runner.manifest(path.clone(), manifest_script).unwrap(); init_logger(&manifest); if let Err(e) = apply_patches(&mut manifest, &mut files, &wasm_runner) { log::error!("{}", e); }; tortuise::run_game(files, wasm_runner, manifest); } #[cfg(not(feature = "tinywasm"))] fn main() { panic!("WebAssembly support is needed for a main runtime."); }