summaryrefslogtreecommitdiff
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-1930ca8d66f66da040c6dd18b9ab1b152c1f7142.tar.gz
rockbox-1930ca8d66f66da040c6dd18b9ab1b152c1f7142.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 @@
21#include "config.h" 21#include "config.h"
22#include "system.h" 22#include "system.h"
23 23
24#include "version.h"
24#include "gcc_extensions.h" 25#include "gcc_extensions.h"
25#include "storage.h" 26#include "storage.h"
26#include "disk.h" 27#include "disk.h"
@@ -208,6 +209,50 @@ int main(void)
208 root_menu(); 209 root_menu();
209} 210}
210 211
212/* The disk isn't ready at boot, rblogo is stored in bin and erased after boot */
213int show_logo_boot( void ) INIT_ATTR;
214int show_logo_boot( void )
215{
216 unsigned char version[32];
217 int font_h, ver_w;
218 snprintf(version, sizeof(version), "Ver. %s", rbversion);
219 ver_w = font_getstringsize(version, NULL, &font_h, FONT_SYSFIXED);
220 lcd_clear_display();
221 lcd_setfont(FONT_SYSFIXED);
222#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS)
223 /* display the logo in the blue area of the screen (bottom 48 pixels) */
224 if (ver_w > LCD_WIDTH)
225 lcd_putsxy(0, 0, rbversion);
226 else
227 lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), 0, version);
228 lcd_bmp(&bm_rockboxlogo, (LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2, 16);
229#else
230 lcd_bmp(&bm_rockboxlogo, (LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2, 10);
231 if (ver_w > LCD_WIDTH)
232 lcd_putsxy(0, LCD_HEIGHT-font_h, rbversion);
233 else
234 lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), LCD_HEIGHT-font_h, version);
235#endif
236 lcd_setfont(FONT_UI);
237 lcd_update();
238#ifdef HAVE_REMOTE_LCD
239 lcd_remote_clear_display();
240 lcd_remote_bmp(&bm_remote_rockboxlogo, 0, 10);
241 lcd_remote_setfont(FONT_SYSFIXED);
242 if (ver_w > LCD_REMOTE_WIDTH)
243 lcd_remote_putsxy(0, LCD_REMOTE_HEIGHT-font_h, rbversion);
244 else
245 lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - (ver_w/2),
246 LCD_REMOTE_HEIGHT-font_h, version);
247 lcd_remote_setfont(FONT_UI);
248 lcd_remote_update();
249#endif
250#ifdef SIMULATOR
251 sleep(HZ); /* sim is too fast to see logo */
252#endif
253 return 0;
254}
255
211#ifdef HAVE_DIRCACHE 256#ifdef HAVE_DIRCACHE
212static int INIT_ATTR init_dircache(bool preinit) 257static int INIT_ATTR init_dircache(bool preinit)
213{ 258{
@@ -241,7 +286,7 @@ static int INIT_ATTR init_dircache(bool preinit)
241 splash(0, str(LANG_SCANNING_DISK)); 286 splash(0, str(LANG_SCANNING_DISK));
242 dircache_wait(); 287 dircache_wait();
243 backlight_on(); 288 backlight_on();
244 show_logo(); 289 show_logo_boot();
245 } 290 }
246 291
247 struct dircache_info info; 292 struct dircache_info info;
@@ -307,7 +352,7 @@ static void init_tagcache(void)
307 if (clear) 352 if (clear)
308 { 353 {
309 backlight_on(); 354 backlight_on();
310 show_logo(); 355 show_logo_boot();
311 } 356 }
312} 357}
313#endif /* HAVE_TAGCACHE */ 358#endif /* HAVE_TAGCACHE */
@@ -330,7 +375,7 @@ static void init(void)
330 FOR_NB_SCREENS(i) 375 FOR_NB_SCREENS(i)
331 global_status.font_id[i] = FONT_SYSFIXED; 376 global_status.font_id[i] = FONT_SYSFIXED;
332 font_init(); 377 font_init();
333 show_logo(); 378 show_logo_boot();
334 button_init(); 379 button_init();
335 powermgmt_init(); 380 powermgmt_init();
336 backlight_init(); 381 backlight_init();
@@ -434,7 +479,7 @@ static void init(void)
434 settings_reset(); 479 settings_reset();
435 480
436 CHART(">show_logo"); 481 CHART(">show_logo");
437 show_logo(); 482 show_logo_boot();
438 CHART("<show_logo"); 483 CHART("<show_logo");
439 lang_init(core_language_builtin, language_strings, 484 lang_init(core_language_builtin, language_strings,
440 LANG_LAST_INDEX_IN_ARRAY); 485 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 @@
51#include "disk.h" 51#include "disk.h"
52 52
53static const struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG}; 53static const struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG};
54 54static int show_info(void);
55/***********************************/ 55/***********************************/
56/* MANAGE SETTINGS MENU */ 56/* MANAGE SETTINGS MENU */
57 57
@@ -113,18 +113,10 @@ MAKE_MENU(manage_settings, ID2P(LANG_MANAGE_MENU), NULL, Icon_Config,
113/***********************************/ 113/***********************************/
114/* INFO MENU */ 114/* INFO MENU */
115 115
116
117static int show_credits(void) 116static int show_credits(void)
118{ 117{
119 char credits[MAX_PATH] = { '\0' }; 118 if (plugin_load(VIEWERS_DIR "/credits.rock", NULL) != PLUGIN_OK)
120 snprintf(credits, MAX_PATH, "%s/credits.rock", VIEWERS_DIR); 119 show_info();
121 if (plugin_load(credits, NULL) != PLUGIN_OK)
122 {
123 /* show the rockbox logo and version untill a button is pressed */
124 show_logo();
125 while (IS_SYSEVENT(get_action(CONTEXT_STD, TIMEOUT_BLOCK)))
126 ;
127 }
128 return 0; 120 return 0;
129} 121}
130 122
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 @@
54#include "power.h" 54#include "power.h"
55#include "powermgmt.h" 55#include "powermgmt.h"
56#include "backlight.h" 56#include "backlight.h"
57#include "version.h"
58#include "font.h" 57#include "font.h"
59#include "splash.h" 58#include "splash.h"
60#include "tagcache.h" 59#include "tagcache.h"
@@ -756,59 +755,6 @@ long default_event_handler(long event)
756 return default_event_handler_ex(event, NULL, NULL); 755 return default_event_handler_ex(event, NULL, NULL);
757} 756}
758 757
759int show_logo( void )
760{
761 unsigned char version[32];
762 int font_h, ver_w;
763
764 snprintf(version, sizeof(version), "Ver. %s", rbversion);
765
766 ver_w = font_getstringsize(version, NULL, &font_h, FONT_SYSFIXED);
767
768 lcd_clear_display();
769
770 lcd_setfont(FONT_SYSFIXED);
771
772#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS)
773 /* display the logo in the blue area of the screen (bottom 48 pixels) */
774 if (ver_w > LCD_WIDTH)
775 lcd_putsxy(0, 0, rbversion);
776 else
777 lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), 0, version);
778
779 lcd_bmp(&bm_rockboxlogo, (LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2, 16);
780#else
781 lcd_bmp(&bm_rockboxlogo, (LCD_WIDTH - BMPWIDTH_rockboxlogo) / 2, 10);
782
783 if (ver_w > LCD_WIDTH)
784 lcd_putsxy(0, LCD_HEIGHT-font_h, rbversion);
785 else
786 lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), LCD_HEIGHT-font_h, version);
787#endif
788 lcd_setfont(FONT_UI);
789
790 lcd_update();
791
792#ifdef HAVE_REMOTE_LCD
793 lcd_remote_clear_display();
794 lcd_remote_bmp(&bm_remote_rockboxlogo, 0, 10);
795 lcd_remote_setfont(FONT_SYSFIXED);
796
797 if (ver_w > LCD_REMOTE_WIDTH)
798 lcd_remote_putsxy(0, LCD_REMOTE_HEIGHT-font_h, rbversion);
799 else
800 lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - (ver_w/2),
801 LCD_REMOTE_HEIGHT-font_h, version);
802
803 lcd_remote_setfont(FONT_UI);
804 lcd_remote_update();
805#endif
806#ifdef SIMULATOR
807 sleep(HZ); /* sim is too fast to see logo */
808#endif
809 return 0;
810}
811
812#ifdef BOOTFILE 758#ifdef BOOTFILE
813#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF) || defined(HAVE_HOTSWAP_STORAGE_AS_MAIN) 759#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF) || defined(HAVE_HOTSWAP_STORAGE_AS_MAIN)
814/* 760/*
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
112long default_event_handler(long event); 112long default_event_handler(long event);
113bool list_stop_handler(void); 113bool list_stop_handler(void);
114void car_adapter_mode_init(void) INIT_ATTR; 114void car_adapter_mode_init(void) INIT_ATTR;
115extern int show_logo(void);
116 115
117/* Unicode byte order mark sequences and lengths */ 116/* Unicode byte order mark sequences and lengths */
118#define BOM_UTF_8 "\xef\xbb\xbf" 117#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 = {
788 read_jpeg_fd, 788 read_jpeg_fd,
789#endif 789#endif
790 screen_dump_set_hook, 790 screen_dump_set_hook,
791 show_logo,
792 791
793#ifdef HAVE_WHEEL_POSITION 792#ifdef HAVE_WHEEL_POSITION
794 wheel_status, 793 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);
157#define PLUGIN_MAGIC 0x526F634B /* RocK */ 157#define PLUGIN_MAGIC 0x526F634B /* RocK */
158 158
159/* increase this every time the api struct changes */ 159/* increase this every time the api struct changes */
160#define PLUGIN_API_VERSION 258 160#define PLUGIN_API_VERSION 259
161 161
162/* update this to latest version if a change to the api struct breaks 162/* update this to latest version if a change to the api struct breaks
163 backwards compatibility (and please take the opportunity to sort in any 163 backwards compatibility (and please take the opportunity to sort in any
164 new function which are "waiting" at the end of the function table) */ 164 new function which are "waiting" at the end of the function table) */
165#define PLUGIN_MIN_API_VERSION 258 165#define PLUGIN_MIN_API_VERSION 259
166 166
167/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ 167/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
168 168
@@ -915,7 +915,6 @@ struct plugin_api {
915 int format, const struct custom_format *cformat); 915 int format, const struct custom_format *cformat);
916#endif 916#endif
917 void (*screen_dump_set_hook)(void (*hook)(int fh)); 917 void (*screen_dump_set_hook)(void (*hook)(int fh));
918 int (*show_logo)(void);
919 918
920#ifdef HAVE_WHEEL_POSITION 919#ifdef HAVE_WHEEL_POSITION
921 int (*wheel_status)(void); 920 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 @@
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/helper.h" 22#include "lib/helper.h"
23 23
24 24#ifdef HAVE_REMOTE_LCD
25#define REMOTE_WIDTH LCD_REMOTE_WIDTH
26#define REMOTE_HEIGHT LCD_REMOTE_HEIGHT
27#include "pluginbitmaps/remote_rockboxlogo.h"
28#define REMOTE_LOGO_WIDTH BMPWIDTH_remote_rockboxlogo
29#define REMOTE_LOGO_HEIGHT BMPHEIGHT_remote_rockboxlogo
30#define REMOTE_LOGO (const fb_remote_data*)remote_rockboxlogo
31#endif /* HAVE_REMOTE_LCD */
32
33#define LOGO (const fb_data*)rockboxlogo
34#include "pluginbitmaps/rockboxlogo.h"
35#define LOGO_WIDTH BMPWIDTH_rockboxlogo
36#define LOGO_HEIGHT BMPHEIGHT_rockboxlogo
25 37
26static const char* const credits[] = { 38static const char* const credits[] = {
27#include "credits.raw" /* generated list of names from docs/CREDITS */ 39#include "credits.raw" /* generated list of names from docs/CREDITS */
@@ -299,6 +311,49 @@ static void roll_credits(void)
299 } 311 }
300} 312}
301 313
314int show_logo(void)
315{
316 unsigned char version[32];
317 int font_h, ver_w;
318 rb->snprintf(version, sizeof(version), "Ver. %s", rb->rbversion);
319 ver_w = rb->font_getstringsize(version, NULL, &font_h, FONT_SYSFIXED);
320 rb->lcd_clear_display();
321 rb->lcd_setfont(FONT_SYSFIXED);
322#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS)
323 /* display the logo in the blue area of the screen (bottom 48 pixels) */
324 if (ver_w > LCD_WIDTH)
325 rb->lcd_puts_scroll(0, 0, version);
326 else
327 rb->lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), 0, version);
328 rb->lcd_bitmap(LOGO, (LCD_WIDTH - LOGO_WIDTH) / 2, 16,
329 LOGO_WIDTH, LOGO_HEIGHT);
330#else
331 rb->lcd_bitmap(LOGO, (LCD_WIDTH - LOGO_WIDTH) / 2, 10,
332 LOGO_WIDTH, LOGO_HEIGHT);
333 if (ver_w > LCD_WIDTH)
334 rb->lcd_puts_scroll(0, (LCD_HEIGHT-font_h) / font_h, version);
335 else
336 rb->lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), LCD_HEIGHT-font_h, version);
337#endif
338 rb->lcd_setfont(FONT_UI);
339 rb->lcd_update();
340#ifdef HAVE_REMOTE_LCD
341 rb->lcd_remote_clear_display();
342 rb->lcd_remote_bitmap(REMOTE_LOGO, 0, 10,
343 REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT);
344 rb->lcd_remote_setfont(FONT_SYSFIXED);
345 if (ver_w > LCD_REMOTE_WIDTH)
346 rb->lcd_remote_puts_scroll(0, (LCD_REMOTE_HEIGHT-font_h) / font_h, version);
347 else
348 rb->lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - (ver_w/2),
349 LCD_REMOTE_HEIGHT-font_h, version);
350 rb->lcd_remote_setfont(FONT_UI);
351 rb->lcd_remote_update();
352#endif
353
354 return 0;
355}
356
302enum plugin_status plugin_start(const void* parameter) 357enum plugin_status plugin_start(const void* parameter)
303{ 358{
304 (void)parameter; 359 (void)parameter;
@@ -307,17 +362,28 @@ enum plugin_status plugin_start(const void* parameter)
307 /* Turn off backlight timeout */ 362 /* Turn off backlight timeout */
308 backlight_ignore_timeout(); 363 backlight_ignore_timeout();
309 364
310 365#if LCD_DEPTH > 1
311#if LCD_DEPTH>=16
312 rb->lcd_set_foreground (LCD_WHITE); 366 rb->lcd_set_foreground (LCD_WHITE);
313 rb->lcd_set_background (LCD_BLACK); 367 rb->lcd_set_background (LCD_BLACK);
314#endif 368#endif
315 rb->show_logo(); 369#ifdef HAVE_REMOTE_LCD
370#if (LCD_REMOTE_DEPTH > 1)
371 rb->lcd_remote_set_foreground (LCD_WHITE);
372 rb->lcd_remote_set_background (LCD_BLACK);
373#endif
374#endif
375 show_logo();
316 376
317 /* Show the logo for about 3 secs allowing the user to stop */ 377 /* Show the logo for about 5 secs allowing the user to stop */
318 if(!rb->action_userabort(3*HZ)) 378 if(!rb->action_userabort(5*HZ))
379 {
380 rb->lcd_scroll_stop();
319 roll_credits(); 381 roll_credits();
382 }
320 383
384#ifdef HAVE_REMOTE_LCD
385 rb->lcd_remote_scroll_stop();
386#endif
321 387
322 /* Turn on backlight timeout (revert to settings) */ 388 /* Turn on backlight timeout (revert to settings) */
323 backlight_use_settings(); 389 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)
930 return -1; 930 return -1;
931} 931}
932 932
933RB_WRAP(show_logo)
934{
935 rb->show_logo();
936 return 0;
937}
938
939RB_WRAP(mem_stats) 933RB_WRAP(mem_stats)
940{ 934{
941 /* used, allocd, free = rb.mem_stats() */ 935 /* used, allocd, free = rb.mem_stats() */
@@ -1032,7 +1026,6 @@ static const luaL_Reg rocklib[] =
1032 1026
1033 /* MISC */ 1027 /* MISC */
1034 RB_FUNC(restart_lua), 1028 RB_FUNC(restart_lua),
1035 RB_FUNC(show_logo),
1036 RB_FUNC(mem_stats), 1029 RB_FUNC(mem_stats),
1037 1030
1038 {NULL, NULL} 1031 {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,
512 if (!id || !id[0]) 512 if (!id || !id[0])
513 id = "bitmap"; 513 id = "bitmap";
514 514
515 bool initdata = create_bm && ((strcmp(id,"rockboxlogo") == 0)
516 || (strcmp(id,"remote_rockboxlogo") == 0));
517
515 f = stdout; 518 f = stdout;
516 519
517 if (have_header) 520 if (have_header)
@@ -527,19 +530,24 @@ void generate_c_source(char *id, char* header_dir, int width, int height,
527 fprintf(fh, 530 fprintf(fh,
528 "#define BMPHEIGHT_%s %d\n" 531 "#define BMPHEIGHT_%s %d\n"
529 "#define BMPWIDTH_%s %d\n", 532 "#define BMPWIDTH_%s %d\n",
530 id, height, id, width); 533 id, height, id, width);
534
531 if (t_depth <= 8) 535 if (t_depth <= 8)
532 fprintf(fh, "extern const unsigned char %s[];\n", id); 536 fprintf(fh, "extern const unsigned char %s[]%s;\n", id,
537 initdata ? " INITDATA_ATTR":"");
533 else if (t_depth <= 16) 538 else if (t_depth <= 16)
534 fprintf(fh, "extern const unsigned short %s[];\n", id); 539 fprintf(fh, "extern const unsigned short %s[]%s;\n", id,
540 initdata ? " INITDATA_ATTR":"");
535 else 541 else
536 fprintf(fh, "extern const fb_data %s[];\n", id); 542 fprintf(fh, "extern const fb_data %s[]%s;\n", id,
543 initdata ? " INITDATA_ATTR":"");
537 544
538 545
539 if (create_bm) 546 if (create_bm)
540 { 547 {
541 fprintf(f, "#include \"lcd.h\"\n"); 548 fprintf(f, "#include \"lcd.h\"\n");
542 fprintf(fh, "extern const struct bitmap bm_%s;\n", id); 549 fprintf(fh, "extern const struct bitmap bm_%s%s;\n", id,
550 initdata ? " INITDATA_ATTR":"");
543 } 551 }
544 fclose(fh); 552 fclose(fh);
545 } else { 553 } else {