forked from len0rd/rockbox
First version of loadable fonts patch by Alex Gitelman
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1666 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
13fdf7e5a5
commit
cd225736f9
15 changed files with 400 additions and 87 deletions
|
@ -25,7 +25,7 @@ TARGET = -DARCHOS_PLAYER_OLD=1
|
||||||
# store output files in this directory:
|
# store output files in this directory:
|
||||||
OBJDIR = .
|
OBJDIR = .
|
||||||
|
|
||||||
CFLAGS = -O -W -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\"
|
CFLAGS = -O -W -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES)
|
||||||
AFLAGS += -small -relax
|
AFLAGS += -small -relax
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
|
|
13
apps/main.c
13
apps/main.c
|
@ -44,10 +44,11 @@
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "debug_menu.h"
|
#include "debug_menu.h"
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
#include "unicode.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
char appsversion[]=APPSVERSION;
|
char appsversion[]=APPSVERSION;
|
||||||
|
|
||||||
|
@ -64,6 +65,9 @@ void app_main(void)
|
||||||
void init(void)
|
void init(void)
|
||||||
{
|
{
|
||||||
init_threads();
|
init_threads();
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
unicode_init();
|
||||||
|
#endif
|
||||||
lcd_init();
|
lcd_init();
|
||||||
show_logo();
|
show_logo();
|
||||||
settings_reset();
|
settings_reset();
|
||||||
|
@ -153,8 +157,11 @@ void init(void)
|
||||||
|
|
||||||
status_init();
|
status_init();
|
||||||
usb_start_monitoring();
|
usb_start_monitoring();
|
||||||
|
|
||||||
power_init();
|
power_init();
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
unicode_init();
|
||||||
|
lcd_init_fonts();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
|
|
40
apps/menu.c
40
apps/menu.c
|
@ -22,11 +22,14 @@
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "panic.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
#include "ajf.h"
|
||||||
|
#endif
|
||||||
struct menu {
|
struct menu {
|
||||||
int top;
|
int top;
|
||||||
int cursor;
|
int cursor;
|
||||||
|
@ -54,11 +57,19 @@ static bool inuse[MAX_MENUS] = { false };
|
||||||
/* count in letter posistions, NOT pixels */
|
/* count in letter posistions, NOT pixels */
|
||||||
void put_cursorxy(int x, int y, bool on)
|
void put_cursorxy(int x, int y, bool on)
|
||||||
{
|
{
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
int fh;
|
||||||
|
unsigned char* font = lcd_getcurrentldfont();
|
||||||
|
fh = ajf_get_fontheight(font);
|
||||||
|
#else
|
||||||
|
int fh = 8;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* place the cursor */
|
/* place the cursor */
|
||||||
if(on) {
|
if(on) {
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
lcd_bitmap ( bitmap_icons_6x8[Cursor],
|
lcd_bitmap ( bitmap_icons_6x8[Cursor],
|
||||||
x*6, y*8, 4, 8, true);
|
x*6, y*fh, 4, 8, true);
|
||||||
#elif defined(SIMULATOR)
|
#elif defined(SIMULATOR)
|
||||||
/* player simulator */
|
/* player simulator */
|
||||||
unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 };
|
unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 };
|
||||||
|
@ -70,7 +81,7 @@ void put_cursorxy(int x, int y, bool on)
|
||||||
else {
|
else {
|
||||||
#if defined(HAVE_LCD_BITMAP)
|
#if defined(HAVE_LCD_BITMAP)
|
||||||
/* I use xy here since it needs to disregard the margins */
|
/* I use xy here since it needs to disregard the margins */
|
||||||
lcd_clearrect (x*6, y*8, 4, 8);
|
lcd_clearrect (x*6, y*fh, 4, 8);
|
||||||
#elif defined(SIMULATOR)
|
#elif defined(SIMULATOR)
|
||||||
/* player simulator in action */
|
/* player simulator in action */
|
||||||
lcd_clearrect (x*6, 12+y*16, 4, 8);
|
lcd_clearrect (x*6, 12+y*16, 4, 8);
|
||||||
|
@ -83,6 +94,15 @@ void put_cursorxy(int x, int y, bool on)
|
||||||
static void menu_draw(int m)
|
static void menu_draw(int m)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
int menu_lines;
|
||||||
|
int fh;
|
||||||
|
unsigned char* font = lcd_getcurrentldfont();
|
||||||
|
fh = ajf_get_fontheight(font);
|
||||||
|
menu_lines = LCD_HEIGHT/fh;
|
||||||
|
#else
|
||||||
|
int menu_lines = MENU_LINES;
|
||||||
|
#endif
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_stop_scroll();
|
lcd_stop_scroll();
|
||||||
|
@ -91,7 +111,7 @@ static void menu_draw(int m)
|
||||||
lcd_setfont(0);
|
lcd_setfont(0);
|
||||||
#endif
|
#endif
|
||||||
for (i = menus[m].top;
|
for (i = menus[m].top;
|
||||||
(i < menus[m].itemcount) && (i<menus[m].top+MENU_LINES);
|
(i < menus[m].itemcount) && (i<menus[m].top+menu_lines);
|
||||||
i++) {
|
i++) {
|
||||||
if((menus[m].cursor - menus[m].top)==(i-menus[m].top))
|
if((menus[m].cursor - menus[m].top)==(i-menus[m].top))
|
||||||
lcd_puts_scroll(1, i-menus[m].top, menus[m].items[i].desc);
|
lcd_puts_scroll(1, i-menus[m].top, menus[m].items[i].desc);
|
||||||
|
@ -111,7 +131,15 @@ static void menu_draw(int m)
|
||||||
static void put_cursor(int m, int target)
|
static void put_cursor(int m, int target)
|
||||||
{
|
{
|
||||||
bool do_update = true;
|
bool do_update = true;
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
int menu_lines;
|
||||||
|
int fh;
|
||||||
|
unsigned char* font = lcd_getcurrentldfont();
|
||||||
|
fh = ajf_get_fontheight(font);
|
||||||
|
menu_lines = LCD_HEIGHT/fh;
|
||||||
|
#else
|
||||||
|
int menu_lines = MENU_LINES;
|
||||||
|
#endif
|
||||||
put_cursorxy(0, menus[m].cursor - menus[m].top, false);
|
put_cursorxy(0, menus[m].cursor - menus[m].top, false);
|
||||||
menus[m].cursor = target;
|
menus[m].cursor = target;
|
||||||
menu_draw(m);
|
menu_draw(m);
|
||||||
|
@ -121,7 +149,7 @@ static void put_cursor(int m, int target)
|
||||||
menu_draw(m);
|
menu_draw(m);
|
||||||
do_update = false;
|
do_update = false;
|
||||||
}
|
}
|
||||||
else if ( target-menus[m].top > MENU_LINES-1 ) {
|
else if ( target-menus[m].top > menu_lines-1 ) {
|
||||||
menus[m].top++;
|
menus[m].top++;
|
||||||
menu_draw(m);
|
menu_draw(m);
|
||||||
do_update = false;
|
do_update = false;
|
||||||
|
|
44
apps/tree.c
44
apps/tree.c
|
@ -43,6 +43,10 @@
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
#include "ajf.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_FILES_IN_DIR 200
|
#define MAX_FILES_IN_DIR 200
|
||||||
#define TREE_MAX_FILENAMELEN MAX_PATH
|
#define TREE_MAX_FILENAMELEN MAX_PATH
|
||||||
#define MAX_DIR_LEVELS 10
|
#define MAX_DIR_LEVELS 10
|
||||||
|
@ -152,8 +156,20 @@ static int showdir(char *path, int start)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
int icon_type = 0;
|
int icon_type = 0;
|
||||||
|
int line_height = LINE_HEIGTH;
|
||||||
#endif
|
#endif
|
||||||
int i;
|
int i;
|
||||||
|
int tree_max_on_screen;
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
int fh;
|
||||||
|
unsigned char *font = lcd_getcurrentldfont();
|
||||||
|
fh = ajf_get_fontheight(font);
|
||||||
|
tree_max_on_screen = ((LCD_HEIGHT-MARGIN_Y)/fh)-LINE_Y;
|
||||||
|
line_height = fh;
|
||||||
|
#else
|
||||||
|
tree_max_on_screen = TREE_MAX_ON_SCREEN;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* new dir? cache it */
|
/* new dir? cache it */
|
||||||
if (strncmp(path,lastdir,sizeof(lastdir))) {
|
if (strncmp(path,lastdir,sizeof(lastdir))) {
|
||||||
|
@ -217,7 +233,7 @@ static int showdir(char *path, int start)
|
||||||
lcd_setfont(0);
|
lcd_setfont(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for ( i=start; i < start+TREE_MAX_ON_SCREEN; i++ ) {
|
for ( i=start; i < start+tree_max_on_screen; i++ ) {
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if ( i >= filesindir )
|
if ( i >= filesindir )
|
||||||
|
@ -235,9 +251,10 @@ static int showdir(char *path, int start)
|
||||||
icon_type = File;
|
icon_type = File;
|
||||||
}
|
}
|
||||||
lcd_bitmap(bitmap_icons_6x8[icon_type],
|
lcd_bitmap(bitmap_icons_6x8[icon_type],
|
||||||
6, MARGIN_Y+(LINE_Y+i-start)*LINE_HEIGTH, 6, 8, true);
|
6, MARGIN_Y+(LINE_Y+i-start)*line_height, 6, 8, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* if MP3 filter is on, cut off the extension */
|
/* if MP3 filter is on, cut off the extension */
|
||||||
if (global_settings.mp3filter &&
|
if (global_settings.mp3filter &&
|
||||||
(dircacheptr[i]->attr & (TREE_ATTR_M3U|TREE_ATTR_MP3)))
|
(dircacheptr[i]->attr & (TREE_ATTR_M3U|TREE_ATTR_MP3)))
|
||||||
|
@ -270,6 +287,15 @@ bool dirbrowse(char *root)
|
||||||
int rc;
|
int rc;
|
||||||
int button;
|
int button;
|
||||||
int start_index;
|
int start_index;
|
||||||
|
int tree_max_on_screen;
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
int fh;
|
||||||
|
unsigned char *font = lcd_getcurrentldfont();
|
||||||
|
fh = ajf_get_fontheight(font);
|
||||||
|
tree_max_on_screen = ((LCD_HEIGHT-MARGIN_Y)/fh)-LINE_Y;
|
||||||
|
#else
|
||||||
|
tree_max_on_screen = TREE_MAX_ON_SCREEN;
|
||||||
|
#endif
|
||||||
|
|
||||||
memcpy(currdir,root,sizeof(currdir));
|
memcpy(currdir,root,sizeof(currdir));
|
||||||
numentries = showdir(root, start);
|
numentries = showdir(root, start);
|
||||||
|
@ -379,7 +405,7 @@ bool dirbrowse(char *root)
|
||||||
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
|
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (numentries < TREE_MAX_ON_SCREEN) {
|
if (numentries < tree_max_on_screen) {
|
||||||
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
|
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
|
||||||
false);
|
false);
|
||||||
dircursor = numentries - 1;
|
dircursor = numentries - 1;
|
||||||
|
@ -387,11 +413,11 @@ bool dirbrowse(char *root)
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
start = numentries - TREE_MAX_ON_SCREEN;
|
start = numentries - tree_max_on_screen;
|
||||||
dircursor = TREE_MAX_ON_SCREEN - 1;
|
dircursor = tree_max_on_screen - 1;
|
||||||
numentries = showdir(currdir, start);
|
numentries = showdir(currdir, start);
|
||||||
put_cursorxy(0, CURSOR_Y + LINE_Y +
|
put_cursorxy(0, CURSOR_Y + LINE_Y +
|
||||||
TREE_MAX_ON_SCREEN - 1, true);
|
tree_max_on_screen - 1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,7 +430,7 @@ bool dirbrowse(char *root)
|
||||||
if(filesindir)
|
if(filesindir)
|
||||||
{
|
{
|
||||||
if (dircursor + start + 1 < numentries ) {
|
if (dircursor + start + 1 < numentries ) {
|
||||||
if(dircursor+1 < TREE_MAX_ON_SCREEN) {
|
if(dircursor+1 < tree_max_on_screen) {
|
||||||
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
|
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
|
||||||
false);
|
false);
|
||||||
dircursor++;
|
dircursor++;
|
||||||
|
@ -417,7 +443,7 @@ bool dirbrowse(char *root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(numentries < TREE_MAX_ON_SCREEN) {
|
if(numentries < tree_max_on_screen) {
|
||||||
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
|
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
|
||||||
false);
|
false);
|
||||||
start = dircursor = 0;
|
start = dircursor = 0;
|
||||||
|
@ -512,7 +538,7 @@ bool dirbrowse(char *root)
|
||||||
/* restore display */
|
/* restore display */
|
||||||
/* We need to adjust if the number of lines on screen have
|
/* We need to adjust if the number of lines on screen have
|
||||||
changed because of a status bar change */
|
changed because of a status bar change */
|
||||||
if(CURSOR_Y+LINE_Y+dircursor>TREE_MAX_ON_SCREEN) {
|
if(CURSOR_Y+LINE_Y+dircursor>tree_max_on_screen) {
|
||||||
start++;
|
start++;
|
||||||
dircursor--;
|
dircursor--;
|
||||||
}
|
}
|
||||||
|
|
47
apps/wps.c
47
apps/wps.c
|
@ -39,6 +39,10 @@
|
||||||
#include "widgets.h"
|
#include "widgets.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
#include "ajf.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */
|
#define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */
|
||||||
#else /* HAVE_LCD_BITMAP */
|
#else /* HAVE_LCD_BITMAP */
|
||||||
|
@ -59,6 +63,15 @@ bool keys_locked = false;
|
||||||
|
|
||||||
static void draw_screen(struct mp3entry* id3)
|
static void draw_screen(struct mp3entry* id3)
|
||||||
{
|
{
|
||||||
|
int font_height;
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
unsigned char *font = lcd_getcurrentldfont();
|
||||||
|
font_height = ajf_get_fontheight(font);
|
||||||
|
#else
|
||||||
|
font_height = 8;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
if(!id3)
|
if(!id3)
|
||||||
{
|
{
|
||||||
|
@ -125,7 +138,7 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
lcd_puts(0, l++, id3->album?id3->album:"");
|
lcd_puts(0, l++, id3->album?id3->album:"");
|
||||||
lcd_puts(0, l++, id3->artist?id3->artist:"");
|
lcd_puts(0, l++, id3->artist?id3->artist:"");
|
||||||
|
|
||||||
if(LINE_Y==0) {
|
if(LINE_Y==0&&font_height<=8) {
|
||||||
if(id3->vbr)
|
if(id3->vbr)
|
||||||
snprintf(buffer, sizeof(buffer), "%d kbit (avg)",
|
snprintf(buffer, sizeof(buffer), "%d kbit (avg)",
|
||||||
id3->bitrate);
|
id3->bitrate);
|
||||||
|
@ -133,7 +146,6 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
snprintf(buffer, sizeof(buffer), "%d kbit", id3->bitrate);
|
snprintf(buffer, sizeof(buffer), "%d kbit", id3->bitrate);
|
||||||
|
|
||||||
lcd_puts(0, l++, buffer);
|
lcd_puts(0, l++, buffer);
|
||||||
|
|
||||||
snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency);
|
snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency);
|
||||||
lcd_puts(0, l++, buffer);
|
lcd_puts(0, l++, buffer);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +160,6 @@ static void draw_screen(struct mp3entry* id3)
|
||||||
lcd_puts(0, l++, buffer);
|
lcd_puts(0, l++, buffer);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>");
|
lcd_puts(0, l++, id3->artist?id3->artist:"<no artist>");
|
||||||
lcd_puts_scroll(0, l++, id3->title?id3->title:"<no title>");
|
lcd_puts_scroll(0, l++, id3->title?id3->title:"<no title>");
|
||||||
#endif
|
#endif
|
||||||
|
@ -444,13 +455,13 @@ int wps_show(void)
|
||||||
if(!keys_locked && !dont_go_to_menu && menu_button_is_down)
|
if(!keys_locked && !dont_go_to_menu && menu_button_is_down)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
bool laststate=statusbar(false);
|
bool laststate=statusbar(false);
|
||||||
#endif
|
#endif
|
||||||
lcd_stop_scroll();
|
lcd_stop_scroll();
|
||||||
button_set_release(old_release_mask);
|
button_set_release(old_release_mask);
|
||||||
main_menu();
|
main_menu();
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
statusbar(laststate);
|
statusbar(laststate);
|
||||||
#endif
|
#endif
|
||||||
old_release_mask = button_set_release(RELEASE_MASK);
|
old_release_mask = button_set_release(RELEASE_MASK);
|
||||||
id3 = mpeg_current_track();
|
id3 = mpeg_current_track();
|
||||||
|
@ -464,14 +475,14 @@ int wps_show(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
case BUTTON_F3:
|
case BUTTON_F3:
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
if(global_settings.statusbar) {
|
if(global_settings.statusbar) {
|
||||||
statusbar_toggle();
|
statusbar_toggle();
|
||||||
draw_screen(id3);
|
draw_screen(id3);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
|
@ -504,19 +515,19 @@ int wps_show(void)
|
||||||
usb_wait_for_disconnect(&button_queue);
|
usb_wait_for_disconnect(&button_queue);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
statusbar(laststate);
|
statusbar(laststate);
|
||||||
#endif
|
#endif
|
||||||
/* Signal to our caller that we have been in USB mode */
|
/* Signal to our caller that we have been in USB mode */
|
||||||
return SYS_USB_CONNECTED;
|
return SYS_USB_CONNECTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case BUTTON_NONE: /* Timeout */
|
case BUTTON_NONE: /* Timeout */
|
||||||
if (mpeg_is_playing() && id3)
|
if (mpeg_is_playing() && id3)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
snprintf(buffer,sizeof(buffer),
|
snprintf(buffer,sizeof(buffer),
|
||||||
"Time:%3d:%02d/%d:%02d",
|
"Time:%3d:%02d/%d:%02d",
|
||||||
id3->elapsed / 60000,
|
id3->elapsed / 60000,
|
||||||
id3->elapsed % 60000 / 1000,
|
id3->elapsed % 60000 / 1000,
|
||||||
id3->length / 60000,
|
id3->length / 60000,
|
||||||
|
@ -524,9 +535,9 @@ int wps_show(void)
|
||||||
|
|
||||||
lcd_puts(0, 6, buffer);
|
lcd_puts(0, 6, buffer);
|
||||||
|
|
||||||
slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6,
|
slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6,
|
||||||
id3->elapsed*100/id3->length,
|
id3->elapsed*100/id3->length,
|
||||||
Grow_Right);
|
Grow_Right);
|
||||||
|
|
||||||
lcd_update();
|
lcd_update();
|
||||||
#else
|
#else
|
||||||
|
@ -535,7 +546,7 @@ int wps_show(void)
|
||||||
if (global_settings.wps_display ==
|
if (global_settings.wps_display ==
|
||||||
PLAY_DISPLAY_FILENAME_SCROLL)
|
PLAY_DISPLAY_FILENAME_SCROLL)
|
||||||
{
|
{
|
||||||
snprintf(buffer,sizeof(buffer), "%d:%02d/%d:%02d ",
|
snprintf(buffer,sizeof(buffer), "%d:%02d/%d:%02d ",
|
||||||
id3->elapsed / 60000,
|
id3->elapsed / 60000,
|
||||||
id3->elapsed % 60000 / 1000,
|
id3->elapsed % 60000 / 1000,
|
||||||
id3->length / 60000,
|
id3->length / 60000,
|
||||||
|
|
|
@ -15,6 +15,8 @@ OC = sh-elf-objcopy
|
||||||
|
|
||||||
INCLUDES=-Iinclude -I. -Icommon -Idrivers
|
INCLUDES=-Iinclude -I. -Icommon -Idrivers
|
||||||
|
|
||||||
|
SYSTEM_FONT = fonts/alt6x10.bdf
|
||||||
|
|
||||||
# Pick a target to build for
|
# Pick a target to build for
|
||||||
TARGET = -DARCHOS_PLAYER=1
|
TARGET = -DARCHOS_PLAYER=1
|
||||||
#TARGET = -DARCHOS_PLAYER_OLD=1
|
#TARGET = -DARCHOS_PLAYER_OLD=1
|
||||||
|
@ -23,7 +25,7 @@ TARGET = -DARCHOS_PLAYER=1
|
||||||
# store output files in this directory:
|
# store output files in this directory:
|
||||||
OBJDIR = .
|
OBJDIR = .
|
||||||
|
|
||||||
CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET)
|
CFLAGS = -W -Wall -O -m1 -nostdlib -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g -DDEBUG
|
CFLAGS += -g -DDEBUG
|
||||||
|
@ -39,7 +41,11 @@ DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common $(DEPS)/malloc
|
||||||
|
|
||||||
OUTPUT = $(OBJDIR)/librockbox.a
|
OUTPUT = $(OBJDIR)/librockbox.a
|
||||||
|
|
||||||
$(OUTPUT): $(OBJS)
|
ifdef LOADABLE_FONTS
|
||||||
|
EXTRA_TARGETS = $(OBJDIR)/system.ajf
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(OUTPUT): $(OBJS) $(EXTRA_TARGETS)
|
||||||
$(AR) ruv $@ $+
|
$(AR) ruv $@ $+
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.c
|
$(OBJDIR)/%.o: %.c
|
||||||
|
@ -50,6 +56,9 @@ $(OBJDIR)/%.o: %.S
|
||||||
@mkdir -p `dirname $@`
|
@mkdir -p `dirname $@`
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/system.ajf: ../tools/bdf2ajf $(SYSTEM_FONT)
|
||||||
|
../tools/bdf2ajf -f $(SYSTEM_FONT) -o $(OBJDIR)/system.ajf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(OUTPUT)
|
rm -f $(OBJS) $(OUTPUT)
|
||||||
rm -rf $(OBJDIR)/$(DEPS)
|
rm -rf $(OBJDIR)/$(DEPS)
|
||||||
|
|
|
@ -107,6 +107,7 @@ struct dirent* readdir(DIR* dir)
|
||||||
|
|
||||||
if ( !entry.name[0] )
|
if ( !entry.name[0] )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
strncpy(theent->d_name, entry.name, sizeof( theent->d_name ) );
|
strncpy(theent->d_name, entry.name, sizeof( theent->d_name ) );
|
||||||
theent->attribute = entry.attr;
|
theent->attribute = entry.attr;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#endif
|
#endif
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <unicode.h>
|
||||||
#include "fat.h"
|
#include "fat.h"
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
@ -1029,12 +1030,14 @@ int fat_getnext(struct fat_dir *dir, struct fat_direntry *entry)
|
||||||
/* replace shortname with longname? */
|
/* replace shortname with longname? */
|
||||||
if ( longs ) {
|
if ( longs ) {
|
||||||
int j,k,l=0;
|
int j,k,l=0;
|
||||||
|
|
||||||
/* iterate backwards through the dir entries */
|
/* iterate backwards through the dir entries */
|
||||||
for (j=longs-1; j>=0; j--) {
|
for (j=longs-1; j>=0; j--) {
|
||||||
unsigned char* ptr = dir->cached_buf;
|
unsigned char* ptr = dir->cached_buf;
|
||||||
int index = longarray[j];
|
int index = longarray[j];
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
int offset_idx = 0;
|
||||||
|
unsigned char uni_char[2];
|
||||||
|
#endif
|
||||||
/* current or cached sector? */
|
/* current or cached sector? */
|
||||||
if ( sectoridx >= SECTOR_SIZE ) {
|
if ( sectoridx >= SECTOR_SIZE ) {
|
||||||
if ( sectoridx >= SECTOR_SIZE*2 ) {
|
if ( sectoridx >= SECTOR_SIZE*2 ) {
|
||||||
|
@ -1052,16 +1055,39 @@ int fat_getnext(struct fat_dir *dir, struct fat_direntry *entry)
|
||||||
index &= SECTOR_SIZE-1;
|
index &= SECTOR_SIZE-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* piece together the name subcomponents.
|
/* piece together the name subcomponents. */
|
||||||
names are stored in unicode, but we
|
#ifdef LOADABLE_FONTS
|
||||||
only grab the low byte (iso8859-1).
|
for (k=0; k<5; k++)
|
||||||
*/
|
{
|
||||||
|
offset_idx = index + k*2 + 1;
|
||||||
|
uni_char[0] = ptr[offset_idx+1];
|
||||||
|
uni_char[1] = ptr[offset_idx];
|
||||||
|
entry->name[l++] = from_unicode(uni_char);
|
||||||
|
}
|
||||||
|
for (k=0; k<6; k++)
|
||||||
|
{
|
||||||
|
offset_idx = index + k*2 + 14;
|
||||||
|
uni_char[0] = ptr[offset_idx+1];
|
||||||
|
uni_char[1] = ptr[offset_idx];
|
||||||
|
entry->name[l++] = from_unicode(uni_char);
|
||||||
|
}
|
||||||
|
for (k=0; k<2; k++)
|
||||||
|
{
|
||||||
|
offset_idx = index + k*2 + 28;
|
||||||
|
uni_char[0] = ptr[offset_idx+1];
|
||||||
|
uni_char[1] = ptr[offset_idx];
|
||||||
|
entry->name[l++] = from_unicode(uni_char);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* names are stored in unicode, but we
|
||||||
|
only grab the low byte (iso8859-1). */
|
||||||
for (k=0; k<5; k++)
|
for (k=0; k<5; k++)
|
||||||
entry->name[l++] = ptr[index + k*2 + 1];
|
entry->name[l++] = ptr[index + k*2 + 1];
|
||||||
for (k=0; k<6; k++)
|
for (k=0; k<6; k++)
|
||||||
entry->name[l++] = ptr[index + k*2 + 14];
|
entry->name[l++] = ptr[index + k*2 + 14];
|
||||||
for (k=0; k<2; k++)
|
for (k=0; k<2; k++)
|
||||||
entry->name[l++] = ptr[index + k*2 + 28];
|
entry->name[l++] = ptr[index + k*2 + 28];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
entry->name[l]=0;
|
entry->name[l]=0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,13 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
#include "ajf.h"
|
||||||
|
#include "panic.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*** definitions ***/
|
/*** definitions ***/
|
||||||
|
|
||||||
#define LCDR (PBDR_ADDR+1)
|
#define LCDR (PBDR_ADDR+1)
|
||||||
|
@ -296,21 +303,21 @@ static void lcd_write(bool command, int byte)
|
||||||
PBDR &= ~LCD_CS; /* enable lcd chip select */
|
PBDR &= ~LCD_CS; /* enable lcd chip select */
|
||||||
|
|
||||||
if ( command ) {
|
if ( command ) {
|
||||||
on=~(LCD_SD|LCD_SC|LCD_DS);
|
on=~(LCD_SD|LCD_SC|LCD_DS);
|
||||||
off=LCD_SC;
|
off=LCD_SC;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
on=~(LCD_SD|LCD_SC);
|
on=~(LCD_SD|LCD_SC);
|
||||||
off=LCD_SC|LCD_DS;
|
off=LCD_SC|LCD_DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clock out each bit, MSB first */
|
/* clock out each bit, MSB first */
|
||||||
for (i=0x80;i;i>>=1)
|
for (i=0x80;i;i>>=1)
|
||||||
{
|
{
|
||||||
PBDR &= on;
|
PBDR &= on;
|
||||||
if (i & byte)
|
if (i & byte)
|
||||||
PBDR |= LCD_SD;
|
PBDR |= LCD_SD;
|
||||||
PBDR |= off;
|
PBDR |= off;
|
||||||
}
|
}
|
||||||
|
|
||||||
PBDR |= LCD_CS; /* disable lcd chip select */
|
PBDR |= LCD_CS; /* disable lcd chip select */
|
||||||
|
@ -322,9 +329,9 @@ static void lcd_write(bool command, int byte)
|
||||||
void lcd_backlight(bool on)
|
void lcd_backlight(bool on)
|
||||||
{
|
{
|
||||||
if ( on )
|
if ( on )
|
||||||
PAIOR |= LCD_BL;
|
PAIOR |= LCD_BL;
|
||||||
else
|
else
|
||||||
PAIOR &= ~LCD_BL;
|
PAIOR &= ~LCD_BL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
@ -431,7 +438,7 @@ void lcd_define_pattern (int which,char *pattern,int length)
|
||||||
int i;
|
int i;
|
||||||
lcd_write(true,LCD_PRAM|which);
|
lcd_write(true,LCD_PRAM|which);
|
||||||
for (i=0;i<length;i++)
|
for (i=0;i<length;i++)
|
||||||
lcd_write(false,pattern[i]);
|
lcd_write(false,pattern[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_double_height(bool on)
|
void lcd_double_height(bool on)
|
||||||
|
@ -510,7 +517,9 @@ void lcd_init (void)
|
||||||
{
|
{
|
||||||
create_thread(scroll_thread, scroll_stack,
|
create_thread(scroll_thread, scroll_stack,
|
||||||
sizeof(scroll_stack), scroll_name);
|
sizeof(scroll_stack), scroll_name);
|
||||||
|
#if defined(LOADABLE_FONTS) && defined(SIMULATOR)
|
||||||
|
lcd_init_fonts();
|
||||||
|
#endif
|
||||||
memset(icon_mirror, sizeof(icon_mirror), 0);
|
memset(icon_mirror, sizeof(icon_mirror), 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -541,8 +550,8 @@ static int ymargin=0;
|
||||||
* This contains only the printable characters (0x20-0x7f).
|
* This contains only the printable characters (0x20-0x7f).
|
||||||
* Each element in this table is a character pattern bitmap.
|
* Each element in this table is a character pattern bitmap.
|
||||||
*/
|
*/
|
||||||
#define ASCII_MIN 0x20 /* First char in table */
|
#define ASCII_MIN 0x20 /* First char in table */
|
||||||
#define ASCII_MAX 0x7f /* Last char in table */
|
#define ASCII_MAX 0x7f /* Last char in table */
|
||||||
|
|
||||||
extern unsigned char char_gen_6x8[][5];
|
extern unsigned char char_gen_6x8[][5];
|
||||||
extern unsigned char char_gen_8x12[][14];
|
extern unsigned char char_gen_8x12[][14];
|
||||||
|
@ -550,9 +559,9 @@ extern unsigned char char_gen_12x16[][22];
|
||||||
|
|
||||||
/* All zeros and ones bitmaps for area filling */
|
/* All zeros and ones bitmaps for area filling */
|
||||||
static unsigned char zeros[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
static unsigned char zeros[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00 };
|
0x00, 0x00 };
|
||||||
static unsigned char ones[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
static unsigned char ones[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff };
|
0xff, 0xff };
|
||||||
static char fonts[] = { 6,8,12 };
|
static char fonts[] = { 6,8,12 };
|
||||||
static char fontheight[] = { 8,12,16 };
|
static char fontheight[] = { 8,12,16 };
|
||||||
|
|
||||||
|
@ -654,6 +663,101 @@ void lcd_setmargins(int x, int y)
|
||||||
ymargin = y;
|
ymargin = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
|
||||||
|
static unsigned char* _font = NULL;
|
||||||
|
|
||||||
|
int lcd_init_fonts(void)
|
||||||
|
{
|
||||||
|
if (!_font)
|
||||||
|
_font = ajf_read_font("/system.ajf");
|
||||||
|
|
||||||
|
if (!_font)
|
||||||
|
{
|
||||||
|
lcd_putsxy(0,0,"No font", 0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_setldfont(unsigned char* f)
|
||||||
|
{
|
||||||
|
_font = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char* lcd_getcurrentldfont()
|
||||||
|
{
|
||||||
|
if (!_font)
|
||||||
|
panicf("No font loaded!");
|
||||||
|
return _font;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return width and height of a string with a given font.
|
||||||
|
*/
|
||||||
|
int lcd_getstringsize(unsigned char *str, unsigned char* font, int *w, int *h)
|
||||||
|
{
|
||||||
|
int width=0;
|
||||||
|
int height=0;
|
||||||
|
unsigned char ch;
|
||||||
|
|
||||||
|
if (!font)
|
||||||
|
panicf("No font specified");
|
||||||
|
|
||||||
|
while((ch = *str++))
|
||||||
|
{
|
||||||
|
int dw,dh;
|
||||||
|
ajf_get_charsize(ch, font, &dw, &dh);
|
||||||
|
if (dh>height)
|
||||||
|
height = dh;
|
||||||
|
width+=dw;
|
||||||
|
}
|
||||||
|
*w = width;
|
||||||
|
*h = height;
|
||||||
|
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Put a string at specified bit position
|
||||||
|
*/
|
||||||
|
|
||||||
|
void lcd_putsldfxy(int x, int y, unsigned char *str)
|
||||||
|
{
|
||||||
|
unsigned char ch;
|
||||||
|
int nx;
|
||||||
|
int ny=8;
|
||||||
|
int lcd_x = x;
|
||||||
|
int lcd_y = y;
|
||||||
|
if (!_font)
|
||||||
|
{
|
||||||
|
lcd_putsxy(0,0,"No font", 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ny = (int)_font[2];
|
||||||
|
while (((ch = *str++) != '\0'))
|
||||||
|
{
|
||||||
|
unsigned char *char_buf = ajf_get_charbuf(ch, _font, &nx, &ny);
|
||||||
|
if (!char_buf)
|
||||||
|
{
|
||||||
|
char_buf = ajf_get_charbuf('?', _font, &nx, &ny);
|
||||||
|
if (!char_buf)
|
||||||
|
panicf("Bad font");
|
||||||
|
}
|
||||||
|
if(lcd_x + nx > LCD_WIDTH)
|
||||||
|
break;
|
||||||
|
|
||||||
|
lcd_clearrect (lcd_x, lcd_y, 1, ny);
|
||||||
|
lcd_bitmap (&char_buf[0], lcd_x, lcd_y, nx, ny, true);
|
||||||
|
lcd_x += nx+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef LCD_PROPFONTS
|
#ifdef LCD_PROPFONTS
|
||||||
|
|
||||||
extern unsigned char char_dw_8x8_prop[][9];
|
extern unsigned char char_dw_8x8_prop[][9];
|
||||||
|
@ -746,10 +850,19 @@ void lcd_puts(int x, int y, unsigned char *str)
|
||||||
ymargin = 8;
|
ymargin = 8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(!str || !str[0])
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef LCD_PROPFONTS
|
#ifdef LCD_PROPFONTS
|
||||||
lcd_putspropxy( xmargin + x*fonts[font],
|
lcd_putspropxy( xmargin + x*fonts[font],
|
||||||
ymargin + y*fontheight[font],
|
ymargin + y*fontheight[font],
|
||||||
str, font );
|
str, font );
|
||||||
|
#elif LOADABLE_FONTS
|
||||||
|
{
|
||||||
|
int w,h;
|
||||||
|
lcd_getstringsize(str,_font,&w,&h);
|
||||||
|
lcd_putsldfxy( xmargin + x*w/strlen(str), ymargin + y*h, str );
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
lcd_putsxy( xmargin + x*fonts[font],
|
lcd_putsxy( xmargin + x*fonts[font],
|
||||||
ymargin + y*fontheight[font],
|
ymargin + y*fontheight[font],
|
||||||
|
@ -1105,25 +1218,31 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
|
||||||
s->space = 11 - x;
|
s->space = 11 - x;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef LCD_PROPFONTS
|
#if defined(LCD_PROPFONTS) || defined(LOADABLE_FONTS)
|
||||||
unsigned char ch[2];
|
unsigned char ch[2];
|
||||||
int w, h;
|
int w, h;
|
||||||
#endif
|
#endif
|
||||||
int width, height;
|
int width, height;
|
||||||
lcd_getfontsize(font, &width, &height);
|
lcd_getfontsize(font, &width, &height);
|
||||||
#ifndef LCD_PROPFONTS
|
#if defined(LCD_PROPFONTS) || defined(LOADABLE_FONTS)
|
||||||
s->space = (LCD_WIDTH - xmargin - x*width) / width;
|
|
||||||
#else
|
|
||||||
ch[1] = 0; /* zero terminate */
|
ch[1] = 0; /* zero terminate */
|
||||||
ch[0] = string[0];
|
ch[0] = string[0];
|
||||||
width = 0;
|
width = 0;
|
||||||
for (s->space = 0;
|
s->space = 0;
|
||||||
ch[0] &&
|
while ( ch[0] &&
|
||||||
(width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8));
|
#ifdef LCD_PROPFONTS
|
||||||
) {
|
(width + lcd_getstringsize(ch, 0, &w, &h) <
|
||||||
|
(LCD_WIDTH - x*8))) {
|
||||||
|
#else
|
||||||
|
(width + lcd_getstringsize(ch, _font, &w, &h) <
|
||||||
|
(LCD_WIDTH - x*8))) {
|
||||||
|
#endif
|
||||||
width += w;
|
width += w;
|
||||||
ch[0]=string[(int)++s->space];
|
s->space++;
|
||||||
|
ch[0]=string[s->space];
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
s->space = (LCD_WIDTH - xmargin - x*width) / width;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1148,11 +1267,25 @@ void lcd_stop_scroll(void)
|
||||||
scroll_count = 0;
|
scroll_count = 0;
|
||||||
|
|
||||||
#ifdef LCD_PROPFONTS
|
#ifdef LCD_PROPFONTS
|
||||||
|
|
||||||
lcd_clearrect(xmargin + s->startx*fonts[font],
|
lcd_clearrect(xmargin + s->startx*fonts[font],
|
||||||
ymargin + s->starty*fontheight[font],
|
ymargin + s->starty*fontheight[font],
|
||||||
LCD_WIDTH - xmargin,
|
LCD_WIDTH - xmargin,
|
||||||
fontheight[font]);
|
fontheight[font]);
|
||||||
|
|
||||||
|
#elif defined(LOADABLE_FONTS)
|
||||||
|
{
|
||||||
|
int w,h;
|
||||||
|
lcd_getstringsize( s->text, _font, &w, &h);
|
||||||
|
lcd_clearrect(xmargin + s->startx*w/s->textlen,
|
||||||
|
ymargin + s->starty*h,
|
||||||
|
LCD_WIDTH - xmargin,
|
||||||
|
h);
|
||||||
|
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* restore scrolled row */
|
/* restore scrolled row */
|
||||||
lcd_puts(s->startx,s->starty,s->text);
|
lcd_puts(s->startx,s->starty,s->text);
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
@ -1208,6 +1341,15 @@ static void scroll_thread(void)
|
||||||
ymargin + s->starty*fontheight[font],
|
ymargin + s->starty*fontheight[font],
|
||||||
LCD_WIDTH - xmargin,
|
LCD_WIDTH - xmargin,
|
||||||
fontheight[font]);
|
fontheight[font]);
|
||||||
|
#elif defined(LOADABLE_FONTS)
|
||||||
|
{
|
||||||
|
int w,h;
|
||||||
|
lcd_getstringsize( s->text, _font, &w, &h);
|
||||||
|
lcd_clearrect(xmargin + s->startx*w/s->textlen,
|
||||||
|
ymargin + s->starty*h,
|
||||||
|
LCD_WIDTH - xmargin,
|
||||||
|
h);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
lcd_puts(s->startx,s->starty,s->line);
|
lcd_puts(s->startx,s->starty,s->line);
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
|
@ -105,4 +105,15 @@ extern void lcd_clearpixel(int x, int y);
|
||||||
|
|
||||||
#endif /* CHARCELLS / BITMAP */
|
#endif /* CHARCELLS / BITMAP */
|
||||||
|
|
||||||
|
#ifdef LOADABLE_FONTS
|
||||||
|
extern int lcd_init_fonts(void);
|
||||||
|
extern void lcd_putsldfxy(int x, int y, unsigned char *str);
|
||||||
|
extern int lcd_getstringsize(unsigned char *str,
|
||||||
|
unsigned char* font,
|
||||||
|
int *w, int *h);
|
||||||
|
extern void lcd_setldfont(unsigned char* f);
|
||||||
|
|
||||||
|
extern unsigned char* lcd_getcurrentldfont(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __LCD_H__ */
|
#endif /* __LCD_H__ */
|
||||||
|
|
|
@ -967,6 +967,7 @@ static void mpeg_thread(void)
|
||||||
|
|
||||||
case SYS_USB_CONNECTED:
|
case SYS_USB_CONNECTED:
|
||||||
stop_playing();
|
stop_playing();
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
|
||||||
/* Tell the USB thread that we are safe */
|
/* Tell the USB thread that we are safe */
|
||||||
DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
|
DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
|
||||||
|
@ -974,6 +975,7 @@ static void mpeg_thread(void)
|
||||||
|
|
||||||
/* Wait until the USB cable is extracted again */
|
/* Wait until the USB cable is extracted again */
|
||||||
usb_wait_for_disconnect(&mpeg_queue);
|
usb_wait_for_disconnect(&mpeg_queue);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 by wavey@wavey.org
|
* Copyright (C) 2002 by wavey@wavey.org
|
||||||
*
|
*nn
|
||||||
* All files in this archive are subject to the GNU General Public License.
|
* 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.
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
*
|
*
|
||||||
|
@ -48,8 +48,9 @@ void panicf( char *fmt, ...)
|
||||||
lcd_puts(0,0,panic_buf);
|
lcd_puts(0,0,panic_buf);
|
||||||
#elif defined(HAVE_LCD_BITMAP)
|
#elif defined(HAVE_LCD_BITMAP)
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_puts(0,0,panic_buf);
|
lcd_putsxy(0,0,panic_buf,0);
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* no LCD */
|
/* no LCD */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#
|
#
|
||||||
CFLAGS := -O -s -ansi
|
CFLAGS := -O -s -ansi
|
||||||
|
|
||||||
TARGETS := scramble descramble sh2d
|
TARGETS := scramble descramble sh2d bdf2ajf
|
||||||
|
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
|
|
||||||
|
@ -18,5 +18,9 @@ descramble: descramble.c
|
||||||
|
|
||||||
sh2d: sh2d.c
|
sh2d: sh2d.c
|
||||||
|
|
||||||
|
bdf2ajf: bdf2ajf.c
|
||||||
|
gcc -O -ansi $+ -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGETS) *~
|
rm -f $(TARGETS) $(shell for f in $(TARGETS) ; do echo $$f.exe $$f.o $$f.obj ; done) *.ajf *~
|
||||||
|
|
||||||
|
|
38
tools/configure
vendored
38
tools/configure
vendored
|
@ -11,6 +11,8 @@
|
||||||
target=$1
|
target=$1
|
||||||
debug=$2
|
debug=$2
|
||||||
|
|
||||||
|
extra_defines="-"
|
||||||
|
|
||||||
input() {
|
input() {
|
||||||
read response
|
read response
|
||||||
echo $response
|
echo $response
|
||||||
|
@ -66,8 +68,9 @@ sed > Makefile \
|
||||||
-e "s,@KEYPAD@,${keypad},g" \
|
-e "s,@KEYPAD@,${keypad},g" \
|
||||||
-e "s,@PWD@,${pwd},g" \
|
-e "s,@PWD@,${pwd},g" \
|
||||||
-e "s,@SIMVER@,${simver},g" \
|
-e "s,@SIMVER@,${simver},g" \
|
||||||
|
-e "s,@EXTRA_DEFINES@,${extra_defines},g" \
|
||||||
<<EOF
|
<<EOF
|
||||||
## Automaticly generated. http://bjorn.haxx.se/rockbox/
|
## Automaticly generated. http://rockbox.haxx.se
|
||||||
|
|
||||||
SIMDIR=@SIMDIR@
|
SIMDIR=@SIMDIR@
|
||||||
DEBUG=@DEBUG@
|
DEBUG=@DEBUG@
|
||||||
|
@ -77,13 +80,14 @@ KEYPAD=@KEYPAD@
|
||||||
THISDIR="@PWD@"
|
THISDIR="@PWD@"
|
||||||
SIMVER=@SIMVER@
|
SIMVER=@SIMVER@
|
||||||
VERSION=\$(shell date +%y%m%d-%H%M)
|
VERSION=\$(shell date +%y%m%d-%H%M)
|
||||||
|
EXTRA_DEFINES=@EXTRA_DEFINES@
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
|
|
||||||
all: sim
|
all: sim
|
||||||
|
|
||||||
sim:
|
sim:
|
||||||
\$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) VERSION=\$(VERSION)
|
\$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) EXTRA_DEFINES=\$(EXTRA_DEFINES)
|
||||||
|
|
||||||
clean-sim:
|
clean-sim:
|
||||||
\$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) clean
|
\$(MAKE) -C \$(SIMDIR) DISPLAY=\$(DISPLAY) KEYPAD=\$(KEYPAD) OBJDIR=\$(THISDIR) clean
|
||||||
|
@ -121,6 +125,7 @@ if [ "$target" = "update" ]; then
|
||||||
echo "Existing generated Makefile found. Getting defaults from it."
|
echo "Existing generated Makefile found. Getting defaults from it."
|
||||||
target=`grep "^TARGET=" Makefile | cut -d= -f2-`
|
target=`grep "^TARGET=" Makefile | cut -d= -f2-`
|
||||||
debug=`grep "^DEBUG=" Makefile | cut -d= -f2-`
|
debug=`grep "^DEBUG=" Makefile | cut -d= -f2-`
|
||||||
|
extra_defines=`grep "^EXTRA_DEFINES=" Makefile | cut -d= -f2-`
|
||||||
|
|
||||||
if [ "$debug" = "SIMULATOR=1" ]; then
|
if [ "$debug" = "SIMULATOR=1" ]; then
|
||||||
simulator="yes"
|
simulator="yes"
|
||||||
|
@ -133,7 +138,7 @@ if [ "$target" = "update" ]; then
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "Setup your Rockbox build environment."
|
echo "Setup your Rockbox build environment."
|
||||||
echo "http://bjorn.haxx.se/rockbox/"
|
echo "http://rockbox.haxx.se/"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -175,6 +180,25 @@ if [ -z "$target" ]; then
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "-" == "$extra_defines" ]; then
|
||||||
|
if [ "-DARCHOS_RECORDER" = "$target" ] ; then
|
||||||
|
|
||||||
|
echo "Loadable fonts support? (N)"
|
||||||
|
getit=`input`;
|
||||||
|
if [ "y" = "$getit" ] ; then
|
||||||
|
extra_defines="-DLOADABLE_FONTS"
|
||||||
|
else
|
||||||
|
echo "Proportional font support? (N)"
|
||||||
|
getit=`input`;
|
||||||
|
if [ "y" = "$getit" ] ; then
|
||||||
|
extra_defines="-DLCD_PROPFONTS"
|
||||||
|
else
|
||||||
|
extra_defines=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$debug" ]; then
|
if [ -z "$debug" ]; then
|
||||||
##################################################################
|
##################################################################
|
||||||
# Figure out debug on/off
|
# Figure out debug on/off
|
||||||
|
@ -250,9 +274,10 @@ sed > Makefile \
|
||||||
-e "s,@APPSDIR@,${appsdir},g" \
|
-e "s,@APPSDIR@,${appsdir},g" \
|
||||||
-e "s,@DEBUG@,${debug},g" \
|
-e "s,@DEBUG@,${debug},g" \
|
||||||
-e "s,@TARGET@,${target},g" \
|
-e "s,@TARGET@,${target},g" \
|
||||||
|
-e "s,@EXTRA_DEFINES@,${extra_defines},g" \
|
||||||
-e "s,@PWD@,${pwd},g" \
|
-e "s,@PWD@,${pwd},g" \
|
||||||
<<EOF
|
<<EOF
|
||||||
## Automaticly generated. http://bjorn.haxx.se/rockbox/
|
## Automaticly generated. http://rockbox.haxx.se
|
||||||
|
|
||||||
FIRMDIR=@FIRMDIR@
|
FIRMDIR=@FIRMDIR@
|
||||||
APPSDIR=@APPSDIR@
|
APPSDIR=@APPSDIR@
|
||||||
|
@ -261,15 +286,16 @@ TARGET=@TARGET@
|
||||||
THISDIR="@PWD@"
|
THISDIR="@PWD@"
|
||||||
VERSION=\$(shell date +%y%m%d-%H%M)
|
VERSION=\$(shell date +%y%m%d-%H%M)
|
||||||
|
|
||||||
|
EXTRA_DEFINES=@EXTRA_DEFINES@
|
||||||
.PHONY: firmware apps
|
.PHONY: firmware apps
|
||||||
|
|
||||||
all: firmware apps
|
all: firmware apps
|
||||||
|
|
||||||
firmware:
|
firmware:
|
||||||
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR)
|
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) EXTRA_DEFINES=\$(EXTRA_DEFINES)
|
||||||
|
|
||||||
apps:
|
apps:
|
||||||
\$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) VERSION=\$(VERSION)
|
\$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) EXTRA_DEFINES=\$(EXTRA_DEFINES)
|
||||||
|
|
||||||
clean-firmware:
|
clean-firmware:
|
||||||
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean
|
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean
|
||||||
|
|
|
@ -25,6 +25,7 @@ FIRMWAREDIR = ../../firmware
|
||||||
DRIVERS = $(FIRMWAREDIR)/drivers
|
DRIVERS = $(FIRMWAREDIR)/drivers
|
||||||
COMMON = $(FIRMWAREDIR)/common
|
COMMON = $(FIRMWAREDIR)/common
|
||||||
LIBMADDIR = $(PREVAPPDIR)/common/libmad
|
LIBMADDIR = $(PREVAPPDIR)/common/libmad
|
||||||
|
TOOLSDIR = ../../tools
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
|
@ -42,7 +43,7 @@ DISPLAY = -DHAVE_LCD_BITMAP
|
||||||
KEYPAD = -DHAVE_RECORDER_KEYPAD
|
KEYPAD = -DHAVE_RECORDER_KEYPAD
|
||||||
|
|
||||||
DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
|
DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
|
||||||
$(KEYPAD) $(DISPLAY) #-DLCD_PROPFONTS
|
$(KEYPAD) $(DISPLAY) $(EXTRA_DEFINES)
|
||||||
|
|
||||||
LDFLAGS = -lX11 -lm -lXt -lXmu -lnsl
|
LDFLAGS = -lX11 -lm -lXt -lXmu -lnsl
|
||||||
|
|
||||||
|
@ -69,11 +70,17 @@ ifdef MPEG_PLAY
|
||||||
INCLUDES += -I$(PREVAPPDIR)/common
|
INCLUDES += -I$(PREVAPPDIR)/common
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall
|
CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall
|
||||||
|
|
||||||
APPCFLAGS = $(DEBUG) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" $(APPINCLUDES) -W -Wall
|
APPCFLAGS = $(DEBUG) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" $(APPINCLUDES) -W -Wall
|
||||||
|
|
||||||
FIRMSRCS = chartables.c lcd.c sprintf.c id3.c debug.c usb.c mpeg.c power.c powermgmt.c
|
FIRMSRCS = chartables.c lcd.c sprintf.c id3.c debug.c usb.c mpeg.c power.c powermgmt.c
|
||||||
|
|
||||||
|
ifeq (LOADABLE_FONTS,$(findstring LOADABLE_FONTS, $(DEFINES)))
|
||||||
|
FIRMSRCS += unicode.c ajf.c panic.c
|
||||||
|
EXTRA_TARGETS = $(OBJDIR)/archos/system.ajf
|
||||||
|
SYSTEM_FONT = $(FIRMWAREDIR)/fonts/alt6x10.bdf
|
||||||
|
endif
|
||||||
|
|
||||||
APPS = main.c tree.c menu.c credits.c main_menu.c\
|
APPS = main.c tree.c menu.c credits.c main_menu.c\
|
||||||
playlist.c showtext.c wps.c settings.c status.c
|
playlist.c showtext.c wps.c settings.c status.c
|
||||||
|
@ -95,12 +102,15 @@ endif
|
||||||
|
|
||||||
OBJS := $(SRCS:%.c=$(OBJDIR)/%.o)
|
OBJS := $(SRCS:%.c=$(OBJDIR)/%.o)
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET) $(EXTRA_TARGETS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(OBJS) *~ core $(TARGET) $(CLIENTS)
|
$(RM) $(OBJS) *~ core $(TARGET) $(CLIENTS)
|
||||||
$(RM) -r $(DEPS)
|
$(RM) -r $(DEPS)
|
||||||
|
|
||||||
|
$(OBJDIR)/archos/system.ajf: $(TOOLSDIR)/bdf2ajf $(SYSTEM_FONT)
|
||||||
|
$(TOOLSDIR)/bdf2ajf -f $(SYSTEM_FONT) -o $(OBJDIR)/archos/system.ajf
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
$(RM) config.cache
|
$(RM) config.cache
|
||||||
|
|
||||||
|
@ -218,6 +228,9 @@ $(OBJDIR)/id3.o: $(FIRMWAREDIR)/id3.c
|
||||||
$(OBJDIR)/debug.o: $(FIRMWAREDIR)/debug.c
|
$(OBJDIR)/debug.o: $(FIRMWAREDIR)/debug.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/panic.o: $(FIRMWAREDIR)/panic.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/mpeg.o: $(FIRMWAREDIR)/mpeg.c
|
$(OBJDIR)/mpeg.o: $(FIRMWAREDIR)/mpeg.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
@ -230,6 +243,12 @@ $(OBJDIR)/usb.o: $(FIRMWAREDIR)/usb.c
|
||||||
$(OBJDIR)/powermgmt.o: $(FIRMWAREDIR)/powermgmt.c
|
$(OBJDIR)/powermgmt.o: $(FIRMWAREDIR)/powermgmt.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/unicode.o: $(FIRMWAREDIR)/unicode.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/ajf.o: $(FIRMWAREDIR)/ajf.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(OBJDIR)/stubs.o: ../common/stubs.c
|
$(OBJDIR)/stubs.o: ../common/stubs.c
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue