mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-30 06:25:20 -04:00
fatal: use STB instead of freetype
This commit is contained in:
parent
5b1060b30e
commit
f3fa680d5d
5 changed files with 4975 additions and 100 deletions
stratosphere/fatal/source
|
@ -198,15 +198,16 @@ namespace ams::fatal::srv {
|
|||
tiled_buf[i] = 0x39C9;
|
||||
}
|
||||
|
||||
/* Draw the atmosphere logo in the bottom right corner. */
|
||||
/* Draw the atmosphere logo in the upper right corner. */
|
||||
const u32 start_x = 32, start_y = 64;
|
||||
for (size_t y = 0; y < AtmosphereLogoHeight; y++) {
|
||||
for (size_t x = 0; x < AtmosphereLogoWidth; x++) {
|
||||
tiled_buf[GetPixelOffset(FatalScreenWidth - AtmosphereLogoWidth - 32 + x, 32 + y)] = AtmosphereLogoData[y * AtmosphereLogoWidth + x];
|
||||
tiled_buf[GetPixelOffset(FatalScreenWidth - AtmosphereLogoWidth - start_x + x, start_x + y)] = AtmosphereLogoData[y * AtmosphereLogoWidth + x];
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Actually draw meaningful shit here. */
|
||||
font::SetPosition(32, 64);
|
||||
/* Draw error message and firmware. */
|
||||
font::SetPosition(start_x, start_y);
|
||||
font::SetFontSize(16.0f);
|
||||
font::PrintFormat(config.GetErrorMessage(), this->context->result.GetModule(), this->context->result.GetDescription(), this->context->result.GetValue());
|
||||
font::AddSpacingLines(0.5f);
|
||||
|
@ -227,7 +228,7 @@ namespace ams::fatal::srv {
|
|||
}
|
||||
|
||||
/* Add a line. */
|
||||
for (size_t x = 32; x < FatalScreenWidth - 32; x++) {
|
||||
for (size_t x = start_x; x < FatalScreenWidth - start_x; x++) {
|
||||
tiled_buf[GetPixelOffset(x, font::GetY())] = 0xFFFF;
|
||||
}
|
||||
|
||||
|
@ -235,6 +236,7 @@ namespace ams::fatal::srv {
|
|||
|
||||
u32 backtrace_y = font::GetY();
|
||||
u32 backtrace_x = 0;
|
||||
u32 pc_x = 0;
|
||||
|
||||
/* Note architecutre. */
|
||||
const bool is_aarch32 = this->context->cpu_ctx.architecture == CpuContext::Architecture_Aarch32;
|
||||
|
@ -242,19 +244,8 @@ namespace ams::fatal::srv {
|
|||
/* Print GPRs. */
|
||||
font::SetFontSize(14.0f);
|
||||
font::Print("General Purpose Registers ");
|
||||
{
|
||||
font::SetPosition(font::GetX() + 2, font::GetY());
|
||||
u32 x = font::GetX();
|
||||
font::Print("PC: ");
|
||||
font::SetPosition(x + 47, font::GetY());
|
||||
}
|
||||
if (is_aarch32) {
|
||||
font::PrintMonospaceU32(this->context->cpu_ctx.aarch32_ctx.pc);
|
||||
} else {
|
||||
font::PrintMonospaceU64(this->context->cpu_ctx.aarch64_ctx.pc);
|
||||
}
|
||||
font::PrintLine("");
|
||||
font::SetPosition(32, font::GetY());
|
||||
font::SetPosition(start_x, font::GetY());
|
||||
font::AddSpacingLines(0.5f);
|
||||
if (is_aarch32) {
|
||||
for (size_t i = 0; i < (aarch32::RegisterName_GeneralPurposeCount / 2); i++) {
|
||||
|
@ -268,9 +259,9 @@ namespace ams::fatal::srv {
|
|||
font::PrintMonospaceBlank(16);
|
||||
}
|
||||
font::Print(" ");
|
||||
x = font::GetX();
|
||||
pc_x = font::GetX();
|
||||
font::PrintFormat("%s:", aarch32::CpuContext::RegisterNameStrings[i + (aarch32::RegisterName_GeneralPurposeCount / 2)]);
|
||||
font::SetPosition(x + 47, font::GetY());
|
||||
font::SetPosition(pc_x + 47, font::GetY());
|
||||
if (this->context->cpu_ctx.aarch32_ctx.HasRegisterValue(static_cast<aarch32::RegisterName>(i + (aarch32::RegisterName_GeneralPurposeCount / 2)))) {
|
||||
font::PrintMonospaceU32(this->context->cpu_ctx.aarch32_ctx.r[i + (aarch32::RegisterName_GeneralPurposeCount / 2)]);
|
||||
font::PrintMonospaceBlank(8);
|
||||
|
@ -284,7 +275,7 @@ namespace ams::fatal::srv {
|
|||
}
|
||||
|
||||
font::PrintLine("");
|
||||
font::SetPosition(32, font::GetY());
|
||||
font::SetPosition(start_x, font::GetY());
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < aarch64::RegisterName_GeneralPurposeCount / 2; i++) {
|
||||
|
@ -297,9 +288,9 @@ namespace ams::fatal::srv {
|
|||
font::PrintMonospaceBlank(16);
|
||||
}
|
||||
font::Print(" ");
|
||||
x = font::GetX();
|
||||
pc_x = font::GetX();
|
||||
font::PrintFormat("%s:", aarch64::CpuContext::RegisterNameStrings[i + (aarch64::RegisterName_GeneralPurposeCount / 2)]);
|
||||
font::SetPosition(x + 47, font::GetY());
|
||||
font::SetPosition(pc_x + 47, font::GetY());
|
||||
if (this->context->cpu_ctx.aarch64_ctx.HasRegisterValue(static_cast<aarch64::RegisterName>(i + (aarch64::RegisterName_GeneralPurposeCount / 2)))) {
|
||||
font::PrintMonospaceU64(this->context->cpu_ctx.aarch64_ctx.x[i + (aarch64::RegisterName_GeneralPurposeCount / 2)]);
|
||||
} else {
|
||||
|
@ -312,10 +303,23 @@ namespace ams::fatal::srv {
|
|||
}
|
||||
|
||||
font::PrintLine("");
|
||||
font::SetPosition(32, font::GetY());
|
||||
font::SetPosition(start_x, font::GetY());
|
||||
}
|
||||
}
|
||||
|
||||
/* Print PC. */
|
||||
{
|
||||
font::SetPosition(pc_x, backtrace_y);
|
||||
const u32 x = font::GetX();
|
||||
font::Print("PC: ");
|
||||
font::SetPosition(x + 47, font::GetY());
|
||||
}
|
||||
if (is_aarch32) {
|
||||
font::PrintMonospaceU32(this->context->cpu_ctx.aarch32_ctx.pc);
|
||||
} else {
|
||||
font::PrintMonospaceU64(this->context->cpu_ctx.aarch64_ctx.pc);
|
||||
}
|
||||
|
||||
/* Print Backtrace. */
|
||||
u32 bt_size;
|
||||
if (is_aarch32) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue