mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
have website not be an option
This commit is contained in:
parent
91da2c926a
commit
1c9e829bd1
|
@ -11,7 +11,12 @@ use crate::{
|
||||||
|
|
||||||
mod text;
|
mod text;
|
||||||
|
|
||||||
static WEBSITE: Option<&str> = core::option_env!("AGBRS_BACKTRACE_WEBSITE");
|
static WEBSITE: &str = {
|
||||||
|
match core::option_env!("AGBRS_BACKTRACE_WEBSITE") {
|
||||||
|
Some(x) => x,
|
||||||
|
None => "",
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
pub fn render_backtrace(trace: &backtrace::Frames, info: &PanicInfo) -> ! {
|
pub fn render_backtrace(trace: &backtrace::Frames, info: &PanicInfo) -> ! {
|
||||||
critical_section::with(|_cs| {
|
critical_section::with(|_cs| {
|
||||||
|
@ -22,12 +27,10 @@ pub fn render_backtrace(trace: &backtrace::Frames, info: &PanicInfo) -> ! {
|
||||||
gba.dma.dma().dma3.disable();
|
gba.dma.dma().dma3.disable();
|
||||||
let mut gfx = gba.display.video.bitmap3();
|
let mut gfx = gba.display.video.bitmap3();
|
||||||
|
|
||||||
let website = WEBSITE.unwrap_or("https://agbrs.dev/crash");
|
let qrcode_string_data = if WEBSITE.is_empty() {
|
||||||
|
|
||||||
let qrcode_string_data = if website.is_empty() {
|
|
||||||
format!("{trace}")
|
format!("{trace}")
|
||||||
} else {
|
} else {
|
||||||
format!("{website}#{trace}")
|
format!("{WEBSITE}#{trace}")
|
||||||
};
|
};
|
||||||
crate::println!("Stack trace: {qrcode_string_data}");
|
crate::println!("Stack trace: {qrcode_string_data}");
|
||||||
|
|
||||||
|
@ -37,8 +40,8 @@ pub fn render_backtrace(trace: &backtrace::Frames, info: &PanicInfo) -> ! {
|
||||||
text::BitmapTextRender::new(&mut gfx, (location, 8).into(), 0x0000);
|
text::BitmapTextRender::new(&mut gfx, (location, 8).into(), 0x0000);
|
||||||
let _ = write!(
|
let _ = write!(
|
||||||
&mut trace_text_render,
|
&mut trace_text_render,
|
||||||
"The game crashed :({}{website}\n{trace}",
|
"The game crashed :({}{WEBSITE}\n{trace}",
|
||||||
if website.is_empty() { "" } else { "\n" }
|
if WEBSITE.is_empty() { "" } else { "\n" }
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut panic_text_render =
|
let mut panic_text_render =
|
||||||
|
|
Loading…
Reference in a new issue