1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-29 21:12:06 +00:00

gfx: Do not try to print if console is not initialized

This commit is contained in:
CTCaer 2021-01-05 15:36:43 +02:00
parent 9daa14abec
commit 7b460f7e56

View file

@ -23,6 +23,8 @@
gfx_ctxt_t gfx_ctxt; gfx_ctxt_t gfx_ctxt;
gfx_con_t gfx_con; gfx_con_t gfx_con;
static bool gfx_con_init_done = false;
static const u8 _gfx_font[] = { static const u8 _gfx_font[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 032 ( ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Char 032 ( )
0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x0C, 0x00, // Char 033 (!) 0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x0C, 0x00, // Char 033 (!)
@ -157,6 +159,8 @@ void gfx_con_init()
gfx_con.fillbg = 1; gfx_con.fillbg = 1;
gfx_con.bgcol = 0xFF1B1B1B; gfx_con.bgcol = 0xFF1B1B1B;
gfx_con.mute = 0; gfx_con.mute = 0;
gfx_con_init_done = true;
} }
void gfx_con_setcol(u32 fgcol, int fillbg, u32 bgcol) void gfx_con_setcol(u32 fgcol, int fillbg, u32 bgcol)
@ -263,7 +267,7 @@ void gfx_putc(char c)
void gfx_puts(char *s) void gfx_puts(char *s)
{ {
if (!s || gfx_con.mute) if (!s || !gfx_con_init_done || gfx_con.mute)
return; return;
for (; *s; s++) for (; *s; s++)
@ -319,7 +323,7 @@ void gfx_put_big_sep()
void gfx_printf(const char *fmt, ...) void gfx_printf(const char *fmt, ...)
{ {
if (gfx_con.mute) if (!gfx_con_init_done || gfx_con.mute)
return; return;
va_list ap; va_list ap;
@ -395,7 +399,7 @@ void gfx_printf(const char *fmt, ...)
void gfx_hexdump(u32 base, const u8 *buf, u32 len) void gfx_hexdump(u32 base, const u8 *buf, u32 len)
{ {
if (gfx_con.mute) if (!gfx_con_init_done || gfx_con.mute)
return; return;
u8 prevFontSize = gfx_con.fntsz; u8 prevFontSize = gfx_con.fntsz;