summaryrefslogtreecommitdiffstats
path: root/bootloader/show_logo.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/show_logo.c')
-rw-r--r--bootloader/show_logo.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/bootloader/show_logo.c b/bootloader/show_logo.c
index 538e90299a..6584e3f24d 100644
--- a/bootloader/show_logo.c
+++ b/bootloader/show_logo.c
@@ -28,14 +28,14 @@
#include "bitmaps/rockboxlogo.h"
#if LCD_WIDTH <= 128
-#define BOOT_VERSION ("Boot " RBVERSION)
+#define BOOT_VERFMT "Boot %s"
#else
-#define BOOT_VERSION ("Boot Ver. " RBVERSION)
+#define BOOT_VERFMT "Boot Ver. %s"
#endif
/* Ensure TEXT_XPOS is >= 0 */
-#define TEXT_WIDTH ((sizeof(BOOT_VERSION)-1)*SYSFONT_WIDTH)
-#define TEXT_XPOS ((TEXT_WIDTH > LCD_WIDTH) ? 0 : ((LCD_WIDTH - TEXT_WIDTH) / 2))
+#define TEXT_WIDTH(l) ((l)*SYSFONT_WIDTH)
+#define TEXT_XPOS(w) (((w) > LCD_WIDTH) ? 0 : ((LCD_WIDTH - (w)) / 2))
#define LOGO_XPOS ((LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2)
void show_logo( void )
@@ -43,14 +43,19 @@ void show_logo( void )
lcd_clear_display();
lcd_setfont(FONT_SYSFIXED);
+ char verstr[strlen(rbversion) + sizeof (BOOT_VERFMT)];
+ int len = snprintf(verstr, sizeof(verstr), BOOT_VERFMT, rbversion);
+ int text_width = TEXT_WIDTH(len);
+ int text_xpos = TEXT_XPOS(text_width);
+
#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS)
/* The top 16 lines of the Sansa Clip screen are yellow, and the bottom 48
are blue, so we reverse the usual positioning */
- lcd_putsxy(TEXT_XPOS, 0, BOOT_VERSION);
+ lcd_putsxy(text_xpos, 0, verstr);
lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 16);
#else
lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 10);
- lcd_putsxy(TEXT_XPOS, LCD_HEIGHT-SYSFONT_HEIGHT, BOOT_VERSION);
+ lcd_putsxy(text_xpos, LCD_HEIGHT-SYSFONT_HEIGHT, verstr);
#endif
lcd_update();