From d259a0d0d6eac448b207c2793e0a53321c0f3ef8 Mon Sep 17 00:00:00 2001 From: DacoTaco Date: Sat, 18 Mar 2023 16:40:50 +0100 Subject: [PATCH] console: forgot to substract the offset from the console size (#147) --- libogc/console.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libogc/console.c b/libogc/console.c index f934a480..f9c2fce8 100644 --- a/libogc/console.c +++ b/libogc/console.c @@ -66,7 +66,7 @@ static const unsigned int color_table[] = 0xEB80EB80, // 37 bright white }; -static u32 do_xfb_copy = FALSE; +static bool do_xfb_copy = false; static struct _console_data_s stdcon; static struct _console_data_s *curr_con = NULL; static void *_console_buffer = NULL; @@ -82,7 +82,7 @@ void __console_vipostcb(u32 retraceCnt) u32 *fb,*ptr; u32 offset; - do_xfb_copy = TRUE; + do_xfb_copy = true; offset = (curr_con->target_y*curr_con->tgt_stride) + curr_con->target_x*VI_DISPLAY_PIX_SZ; ptr = curr_con->destbuffer+offset; @@ -98,7 +98,7 @@ void __console_vipostcb(u32 retraceCnt) fb += fb_stride; } - do_xfb_copy = FALSE; + do_xfb_copy = false; } @@ -113,7 +113,7 @@ static void __console_drawc(int c) unsigned int fgcolor, bgcolor; unsigned int nextline; - if(do_xfb_copy==TRUE) return; + if(do_xfb_copy==true) return; if(!curr_con) return; con = curr_con; @@ -264,8 +264,8 @@ void __console_init(void *framebuffer,int xstart,int ystart,int xres,int yres,in con->destbuffer = framebuffer; con->con_xres = xres; con->con_yres = yres; - con->con_cols = xres / FONT_XSIZE; - con->con_rows = yres / FONT_YSIZE; + con->con_cols = (xres - xstart) / FONT_XSIZE; + con->con_rows = (yres - ystart) / FONT_YSIZE; con->con_stride = con->tgt_stride = stride; con->target_x = xstart; con->target_y = ystart; @@ -305,8 +305,8 @@ void __console_init_ex(void *conbuffer,int tgt_xstart,int tgt_ystart,int tgt_str con->con_yres = con_yres; con->tgt_stride = tgt_stride; con->con_stride = con_stride; - con->con_cols = con_xres / FONT_XSIZE; - con->con_rows = con_yres / FONT_YSIZE; + con->con_cols = (con_xres - tgt_xstart) / FONT_XSIZE; + con->con_rows = (con_yres - tgt_ystart) / FONT_YSIZE; con->cursor_row = 0; con->cursor_col = 0; con->saved_row = 0;