From 354a00627e530bd854e57126f28c67b77dfd52b6 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Sat, 19 Nov 2005 09:47:31 +0000 Subject: User now receives a message if initial directory cache initialization fails. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7988 a1c6a512-1295-4272-9138-f99709370657 --- apps/main.c | 27 ++++++++++++++++++++------- firmware/include/dircache.h | 2 +- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/apps/main.c b/apps/main.c index 43ce9f4..a3fc267 100644 --- a/apps/main.c +++ b/apps/main.c @@ -99,6 +99,8 @@ void app_main(void) void init_dircache(void) { int font_w, font_h; + int result; + char buf[32]; dircache_init(); if (global_settings.dircache) @@ -109,13 +111,24 @@ void init_dircache(void) LCD_HEIGHT-font_h*3, str(LANG_DIRCACHE_BUILDING)); lcd_update(); - dircache_build(global_settings.dircache_size); - - /* Clean the text when we are done. */ - lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); - lcd_fillrect(0, LCD_HEIGHT-font_h*3, LCD_WIDTH, font_h); - lcd_set_drawmode(DRMODE_SOLID); - lcd_update(); + result = dircache_build(global_settings.dircache_size); + if (result < 0) + { + snprintf(buf, sizeof(buf), + "Failed! Result: %d", + result); + lcd_getstringsize("A", &font_w, &font_h); + lcd_putsxy((LCD_WIDTH/2) - ((strlen(buf)*font_w)/2), + LCD_HEIGHT-font_h*2, buf); + } + else + { + /* Clean the text when we are done. */ + lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); + lcd_fillrect(0, LCD_HEIGHT-font_h*3, LCD_WIDTH, font_h); + lcd_set_drawmode(DRMODE_SOLID); + lcd_update(); + } } } #else diff --git a/firmware/include/dircache.h b/firmware/include/dircache.h index 11d7335..62c5bcd 100644 --- a/firmware/include/dircache.h +++ b/firmware/include/dircache.h @@ -24,7 +24,7 @@ #ifdef HAVE_DIRCACHE #define DIRCACHE_RESERVE (1024*64) -#define DIRCACHE_LIMIT (1024*1024*2) +#define DIRCACHE_LIMIT (1024*1024*3) #define DIRCACHE_FILE ROCKBOX_DIR "/dircache.dat" /* Internal structures. */ -- cgit v1.1