diff --git a/ctru-rs/src/services/mod.rs b/ctru-rs/src/services/mod.rs index 7a0e194..2159e9e 100644 --- a/ctru-rs/src/services/mod.rs +++ b/ctru-rs/src/services/mod.rs @@ -2,6 +2,7 @@ pub mod apt; pub mod fs; pub mod gspgpu; pub mod hid; +pub mod ps; pub mod soc; pub mod sslc; diff --git a/ctru-rs/src/services/ps.rs b/ctru-rs/src/services/ps.rs new file mode 100644 index 0000000..a20e47e --- /dev/null +++ b/ctru-rs/src/services/ps.rs @@ -0,0 +1,21 @@ +#[non_exhaustive] +pub struct Ps; + +impl Ps { + pub fn init() -> crate::Result { + let r = unsafe { ctru_sys::psInit() }; + if r < 0 { + Err(r.into()) + } else { + Ok(Self) + } + } +} + +impl Drop for Ps { + fn drop(&mut self) { + unsafe { + ctru_sys::psExit(); + } + } +}