diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-10-28 11:00:36 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-10-28 11:00:36 +0000 |
| commit | 943de3ce49e3ff4bbdefa7459dbc3b885fe145ad (patch) | |
| tree | 4d0791456aa944700570e7207f6f8717e8c1a667 /lib/skin_parser/skin_parser.c | |
| parent | db2a8ffd30f3c1b5a17f318d4acbbeab54bab4c3 (diff) | |
| download | rockbox-943de3ce49e3ff4bbdefa7459dbc3b885fe145ad.zip rockbox-943de3ce49e3ff4bbdefa7459dbc3b885fe145ad.tar.gz rockbox-943de3ce49e3ff4bbdefa7459dbc3b885fe145ad.tar.bz2 rockbox-943de3ce49e3ff4bbdefa7459dbc3b885fe145ad.tar.xz | |
skin_parser: Change the way hardware conditionals are done (i.e %?cc)
They now only parse the correct branch (so only the true branch, or only the false branch). This shuold allow you to load different images/backdrops with the same id's depending on the targets hardware.
Add a new %Tp - "touchscreen present?" tag to check if the target has a touchscreen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28370 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'lib/skin_parser/skin_parser.c')
| -rw-r--r-- | lib/skin_parser/skin_parser.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c index 64ac462..f574d3f 100644 --- a/lib/skin_parser/skin_parser.c +++ b/lib/skin_parser/skin_parser.c @@ -877,6 +877,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc #ifdef ROCKBOX bool feature_available = true; const char *false_branch = NULL; + const char *conditional_end = NULL; #endif /* Some conditional tags allow for target feature checking, @@ -955,6 +956,12 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc false_branch = cursor+1; children--; } + if (element->tag->flags&FEATURE_TAG) + { + if (feature_available) + children--; + } + conditional_end = cursor; /* if we are skipping the true branch fix that up */ cursor = false_branch ? false_branch : bookmark; #else @@ -969,7 +976,13 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc for(i = 0; i < children; i++) { element->children[i] = skin_parse_code_as_arg(&cursor); + if (element->children[i] == NULL) + return 0; skip_whitespace(&cursor); +#ifdef ROCKBOX + if ((element->tag->flags&FEATURE_TAG) && feature_available) + cursor = conditional_end; +#endif if(i < children - 1 && *cursor != ENUMLISTSEPERATESYM) { @@ -986,7 +999,6 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc cursor++; } } - *document = cursor; return 1; |