diff options
author | Dave Chapman <dave@dchapman.com> | 2008-03-26 18:18:22 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-03-26 18:18:22 +0000 |
commit | b9bb723f12c95f2b253f822bc9dc9d7f474f8d75 (patch) | |
tree | ce8e31b32aec877c2918b040254e29734f99c16f /apps/gui | |
parent | a53b85a52a71b84cc3137da8b7cbfb035a5285cb (diff) | |
download | rockbox-b9bb723f12c95f2b253f822bc9dc9d7f474f8d75.tar.gz rockbox-b9bb723f12c95f2b253f822bc9dc9d7f474f8d75.zip |
1) Make Rockbox reject any WPSs if there are errors loading any of the required bmps; 2) Make checkwps actually load the images using the Rockbox bmp loader, and reject the WPS in the same was as Rockbox on bmp errors.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16822 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/wps_parser.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index ae50499960..55b4ed9cae 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c | |||
@@ -17,18 +17,29 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include <stdio.h> | ||
21 | #include <string.h> | ||
22 | #include "gwps.h" | ||
23 | #ifdef __PCTOOL__ | ||
24 | #define DEBUGF printf | ||
25 | #define FONT_SYSFIXED 0 | ||
26 | #define FONT_UI 1 | ||
27 | #else | ||
28 | #include "debug.h" | ||
29 | #endif | ||
30 | |||
31 | #ifndef __PCTOOL__ | ||
20 | #include <ctype.h> | 32 | #include <ctype.h> |
21 | #include <stdbool.h> | 33 | #include <stdbool.h> |
22 | #include <stdio.h> | 34 | #include <stdio.h> |
23 | #include <stdlib.h> | 35 | #include <stdlib.h> |
24 | #include <string.h> | 36 | #include <string.h> |
37 | #include "font.h" | ||
38 | |||
25 | #include "atoi.h" | 39 | #include "atoi.h" |
26 | #include "gwps.h" | 40 | #include "gwps.h" |
27 | #include "font.h" | ||
28 | #ifndef __PCTOOL__ | ||
29 | #include "settings.h" | 41 | #include "settings.h" |
30 | #include "misc.h" | 42 | #include "misc.h" |
31 | #include "debug.h" | ||
32 | #include "plugin.h" | 43 | #include "plugin.h" |
33 | 44 | ||
34 | #ifdef HAVE_LCD_BITMAP | 45 | #ifdef HAVE_LCD_BITMAP |
@@ -382,7 +393,7 @@ static bool load_bitmap(struct wps_data *wps_data, | |||
382 | int ret = read_bmp_file(filename, bm, | 393 | int ret = read_bmp_file(filename, bm, |
383 | wps_data->img_buf_free, | 394 | wps_data->img_buf_free, |
384 | format); | 395 | format); |
385 | 396 | DEBUGF("Read %s, ret=%d\n",filename,ret); | |
386 | if (ret > 0) | 397 | if (ret > 0) |
387 | { | 398 | { |
388 | #if LCD_DEPTH == 16 | 399 | #if LCD_DEPTH == 16 |
@@ -1370,12 +1381,11 @@ static void wps_reset(struct wps_data *data) | |||
1370 | 1381 | ||
1371 | #ifdef HAVE_LCD_BITMAP | 1382 | #ifdef HAVE_LCD_BITMAP |
1372 | 1383 | ||
1373 | static void load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir) | 1384 | static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir) |
1374 | { | 1385 | { |
1375 | char img_path[MAX_PATH]; | 1386 | char img_path[MAX_PATH]; |
1376 | struct bitmap *bitmap; | 1387 | struct bitmap *bitmap; |
1377 | bool *loaded; | 1388 | bool *loaded; |
1378 | |||
1379 | int n; | 1389 | int n; |
1380 | for (n = 0; n < BACKDROP_BMP; n++) | 1390 | for (n = 0; n < BACKDROP_BMP; n++) |
1381 | { | 1391 | { |
@@ -1405,6 +1415,12 @@ static void load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir) | |||
1405 | wps_data->img[n].subimage_height = wps_data->img[n].bm.height / | 1415 | wps_data->img[n].subimage_height = wps_data->img[n].bm.height / |
1406 | wps_data->img[n].num_subimages; | 1416 | wps_data->img[n].num_subimages; |
1407 | } | 1417 | } |
1418 | else | ||
1419 | { | ||
1420 | /* Abort if we can't load an image */ | ||
1421 | DEBUGF("ERR: Failed to load image %d - %s\n",n,img_path); | ||
1422 | return false; | ||
1423 | } | ||
1408 | } | 1424 | } |
1409 | } | 1425 | } |
1410 | 1426 | ||
@@ -1416,14 +1432,19 @@ static void load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir) | |||
1416 | #ifdef HAVE_REMOTE_LCD | 1432 | #ifdef HAVE_REMOTE_LCD |
1417 | if (wps_data->remote_wps) | 1433 | if (wps_data->remote_wps) |
1418 | #if LCD_REMOTE_DEPTH > 1 | 1434 | #if LCD_REMOTE_DEPTH > 1 |
1419 | load_remote_wps_backdrop(img_path) | 1435 | if (!load_remote_wps_backdrop(img_path)) |
1436 | return false | ||
1420 | #endif | 1437 | #endif |
1421 | ; | 1438 | ; |
1422 | else | 1439 | else |
1423 | #endif /* HAVE_REMOTE_LCD */ | 1440 | #endif /* HAVE_REMOTE_LCD */ |
1424 | load_wps_backdrop(img_path); | 1441 | if (!load_wps_backdrop(img_path)) |
1442 | return false; | ||
1425 | } | 1443 | } |
1426 | #endif /* has backdrop support */ | 1444 | #endif /* has backdrop support */ |
1445 | |||
1446 | /* If we got here, everything was OK */ | ||
1447 | return true; | ||
1427 | } | 1448 | } |
1428 | 1449 | ||
1429 | #endif /* HAVE_LCD_BITMAP */ | 1450 | #endif /* HAVE_LCD_BITMAP */ |
@@ -1552,7 +1573,8 @@ bool wps_data_load(struct wps_data *wps_data, | |||
1552 | bmpdir[bmpdirlen] = 0; | 1573 | bmpdir[bmpdirlen] = 0; |
1553 | 1574 | ||
1554 | /* load the bitmaps that were found by the parsing */ | 1575 | /* load the bitmaps that were found by the parsing */ |
1555 | load_wps_bitmaps(wps_data, bmpdir); | 1576 | if (!load_wps_bitmaps(wps_data, bmpdir)) |
1577 | return false; | ||
1556 | #endif | 1578 | #endif |
1557 | return true; | 1579 | return true; |
1558 | } | 1580 | } |