forked from len0rd/rockbox
Make checkwps compile again. Still more work is needed though, as checkwps is compiled to emulate an iPod Color - this needs changing to allow the LCD (and remote LCD) dimensions/depth to be specified on the commandline - the new %V tags are validated against the LCD characteristics
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16807 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ffa304865e
commit
7418c357c3
5 changed files with 96 additions and 38 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "atoi.h"
|
#include "atoi.h"
|
||||||
#include "gwps.h"
|
#include "gwps.h"
|
||||||
|
#include "font.h"
|
||||||
#ifndef __PCTOOL__
|
#ifndef __PCTOOL__
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
75
apps/misc.c
75
apps/misc.c
|
@ -18,6 +18,8 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include "sprintf.h"
|
||||||
|
#ifndef __PCTOOL__
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -25,7 +27,6 @@
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "lcd-remote.h"
|
#include "lcd-remote.h"
|
||||||
#include "sprintf.h"
|
|
||||||
#include "errno.h"
|
#include "errno.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "timefuncs.h"
|
#include "timefuncs.h"
|
||||||
|
@ -48,15 +49,17 @@
|
||||||
#include "tagcache.h"
|
#include "tagcache.h"
|
||||||
#include "scrobbler.h"
|
#include "scrobbler.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MMC
|
#ifdef HAVE_MMC
|
||||||
#include "ata_mmc.h"
|
#include "ata_mmc.h"
|
||||||
#endif
|
#endif
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "eeprom_settings.h"
|
#include "eeprom_settings.h"
|
||||||
#ifdef HAVE_RECORDING
|
#if defined(HAVE_RECORDING) && !defined(__PCTOOL__)
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#if defined(HAVE_LCD_BITMAP) && !defined(__PCTOOL__)
|
||||||
#include "bmp.h"
|
#include "bmp.h"
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#endif /* End HAVE_LCD_BITMAP */
|
#endif /* End HAVE_LCD_BITMAP */
|
||||||
|
@ -74,6 +77,7 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PCTOOL__
|
||||||
/* Format a large-range value for output, using the appropriate unit so that
|
/* 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"
|
* 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
|
* units) if possible, and 3 significant digits are shown. If a buffer is
|
||||||
|
@ -1087,38 +1091,6 @@ void setvol(void)
|
||||||
settings_save();
|
settings_save();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
|
||||||
/*
|
|
||||||
* Helper function to convert a string of 6 hex digits to a native colour
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int hex2dec(int c)
|
|
||||||
{
|
|
||||||
return (((c) >= '0' && ((c) <= '9')) ? (c) - '0' :
|
|
||||||
(toupper(c)) - 'A' + 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
int hex_to_rgb(const char* hex, int* color)
|
|
||||||
{
|
|
||||||
int red, green, blue;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while ((i < 6) && (isxdigit(hex[i])))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (i < 6)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
red = (hex2dec(hex[0]) << 4) | hex2dec(hex[1]);
|
|
||||||
green = (hex2dec(hex[2]) << 4) | hex2dec(hex[3]);
|
|
||||||
blue = (hex2dec(hex[4]) << 4) | hex2dec(hex[5]);
|
|
||||||
|
|
||||||
*color = LCD_RGBPACK(red,green,blue);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_LCD_COLOR */
|
|
||||||
|
|
||||||
char* strrsplt(char* str, int c)
|
char* strrsplt(char* str, int c)
|
||||||
{
|
{
|
||||||
char* s = strrchr(str, c);
|
char* s = strrchr(str, c);
|
||||||
|
@ -1196,6 +1168,39 @@ char *strip_extension(char* buffer, int buffer_size, const char *filename)
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
#endif /* !defined(__PCTOOL__) */
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
/*
|
||||||
|
* Helper function to convert a string of 6 hex digits to a native colour
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int hex2dec(int c)
|
||||||
|
{
|
||||||
|
return (((c) >= '0' && ((c) <= '9')) ? (c) - '0' :
|
||||||
|
(toupper(c)) - 'A' + 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
int hex_to_rgb(const char* hex, int* color)
|
||||||
|
{
|
||||||
|
int red, green, blue;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while ((i < 6) && (isxdigit(hex[i])))
|
||||||
|
i++;
|
||||||
|
|
||||||
|
if (i < 6)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
red = (hex2dec(hex[0]) << 4) | hex2dec(hex[1]);
|
||||||
|
green = (hex2dec(hex[2]) << 4) | hex2dec(hex[3]);
|
||||||
|
blue = (hex2dec(hex[4]) << 4) | hex2dec(hex[5]);
|
||||||
|
|
||||||
|
*color = LCD_RGBPACK(red,green,blue);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_LCD_COLOR */
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
/* A simplified scanf - used (at time of writing) by wps parsing functions.
|
/* A simplified scanf - used (at time of writing) by wps parsing functions.
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
|
#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
|
||||||
|
#ifndef __PCTOOL__
|
||||||
#include "sysfont.h"
|
#include "sysfont.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* max static loadable font buffer size */
|
/* max static loadable font buffer size */
|
||||||
#ifndef MAX_FONT_SIZE
|
#ifndef MAX_FONT_SIZE
|
||||||
|
|
|
@ -64,9 +64,9 @@ database: database.c ../apps/tagcache.c ../apps/metadata.c \
|
||||||
-D__PCTOOL__ -DHAVE_TAGCACHE -DROCKBOX_HAS_LOGF -DSIMULATOR \
|
-D__PCTOOL__ -DHAVE_TAGCACHE -DROCKBOX_HAS_LOGF -DSIMULATOR \
|
||||||
-DCONFIG_CODEC=1 -ldl -I../apps $+ -o $@
|
-DCONFIG_CODEC=1 -ldl -I../apps $+ -o $@
|
||||||
|
|
||||||
checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c
|
checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c ../apps/misc.c
|
||||||
$(SILENT)$(CC) -g -I ../apps/gui -I../firmware/export \
|
$(SILENT)$(CC) -g -I ../apps/gui -I../firmware/export \
|
||||||
-D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN=255 -D WPS_DIR=\".\" \
|
-D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN -D WPS_DIR=\".\" \
|
||||||
-I../apps -I../firmware/target/arm/ipod -I../firmware/include $+ -o $@
|
-I../apps -I../firmware/target/arm/ipod -I../firmware/include $+ -o $@
|
||||||
|
|
||||||
convbdf: convbdf.c
|
convbdf: convbdf.c
|
||||||
|
|
|
@ -54,12 +54,62 @@ bool load_wps_backdrop(char* filename)
|
||||||
|
|
||||||
static char pluginbuf[PLUGIN_BUFFER_SIZE];
|
static char pluginbuf[PLUGIN_BUFFER_SIZE];
|
||||||
|
|
||||||
|
static int dummy_func1(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned dummy_func2(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void* plugin_get_buffer(size_t *buffer_size)
|
void* plugin_get_buffer(size_t *buffer_size)
|
||||||
{
|
{
|
||||||
*buffer_size = PLUGIN_BUFFER_SIZE;
|
*buffer_size = PLUGIN_BUFFER_SIZE;
|
||||||
return pluginbuf;
|
return pluginbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct screen screens[NB_SCREENS] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
.screen_type=SCREEN_MAIN,
|
||||||
|
.width=LCD_WIDTH,
|
||||||
|
.height=LCD_HEIGHT,
|
||||||
|
.depth=LCD_DEPTH,
|
||||||
|
.is_color=true,
|
||||||
|
.has_disk_led=false,
|
||||||
|
.getxmargin=dummy_func1,
|
||||||
|
.getymargin=dummy_func1,
|
||||||
|
.get_foreground=dummy_func2,
|
||||||
|
.get_background=dummy_func2,
|
||||||
|
},
|
||||||
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
{
|
||||||
|
.screen_type=SCREEN_REMOTE,
|
||||||
|
.width=LCD_REMOTE_WIDTH,
|
||||||
|
.height=LCD_REMOTE_HEIGHT,
|
||||||
|
.depth=LCD_REMOTE_DEPTH,
|
||||||
|
.is_color=false,/* No color remotes yet */
|
||||||
|
.getxmargin=dummy_func,
|
||||||
|
.getymargin=dummy_func,
|
||||||
|
.get_foreground=dummy_func,
|
||||||
|
.get_background=dummy_func,
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
void screen_clear_area(struct screen * display, int xstart, int ystart,
|
||||||
|
int width, int height)
|
||||||
|
{
|
||||||
|
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||||
|
display->fillrect(xstart, ystart, width, height);
|
||||||
|
display->set_drawmode(DRMODE_SOLID);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
@ -93,7 +143,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
res = wps_data_load(&wps, argv[filearg], true);
|
res = wps_data_load(&wps, &screens[0], argv[filearg], true);
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
printf("WPS parsing failure\n");
|
printf("WPS parsing failure\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue