fatal: add line spacing func, improve 565->888 for blending

This commit is contained in:
Michael Scire 2018-11-13 13:28:05 -08:00
parent 560d899a9b
commit 1bface09d5
3 changed files with 10 additions and 4 deletions

View File

@ -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<u32>((static_cast<float>(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;

View File

@ -20,9 +20,9 @@
#include <stratosphere.hpp>
#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, ...);
};

View File

@ -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());