From 03c7a772c58bb8611e8493ee9fd1290eb83d9cab Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Fri, 7 Jan 2022 18:17:37 +0100 Subject: [PATCH] Dedicated BackTrace Console instead of default --- ctru-rs/src/console.rs | 20 -------------------- ctru-rs/src/lib.rs | 2 ++ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/ctru-rs/src/console.rs b/ctru-rs/src/console.rs index 276509f..eec95d9 100644 --- a/ctru-rs/src/console.rs +++ b/ctru-rs/src/console.rs @@ -44,26 +44,6 @@ impl Console { } } -impl Drop for Console { - fn drop(&mut self) { - // Get the current console by replacing it with the default. - let default_console = unsafe { libctru::consoleGetDefault() }; - let current_console = unsafe { libctru::consoleSelect(default_console) }; - - if std::ptr::eq(current_console, &*self.context) { - // Console dropped while selected. We just replaced it with the - // default so make sure it's initialized. - if unsafe { !(*default_console).consoleInitialised } { - unsafe { libctru::consoleInit(Screen::Top.into(), default_console) }; - } - } else { - // Console dropped while a different console was selected. Put back - // the console that was selected. - unsafe { libctru::consoleSelect(current_console) }; - } - } -} - impl Default for Console { fn default() -> Self { Console::init(Screen::Top) diff --git a/ctru-rs/src/lib.rs b/ctru-rs/src/lib.rs index c9c3ee9..91e93c3 100644 --- a/ctru-rs/src/lib.rs +++ b/ctru-rs/src/lib.rs @@ -21,6 +21,8 @@ pub fn init() { // Panic Hook setup let default_hook = std::panic::take_hook(); let new_hook = Box::new( move |info: &PanicInfo| { + let _bt_console = console::Console::default(); + println!("\x1b[1;31m\n--------------------------------------------------"); default_hook(info); println!("\nPress SELECT to exit the software");