summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-12-18 14:30:42 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-12-19 18:59:59 -0500
commit1930ca8d66f66da040c6dd18b9ab1b152c1f7142 (patch)
tree42df5b6edfd099537deb2da81038de32146ccf6e
parentf37ebe5ed2aeacf491c4a61d081d7a64215938fa (diff)
downloadrockbox-1930ca8d66.tar.gz
rockbox-1930ca8d66.zip
remove rockboxlogo after boot INIT_ATTR
nets about 5k on clipzip (less on mono, more on others) to move rockboxlogo to .initdata section Remove show_logo completely and move to main.c remove plugin stub give credits plugin its own copy credit fallback is now show_info() Change-Id: Id9ed787e605ed29e7ab1e7a74d3821cd0f840ed4
-rw-r--r--apps/main.c53
-rw-r--r--apps/menus/main_menu.c14
-rw-r--r--apps/misc.c54
-rw-r--r--apps/misc.h1
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h5
-rw-r--r--apps/plugins/credits.c78
-rw-r--r--apps/plugins/lua/rocklib.c7
-rw-r--r--tools/bmp2rb.c18
9 files changed, 139 insertions, 92 deletions
diff --git a/apps/main.c b/apps/main.c
index 8cf202243c..1e012efb3c 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"
@@ -208,6 +209,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 +286,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;
@@ -307,7 +352,7 @@ static void init_tagcache(void)
if (clear)
{
backlight_on();
- show_logo();
+ show_logo_boot();
}
}
#endif /* HAVE_TAGCACHE */
@@ -330,7 +375,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();
@@ -434,7 +479,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);
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index a5a4ebc75a..eab675c4a0 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -51,7 +51,7 @@
#include "disk.h"
static const struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG};
-
+static int show_info(void);
/***********************************/
/* MANAGE SETTINGS MENU */
@@ -113,18 +113,10 @@ MAKE_MENU(manage_settings, ID2P(LANG_MANAGE_MENU), NULL, Icon_Config,
/***********************************/
/* INFO MENU */
-
static int show_credits(void)
{
- char credits[MAX_PATH] = { '\0' };
- snprintf(credits, MAX_PATH, "%s/credits.rock", VIEWERS_DIR);
- if (plugin_load(credits, NULL) != PLUGIN_OK)
- {
- /* show the rockbox logo and version untill a button is pressed */
- show_logo();
- while (IS_SYSEVENT(get_action(CONTEXT_STD, TIMEOUT_BLOCK)))
- ;
- }
+ if (plugin_load(VIEWERS_DIR "/credits.rock", NULL) != PLUGIN_OK)
+ show_info();
return 0;
}
diff --git a/apps/misc.c b/apps/misc.c
index 71ab913139..f878bad833 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -54,7 +54,6 @@
#include "power.h"
#include "powermgmt.h"
#include "backlight.h"
-#include "version.h"
#include "font.h"
#include "splash.h"
#include "tagcache.h"
@@ -756,59 +755,6 @@ long default_event_handler(long event)
return default_event_handler_ex(event, NULL, NULL);
}
-int show_logo( 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 BOOTFILE
#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF) || defined(HAVE_HOTSWAP_STORAGE_AS_MAIN)
/*
diff --git a/apps/misc.h b/apps/misc.h
index 463e772aa5..e2e856f212 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -112,7 +112,6 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
long default_event_handler(long event);
bool list_stop_handler(void);
void car_adapter_mode_init(void) INIT_ATTR;
-extern int show_logo(void);
/* Unicode byte order mark sequences and lengths */
#define BOM_UTF_8 "\xef\xbb\xbf"
diff --git a/apps/plugin.c b/apps/plugin.c
index 1cf4d37b2b..b017db017b 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -788,7 +788,6 @@ static const struct plugin_api rockbox_api = {
read_jpeg_fd,
#endif
screen_dump_set_hook,
- show_logo,
#ifdef HAVE_WHEEL_POSITION
wheel_status,
diff --git a/apps/plugin.h b/apps/plugin.h
index cbdbdee7cf..377b18773f 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -157,12 +157,12 @@ int plugin_open(const char *plugin, const char *parameter);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 258
+#define PLUGIN_API_VERSION 259
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
-#define PLUGIN_MIN_API_VERSION 258
+#define PLUGIN_MIN_API_VERSION 259
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
@@ -915,7 +915,6 @@ struct plugin_api {
int format, const struct custom_format *cformat);
#endif
void (*screen_dump_set_hook)(void (*hook)(int fh));
- int (*show_logo)(void);
#ifdef HAVE_WHEEL_POSITION
int (*wheel_status)(void);
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c
index efdcf42df1..782bc6eb14 100644
--- a/apps/plugins/credits.c
+++ b/apps/plugins/credits.c
@@ -21,7 +21,19 @@
#include "plugin.h"
#include "lib/helper.h"
-
+#ifdef HAVE_REMOTE_LCD
+#define REMOTE_WIDTH LCD_REMOTE_WIDTH
+#define REMOTE_HEIGHT LCD_REMOTE_HEIGHT
+#include "pluginbitmaps/remote_rockboxlogo.h"
+#define REMOTE_LOGO_WIDTH BMPWIDTH_remote_rockboxlogo
+#define REMOTE_LOGO_HEIGHT BMPHEIGHT_remote_rockboxlogo
+#define REMOTE_LOGO (const fb_remote_data*)remote_rockboxlogo
+#endif /* HAVE_REMOTE_LCD */
+
+#define LOGO (const fb_data*)rockboxlogo
+#include "pluginbitmaps/rockboxlogo.h"
+#define LOGO_WIDTH BMPWIDTH_rockboxlogo
+#define LOGO_HEIGHT BMPHEIGHT_rockboxlogo
static const char* const credits[] = {
#include "credits.raw" /* generated list of names from docs/CREDITS */
@@ -299,6 +311,49 @@ static void roll_credits(void)
}
}
+int show_logo(void)
+{
+ unsigned char version[32];
+ int font_h, ver_w;
+ rb->snprintf(version, sizeof(version), "Ver. %s", rb->rbversion);
+ ver_w = rb->font_getstringsize(version, NULL, &font_h, FONT_SYSFIXED);
+ rb->lcd_clear_display();
+ rb->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)
+ rb->lcd_puts_scroll(0, 0, version);
+ else
+ rb->lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), 0, version);
+ rb->lcd_bitmap(LOGO, (LCD_WIDTH - LOGO_WIDTH) / 2, 16,
+ LOGO_WIDTH, LOGO_HEIGHT);
+#else
+ rb->lcd_bitmap(LOGO, (LCD_WIDTH - LOGO_WIDTH) / 2, 10,
+ LOGO_WIDTH, LOGO_HEIGHT);
+ if (ver_w > LCD_WIDTH)
+ rb->lcd_puts_scroll(0, (LCD_HEIGHT-font_h) / font_h, version);
+ else
+ rb->lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), LCD_HEIGHT-font_h, version);
+#endif
+ rb->lcd_setfont(FONT_UI);
+ rb->lcd_update();
+#ifdef HAVE_REMOTE_LCD
+ rb->lcd_remote_clear_display();
+ rb->lcd_remote_bitmap(REMOTE_LOGO, 0, 10,
+ REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT);
+ rb->lcd_remote_setfont(FONT_SYSFIXED);
+ if (ver_w > LCD_REMOTE_WIDTH)
+ rb->lcd_remote_puts_scroll(0, (LCD_REMOTE_HEIGHT-font_h) / font_h, version);
+ else
+ rb->lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - (ver_w/2),
+ LCD_REMOTE_HEIGHT-font_h, version);
+ rb->lcd_remote_setfont(FONT_UI);
+ rb->lcd_remote_update();
+#endif
+
+ return 0;
+}
+
enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
@@ -307,17 +362,28 @@ enum plugin_status plugin_start(const void* parameter)
/* Turn off backlight timeout */
backlight_ignore_timeout();
-
-#if LCD_DEPTH>=16
+#if LCD_DEPTH > 1
rb->lcd_set_foreground (LCD_WHITE);
rb->lcd_set_background (LCD_BLACK);
#endif
- rb->show_logo();
+#ifdef HAVE_REMOTE_LCD
+#if (LCD_REMOTE_DEPTH > 1)
+ rb->lcd_remote_set_foreground (LCD_WHITE);
+ rb->lcd_remote_set_background (LCD_BLACK);
+#endif
+#endif
+ show_logo();
- /* Show the logo for about 3 secs allowing the user to stop */
- if(!rb->action_userabort(3*HZ))
+ /* Show the logo for about 5 secs allowing the user to stop */
+ if(!rb->action_userabort(5*HZ))
+ {
+ rb->lcd_scroll_stop();
roll_credits();
+ }
+#ifdef HAVE_REMOTE_LCD
+ rb->lcd_remote_scroll_stop();
+#endif
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings();
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index cadc8be6ac..8efaaab169 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -930,12 +930,6 @@ RB_WRAP(restart_lua)
return -1;
}
-RB_WRAP(show_logo)
-{
- rb->show_logo();
- return 0;
-}
-
RB_WRAP(mem_stats)
{
/* used, allocd, free = rb.mem_stats() */
@@ -1032,7 +1026,6 @@ static const luaL_Reg rocklib[] =
/* MISC */
RB_FUNC(restart_lua),
- RB_FUNC(show_logo),
RB_FUNC(mem_stats),
{NULL, NULL}
diff --git a/tools/bmp2rb.c b/tools/bmp2rb.c
index 387bcc05fe..1a10a17b49 100644
--- a/tools/bmp2rb.c
+++ b/tools/bmp2rb.c
@@ -512,6 +512,9 @@ void generate_c_source(char *id, char* header_dir, int width, int height,
if (!id || !id[0])
id = "bitmap";
+ bool initdata = create_bm && ((strcmp(id,"rockboxlogo") == 0)
+ || (strcmp(id,"remote_rockboxlogo") == 0));
+
f = stdout;
if (have_header)
@@ -527,19 +530,24 @@ void generate_c_source(char *id, char* header_dir, int width, int height,
fprintf(fh,
"#define BMPHEIGHT_%s %d\n"
"#define BMPWIDTH_%s %d\n",
- id, height, id, width);
+ id, height, id, width);
+
if (t_depth <= 8)
- fprintf(fh, "extern const unsigned char %s[];\n", id);
+ fprintf(fh, "extern const unsigned char %s[]%s;\n", id,
+ initdata ? " INITDATA_ATTR":"");
else if (t_depth <= 16)
- fprintf(fh, "extern const unsigned short %s[];\n", id);
+ fprintf(fh, "extern const unsigned short %s[]%s;\n", id,
+ initdata ? " INITDATA_ATTR":"");
else
- fprintf(fh, "extern const fb_data %s[];\n", id);
+ fprintf(fh, "extern const fb_data %s[]%s;\n", id,
+ initdata ? " INITDATA_ATTR":"");
if (create_bm)
{
fprintf(f, "#include \"lcd.h\"\n");
- fprintf(fh, "extern const struct bitmap bm_%s;\n", id);
+ fprintf(fh, "extern const struct bitmap bm_%s%s;\n", id,
+ initdata ? " INITDATA_ATTR":"");
}
fclose(fh);
} else {