diff --git a/ctru-rs/src/services/cam.rs b/ctru-rs/src/services/cam.rs index cb5d217..ee953f4 100644 --- a/ctru-rs/src/services/cam.rs +++ b/ctru-rs/src/services/cam.rs @@ -1,5 +1,6 @@ use bitflags::bitflags; use ctru_sys::Handle; +use crate::services::gspgpu::FramebufferFormat; pub struct Cam(()); @@ -166,6 +167,28 @@ bitflags! { } } +impl TryFrom for CamOutputFormat { + type Error = (); + + fn try_from(value: FramebufferFormat) -> Result { + match value { + FramebufferFormat::Rgb565 => Ok(CamOutputFormat::RGB_565), + _ => Err(()) + } + } +} + +impl TryFrom for FramebufferFormat { + type Error = (); + + fn try_from(value: CamOutputFormat) -> Result { + match value { + CamOutputFormat::RGB_565 => Ok(FramebufferFormat::Rgb565), + _ => Err(()) + } + } +} + bitflags! { #[derive(Default)] pub struct CamShutterSoundType: u32 {