summaryrefslogtreecommitdiffstats
path: root/apps/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/main.c')
-rw-r--r--apps/main.c91
1 files changed, 72 insertions, 19 deletions
diff --git a/apps/main.c b/apps/main.c
index dff9dc5778..cf7d302fc9 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "system.h"
+#include "version.h"
#include "gcc_extensions.h"
#include "storage.h"
#include "disk.h"
@@ -76,6 +77,7 @@
#include "statusbar-skinned.h"
#include "bootchart.h"
#include "logdiskf.h"
+#include "bootdata.h"
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
#include "notification.h"
#endif
@@ -167,7 +169,7 @@ int main(void)
screens[i].update();
}
list_init();
- tree_gui_init();
+ tree_init();
/* Keep the order of this 3
* Must be done before any code uses the multi-screen API */
#ifdef HAVE_USBSTACK
@@ -208,6 +210,50 @@ int main(void)
root_menu();
}
+/* The disk isn't ready at boot, rblogo is stored in bin and erased after boot */
+int show_logo_boot( void ) INIT_ATTR;
+int show_logo_boot( void )
+{
+ unsigned char version[32];
+ int font_h, ver_w;
+ snprintf(version, sizeof(version), "Ver. %s", rbversion);
+ ver_w = font_getstringsize(version, NULL, &font_h, FONT_SYSFIXED);
+ lcd_clear_display();
+ lcd_setfont(FONT_SYSFIXED);
+#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS)
+ /* display the logo in the blue area of the screen (bottom 48 pixels) */
+ if (ver_w > LCD_WIDTH)
+ lcd_putsxy(0, 0, rbversion);
+ else
+ lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), 0, version);
+ lcd_bmp(&bm_rockboxlogo, (LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2, 16);
+#else
+ lcd_bmp(&bm_rockboxlogo, (LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2, 10);
+ if (ver_w > LCD_WIDTH)
+ lcd_putsxy(0, LCD_HEIGHT-font_h, rbversion);
+ else
+ lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), LCD_HEIGHT-font_h, version);
+#endif
+ lcd_setfont(FONT_UI);
+ lcd_update();
+#ifdef HAVE_REMOTE_LCD
+ lcd_remote_clear_display();
+ lcd_remote_bmp(&bm_remote_rockboxlogo, 0, 10);
+ lcd_remote_setfont(FONT_SYSFIXED);
+ if (ver_w > LCD_REMOTE_WIDTH)
+ lcd_remote_putsxy(0, LCD_REMOTE_HEIGHT-font_h, rbversion);
+ else
+ lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - (ver_w/2),
+ LCD_REMOTE_HEIGHT-font_h, version);
+ lcd_remote_setfont(FONT_UI);
+ lcd_remote_update();
+#endif
+#ifdef SIMULATOR
+ sleep(HZ); /* sim is too fast to see logo */
+#endif
+ return 0;
+}
+
#ifdef HAVE_DIRCACHE
static int INIT_ATTR init_dircache(bool preinit)
{
@@ -241,7 +287,7 @@ static int INIT_ATTR init_dircache(bool preinit)
splash(0, str(LANG_SCANNING_DISK));
dircache_wait();
backlight_on();
- show_logo();
+ show_logo_boot();
}
struct dircache_info info;
@@ -288,13 +334,15 @@ static void init_tagcache(void)
#endif
if (lang_is_rtl())
{
- splashf(0, "[%d/%d] %s", ret, tagcache_get_max_commit_step(),
- str(LANG_TAGCACHE_INIT));
+ splash_progress(ret, tagcache_get_max_commit_step(),
+ "[%d/%d] %s", ret, tagcache_get_max_commit_step(),
+ str(LANG_TAGCACHE_INIT));
}
else
{
- splashf(0, "%s [%d/%d]", str(LANG_TAGCACHE_INIT), ret,
- tagcache_get_max_commit_step());
+ splash_progress(ret, tagcache_get_max_commit_step(),
+ "%s [%d/%d]", str(LANG_TAGCACHE_INIT), ret,
+ tagcache_get_max_commit_step());
}
clear = true;
}
@@ -305,7 +353,7 @@ static void init_tagcache(void)
if (clear)
{
backlight_on();
- show_logo();
+ show_logo_boot();
}
}
#endif /* HAVE_TAGCACHE */
@@ -328,7 +376,7 @@ static void init(void)
FOR_NB_SCREENS(i)
global_status.font_id[i] = FONT_SYSFIXED;
font_init();
- show_logo();
+ show_logo_boot();
button_init();
powermgmt_init();
backlight_init();
@@ -398,6 +446,10 @@ static void init(void)
core_allocator_init();
kernel_init();
+#if defined(HAVE_BOOTDATA) && !defined(BOOTLOADER)
+ verify_boot_data();
+#endif
+
/* early early early! */
filesystem_init();
@@ -432,7 +484,7 @@ static void init(void)
settings_reset();
CHART(">show_logo");
- show_logo();
+ show_logo_boot();
CHART("<show_logo");
lang_init(core_language_builtin, language_strings,
LANG_LAST_INDEX_IN_ARRAY);
@@ -566,27 +618,28 @@ static void init(void)
pcm_init();
dsp_init();
-#if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) || \
+ CHART(">settings_load(ALL)");
+ settings_load(SETTINGS_ALL);
+ CHART("<settings_load(ALL)");
+
+#if defined(BUTTON_REC) || \
+ (CONFIG_KEYPAD == GIGABEAT_PAD) || \
+ (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IRIVER_H10_PAD)
+ if (global_settings.clear_settings_on_hold &&
#ifdef SETTINGS_RESET
/* Reset settings if holding the reset button. (Rec on Archos,
A on Gigabeat) */
- if ((button_status() & SETTINGS_RESET) == SETTINGS_RESET)
+ ((button_status() & SETTINGS_RESET) == SETTINGS_RESET))
#else
/* Reset settings if the hold button is turned on */
- if (button_hold())
+ (button_hold()))
#endif
{
splash(HZ*2, str(LANG_RESET_DONE_CLEAR));
settings_reset();
}
- else
#endif
- {
- CHART(">settings_load(ALL)");
- settings_load(SETTINGS_ALL);
- CHART("<settings_load(ALL)");
- }
#ifdef HAVE_DIRCACHE
CHART(">init_dircache(true)");
@@ -594,7 +647,7 @@ static void init(void)
CHART("<init_dircache(true)");
#ifdef HAVE_TAGCACHE
if (rc < 0)
- remove(TAGCACHE_STATEFILE);
+ tagcache_remove_statefile();
#endif /* HAVE_TAGCACHE */
#endif /* HAVE_DIRCACHE */