From d5d59eb4793bb5ffaa880bc2dc67908ff824e201 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 21 Dec 2009 16:43:30 +0000 Subject: [PATCH] bugfixes git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@846 be3aeb3a-fb24-0410-a615-afba39da0efa --- common/menu.c | 10 ++++++++-- linux/fbdev.c | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/common/menu.c b/common/menu.c index ded7bbc..8accc25 100644 --- a/common/menu.c +++ b/common/menu.c @@ -45,7 +45,7 @@ static const int me_sfont_w = 6, me_sfont_h = 10; // draws text to current bbp16 screen static void text_out16_(int x, int y, const char *text, int color) { - int i, l, u, tr, tg, tb, len; + int i, lh, tr, tg, tb, len; unsigned short *dest = (unsigned short *)g_screen_ptr + x + y * g_screen_width; tr = (color & 0xf800) >> 8; tg = (color & 0x07e0) >> 3; @@ -65,11 +65,17 @@ static void text_out16_(int x, int y, const char *text, int color) len = p - text; } + lh = me_mfont_h; + if (y + lh > g_screen_height) + lh = g_screen_height - y; + for (i = 0; i < len; i++) { unsigned char *src = menu_font_data + (unsigned int)text[i] * me_mfont_w * me_mfont_h / 2; unsigned short *dst = dest; - for (l = 0; l < me_mfont_h; l++, dst += g_screen_width - me_mfont_w) + int u, l; + + for (l = 0; l < lh; l++, dst += g_screen_width - me_mfont_w) { for (u = me_mfont_w / 2; u > 0; u--, src++) { diff --git a/linux/fbdev.c b/linux/fbdev.c index 6ad1d4e..474f708 100644 --- a/linux/fbdev.c +++ b/linux/fbdev.c @@ -38,6 +38,8 @@ void plat_video_flip(void) fbvar_new.yoffset = fbvar_old.yres * draw_buf; g_screen_ptr = fbdev_buffers[fbdev_buffer_write]; + + ioctl(fbdev, FBIOPAN_DISPLAY, &fbvar_new); } void plat_video_wait_vsync(void) -- 2.39.5