Index: apps/misc.h
===================================================================
--- apps/misc.h (revision 15901)
+++ apps/misc.h (working copy)
@@ -92,6 +92,11 @@
void car_adapter_mode_init(void);
extern int show_logo(void);
+#ifdef HAVE_LCD_BITMAP
+/* custom user spash screen */
+extern int show_splash(void);
+#endif
+
#if CONFIG_CODEC == SWCODEC
/* Return current ReplayGain mode a file should have (REPLAYGAIN_TRACK or
* REPLAYGAIN_ALBUM) if ReplayGain processing is enabled, or -1 if no
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 15901)
+++ apps/lang/english.lang (working copy)
@@ -11479,6 +11479,34 @@
+ id: LANG_SHOW_SPLASH
+ desc: in settings_menu
+ user:
+
+ *: "Configure Splash Screen"
+
+
+ *: "Configure Splash Screen"
+
+
+ *: "Configure Splash Screen"
+
+
+
+ id: LANG_SET_AS_SPLASH
+ desc: in context_menu
+ user:
+
+ *: "Set as Splash Screen"
+
+
+ *: "Set as Splash Screen"
+
+
+ *: "Set as Splash Screen"
+
+
+
id: LANG_BASS_CUTOFF
desc: Bass setting cut-off frequency
user:
@@ -11512,4 +11540,3 @@
ipodvideo: "Treble Cutoff"
-
Index: apps/onplay.c
===================================================================
--- apps/onplay.c (revision 15901)
+++ apps/onplay.c (working copy)
@@ -586,6 +586,17 @@
}
#endif
+#ifdef HAVE_LCD_BITMAP
+static bool set_splash(void)
+{
+ set_file(selected_file, (char *)global_settings.splash_file,
+ MAX_FILENAME);
+ /* will display the file that will show when set */
+ show_splash();
+ return true;
+}
+#endif
+
static bool rename_file(void)
{
char newname[MAX_PATH];
@@ -1046,6 +1057,10 @@
MENUITEM_FUNCTION(set_backdrop_item, 0, ID2P(LANG_SET_AS_BACKDROP),
set_backdrop, NULL, clipboard_callback, Icon_NOICON);
#endif
+#ifdef HAVE_LCD_BITMAP
+MENUITEM_FUNCTION(set_splash_item, 0, ID2P(LANG_SET_AS_SPLASH),
+ set_splash, NULL, clipboard_callback, Icon_NOICON);
+#endif
#ifdef HAVE_RECORDING
static bool set_recdir(void)
{
@@ -1107,6 +1122,23 @@
return ACTION_EXIT_MENUITEM;
}
#endif
+#ifdef HAVE_LCD_BITMAP
+ else if ((this_item == &set_splash_item) && (global_settings.splash_timeout > 0))
+ {
+ if (selected_file)
+ {
+ char *suffix = strrchr(selected_file, '.');
+ if (suffix)
+ {
+ if (strcasecmp(suffix, ".bmp") == 0)
+ {
+ return action;
+ }
+ }
+ }
+ return ACTION_EXIT_MENUITEM;
+ }
+#endif
else if ((selected_file_attr & ATTR_DIRECTORY))
{
if ((this_item == &delete_dir_item)
@@ -1161,6 +1193,9 @@
#if LCD_DEPTH > 1
&set_backdrop_item,
#endif
+#ifdef HAVE_LCD_BITMAP
+ &set_splash_item,
+#endif
&list_viewers_item, &create_dir_item, &properties_item,
#ifdef HAVE_RECORDING
&set_recdir_item,
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 15901)
+++ apps/settings.h (working copy)
@@ -476,6 +476,11 @@
#ifdef HAVE_LCD_BITMAP
bool offset_out_of_view;
int screen_scroll_step;
+ /* custom user splash screen */
+ int splash_timeout; /* splash screen off timeout: 0-9 0=never,
+ then according to timeout_values[] */
+ unsigned char splash_file[MAX_FILENAME+1]; /* splash screen bitmap file */
+/* custom user splash screen */
#endif
/* auto bookmark settings */
Index: apps/menus/theme_menu.c
===================================================================
--- apps/menus/theme_menu.c (revision 15901)
+++ apps/menus/theme_menu.c (working copy)
@@ -193,6 +193,11 @@
#endif
MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL);
+#ifdef HAVE_LCD_BITMAP
+/* custom user splash screen */
+MENUITEM_SETTING(splash_timeout, &global_settings.splash_timeout, NULL);
+/* custom user splash screen */
+#endif
MENUITEM_FUNCTION(browse_themes, MENU_FUNC_USEPARAM,
ID2P(LANG_CUSTOM_THEME),
browse_folder, (void*)&themes, NULL, Icon_Config);
@@ -210,6 +215,9 @@
#ifdef HAVE_REMOTE_LCD
&browse_rwps,
#endif
+#ifdef HAVE_LCD_BITMAP
+ &splash_timeout,
+#endif
&show_icons,
#if LCD_DEPTH > 1
&clear_main_bd,
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 15901)
+++ apps/settings_list.c (working copy)
@@ -217,6 +217,33 @@
return TALK_ID(value,unit);
}
+#ifdef HAVE_LCD_BITMAP
+/* for custom user splash screen */
+
+static void splash_formatter(char *buffer, size_t buffer_size,
+ int val, const char *unit)
+{
+ (void)unit;
+ if (val == 0)
+ strcpy(buffer, str(LANG_OFF));
+ else if (val == 1)
+ strcpy(buffer, str(LANG_ON));
+ else
+ snprintf(buffer, buffer_size, "%d %s", val, unit);
+}
+
+static int32_t splash_getlang(int value, int unit)
+{
+ if (value == 0)
+ return LANG_OFF;
+ else if (value == 1)
+ return LANG_ON;
+ else
+ return TALK_ID(value, unit);
+}
+/* for custom user splash screen */
+#endif
+
#ifdef HAVE_BACKLIGHT
static void backlight_formatter(char *buffer, size_t buffer_size,
int val, const char *unit)
@@ -427,6 +454,15 @@
"time format", "24hour,12hour", NULL, 2,
ID2P(LANG_24_HOUR_CLOCK), ID2P(LANG_12_HOUR_CLOCK)),
#endif
+
+/* custom user splash screen */
+ //TABLE_SETTING(0, splash_timeout, LANG_SHOW_SPLASH, 0,
+ TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, splash_timeout, LANG_SHOW_SPLASH, 0,
+ "splash timeout", off_on, UNIT_SEC, splash_formatter,
+ splash_getlang, NULL, 10,
+ 0,1,2,3,4,5,6,7,8,9),
+/* custom user splash screen */
+
#endif /* HAVE_LCD_BITMAP */
OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL),
/* system */
@@ -1094,6 +1130,8 @@
"", BACKDROP_DIR "/", ".bmp", MAX_FILENAME+1),
#endif
#ifdef HAVE_LCD_BITMAP
+ FILENAME_SETTING(F_THEMESETTING,splash_file,"splash screen",
+ "", BACKDROP_DIR "/", ".bmp", MAX_FILENAME+1),
FILENAME_SETTING(0,kbd_file,"kbd","",ROCKBOX_DIR "/",".kbd",MAX_FILENAME+1),
#endif
#ifdef HAVE_USB_POWER
Index: apps/main.c
===================================================================
--- apps/main.c (revision 15901)
+++ apps/main.c (working copy)
@@ -273,7 +273,10 @@
lcd_remote_init();
#endif
font_init();
+#ifndef HAVE_LCD_BITMAP
+/* like this for the custom splash screen */
show_logo();
+#endif
button_init();
backlight_init();
lang_init();
@@ -286,10 +289,20 @@
ata_init();
settings_reset();
settings_load(SETTINGS_ALL);
+#ifdef HAVE_LCD_BITMAP
+/* just for the sim. This mimics the behaviour on target */
+ if(global_settings.splash_timeout < 1){
+ show_logo();
+ }else{
+ show_splash();
+ }
+/* custom user splash screen */
+#endif
gui_sync_wps_init();
settings_apply();
init_dircache(true);
init_dircache(false);
+
#ifdef HAVE_TAGCACHE
init_tagcache();
#endif
@@ -363,7 +376,11 @@
#endif
font_init();
+#ifndef HAVE_LCD_BITMAP
+/* like this for the custom splash screen */
show_logo();
+#endif
+
lang_init();
#ifdef DEBUG
@@ -510,6 +527,15 @@
#endif
}
+#ifdef HAVE_LCD_BITMAP
+/* custom user splash screen */
+ if(global_settings.splash_timeout < 1){
+ show_logo();
+ }else{
+ show_splash();
+ }
+#endif
+
gui_sync_wps_init();
settings_apply();
init_dircache(false);
Index: apps/misc.c
===================================================================
--- apps/misc.c (revision 15901)
+++ apps/misc.c (working copy)
@@ -925,7 +925,49 @@
{
return default_event_handler_ex(event, NULL, NULL);
}
+#ifdef HAVE_LCD_BITMAP
+/* custom user splash */
+int show_splash( void )
+{
+#if LCD_DEPTH >= 8
+ static fb_data img_buffer[LCD_HEIGHT*LCD_WIDTH]
+ __attribute__ ((aligned (16)));
+#elif LCD_DEPTH == 2
+ static fb_data img_buffer[LCD_FBHEIGHT*LCD_FBWIDTH];
+#else
+ static fb_data img_buffer[LCD_WIDTH*LCD_HEIGHT];
+#endif
+ struct bitmap bm;
+ bm.data = (char*)img_buffer;
+ char filename[MAX_PATH];
+ snprintf(filename, MAX_PATH, "%s/%s.bmp",BACKDROP_DIR, (char *)global_settings.splash_file);
+ int ret = read_bmp_file(filename, &bm, sizeof(img_buffer),
+ FORMAT_NATIVE | FORMAT_DITHER);
+ // for bmp resize patch
+ //FORMAT_NATIVE | FORMAT_DITHER, LCD_WIDTH, LCD_HEIGHT,
+ // BMP_RESIZE_DECREASE);
+ if(ret < 0){
+ ret = read_bmp_file( "/splash.bmp", &bm, sizeof(img_buffer),
+ FORMAT_NATIVE | FORMAT_DITHER);
+ // for bmp resize patch
+ //FORMAT_NATIVE | FORMAT_DITHER, LCD_WIDTH, LCD_HEIGHT,
+ // BMP_RESIZE_DECREASE);
+ }
+ //if(ret <= 0){ // for bmp resize patch
+ if(ret <= 0 || (LCD_WIDTH < bm.width || LCD_HEIGHT < bm.height)){
+ show_logo();
+ }else{
+ lcd_bitmap(img_buffer, (LCD_WIDTH-bm.width)/2,
+ (LCD_HEIGHT-bm.height)/2, bm.width, bm.height);
+ lcd_update();
+ sleep(HZ*global_settings.splash_timeout);
+ }
+ return 0;
+}
+/* custom user splash */
+#endif
+
int show_logo( void )
{
#ifdef HAVE_LCD_BITMAP