use oxforge::mdk::{ GlobalConfig, ModuleContract, OxideModule, ParameterDescriptor, PortDeclaration, Ports, ProcessContext, }; use std::any::Any; use std::path::Path; #[derive(Debug, Clone)] pub struct PluginInfo { pub name: String, pub display_name: String, pub path: std::path::PathBuf, } #[derive(Clone)] pub struct FramebufferGuiBridge { pub width: u32, pub height: u32, } impl std::fmt::Debug for FramebufferGuiBridge { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("FramebufferGuiBridge") .field("width", &self.width) .field("height", &self.height) .finish() } } pub struct DynamicPlugin { info: PluginInfo, bridge: Option, } impl DynamicPlugin { pub fn load(_path: &Path, _config: &GlobalConfig) -> Option<(Self, PluginInfo)> { None } pub fn info(&self) -> &PluginInfo { &self.info } pub fn contract(&self) -> ModuleContract { ModuleContract::default() } pub fn port_declarations(&self) -> Vec { Vec::new() } pub fn take_framebuffer_bridge(&mut self) -> Option { self.bridge.take() } } impl OxideModule for DynamicPlugin { fn new(_config: &GlobalConfig) -> Self where Self: Sized { Self { info: PluginInfo { name: String::new(), display_name: String::new(), path: std::path::PathBuf::new(), }, bridge: None, } } fn process(&mut self, _ports: Ports, _context: &ProcessContext) {} fn receive_data(&mut self, _key: &str, _data: Box) {} fn param_descriptors(&self) -> Vec { Vec::new() } } pub fn scan_all_plugins() -> Vec { Vec::new() }