summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-09-02 05:39:09 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-09-02 05:39:09 +0000
commit60895bc107f5689f19de61828d8ffe0f2f1f59b5 (patch)
tree0141dc6cada785f2c7c6b6655820567432c353ec
parent58e9412bff9947e4514c0d55152bfad91049a60c (diff)
Patch #1272052 by Henrik Backe - Move credits to a plugin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7450 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/Makefile11
-rw-r--r--apps/SOURCES1
-rw-r--r--apps/credits.h28
-rw-r--r--apps/main.c1
-rw-r--r--apps/main_menu.c71
-rw-r--r--apps/main_menu.h1
-rw-r--r--apps/misc.c53
-rw-r--r--apps/misc.h1
-rw-r--r--apps/plugin.c3
-rw-r--r--apps/plugin.h7
-rw-r--r--apps/plugins/Makefile11
-rw-r--r--apps/plugins/SOURCES1
-rw-r--r--apps/plugins/clock.c12
-rw-r--r--apps/plugins/credits.c (renamed from apps/credits.c)94
-rw-r--r--apps/plugins/credits.pl (renamed from apps/credits.pl)0
15 files changed, 140 insertions, 155 deletions
diff --git a/apps/Makefile b/apps/Makefile
index 5cf1ebd8a2..04e0e87728 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -152,15 +152,6 @@ $(BUILDDIR)/rombox.ucl: $(OBJDIR)/rombox.bin $(MAXOUTFILE)
echo "fake" > $@; \
fi
-$(OBJDIR)/credits.raw: $(DOCSDIR)/CREDITS
- @echo "create credits.raw"
- @perl credits.pl < $< > $@
-
-$(OBJDIR)/credits.o: credits.c credits.h $(OBJDIR)/credits.raw
- @mkdir -p `dirname $@`
- @echo "CC $<"
- @$(CC) $(CFLAGS) -c $< -o $@
-
include $(TOOLSDIR)/make.inc
$(OBJDIR)/build.lang: lang/$(LANGUAGE).lang $(TOOLSDIR)/uplang
@@ -180,7 +171,7 @@ clean:
@-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/rockbox.asm \
$(OBJDIR)/rockbox.bin $(OBJDIR)/rockbox.elf $(OBJDIR)/*.map \
$(OBJDIR)/lang.o $(OBJDIR)/build.lang $(BUILDDIR)/lang.[ch] \
- $(OBJDIR)/credits.raw $(LINKFILE) $(BUILDDIR)/rockbox.ucl $(LINKROM) \
+ $(LINKFILE) $(BUILDDIR)/rockbox.ucl $(LINKROM) \
$(BUILDDIR)/rombox.ucl $(OBJDIR)/rombox.bin $(OBJDIR)/rombox.elf \
$(MAXOUTFILE) $(DEPFILE)
@$(MAKE) -C plugins clean OBJDIR=$(OBJDIR)/plugins
diff --git a/apps/SOURCES b/apps/SOURCES
index 063abe34d7..26af159d5a 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -4,7 +4,6 @@ logfdisp.c
alarm_menu.c
abrepeat.c
bookmark.c
-credits.c
debug_menu.c
filetypes.c
language.c
diff --git a/apps/credits.h b/apps/credits.h
deleted file mode 100644
index dd4b459326..0000000000
--- a/apps/credits.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 by Robert Hak <rhak at ramapo.edu>
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#ifndef __ROCKBOX_CREDITS_H__
-#define __ROCKBOX_CREDITS_H__
-
-/* Show who worked on the project */
-void roll_credits(void);
-
-#endif
-
-
diff --git a/apps/main.c b/apps/main.c
index 6373920c74..c272dba57e 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -40,7 +40,6 @@
#endif
#include "audio.h"
#include "mp3_playback.h"
-#include "main_menu.h"
#include "thread.h"
#include "settings.h"
#include "backlight.h"
diff --git a/apps/main_menu.c b/apps/main_menu.c
index b887ed6504..deaeb9b2ec 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -22,13 +22,11 @@
#include "menu.h"
#include "tree.h"
-#include "credits.h"
#include "lcd.h"
#include "font.h"
#include "button.h"
#include "kernel.h"
#include "main_menu.h"
-#include "version.h"
#include "debug_menu.h"
#include "sprintf.h"
#include <string.h>
@@ -50,83 +48,20 @@
#include "misc.h"
#include "lang.h"
#include "logfdisp.h"
+#include "plugin.h"
+#include "filetypes.h"
#ifdef HAVE_RECORDING
#include "recording.h"
#endif
-#ifdef HAVE_LCD_BITMAP
-#include "bmp.h"
-#include "icons.h"
-#endif /* End HAVE_LCD_BITMAP */
-
#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
-int show_logo( void )
-{
-#ifdef HAVE_LCD_BITMAP
- char version[32];
- int font_h, font_w;
-
- lcd_clear_display();
-#if LCD_WIDTH == 112 || LCD_WIDTH == 128
- lcd_bitmap(rockbox112x37, 0, 10, 112, 37);
-#endif
-#if LCD_WIDTH >= 160
- lcd_bitmap(rockbox160x53x2, 0, 10, 160, 53);
-#endif
-
-#ifdef HAVE_REMOTE_LCD
- lcd_remote_clear_display();
- lcd_remote_bitmap(rockbox112x37,10,14,112,37);
-#endif
-
- snprintf(version, sizeof(version), "Ver. %s", appsversion);
- lcd_setfont(FONT_SYSFIXED);
- lcd_getstringsize("A", &font_w, &font_h);
- lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2),
- LCD_HEIGHT-font_h, version);
- lcd_update();
-
-#ifdef HAVE_REMOTE_LCD
- lcd_remote_setfont(FONT_SYSFIXED);
- lcd_remote_getstringsize("A", &font_w, &font_h);
- lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - ((strlen(version)*font_w)/2),
- LCD_REMOTE_HEIGHT-font_h, version);
- lcd_remote_update();
-#endif
-
-#else
- char *rockbox = " ROCKbox!";
- lcd_clear_display();
- lcd_double_height(true);
- lcd_puts(0, 0, rockbox);
- lcd_puts(0, 1, appsversion);
-#endif
-
- return 0;
-}
-
bool show_credits(void)
{
- int j = 0;
- int btn;
-
- show_logo();
-#ifdef HAVE_LCD_CHARCELLS
- lcd_double_height(false);
-#endif
-
- for (j = 0; j < 10; j++) {
- sleep((HZ*2)/10);
-
- btn = button_get(false);
- if (btn != BUTTON_NONE && !(btn & BUTTON_REL))
- return false;
- }
- roll_credits();
+ plugin_load("/.rockbox/rocks/credits.rock",NULL);
return false;
}
diff --git a/apps/main_menu.h b/apps/main_menu.h
index f05cc52adc..d1c36b3663 100644
--- a/apps/main_menu.h
+++ b/apps/main_menu.h
@@ -21,7 +21,6 @@
#include "menu.h"
-extern int show_logo(void);
extern bool main_menu(void);
extern bool rec_menu(void);
diff --git a/apps/misc.c b/apps/misc.c
index 6751da9d69..ddf8d06e7b 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -24,6 +24,7 @@
#include "file.h"
#include "dir.h"
#include "lcd.h"
+#include "lcd-remote.h"
#include "sprintf.h"
#include "errno.h"
#include "system.h"
@@ -40,10 +41,17 @@
#include "powermgmt.h"
#include "backlight.h"
#include "atoi.h"
+#include "version.h"
+#include "font.h"
#ifdef HAVE_MMC
#include "ata_mmc.h"
#endif
+#ifdef HAVE_LCD_BITMAP
+#include "bmp.h"
+#include "icons.h"
+#endif /* End HAVE_LCD_BITMAP */
+
/* Format a large-range value for output, using the appropriate unit so that
* the displayed value is in the range 1 <= display < 1000 (1024 for "binary"
* units) if possible, and 3 significant digits are shown. If a buffer is
@@ -482,3 +490,48 @@ long default_event_handler(long event)
{
return default_event_handler_ex(event, NULL, NULL);
}
+
+int show_logo( void )
+{
+#ifdef HAVE_LCD_BITMAP
+ char version[32];
+ int font_h, font_w;
+
+ lcd_clear_display();
+#if LCD_WIDTH == 112 || LCD_WIDTH == 128
+ lcd_bitmap(rockbox112x37, 0, 10, 112, 37);
+#endif
+#if LCD_WIDTH >= 160
+ lcd_bitmap(rockbox160x53x2, 0, 10, 160, 53);
+#endif
+
+#ifdef HAVE_REMOTE_LCD
+ lcd_remote_clear_display();
+ lcd_remote_bitmap(rockbox112x37,10,14,112,37);
+#endif
+
+ snprintf(version, sizeof(version), "Ver. %s", appsversion);
+ lcd_setfont(FONT_SYSFIXED);
+ lcd_getstringsize("A", &font_w, &font_h);
+ lcd_putsxy((LCD_WIDTH/2) - ((strlen(version)*font_w)/2),
+ LCD_HEIGHT-font_h, version);
+ lcd_update();
+
+#ifdef HAVE_REMOTE_LCD
+ lcd_remote_setfont(FONT_SYSFIXED);
+ lcd_remote_getstringsize("A", &font_w, &font_h);
+ lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - ((strlen(version)*font_w)/2),
+ LCD_REMOTE_HEIGHT-font_h, version);
+ lcd_remote_update();
+#endif
+
+#else
+ char *rockbox = " ROCKbox!";
+ lcd_clear_display();
+ lcd_double_height(true);
+ lcd_puts(0, 0, rockbox);
+ lcd_puts(0, 1, appsversion);
+#endif
+
+ return 0;
+}
diff --git a/apps/misc.h b/apps/misc.h
index 5e7450a7b2..d637501c27 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -52,5 +52,6 @@ bool settings_parseline(char* line, char** name, char** value);
long default_event_handler_ex(long event, void (*callback)(void *), void *parameter);
long default_event_handler(long event);
void car_adapter_mode_init(void);
+extern int show_logo(void);
#endif
diff --git a/apps/plugin.c b/apps/plugin.c
index c02a8e2936..7d3b13c726 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -98,6 +98,7 @@ static const struct plugin_api rockbox_api = {
lcd_put_cursor,
lcd_remove_cursor,
PREFIX(lcd_icon),
+ lcd_double_height,
#else
#ifndef SIMULATOR
lcd_roll,
@@ -336,10 +337,10 @@ static const struct plugin_api rockbox_api = {
#ifdef HAVE_LCD_BITMAP
read_bmp_file,
#endif
+ show_logo,
/* new stuff at the end, sort into place next time
the API gets incompatible */
-
};
int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 2aa3e09475..01ace98690 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -44,6 +44,7 @@
#include "mpeg.h"
#include "audio.h"
#include "mp3_playback.h"
+#include "misc.h"
#if (HWCODEC == SWCODEC)
#include "pcm_playback.h"
#endif
@@ -88,12 +89,12 @@
#endif
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 49
+#define PLUGIN_API_VERSION 50
/* 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 49
+#define PLUGIN_MIN_API_VERSION 50
/* plugin return codes */
enum plugin_status {
@@ -151,6 +152,7 @@ struct plugin_api {
void (*lcd_put_cursor)(int x, int y, char cursor_char);
void (*lcd_remove_cursor)(void);
void (*PREFIX(lcd_icon))(int icon, bool enable);
+ void (*lcd_double_height)(bool on);
#else
#ifndef SIMULATOR
void (*lcd_roll)(int pixels);
@@ -420,6 +422,7 @@ struct plugin_api {
int (*read_bmp_file)(char* filename, int *get_width, int *get_height,
char *bitmap, int maxsize);
#endif
+ int (*show_logo)(void);
/* new stuff at the end, sort into place next time
the API gets incompatible */
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile
index 1f1c309bd2..96e57d3c76 100644
--- a/apps/plugins/Makefile
+++ b/apps/plugins/Makefile
@@ -50,6 +50,15 @@ endif
.PHONY: $(SUBDIRS)
all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE)
+$(BUILDDIR)/credits.raw: $(DOCSDIR)/CREDITS
+ @echo "create credits.raw"
+ @perl credits.pl < $< > $@
+
+$(OBJDIR)/credits.o: credits.c $(BUILDDIR)/credits.raw
+ @mkdir -p `dirname $@`
+ @echo "CC $<"
+ @$(CC) $(CFLAGS) -c $< -o $@
+
ifndef SIMVER
$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a
$(SILENT)(file=`basename $@`; \
@@ -117,7 +126,7 @@ $(SUBDIRS):
clean:
@echo "cleaning plugins"
@rm -f $(ROCKS) $(LINKFILE) $(OBJDIR)/*.rock $(DEPFILE) $(ELFS) \
- $(OBJS) $(DEFS)
+ $(BUILDDIR)/credits.raw $(OBJS) $(DEFS)
@$(MAKE) -C lib clean OBJDIR=$(OBJDIR)/lib
@$(MAKE) -C rockboy clean OBJDIR=$(OBJDIR)/rockboy
@$(MAKE) -C searchengine clean OBJDIR=$(OBJDIR)/searchengine
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index cf62ee7203..254324164a 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -1,6 +1,7 @@
/* plugins common to all models */
battery_test.c
chessclock.c
+credits.c
cube.c
favorites.c
firmware_flash.c
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c
index 6830c74d53..6b06b1a74e 100644
--- a/apps/plugins/clock.c
+++ b/apps/plugins/clock.c
@@ -91,7 +91,7 @@ Original release, featuring analog / digital modes and a few options.
/************
* Prototypes
***********/
-void show_logo(bool animate, bool show_clock_text);
+void show_clock_logo(bool animate, bool show_clock_text);
void exit_logo(void);
void save_settings(bool interface);
@@ -461,7 +461,7 @@ void save_settings(bool interface)
rb->snprintf(buf, sizeof(buf), "Saving Settings");
rb->lcd_getstringsize(buf, &buf_w, &buf_h);
rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
- show_logo(true, true);
+ show_clock_logo(true, true);
rb->lcd_update();
}
@@ -523,7 +523,7 @@ void load_settings(void)
rb->snprintf(buf, sizeof(buf), "Loading Settings");
rb->lcd_getstringsize(buf, &buf_w, &buf_h);
rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
- show_logo(true, true);
+ show_clock_logo(true, true);
rb->lcd_update();
if(fd >= 0) /* does file exist? */
@@ -1020,7 +1020,7 @@ void binary(int hour, int minute, int second)
/****************
* Shows the logo
***************/
-void show_logo(bool animate, bool show_clock_text)
+void show_clock_logo(bool animate, bool show_clock_text)
{
int y_position;
@@ -1151,7 +1151,7 @@ bool roll_credits(void)
{
rb->lcd_clear_display();
- show_logo(false, false);
+ show_clock_logo(false, false);
rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", j+1, numnames);
rb->lcd_putsxy(credits_pos-1, 0, elapsednames);
@@ -1299,7 +1299,7 @@ bool show_credits(void)
rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
/* show the logo with an animation and the clock version text */
- show_logo(true, true);
+ show_clock_logo(true, true);
rb->lcd_update();
diff --git a/apps/credits.c b/apps/plugins/credits.c
index 9acc90da19..f172cc6c18 100644
--- a/apps/credits.c
+++ b/apps/plugins/credits.c
@@ -1,10 +1,10 @@
/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Robert Hak <rhak at ramapo.edu>
@@ -16,33 +16,55 @@
* KIND, either express or implied.
*
****************************************************************************/
+#include "plugin.h"
-#include "credits.h"
-#include "lcd.h"
-#include "font.h"
-#include "kernel.h"
-#include "button.h"
-#include "sprintf.h"
-#include "string.h"
-
+void roll_credits(void);
const char* const credits[] = {
#include "credits.raw" /* generated list of names from docs/CREDITS */
};
+static struct plugin_api* rb;
+
+enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+{
+ int j = 0;
+ int btn;
+
+ TEST_PLUGIN_API(api);
+ (void)parameter;
+ rb = api;
+
+ rb->show_logo();
+#ifdef HAVE_LCD_CHARCELLS
+ rb->lcd_double_height(false);
+#endif
+
+ for (j = 0; j < 10; j++) {
+ rb->sleep((HZ*2)/10);
+
+ btn = rb->button_get(false);
+ if (btn != BUTTON_NONE && !(btn & BUTTON_REL))
+ return PLUGIN_OK;
+ }
+
+ roll_credits();
+
+ return PLUGIN_OK;
+}
+
#ifdef HAVE_LCD_CHARCELLS
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
void roll_credits(void)
{
int numnames = sizeof(credits)/sizeof(char*);
int curr_name = 0;
- int curr_len = strlen(credits[0]);
+ int curr_len = rb->strlen(credits[0]);
int curr_index = 0;
int curr_line = 0;
int name, len, new_len, line, x;
while (1)
{
- lcd_clear_display();
+ rb->lcd_clear_display();
name = curr_name;
x = -curr_index;
@@ -54,31 +76,31 @@ void roll_credits(void)
int x2;
if (x < 0)
- lcd_puts(0, line, credits[name] - x);
+ rb->lcd_puts(0, line, credits[name] - x);
else
- lcd_puts(x, line, credits[name]);
-
+ rb->lcd_puts(x, line, credits[name]);
+
if (++name >= numnames)
break;
line ^= 1;
x2 = x + len/2;
if ((unsigned)x2 < 11)
- lcd_putc(x2, line, '*');
+ rb->lcd_putc(x2, line, '*');
- new_len = strlen(credits[name]);
+ new_len = rb->strlen(credits[name]);
x += MAX(len/2 + 2, len - new_len/2 + 1);
len = new_len;
}
/* abort on keypress */
- if (button_get_w_tmo(HZ/8) & BUTTON_REL)
+ if (rb->button_get_w_tmo(HZ/8) & BUTTON_REL)
return;
if (++curr_index >= curr_len)
{
if (++curr_name >= numnames)
break;
- new_len = strlen(credits[curr_name]);
+ new_len = rb->strlen(credits[curr_name]);
curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1);
curr_len = new_len;
curr_line ^= 1;
@@ -98,24 +120,24 @@ void roll_credits(void)
int height;
int width;
-
- lcd_setfont(FONT_UI);
- lcd_getstringsize("A", &width, &height);
+ rb->lcd_setfont(FONT_UI);
+
+ rb->lcd_getstringsize("A", &width, &height);
while(1) {
- lcd_clear_display();
+ rb->lcd_clear_display();
for ( i=0; i <= (LCD_HEIGHT-y)/height; i++ )
- lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"");
- snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
+ rb->lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"");
+ rb->snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
line+1, numnames);
- lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- lcd_fillrect(0, 0, LCD_WIDTH, height);
- lcd_set_drawmode(DRMODE_SOLID);
- lcd_putsxy(0, 0, buffer);
- lcd_update();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, 0, LCD_WIDTH, height);
+ rb->lcd_set_drawmode(DRMODE_SOLID);
+ rb->lcd_putsxy(0, 0, buffer);
+ rb->lcd_update();
- if (button_get_w_tmo(HZ/20) & BUTTON_REL)
+ if (rb->button_get_w_tmo(HZ/20) & BUTTON_REL)
return;
y--;
diff --git a/apps/credits.pl b/apps/plugins/credits.pl
index 942a96b99f..942a96b99f 100644
--- a/apps/credits.pl
+++ b/apps/plugins/credits.pl