From efe43d2f628b636679297e3b3693f778bdbdcccf Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Fri, 29 Mar 2013 05:45:39 -0400 Subject: Stop the odd disappearing text when moving between files in recently played games. --- source/nds/draw.c | 15 +++++++++++---- source/nds/draw.h | 4 +++- source/nds/gui.c | 8 ++++---- 3 files changed, 18 insertions(+), 9 deletions(-) (limited to 'source/nds') diff --git a/source/nds/draw.c b/source/nds/draw.c index e33d0c6..56d5051 100644 --- a/source/nds/draw.c +++ b/source/nds/draw.c @@ -418,7 +418,7 @@ static u32 scroll_string_num= 0; * Output: the scroller's handle, to be used to scroll the text in * draw_hscroll. */ -u32 draw_hscroll_init(void* screen_addr, u32 sx, u32 sy, u32 width, +u32 hscroll_init(void* screen_addr, u32 sx, u32 sy, u32 width, u32 color_bg, u32 color_fg, char *string) { u32 index, x, textWidth, num, len, i; @@ -497,12 +497,19 @@ u32 draw_hscroll_init(void* screen_addr, u32 sx, u32 sy, u32 width, x += BDF_render16_ucs(screenp + x, textWidth, 0, color_bg, color_fg, unicode[i++]); } - // 5. Draw text to the screen at its initial position (left justified). - draw_hscroll(index, 0 /* stay on the left */); - return index; // (1. Which scroller?) } +u32 draw_hscroll_init(void* screen_addr, u32 sx, u32 sy, u32 width, + u32 color_bg, u32 color_fg, char *string) +{ + u32 ret = hscroll_init(screen_addr, sx, sy, width, color_bg, color_fg, string); + + draw_hscroll(index, 0 /* stay on the left */); + + return ret; +} + /* * Scrolls an initialised scroller's text. * A scroller is never allowed to go past the beginning of the text when diff --git a/source/nds/draw.h b/source/nds/draw.h index dc34bf7..b81328a 100644 --- a/source/nds/draw.h +++ b/source/nds/draw.h @@ -161,7 +161,9 @@ extern void draw_message(void* screen_address, u16 *screen_bg, u32 sx, u32 sy, u extern void draw_string_vcenter(void* screen_address, u32 sx, u32 sy, u32 width, u32 color_fg, char *string); -#define MAX_SCROLL_STRING 8 +#define MAX_SCROLL_STRING 16 +extern u32 hscroll_init(void* screen_address, u32 sx, u32 sy, u32 width, + u32 color_bg, u32 color_fg, char *string); extern u32 draw_hscroll_init(void* screen_address, u32 sx, u32 sy, u32 width, u32 color_bg, u32 color_fg, char *string); extern u32 draw_hscroll(u32 index, s32 scroll_val); diff --git a/source/nds/gui.c b/source/nds/gui.c index 8b645fe..be95ed1 100644 --- a/source/nds/gui.c +++ b/source/nds/gui.c @@ -3694,7 +3694,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation) { draw_hscroll_over(current_option_num-1); ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/'); - draw_hscroll_init(down_screen_addr, OPTION_TEXT_X, 40 + (current_option_num-1)*27, OPTION_TEXT_SX, + hscroll_init(down_screen_addr, OPTION_TEXT_X, 40 + (current_option_num-1)*27, OPTION_TEXT_SX, COLOR_TRANS, COLOR_INACTIVE_ITEM, ext_pos+1); } @@ -3708,7 +3708,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation) { draw_hscroll_over(current_option_num-1); ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/'); - draw_hscroll_init(down_screen_addr, OPTION_TEXT_X, 40 + (current_option_num-1)*27, OPTION_TEXT_SX, + hscroll_init(down_screen_addr, OPTION_TEXT_X, 40 + (current_option_num-1)*27, OPTION_TEXT_SX, COLOR_TRANS, COLOR_ACTIVE_ITEM, ext_pos+1); } @@ -3720,7 +3720,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation) { draw_hscroll_over(current_option_num-1); ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/'); - draw_hscroll_init(down_screen_addr, OPTION_TEXT_X, 40 + (current_option_num-1)*27, OPTION_TEXT_SX, + hscroll_init(down_screen_addr, OPTION_TEXT_X, 40 + (current_option_num-1)*27, OPTION_TEXT_SX, COLOR_TRANS, COLOR_INACTIVE_ITEM, ext_pos+1); } @@ -3733,7 +3733,7 @@ u32 menu(u16 *screen, bool8 FirstInvocation) { draw_hscroll_over(current_option_num-1); ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/'); - draw_hscroll_init(down_screen_addr, OPTION_TEXT_X, 40 + (current_option_num-1)*27, OPTION_TEXT_SX, + hscroll_init(down_screen_addr, OPTION_TEXT_X, 40 + (current_option_num-1)*27, OPTION_TEXT_SX, COLOR_TRANS, COLOR_ACTIVE_ITEM, ext_pos+1); } -- cgit v1.2.3