From 17dc4c4c76e2581e4fa6da21daaba82e8a47245a Mon Sep 17 00:00:00 2001 From: Fenrir Date: Fri, 23 Feb 2024 19:06:59 -0700 Subject: [PATCH] Add private PopUp::launch_unchecked method --- ctru-rs/src/applets/error.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ctru-rs/src/applets/error.rs b/ctru-rs/src/applets/error.rs index 06e5ffe..ac9a3db 100644 --- a/ctru-rs/src/applets/error.rs +++ b/ctru-rs/src/applets/error.rs @@ -77,6 +77,15 @@ impl PopUp { _ => Err(Error::Unknown), } } + + /// Launches the error applet without requiring an [`Apt`] or [`Gfx`] handle. + /// + /// # Safety + /// + /// Causes undefined behavior if the aforementioned services are not actually active when the applet launches. + unsafe fn launch_unchecked(&mut self) { + unsafe { ctru_sys::errorDisp(self.state.as_mut()) }; + } } /// Sets a custom panic hook that uses the error applet to display panic messages. You can also choose to have @@ -104,7 +113,7 @@ pub unsafe fn set_panic_hook(use_stderr: bool) { } unsafe { - ctru_sys::errorDisp(popup.state.as_mut()); + popup.launch_unchecked(); } })) }