From cd225736f95555c7083b642675d013bff8057d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Sun, 11 Aug 2002 09:17:47 +0000 Subject: [PATCH] First version of loadable fonts patch by Alex Gitelman git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1666 a1c6a512-1295-4272-9138-f99709370657 --- apps/Makefile | 2 +- apps/main.c | 13 ++- apps/menu.c | 40 ++++++-- apps/tree.c | 44 +++++++-- apps/wps.c | 47 ++++++---- firmware/Makefile | 13 ++- firmware/common/dir.c | 1 + firmware/drivers/fat.c | 38 ++++++-- firmware/drivers/lcd.c | 198 +++++++++++++++++++++++++++++++++------ firmware/drivers/lcd.h | 11 +++ firmware/mpeg.c | 2 + firmware/panic.c | 5 +- tools/Makefile | 8 +- tools/configure | 38 ++++++-- uisimulator/x11/Makefile | 27 +++++- 15 files changed, 400 insertions(+), 87 deletions(-) diff --git a/apps/Makefile b/apps/Makefile index 3629813595..0347c03507 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -25,7 +25,7 @@ TARGET = -DARCHOS_PLAYER_OLD=1 # store output files in this directory: 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 ifdef DEBUG diff --git a/apps/main.c b/apps/main.c index 895f79af3b..887c85b64e 100644 --- a/apps/main.c +++ b/apps/main.c @@ -44,10 +44,11 @@ #include "backlight.h" #include "status.h" #include "debug_menu.h" - #include "version.h" - #include "sprintf.h" +#ifdef LOADABLE_FONTS +#include "unicode.h" +#endif char appsversion[]=APPSVERSION; @@ -64,6 +65,9 @@ void app_main(void) void init(void) { init_threads(); +#ifdef LOADABLE_FONTS + unicode_init(); +#endif lcd_init(); show_logo(); settings_reset(); @@ -153,8 +157,11 @@ void init(void) status_init(); usb_start_monitoring(); - power_init(); +#ifdef LOADABLE_FONTS + unicode_init(); + lcd_init_fonts(); +#endif } int main(void) diff --git a/apps/menu.c b/apps/menu.c index c8a5d0e73d..7267afe193 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -22,11 +22,14 @@ #include "button.h" #include "kernel.h" #include "debug.h" +#include "panic.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" #endif - +#ifdef LOADABLE_FONTS +#include "ajf.h" +#endif struct menu { int top; int cursor; @@ -54,11 +57,19 @@ static bool inuse[MAX_MENUS] = { false }; /* count in letter posistions, NOT pixels */ 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 */ if(on) { #ifdef HAVE_LCD_BITMAP lcd_bitmap ( bitmap_icons_6x8[Cursor], - x*6, y*8, 4, 8, true); + x*6, y*fh, 4, 8, true); #elif defined(SIMULATOR) /* player simulator */ unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 }; @@ -70,7 +81,7 @@ void put_cursorxy(int x, int y, bool on) else { #if defined(HAVE_LCD_BITMAP) /* 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) /* player simulator in action */ 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) { 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_stop_scroll(); @@ -91,7 +111,7 @@ static void menu_draw(int m) lcd_setfont(0); #endif for (i = menus[m].top; - (i < menus[m].itemcount) && (i MENU_LINES-1 ) { + else if ( target-menus[m].top > menu_lines-1 ) { menus[m].top++; menu_draw(m); do_update = false; diff --git a/apps/tree.c b/apps/tree.c index cbb19fc2bd..80af6e01d6 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -43,6 +43,10 @@ #include "icons.h" #endif +#ifdef LOADABLE_FONTS +#include "ajf.h" +#endif + #define MAX_FILES_IN_DIR 200 #define TREE_MAX_FILENAMELEN MAX_PATH #define MAX_DIR_LEVELS 10 @@ -152,8 +156,20 @@ static int showdir(char *path, int start) { #ifdef HAVE_LCD_BITMAP int icon_type = 0; + int line_height = LINE_HEIGTH; #endif 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 */ if (strncmp(path,lastdir,sizeof(lastdir))) { @@ -217,7 +233,7 @@ static int showdir(char *path, int start) lcd_setfont(0); #endif - for ( i=start; i < start+TREE_MAX_ON_SCREEN; i++ ) { + for ( i=start; i < start+tree_max_on_screen; i++ ) { int len; if ( i >= filesindir ) @@ -235,9 +251,10 @@ static int showdir(char *path, int start) icon_type = File; } 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 + /* if MP3 filter is on, cut off the extension */ if (global_settings.mp3filter && (dircacheptr[i]->attr & (TREE_ATTR_M3U|TREE_ATTR_MP3))) @@ -270,6 +287,15 @@ bool dirbrowse(char *root) int rc; int button; 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)); numentries = showdir(root, start); @@ -379,7 +405,7 @@ bool dirbrowse(char *root) put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); } else { - if (numentries < TREE_MAX_ON_SCREEN) { + if (numentries < tree_max_on_screen) { put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, false); dircursor = numentries - 1; @@ -387,11 +413,11 @@ bool dirbrowse(char *root) true); } else { - start = numentries - TREE_MAX_ON_SCREEN; - dircursor = TREE_MAX_ON_SCREEN - 1; + start = numentries - tree_max_on_screen; + dircursor = tree_max_on_screen - 1; numentries = showdir(currdir, start); 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 (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, false); dircursor++; @@ -417,7 +443,7 @@ bool dirbrowse(char *root) } } else { - if(numentries < TREE_MAX_ON_SCREEN) { + if(numentries < tree_max_on_screen) { put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, false); start = dircursor = 0; @@ -512,7 +538,7 @@ bool dirbrowse(char *root) /* restore display */ /* We need to adjust if the number of lines on screen have 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++; dircursor--; } diff --git a/apps/wps.c b/apps/wps.c index 53458ca140..2bf384b20c 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -39,6 +39,10 @@ #include "widgets.h" #endif +#ifdef LOADABLE_FONTS +#include "ajf.h" +#endif + #ifdef HAVE_LCD_BITMAP #define LINE_Y (global_settings.statusbar&&statusbar_enabled?1:0) /* Y position the entry-list starts at */ #else /* HAVE_LCD_BITMAP */ @@ -59,6 +63,15 @@ bool keys_locked = false; 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(); 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->artist?id3->artist:""); - if(LINE_Y==0) { + if(LINE_Y==0&&font_height<=8) { if(id3->vbr) snprintf(buffer, sizeof(buffer), "%d kbit (avg)", id3->bitrate); @@ -133,7 +146,6 @@ static void draw_screen(struct mp3entry* id3) snprintf(buffer, sizeof(buffer), "%d kbit", id3->bitrate); lcd_puts(0, l++, buffer); - snprintf(buffer,sizeof(buffer), "%d Hz", id3->frequency); lcd_puts(0, l++, buffer); } @@ -148,7 +160,6 @@ static void draw_screen(struct mp3entry* id3) lcd_puts(0, l++, buffer); } #else - lcd_puts(0, l++, id3->artist?id3->artist:""); lcd_puts_scroll(0, l++, id3->title?id3->title:""); #endif @@ -444,13 +455,13 @@ int wps_show(void) if(!keys_locked && !dont_go_to_menu && menu_button_is_down) { #ifdef HAVE_LCD_BITMAP - bool laststate=statusbar(false); + bool laststate=statusbar(false); #endif lcd_stop_scroll(); button_set_release(old_release_mask); main_menu(); #ifdef HAVE_LCD_BITMAP - statusbar(laststate); + statusbar(laststate); #endif old_release_mask = button_set_release(RELEASE_MASK); id3 = mpeg_current_track(); @@ -464,14 +475,14 @@ int wps_show(void) break; #ifdef HAVE_RECORDER_KEYPAD - case BUTTON_F3: + case BUTTON_F3: #ifdef HAVE_LCD_BITMAP - if(global_settings.statusbar) { - statusbar_toggle(); - draw_screen(id3); - } + if(global_settings.statusbar) { + statusbar_toggle(); + draw_screen(id3); + } #endif - break; + break; #endif #ifdef HAVE_RECORDER_KEYPAD @@ -504,19 +515,19 @@ int wps_show(void) usb_wait_for_disconnect(&button_queue); #ifdef HAVE_LCD_BITMAP - statusbar(laststate); + statusbar(laststate); #endif /* Signal to our caller that we have been in USB mode */ return SYS_USB_CONNECTED; break; - } + } #endif case BUTTON_NONE: /* Timeout */ if (mpeg_is_playing() && id3) { #ifdef HAVE_LCD_BITMAP snprintf(buffer,sizeof(buffer), - "Time:%3d:%02d/%d:%02d", + "Time:%3d:%02d/%d:%02d", id3->elapsed / 60000, id3->elapsed % 60000 / 1000, id3->length / 60000, @@ -524,9 +535,9 @@ int wps_show(void) lcd_puts(0, 6, buffer); - slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6, - id3->elapsed*100/id3->length, - Grow_Right); + slidebar(0, LCD_HEIGHT-6, LCD_WIDTH, 6, + id3->elapsed*100/id3->length, + Grow_Right); lcd_update(); #else @@ -535,7 +546,7 @@ int wps_show(void) if (global_settings.wps_display == 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 / 1000, id3->length / 60000, diff --git a/firmware/Makefile b/firmware/Makefile index 69a27a1b40..eb173848f3 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -15,6 +15,8 @@ OC = sh-elf-objcopy INCLUDES=-Iinclude -I. -Icommon -Idrivers +SYSTEM_FONT = fonts/alt6x10.bdf + # Pick a target to build for TARGET = -DARCHOS_PLAYER=1 #TARGET = -DARCHOS_PLAYER_OLD=1 @@ -23,7 +25,7 @@ TARGET = -DARCHOS_PLAYER=1 # store output files in this directory: 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 CFLAGS += -g -DDEBUG @@ -39,7 +41,11 @@ DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common $(DEPS)/malloc OUTPUT = $(OBJDIR)/librockbox.a -$(OUTPUT): $(OBJS) +ifdef LOADABLE_FONTS + EXTRA_TARGETS = $(OBJDIR)/system.ajf +endif + +$(OUTPUT): $(OBJS) $(EXTRA_TARGETS) $(AR) ruv $@ $+ $(OBJDIR)/%.o: %.c @@ -50,6 +56,9 @@ $(OBJDIR)/%.o: %.S @mkdir -p `dirname $@` $(CC) $(CFLAGS) -c $< -o $@ +$(OBJDIR)/system.ajf: ../tools/bdf2ajf $(SYSTEM_FONT) + ../tools/bdf2ajf -f $(SYSTEM_FONT) -o $(OBJDIR)/system.ajf + clean: rm -f $(OBJS) $(OUTPUT) rm -rf $(OBJDIR)/$(DEPS) diff --git a/firmware/common/dir.c b/firmware/common/dir.c index 473997bd37..809e1a28e5 100644 --- a/firmware/common/dir.c +++ b/firmware/common/dir.c @@ -107,6 +107,7 @@ struct dirent* readdir(DIR* dir) if ( !entry.name[0] ) return NULL; + strncpy(theent->d_name, entry.name, sizeof( theent->d_name ) ); theent->attribute = entry.attr; diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 75915bd710..7fe011c863 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -27,6 +27,7 @@ #include #endif #include +#include #include "fat.h" #include "ata.h" #include "debug.h" @@ -1029,12 +1030,14 @@ int fat_getnext(struct fat_dir *dir, struct fat_direntry *entry) /* replace shortname with longname? */ if ( longs ) { int j,k,l=0; - /* iterate backwards through the dir entries */ for (j=longs-1; j>=0; j--) { unsigned char* ptr = dir->cached_buf; int index = longarray[j]; - +#ifdef LOADABLE_FONTS + int offset_idx = 0; + unsigned char uni_char[2]; +#endif /* current or cached sector? */ if ( sectoridx >= SECTOR_SIZE ) { if ( sectoridx >= SECTOR_SIZE*2 ) { @@ -1052,16 +1055,39 @@ int fat_getnext(struct fat_dir *dir, struct fat_direntry *entry) index &= SECTOR_SIZE-1; } - /* piece together the name subcomponents. - names are stored in unicode, but we - only grab the low byte (iso8859-1). - */ + /* piece together the name subcomponents. */ +#ifdef LOADABLE_FONTS + 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++) entry->name[l++] = ptr[index + k*2 + 1]; for (k=0; k<6; k++) entry->name[l++] = ptr[index + k*2 + 14]; for (k=0; k<2; k++) entry->name[l++] = ptr[index + k*2 + 28]; +#endif } entry->name[l]=0; } diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c index a9cd8c65ac..806b812b82 100644 --- a/firmware/drivers/lcd.c +++ b/firmware/drivers/lcd.c @@ -27,6 +27,13 @@ #include "debug.h" #include "system.h" +#ifdef LOADABLE_FONTS +#include "ajf.h" +#include "panic.h" +#endif + + + /*** definitions ***/ #define LCDR (PBDR_ADDR+1) @@ -296,21 +303,21 @@ static void lcd_write(bool command, int byte) PBDR &= ~LCD_CS; /* enable lcd chip select */ if ( command ) { - on=~(LCD_SD|LCD_SC|LCD_DS); - off=LCD_SC; + on=~(LCD_SD|LCD_SC|LCD_DS); + off=LCD_SC; } else { - on=~(LCD_SD|LCD_SC); - off=LCD_SC|LCD_DS; + on=~(LCD_SD|LCD_SC); + off=LCD_SC|LCD_DS; } /* clock out each bit, MSB first */ for (i=0x80;i;i>>=1) { - PBDR &= on; - if (i & byte) - PBDR |= LCD_SD; - PBDR |= off; + PBDR &= on; + if (i & byte) + PBDR |= LCD_SD; + PBDR |= off; } PBDR |= LCD_CS; /* disable lcd chip select */ @@ -322,9 +329,9 @@ static void lcd_write(bool command, int byte) void lcd_backlight(bool on) { if ( on ) - PAIOR |= LCD_BL; + PAIOR |= LCD_BL; else - PAIOR &= ~LCD_BL; + PAIOR &= ~LCD_BL; } #endif /* SIMULATOR */ @@ -431,7 +438,7 @@ void lcd_define_pattern (int which,char *pattern,int length) int i; lcd_write(true,LCD_PRAM|which); for (i=0;iheight) + 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 extern unsigned char char_dw_8x8_prop[][9]; @@ -746,10 +850,19 @@ void lcd_puts(int x, int y, unsigned char *str) ymargin = 8; #endif + if(!str || !str[0]) + return; + #ifdef LCD_PROPFONTS lcd_putspropxy( xmargin + x*fonts[font], ymargin + y*fontheight[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 lcd_putsxy( xmargin + x*fonts[font], ymargin + y*fontheight[font], @@ -1105,25 +1218,31 @@ void lcd_puts_scroll(int x, int y, unsigned char* string ) s->space = 11 - x; #else -#ifdef LCD_PROPFONTS +#if defined(LCD_PROPFONTS) || defined(LOADABLE_FONTS) unsigned char ch[2]; int w, h; #endif int width, height; lcd_getfontsize(font, &width, &height); -#ifndef LCD_PROPFONTS - s->space = (LCD_WIDTH - xmargin - x*width) / width; -#else +#if defined(LCD_PROPFONTS) || defined(LOADABLE_FONTS) ch[1] = 0; /* zero terminate */ ch[0] = string[0]; width = 0; - for (s->space = 0; - ch[0] && - (width + lcd_getstringsize(ch, 0, &w, &h) < (LCD_WIDTH - x*8)); - ) { + s->space = 0; + while ( ch[0] && +#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; - ch[0]=string[(int)++s->space]; + s->space++; + ch[0]=string[s->space]; } +#else + s->space = (LCD_WIDTH - xmargin - x*width) / width; #endif #endif @@ -1148,11 +1267,25 @@ void lcd_stop_scroll(void) scroll_count = 0; #ifdef LCD_PROPFONTS + lcd_clearrect(xmargin + s->startx*fonts[font], - ymargin + s->starty*fontheight[font], - LCD_WIDTH - xmargin, - fontheight[font]); + ymargin + s->starty*fontheight[font], + LCD_WIDTH - xmargin, + 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 + + /* restore scrolled row */ lcd_puts(s->startx,s->starty,s->text); lcd_update(); @@ -1208,6 +1341,15 @@ static void scroll_thread(void) ymargin + s->starty*fontheight[font], LCD_WIDTH - xmargin, 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 lcd_puts(s->startx,s->starty,s->line); lcd_update(); diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h index bc971dc117..ed2fe7ee45 100644 --- a/firmware/drivers/lcd.h +++ b/firmware/drivers/lcd.h @@ -105,4 +105,15 @@ extern void lcd_clearpixel(int x, int y); #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__ */ diff --git a/firmware/mpeg.c b/firmware/mpeg.c index efe7570bff..a85545efce 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -967,6 +967,7 @@ static void mpeg_thread(void) case SYS_USB_CONNECTED: stop_playing(); +#ifndef SIMULATOR /* Tell the USB thread that we are safe */ 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 */ usb_wait_for_disconnect(&mpeg_queue); +#endif break; } } diff --git a/firmware/panic.c b/firmware/panic.c index f9023fe704..b130482495 100644 --- a/firmware/panic.c +++ b/firmware/panic.c @@ -8,7 +8,7 @@ * $Id$ * * Copyright (C) 2002 by wavey@wavey.org - * + *nn * 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. * @@ -48,8 +48,9 @@ void panicf( char *fmt, ...) lcd_puts(0,0,panic_buf); #elif defined(HAVE_LCD_BITMAP) lcd_clear_display(); - lcd_puts(0,0,panic_buf); + lcd_putsxy(0,0,panic_buf,0); lcd_update(); + #else /* no LCD */ #endif diff --git a/tools/Makefile b/tools/Makefile index 92f621f51e..9d47a1c762 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -8,7 +8,7 @@ # CFLAGS := -O -s -ansi -TARGETS := scramble descramble sh2d +TARGETS := scramble descramble sh2d bdf2ajf all: $(TARGETS) @@ -18,5 +18,9 @@ descramble: descramble.c sh2d: sh2d.c +bdf2ajf: bdf2ajf.c + gcc -O -ansi $+ -o $@ + clean: - rm -f $(TARGETS) *~ + rm -f $(TARGETS) $(shell for f in $(TARGETS) ; do echo $$f.exe $$f.o $$f.obj ; done) *.ajf *~ + diff --git a/tools/configure b/tools/configure index 2ddfb72360..bf89d88929 100755 --- a/tools/configure +++ b/tools/configure @@ -11,6 +11,8 @@ target=$1 debug=$2 +extra_defines="-" + input() { read response echo $response @@ -66,8 +68,9 @@ sed > Makefile \ -e "s,@KEYPAD@,${keypad},g" \ -e "s,@PWD@,${pwd},g" \ -e "s,@SIMVER@,${simver},g" \ + -e "s,@EXTRA_DEFINES@,${extra_defines},g" \ < Makefile \ -e "s,@APPSDIR@,${appsdir},g" \ -e "s,@DEBUG@,${debug},g" \ -e "s,@TARGET@,${target},g" \ + -e "s,@EXTRA_DEFINES@,${extra_defines},g" \ -e "s,@PWD@,${pwd},g" \ <