[GFX] Add position saving and muting

This commit is contained in:
Kostas Missos 2018-06-23 07:07:53 +03:00
parent f3149e0be3
commit bee8004b74
3 changed files with 15 additions and 2 deletions

View file

@ -141,9 +141,12 @@ void gfx_con_init(gfx_con_t *con, gfx_ctxt_t *ctxt)
con->gfx_ctxt = ctxt; con->gfx_ctxt = ctxt;
con->x = 0; con->x = 0;
con->y = 0; con->y = 0;
con->savedx = 0;
con->savedy = 0;
con->fgcol = 0xFFCCCCCC; con->fgcol = 0xFFCCCCCC;
con->fillbg = 0; con->fillbg = 0;
con->bgcol = 0xFF1B1B1B; con->bgcol = 0xFF1B1B1B;
con->mute = 0;
} }
void gfx_con_setcol(gfx_con_t *con, u32 fgcol, int fillbg, u32 bgcol) void gfx_con_setcol(gfx_con_t *con, u32 fgcol, int fillbg, u32 bgcol)
@ -198,7 +201,7 @@ void gfx_putc(gfx_con_t *con, char c)
void gfx_puts(gfx_con_t *con, const char *s) void gfx_puts(gfx_con_t *con, const char *s)
{ {
if (!s) if (!s || con->mute)
return; return;
for (; *s; s++) for (; *s; s++)
@ -238,6 +241,9 @@ static void _gfx_putn(gfx_con_t *con, u32 v, int base, char fill, int fcnt)
void gfx_printf(gfx_con_t *con, const char *fmt, ...) void gfx_printf(gfx_con_t *con, const char *fmt, ...)
{ {
if (con->mute)
return;
va_list ap; va_list ap;
int fill, fcnt; int fill, fcnt;
@ -309,6 +315,9 @@ void gfx_printf(gfx_con_t *con, const char *fmt, ...)
void gfx_hexdump(gfx_con_t *con, u32 base, const u8 *buf, u32 len) void gfx_hexdump(gfx_con_t *con, u32 base, const u8 *buf, u32 len)
{ {
if (con->mute)
return;
for(u32 i = 0; i < len; i++) for(u32 i = 0; i < len; i++)
{ {
if(i % 0x10 == 0) if(i % 0x10 == 0)

View file

@ -33,9 +33,12 @@ typedef struct _gfx_con_t
gfx_ctxt_t *gfx_ctxt; gfx_ctxt_t *gfx_ctxt;
u32 x; u32 x;
u32 y; u32 y;
u32 savedx;
u32 savedy;
u32 fgcol; u32 fgcol;
int fillbg; int fillbg;
u32 bgcol; u32 bgcol;
int mute;
} gfx_con_t; } gfx_con_t;
void gfx_init_ctxt(gfx_ctxt_t *ctxt, u32 *fb, u32 width, u32 height, u32 stride); void gfx_init_ctxt(gfx_ctxt_t *ctxt, u32 *fb, u32 width, u32 height, u32 stride);

View file

@ -384,6 +384,7 @@ int hos_launch(ini_sec_t *cfg)
memset(&ctxt, 0, sizeof(launch_ctxt_t)); memset(&ctxt, 0, sizeof(launch_ctxt_t));
list_init(&ctxt.kip1_list); list_init(&ctxt.kip1_list);
if (!gfx_con.mute)
gfx_clear_grey(&gfx_ctxt, 0x1B); gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);