From 6c9c23f79ea3d729e269e65b456a27d07fa04acd Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 2 Apr 2024 22:37:23 +0100 Subject: [PATCH] Change what's being printed slightly --- agb/src/lib.rs | 5 ----- agb/src/panics_render.rs | 11 +++++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/agb/src/lib.rs b/agb/src/lib.rs index dcb3078f..0febf2b5 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -325,11 +325,6 @@ pub mod test_runner { if let Some(mut mgba) = mgba::Mgba::new() { let _ = mgba.print(format_args!("[failed]"), mgba::DebugLevel::Error); - - let _ = mgba.print( - format_args!("debug data: {frames}"), - mgba::DebugLevel::Error, - ); } render_backtrace(&frames, info); diff --git a/agb/src/panics_render.rs b/agb/src/panics_render.rs index ab9433f1..6bda8b38 100644 --- a/agb/src/panics_render.rs +++ b/agb/src/panics_render.rs @@ -16,7 +16,11 @@ pub fn render_backtrace(trace: &backtrace::Frames, info: &PanicInfo) -> ! { let mut gba = unsafe { crate::Gba::new_in_entry() }; gba.dma.dma().dma3.disable(); - draw_qr_code(&mut gba, trace); + + let qrcode_string_data = format!("https://agbrs.dev/crash#v1-{trace}"); + crate::println!("Stack trace: {qrcode_string_data}"); + + draw_qr_code(&mut gba, &qrcode_string_data); busy_wait_for_vblank(); @@ -31,17 +35,16 @@ pub fn render_backtrace(trace: &backtrace::Frames, info: &PanicInfo) -> ! { }) } -fn draw_qr_code(gba: &mut crate::Gba, trace: &backtrace::Frames) { +fn draw_qr_code(gba: &mut crate::Gba, qrcode_string_data: &str) { let mut gfx = gba.display.video.bitmap3(); - let qrcode_string_data = format!("https://agbrs.dev/crash#v1-{trace}"); const MAX_VERSION: qrcodegen_no_heap::Version = qrcodegen_no_heap::Version::new(6); let mut temp_buffer = vec![0; MAX_VERSION.buffer_len()]; let mut out_buffer = vec![0; MAX_VERSION.buffer_len()]; let qr_code = match qrcodegen_no_heap::QrCode::encode_text( - &qrcode_string_data, + qrcode_string_data, &mut temp_buffer, &mut out_buffer, qrcodegen_no_heap::QrCodeEcc::Medium,