From 1bface09d5412a368f0907503cd9f8126e7977ff Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 13 Nov 2018 13:28:05 -0800 Subject: [PATCH] fatal: add line spacing func, improve 565->888 for blending --- stratosphere/fatal/source/fatal_font.cpp | 4 ++++ stratosphere/fatal/source/fatal_font.hpp | 7 ++++--- stratosphere/fatal/source/fatal_task_screen.cpp | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/stratosphere/fatal/source/fatal_font.cpp b/stratosphere/fatal/source/fatal_font.cpp index e2fd4b3b2..a832f3238 100644 --- a/stratosphere/fatal/source/fatal_font.cpp +++ b/stratosphere/fatal/source/fatal_font.cpp @@ -132,6 +132,10 @@ void FontManager::SetPosition(u32 x, u32 y) { g_cur_y = y; } +void FontManager::AddSpacingLines(float num_lines) { + g_cur_y += static_cast((static_cast(g_face->size->metrics.height) * num_lines) / 64.0f); +} + void FontManager::ConfigureFontFramebuffer(u16 *fb, u32 (*unswizzle_func)(u32, u32)) { g_fb = fb; g_unswizzle_func = unswizzle_func; diff --git a/stratosphere/fatal/source/fatal_font.hpp b/stratosphere/fatal/source/fatal_font.hpp index c72921065..a7622dc56 100644 --- a/stratosphere/fatal/source/fatal_font.hpp +++ b/stratosphere/fatal/source/fatal_font.hpp @@ -20,9 +20,9 @@ #include #define RGB888_TO_RGB565(r, g, b) ((((r >> 3) << 11) & 0xF800) | (((g >> 2) << 5) & 0x7E0) | ((b >> 3) & 0x1F)) -#define RGB565_GET_R8(c) (((c >> 11) & 0x1F) << 3) -#define RGB565_GET_G8(c) (((c >> 5) & 0x3F) << 2) -#define RGB565_GET_B8(c) (((c >> 0) & 0x1F) << 3) +#define RGB565_GET_R8(c) ((((c >> 11) & 0x1F) << 3) | ((c >> 13) & 7)) +#define RGB565_GET_G8(c) ((((c >> 5) & 0x3F) << 2) | ((c >> 9) & 3)) +#define RGB565_GET_B8(c) ((((c >> 0) & 0x1F) << 3) | ((c >> 2) & 7)) class FontManager { public: @@ -31,6 +31,7 @@ class FontManager { static void SetFontColor(u16 color); static void SetPosition(u32 x, u32 y); + static void AddSpacingLines(float num_lines); static void PrintLine(const char *str); static void PrintFormatLine(const char *format, ...); }; \ No newline at end of file diff --git a/stratosphere/fatal/source/fatal_task_screen.cpp b/stratosphere/fatal/source/fatal_task_screen.cpp index 81d4b143b..1872a7222 100644 --- a/stratosphere/fatal/source/fatal_task_screen.cpp +++ b/stratosphere/fatal/source/fatal_task_screen.cpp @@ -203,7 +203,8 @@ Result ShowFatalTask::ShowFatal() { /* TODO: Actually draw meaningful shit here. */ FontManager::SetPosition(32, 64); FontManager::PrintFormatLine(u8"A fatal error occurred: 2%03d-%04d", R_MODULE(this->ctx->error_code), R_DESCRIPTION(this->ctx->error_code)); - FontManager::PrintFormatLine(u8"Firmware: %s (AMS %u.%u.%u-%s)", GetFatalConfig()->firmware_version.display_version, + FontManager::AddSpacingLines(0.5f); + FontManager::PrintFormatLine(u8"Firmware: %s (Atmosphère %u.%u.%u-%s)", GetFatalConfig()->firmware_version.display_version, CURRENT_ATMOSPHERE_VERSION, GetAtmosphereGitRevision());