diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-08-21 18:15:20 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-08-21 18:15:20 +0000 |
commit | 876db6c2fcb6d84a9c02b5aa7fbd60dbc78548a5 (patch) | |
tree | 39c12340945df6586e7132acc5c8c36a254568ad /tools | |
parent | 11826e904031f100e82aa376a51e84648cb99a7d (diff) | |
download | rockbox-876db6c2fcb6d84a9c02b5aa7fbd60dbc78548a5.tar.gz rockbox-876db6c2fcb6d84a9c02b5aa7fbd60dbc78548a5.zip |
Fix/hack checkwps + add Onda VX747/VX777 targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22451 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rw-r--r-- | tools/checkwps/Makefile | 9 | ||||
-rw-r--r-- | tools/checkwps/checkwps.c | 228 | ||||
-rw-r--r-- | tools/checkwps/checkwps.h | 18 | ||||
-rw-r--r-- | tools/checkwps/system-target.h | 0 | ||||
-rw-r--r-- | tools/checkwps/targets.txt | 2 |
5 files changed, 218 insertions, 39 deletions
diff --git a/tools/checkwps/Makefile b/tools/checkwps/Makefile index 1bdf3580f9..2f127af618 100644 --- a/tools/checkwps/Makefile +++ b/tools/checkwps/Makefile | |||
@@ -19,12 +19,15 @@ CC = mingw32-gcc | |||
19 | endif | 19 | endif |
20 | endif | 20 | endif |
21 | 21 | ||
22 | COMMON=$(ROOT)/apps/gui/wps_parser.c \ | 22 | COMMON=$(ROOT)/apps/gui/skin_engine/wps_debug.c \ |
23 | $(ROOT)/apps/gui/wps_debug.c \ | 23 | $(ROOT)/apps/gui/skin_engine/skin_parser.c \ |
24 | $(ROOT)/apps/gui/skin_engine/skin_buffer.c \ | ||
24 | $(ROOT)/apps/misc.c \ | 25 | $(ROOT)/apps/misc.c \ |
25 | $(ROOT)/apps/recorder/bmp.c | 26 | $(ROOT)/apps/recorder/bmp.c \ |
27 | $(ROOT)/firmware/common/strlcpy.c | ||
26 | 28 | ||
27 | INCLUDE=-I $(ROOT)/apps/gui \ | 29 | INCLUDE=-I $(ROOT)/apps/gui \ |
30 | -I $(ROOT)/apps/gui/skin_engine \ | ||
28 | -I $(ROOT)/firmware/export \ | 31 | -I $(ROOT)/firmware/export \ |
29 | -I $(ROOT)/apps \ | 32 | -I $(ROOT)/apps \ |
30 | -I $(ROOT)/apps/recorder \ | 33 | -I $(ROOT)/apps/recorder \ |
diff --git a/tools/checkwps/checkwps.c b/tools/checkwps/checkwps.c index ffe428885d..0b6a8cb759 100644 --- a/tools/checkwps/checkwps.c +++ b/tools/checkwps/checkwps.c | |||
@@ -21,11 +21,12 @@ | |||
21 | 21 | ||
22 | #include <stdio.h> | 22 | #include <stdio.h> |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <fcntl.h> | ||
25 | #include "config.h" | 24 | #include "config.h" |
26 | #include "gwps.h" | ||
27 | #include "checkwps.h" | 25 | #include "checkwps.h" |
28 | #include "resize.h" | 26 | #include "resize.h" |
27 | #include "wps.h" | ||
28 | #include "wps_internals.h" | ||
29 | #include "settings.h" | ||
29 | 30 | ||
30 | bool debug_wps = true; | 31 | bool debug_wps = true; |
31 | int wps_verbose_level = 0; | 32 | int wps_verbose_level = 0; |
@@ -96,7 +97,7 @@ int read_line(int fd, char* buffer, int buffer_size) | |||
96 | { | 97 | { |
97 | int count = 0; | 98 | int count = 0; |
98 | int num_read = 0; | 99 | int num_read = 0; |
99 | 100 | ||
100 | errno = 0; | 101 | errno = 0; |
101 | 102 | ||
102 | while (count < buffer_size) | 103 | while (count < buffer_size) |
@@ -105,9 +106,9 @@ int read_line(int fd, char* buffer, int buffer_size) | |||
105 | 106 | ||
106 | if (1 != read(fd, &c, 1)) | 107 | if (1 != read(fd, &c, 1)) |
107 | break; | 108 | break; |
108 | 109 | ||
109 | num_read++; | 110 | num_read++; |
110 | 111 | ||
111 | if ( c == '\n' ) | 112 | if ( c == '\n' ) |
112 | break; | 113 | break; |
113 | 114 | ||
@@ -137,9 +138,11 @@ int recalc_dimension(struct dim *dst, struct dim *src) | |||
137 | return 0; | 138 | return 0; |
138 | } | 139 | } |
139 | 140 | ||
140 | int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, | 141 | int resize_on_load(struct bitmap *bm, bool dither, |
141 | struct rowset *rset, unsigned char *buf, unsigned int len, | 142 | struct dim *src, struct rowset *tmp_row, |
142 | const struct custom_format *format, | 143 | unsigned char *buf, unsigned int len, |
144 | const struct custom_format *cformat, | ||
145 | IF_PIX_FMT(int format_index,) | ||
143 | struct img_part* (*store_part)(void *args), | 146 | struct img_part* (*store_part)(void *args), |
144 | void *args) | 147 | void *args) |
145 | { | 148 | { |
@@ -176,6 +179,7 @@ void* plugin_get_buffer(size_t *buffer_size) | |||
176 | *buffer_size = PLUGIN_BUFFER_SIZE; | 179 | *buffer_size = PLUGIN_BUFFER_SIZE; |
177 | return pluginbuf; | 180 | return pluginbuf; |
178 | } | 181 | } |
182 | |||
179 | struct user_settings global_settings = { | 183 | struct user_settings global_settings = { |
180 | .statusbar = true, | 184 | .statusbar = true, |
181 | #ifdef HAVE_LCD_COLOR | 185 | #ifdef HAVE_LCD_COLOR |
@@ -183,7 +187,7 @@ struct user_settings global_settings = { | |||
183 | .fg_color = LCD_DEFAULT_FG, | 187 | .fg_color = LCD_DEFAULT_FG, |
184 | #endif | 188 | #endif |
185 | }; | 189 | }; |
186 | 190 | ||
187 | int getwidth(void) { return LCD_WIDTH; } | 191 | int getwidth(void) { return LCD_WIDTH; } |
188 | int getheight(void) { return LCD_HEIGHT; } | 192 | int getheight(void) { return LCD_HEIGHT; } |
189 | #ifdef HAVE_REMOTE_LCD | 193 | #ifdef HAVE_REMOTE_LCD |
@@ -209,6 +213,7 @@ struct screen screens[NB_SCREENS] = | |||
209 | .get_foreground=dummy_func2, | 213 | .get_foreground=dummy_func2, |
210 | .get_background=dummy_func2, | 214 | .get_background=dummy_func2, |
211 | #endif | 215 | #endif |
216 | .backdrop_load=backdrop_load, | ||
212 | }, | 217 | }, |
213 | #ifdef HAVE_REMOTE_LCD | 218 | #ifdef HAVE_REMOTE_LCD |
214 | { | 219 | { |
@@ -237,11 +242,190 @@ void screen_clear_area(struct screen * display, int xstart, int ystart, | |||
237 | } | 242 | } |
238 | #endif | 243 | #endif |
239 | 244 | ||
245 | /* From skin_display.c */ | ||
246 | void skin_data_init(struct wps_data *wps_data) | ||
247 | { | ||
248 | #ifdef HAVE_LCD_BITMAP | ||
249 | wps_data->wps_sb_tag = false; | ||
250 | wps_data->show_sb_on_wps = false; | ||
251 | wps_data->peak_meter_enabled = false; | ||
252 | wps_data->images = NULL; | ||
253 | wps_data->progressbars = NULL; | ||
254 | /* progress bars */ | ||
255 | #else /* HAVE_LCD_CHARCELLS */ | ||
256 | int i; | ||
257 | for (i = 0; i < 8; i++) | ||
258 | { | ||
259 | wps_data->wps_progress_pat[i] = 0; | ||
260 | } | ||
261 | wps_data->full_line_progressbar = false; | ||
262 | #endif | ||
263 | wps_data->button_time_volume = 0; | ||
264 | wps_data->wps_loaded = false; | ||
265 | } | ||
266 | |||
267 | #ifdef HAVE_LCD_BITMAP | ||
268 | struct gui_img* find_image(char label, struct wps_data *data) | ||
269 | { | ||
270 | struct skin_token_list *list = data->images; | ||
271 | while (list) | ||
272 | { | ||
273 | struct gui_img *img = (struct gui_img *)list->token->value.data; | ||
274 | if (img->label == label) | ||
275 | return img; | ||
276 | list = list->next; | ||
277 | } | ||
278 | return NULL; | ||
279 | } | ||
280 | #endif | ||
281 | |||
282 | struct skin_viewport* find_viewport(char label, struct wps_data *data) | ||
283 | { | ||
284 | struct skin_token_list *list = data->viewports; | ||
285 | while (list) | ||
286 | { | ||
287 | struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data; | ||
288 | if (vp->label == label) | ||
289 | return vp; | ||
290 | list = list->next; | ||
291 | } | ||
292 | return NULL; | ||
293 | } | ||
294 | |||
295 | int skin_last_token_index(struct wps_data *data, int line, int subline) | ||
296 | { | ||
297 | int first_subline_idx = data->lines[line].first_subline_idx; | ||
298 | int idx = first_subline_idx + subline; | ||
299 | if (idx < data->num_sublines - 1) | ||
300 | { | ||
301 | /* This subline ends where the next begins */ | ||
302 | return data->sublines[idx+1].first_token_idx - 1; | ||
303 | } | ||
304 | else | ||
305 | { | ||
306 | /* The last subline goes to the end */ | ||
307 | return data->num_tokens - 1; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | /* From viewport.c & misc.h */ | ||
312 | #define LIST_VALUE_PARSED(setvals, position) ((setvals) & BIT_N(position)) | ||
313 | |||
314 | /*some short cuts for fg/bg/line selector handling */ | ||
315 | #ifdef HAVE_LCD_COLOR | ||
316 | #define LINE_SEL_FROM_SETTINGS(vp) \ | ||
317 | do { \ | ||
318 | vp->lss_pattern = global_settings.lss_color; \ | ||
319 | vp->lse_pattern = global_settings.lse_color; \ | ||
320 | vp->lst_pattern = global_settings.lst_color; \ | ||
321 | } while (0) | ||
322 | #define FG_FALLBACK global_settings.fg_color | ||
323 | #define BG_FALLBACK global_settings.bg_color | ||
324 | #else | ||
325 | /* mono/greyscale doesn't have most of the above */ | ||
326 | #define LINE_SEL_FROM_SETTINGS(vp) | ||
327 | #define FG_FALLBACK LCD_DEFAULT_FG | ||
328 | #define BG_FALLBACK LCD_DEFAULT_BG | ||
329 | #endif | ||
330 | |||
331 | #ifdef HAVE_LCD_COLOR | ||
332 | #define ARG_STRING(_depth) ((_depth) == 2 ? "dddddgg":"dddddcc") | ||
333 | #else | ||
334 | #define ARG_STRING(_depth) "dddddgg" | ||
335 | #endif | ||
336 | |||
337 | extern const char* parse_list(const char *fmt, uint32_t *set_vals, | ||
338 | const char sep, const char* str, ...); | ||
339 | |||
340 | const char* viewport_parse_viewport(struct viewport *vp, | ||
341 | enum screen_type screen, | ||
342 | const char *bufptr, | ||
343 | const char separator) | ||
344 | { | ||
345 | /* parse the list to the viewport struct */ | ||
346 | const char *ptr = bufptr; | ||
347 | int depth; | ||
348 | uint32_t set = 0; | ||
349 | |||
350 | enum { | ||
351 | PL_X = 0, | ||
352 | PL_Y, | ||
353 | PL_WIDTH, | ||
354 | PL_HEIGHT, | ||
355 | PL_FONT, | ||
356 | PL_FG, | ||
357 | PL_BG, | ||
358 | }; | ||
359 | |||
360 | /* Work out the depth of this display */ | ||
361 | depth = screens[screen].depth; | ||
362 | #if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) | ||
363 | if (depth == 1) | ||
364 | { | ||
365 | if (!(ptr = parse_list("ddddd", &set, separator, ptr, | ||
366 | &vp->x, &vp->y, &vp->width, &vp->height, &vp->font))) | ||
367 | return NULL; | ||
368 | } | ||
369 | else | ||
370 | #endif | ||
371 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) | ||
372 | if (depth >= 2) | ||
373 | { | ||
374 | if (!(ptr = parse_list(ARG_STRING(depth), &set, separator, ptr, | ||
375 | &vp->x, &vp->y, &vp->width, &vp->height, &vp->font, | ||
376 | &vp->fg_pattern,&vp->bg_pattern))) | ||
377 | return NULL; | ||
378 | } | ||
379 | else | ||
380 | #endif | ||
381 | {} | ||
382 | #undef ARG_STRING | ||
383 | |||
384 | /* X and Y *must* be set */ | ||
385 | if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y)) | ||
386 | return NULL; | ||
387 | |||
388 | /* fix defaults */ | ||
389 | if (!LIST_VALUE_PARSED(set, PL_WIDTH)) | ||
390 | vp->width = screens[screen].lcdwidth - vp->x; | ||
391 | if (!LIST_VALUE_PARSED(set, PL_HEIGHT)) | ||
392 | vp->height = screens[screen].lcdheight - vp->y; | ||
393 | |||
394 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) | ||
395 | if (!LIST_VALUE_PARSED(set, PL_FG)) | ||
396 | vp->fg_pattern = FG_FALLBACK; | ||
397 | if (!LIST_VALUE_PARSED(set, PL_BG)) | ||
398 | vp->bg_pattern = BG_FALLBACK; | ||
399 | #endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */ | ||
400 | |||
401 | LINE_SEL_FROM_SETTINGS(vp); | ||
402 | |||
403 | /* Validate the viewport dimensions - we know that the numbers are | ||
404 | non-negative integers, ignore bars and assume the viewport takes them | ||
405 | * into account */ | ||
406 | if ((vp->x >= screens[screen].lcdwidth) || | ||
407 | ((vp->x + vp->width) > screens[screen].lcdwidth) || | ||
408 | (vp->y >= screens[screen].lcdheight) || | ||
409 | ((vp->y + vp->height) > screens[screen].lcdheight)) | ||
410 | { | ||
411 | return NULL; | ||
412 | } | ||
413 | |||
414 | /* Default to using the user font if the font was an invalid number or '-'*/ | ||
415 | if (((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI)) | ||
416 | || !LIST_VALUE_PARSED(set, PL_FONT) | ||
417 | ) | ||
418 | vp->font = FONT_UI; | ||
419 | |||
420 | /* Set the defaults for fields not user-specified */ | ||
421 | vp->drawmode = DRMODE_SOLID; | ||
422 | |||
423 | return ptr; | ||
424 | } | ||
240 | 425 | ||
241 | int main(int argc, char **argv) | 426 | int main(int argc, char **argv) |
242 | { | 427 | { |
243 | int res; | 428 | int res; |
244 | int fd; | ||
245 | int filearg = 1; | 429 | int filearg = 1; |
246 | 430 | ||
247 | struct wps_data wps; | 431 | struct wps_data wps; |
@@ -270,27 +454,21 @@ int main(int argc, char **argv) | |||
270 | } | 454 | } |
271 | } | 455 | } |
272 | 456 | ||
273 | fd = open(argv[filearg], O_RDONLY); | 457 | skin_buffer_init(); |
274 | if (fd < 0) { | ||
275 | printf("Failed to open %s\n",argv[1]); | ||
276 | return 2; | ||
277 | } | ||
278 | close(fd); | ||
279 | 458 | ||
280 | /* Go through every wps that was thrown at us, error out at the first | 459 | /* Go through every wps that was thrown at us, error out at the first |
281 | * flawed wps */ | 460 | * flawed wps */ |
282 | while (argv[filearg]) { | 461 | while (argv[filearg]) { |
283 | printf("Checking %s...\n", argv[filearg]); | 462 | printf("Checking %s...\n", argv[filearg]); |
284 | res = wps_data_load(&wps, &screens[0], argv[filearg], true); | 463 | res = skin_data_load(&wps, &screens[SCREEN_MAIN], argv[filearg], true); |
285 | 464 | ||
286 | if (!res) { | 465 | if (!res) { |
287 | printf("WPS parsing failure\n"); | 466 | printf("WPS parsing failure\n"); |
288 | return 3; | 467 | return 3; |
289 | } | 468 | } |
290 | 469 | ||
291 | printf("WPS parsed OK\n\n"); | 470 | printf("WPS parsed OK\n\n"); |
292 | filearg++; | 471 | filearg++; |
293 | } | 472 | } |
294 | return 0; | 473 | return 0; |
295 | } | 474 | } |
296 | |||
diff --git a/tools/checkwps/checkwps.h b/tools/checkwps/checkwps.h index 2ba8f5f59e..1032cca246 100644 --- a/tools/checkwps/checkwps.h +++ b/tools/checkwps/checkwps.h | |||
@@ -24,21 +24,17 @@ | |||
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <stdbool.h> | 26 | #include <stdbool.h> |
27 | #include <fcntl.h> | ||
28 | |||
29 | /* subset of global_settings needed to build checkwps. */ | ||
30 | struct user_settings { | ||
31 | bool statusbar; | ||
32 | int bg_color; /* background color native format */ | ||
33 | int fg_color; /* foreground color native format */ | ||
34 | }; | ||
35 | |||
36 | extern struct user_settings global_settings; | ||
37 | 27 | ||
38 | #define FONT_SYSFIXED 0 | 28 | #define FONT_SYSFIXED 0 |
39 | #define FONT_UI 1 | 29 | #define FONT_UI 1 |
40 | #define SYSFONT_HEIGHT 8 | 30 | #define SYSFONT_HEIGHT 8 |
41 | 31 | ||
42 | #define MIN(x,y) ((x) > (y) ? (y) : (x)) | 32 | #ifndef MIN |
33 | #define MIN(a, b) (((a)<(b))?(a):(b)) | ||
34 | #endif | ||
35 | |||
36 | #ifndef BIT_N | ||
37 | #define BIT_N(n) (1U << (n)) | ||
38 | #endif | ||
43 | 39 | ||
44 | #endif | 40 | #endif |
diff --git a/tools/checkwps/system-target.h b/tools/checkwps/system-target.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tools/checkwps/system-target.h | |||
diff --git a/tools/checkwps/targets.txt b/tools/checkwps/targets.txt index 196f0c3694..d14cff93b8 100644 --- a/tools/checkwps/targets.txt +++ b/tools/checkwps/targets.txt | |||
@@ -35,3 +35,5 @@ SANSA_C200 c200 | |||
35 | SANSA_M200 m200 | 35 | SANSA_M200 m200 |
36 | SANSA_C100 c100 | 36 | SANSA_C100 c100 |
37 | ELIO_TPJ1022 tpj1022 | 37 | ELIO_TPJ1022 tpj1022 |
38 | ONDA_VX747 ondavx747 | ||
39 | ONDA_VX777 ondavx777 | ||