Index: tools/checkwps/targets.txt =================================================================== --- tools/checkwps/targets.txt (revision 22450) +++ tools/checkwps/targets.txt (working copy) @@ -35,3 +35,5 @@ SANSA_M200 m200 SANSA_C100 c100 ELIO_TPJ1022 tpj1022 +ONDA_VX747 ondavx747 +ONDA_VX777 ondavx777 Index: tools/checkwps/checkwps.c =================================================================== --- tools/checkwps/checkwps.c (revision 22450) +++ tools/checkwps/checkwps.c (working copy) @@ -21,11 +21,12 @@ #include #include -#include #include "config.h" -#include "gwps.h" #include "checkwps.h" #include "resize.h" +#include "wps.h" +#include "wps_internals.h" +#include "settings.h" bool debug_wps = true; int wps_verbose_level = 0; @@ -137,9 +138,11 @@ return 0; } -int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, - struct rowset *rset, unsigned char *buf, unsigned int len, - const struct custom_format *format, +int resize_on_load(struct bitmap *bm, bool dither, + struct dim *src, struct rowset *tmp_row, + unsigned char *buf, unsigned int len, + const struct custom_format *cformat, + IF_PIX_FMT(int format_index,) struct img_part* (*store_part)(void *args), void *args) { @@ -176,6 +179,7 @@ *buffer_size = PLUGIN_BUFFER_SIZE; return pluginbuf; } + struct user_settings global_settings = { .statusbar = true, #ifdef HAVE_LCD_COLOR @@ -238,10 +242,83 @@ #endif +void skin_data_init(struct wps_data *wps_data) +{ +#ifdef HAVE_LCD_BITMAP + wps_data->wps_sb_tag = false; + wps_data->show_sb_on_wps = false; + wps_data->peak_meter_enabled = false; + wps_data->images = NULL; + wps_data->progressbars = NULL; + /* progress bars */ +#else /* HAVE_LCD_CHARCELLS */ + int i; + for (i = 0; i < 8; i++) + { + wps_data->wps_progress_pat[i] = 0; + } + wps_data->full_line_progressbar = false; +#endif + wps_data->button_time_volume = 0; + wps_data->wps_loaded = false; +} + +#ifdef HAVE_LCD_BITMAP +struct gui_img* find_image(char label, struct wps_data *data) +{ + struct skin_token_list *list = data->images; + while (list) + { + struct gui_img *img = (struct gui_img *)list->token->value.data; + if (img->label == label) + return img; + list = list->next; + } + return NULL; +} +#endif + +struct skin_viewport* find_viewport(char label, struct wps_data *data) +{ + struct skin_token_list *list = data->viewports; + while (list) + { + struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data; + if (vp->label == label) + return vp; + list = list->next; + } + return NULL; +} + +int skin_last_token_index(struct wps_data *data, int line, int subline) +{ + int first_subline_idx = data->lines[line].first_subline_idx; + int idx = first_subline_idx + subline; + if (idx < data->num_sublines - 1) + { + /* This subline ends where the next begins */ + return data->sublines[idx+1].first_token_idx - 1; + } + else + { + /* The last subline goes to the end */ + return data->num_tokens - 1; + } +} + +const char* viewport_parse_viewport(struct viewport *vp, + enum screen_type screen, + const char *bufptr, + const char separator) +{ + return NULL; +} + int main(int argc, char **argv) { int res; - int fd; + FILE *fd; int filearg = 1; struct wps_data wps; @@ -270,26 +347,28 @@ } } - fd = open(argv[filearg], O_RDONLY); - if (fd < 0) { - printf("Failed to open %s\n",argv[1]); + fd = fopen(argv[filearg], "rb"); + if (fd == NULL) { + printf("Failed to open %s\n", argv[1]); return 2; } - close(fd); + fclose(fd); + skin_buffer_init(); + /* Go through every wps that was thrown at us, error out at the first * flawed wps */ while (argv[filearg]) { - printf("Checking %s...\n", argv[filearg]); - res = wps_data_load(&wps, &screens[0], argv[filearg], true); + printf("Checking %s...\n", argv[filearg]); + res = skin_data_load(&wps, &screens[SCREEN_MAIN], argv[filearg], true); - if (!res) { - printf("WPS parsing failure\n"); - return 3; - } + if (!res) { + printf("WPS parsing failure\n"); + return 3; + } - printf("WPS parsed OK\n\n"); - filearg++; + printf("WPS parsed OK\n\n"); + filearg++; } return 0; } Index: tools/checkwps/Makefile =================================================================== --- tools/checkwps/Makefile (revision 22450) +++ tools/checkwps/Makefile (working copy) @@ -19,12 +19,15 @@ endif endif -COMMON=$(ROOT)/apps/gui/wps_parser.c \ - $(ROOT)/apps/gui/wps_debug.c \ +COMMON=$(ROOT)/apps/gui/skin_engine/wps_debug.c \ + $(ROOT)/apps/gui/skin_engine/skin_parser.c \ + $(ROOT)/apps/gui/skin_engine/skin_buffer.c \ $(ROOT)/apps/misc.c \ - $(ROOT)/apps/recorder/bmp.c + $(ROOT)/apps/recorder/bmp.c \ + $(ROOT)/firmware/common/strlcpy.c INCLUDE=-I $(ROOT)/apps/gui \ + -I $(ROOT)/apps/gui/skin_engine \ -I $(ROOT)/firmware/export \ -I $(ROOT)/apps \ -I $(ROOT)/apps/recorder \ Index: tools/checkwps/checkwps.h =================================================================== --- tools/checkwps/checkwps.h (revision 22450) +++ tools/checkwps/checkwps.h (working copy) @@ -24,21 +24,17 @@ #include #include #include -#include -/* subset of global_settings needed to build checkwps. */ -struct user_settings { - bool statusbar; - int bg_color; /* background color native format */ - int fg_color; /* foreground color native format */ -}; - -extern struct user_settings global_settings; - #define FONT_SYSFIXED 0 #define FONT_UI 1 #define SYSFONT_HEIGHT 8 -#define MIN(x,y) ((x) > (y) ? (y) : (x)) +#ifndef MIN +#define MIN(a, b) (((a)<(b))?(a):(b)) +#endif +#ifndef BIT_N +#define BIT_N(n) (1U << (n)) #endif + +#endif Index: apps/gui/skin_engine/skin_parser.c =================================================================== --- apps/gui/skin_engine/skin_parser.c (revision 22450) +++ apps/gui/skin_engine/skin_parser.c (working copy) @@ -32,6 +32,7 @@ #include "proxy.h" #include "sysfont.h" #else +#include "action.h" #include "checkwps.h" #include "audio.h" #define DEBUGF printf