1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Linus Nielsen Feltzing 2005-09-02 05:39:09 +00:00
parent 58e9412bff
commit 60895bc107
15 changed files with 140 additions and 155 deletions

View file

@ -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

View file

@ -4,7 +4,6 @@ logfdisp.c
alarm_menu.c
abrepeat.c
bookmark.c
credits.c
debug_menu.c
filetypes.c
language.c

View file

@ -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

View file

@ -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"

View file

@ -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;
}

View file

@ -21,7 +21,6 @@
#include "menu.h"
extern int show_logo(void);
extern bool main_menu(void);
extern bool rec_menu(void);

View file

@ -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;
}

View file

@ -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

View file

@ -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)

View file

@ -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 */

View file

@ -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

View file

@ -1,6 +1,7 @@
/* plugins common to all models */
battery_test.c
chessclock.c
credits.c
cube.c
favorites.c
firmware_flash.c

View file

@ -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();

View file

@ -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,9 +76,9 @@ 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;
@ -64,21 +86,21 @@ void roll_credits(void)
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;
@ -99,23 +121,23 @@ void roll_credits(void)
int height;
int width;
lcd_setfont(FONT_UI);
rb->lcd_setfont(FONT_UI);
lcd_getstringsize("A", &width, &height);
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--;