summaryrefslogtreecommitdiff
path: root/apps/plugins
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 /apps/plugins
parent58e9412bff9947e4514c0d55152bfad91049a60c (diff)
downloadrockbox-60895bc107f5689f19de61828d8ffe0f2f1f59b5.zip
rockbox-60895bc107f5689f19de61828d8ffe0f2f1f59b5.tar.gz
rockbox-60895bc107f5689f19de61828d8ffe0f2f1f59b5.tar.bz2
rockbox-60895bc107f5689f19de61828d8ffe0f2f1f59b5.tar.xz
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
Diffstat (limited to 'apps/plugins')
-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.c154
-rw-r--r--apps/plugins/credits.pl13
5 files changed, 184 insertions, 7 deletions
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile
index 1f1c309..96e57d3 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 cf62ee7..2543241 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 6830c74..6b06b1a 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/plugins/credits.c b/apps/plugins/credits.c
new file mode 100644
index 0000000..f172cc6
--- /dev/null
+++ b/apps/plugins/credits.c
@@ -0,0 +1,154 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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.
+ *
+ ****************************************************************************/
+#include "plugin.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
+void roll_credits(void)
+{
+ int numnames = sizeof(credits)/sizeof(char*);
+ int curr_name = 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)
+ {
+ rb->lcd_clear_display();
+
+ name = curr_name;
+ x = -curr_index;
+ len = curr_len;
+ line = curr_line;
+
+ while (x < 11)
+ {
+ int x2;
+
+ if (x < 0)
+ rb->lcd_puts(0, line, credits[name] - x);
+ else
+ rb->lcd_puts(x, line, credits[name]);
+
+ if (++name >= numnames)
+ break;
+ line ^= 1;
+
+ x2 = x + len/2;
+ if ((unsigned)x2 < 11)
+ rb->lcd_putc(x2, line, '*');
+
+ new_len = rb->strlen(credits[name]);
+ x += MAX(len/2 + 2, len - new_len/2 + 1);
+ len = new_len;
+ }
+ /* abort on keypress */
+ if (rb->button_get_w_tmo(HZ/8) & BUTTON_REL)
+ return;
+
+ if (++curr_index >= curr_len)
+ {
+ if (++curr_name >= numnames)
+ break;
+ 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;
+ }
+ }
+}
+#else
+
+void roll_credits(void)
+{
+ int i;
+ int line = 0;
+ int numnames = sizeof(credits)/sizeof(char*);
+ char buffer[40];
+
+ int y=LCD_HEIGHT;
+
+ int height;
+ int width;
+
+ rb->lcd_setfont(FONT_UI);
+
+ rb->lcd_getstringsize("A", &width, &height);
+
+ while(1) {
+ rb->lcd_clear_display();
+ for ( i=0; i <= (LCD_HEIGHT-y)/height; i++ )
+ rb->lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"");
+ rb->snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
+ line+1, numnames);
+ 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 (rb->button_get_w_tmo(HZ/20) & BUTTON_REL)
+ return;
+
+ y--;
+
+ if(y<0) {
+ line++;
+ if(line >= numnames)
+ break;
+ y+=height;
+ }
+
+ }
+}
+#endif
diff --git a/apps/plugins/credits.pl b/apps/plugins/credits.pl
new file mode 100644
index 0000000..942a96b
--- /dev/null
+++ b/apps/plugins/credits.pl
@@ -0,0 +1,13 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id$
+#
+while (<STDIN>) {
+ if(($_ =~ /^([A-Z]+[\S ]+)/) && ($_ !~ /^People/)) {
+ print "\"$1\",\n";
+ }
+}