diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-11-30 12:27:52 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-04 11:19:57 -0500 |
commit | 1e6c8d2ea684e8a8e7a5f2cc08858c2ba2c15387 (patch) | |
tree | 5be985909f1c985f6f433d8934c92ad91f6aa0d4 /apps/gui/skin_engine/skin_parser.c | |
parent | 4ff97ae07c9b7beed4c8c9bf965e2ba679d05a20 (diff) | |
download | rockbox-1e6c8d2ea684e8a8e7a5f2cc08858c2ba2c15387.tar.gz rockbox-1e6c8d2ea684e8a8e7a5f2cc08858c2ba2c15387.zip |
skin engine: Settings ID to pointer conversions
Convert %St tag to operate on settings pointers instead of IDs.
Change-Id: Iabf4c280be82b495a64b560b59620fb477e0c738
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 8ecbf7b7f9..435bad9e1f 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -803,14 +803,14 @@ static int parse_setting_and_lang(struct skin_element *element, | |||
803 | */ | 803 | */ |
804 | (void)wps_data; | 804 | (void)wps_data; |
805 | char *temp = get_param_text(element, 0); | 805 | char *temp = get_param_text(element, 0); |
806 | int i; | ||
807 | 806 | ||
808 | if (token->type == SKIN_TOKEN_TRANSLATEDSTRING) | 807 | if (token->type == SKIN_TOKEN_TRANSLATEDSTRING) |
809 | { | 808 | { |
810 | #ifndef __PCTOOL__ | 809 | #ifndef __PCTOOL__ |
811 | i = lang_english_to_id(temp); | 810 | int i = lang_english_to_id(temp); |
812 | if (i < 0) | 811 | if (i < 0) |
813 | i = LANG_LAST_INDEX_IN_ARRAY; | 812 | i = LANG_LAST_INDEX_IN_ARRAY; |
813 | token->value.i = i; | ||
814 | #endif | 814 | #endif |
815 | } | 815 | } |
816 | else if (element->params_count > 1) | 816 | else if (element->params_count > 1) |
@@ -823,12 +823,13 @@ static int parse_setting_and_lang(struct skin_element *element, | |||
823 | else | 823 | else |
824 | { | 824 | { |
825 | #ifndef __PCTOOL__ | 825 | #ifndef __PCTOOL__ |
826 | if (find_setting_by_cfgname(temp, &i) == NULL) | 826 | const struct settings_list *setting = find_setting_by_cfgname(temp, NULL); |
827 | if (!setting) | ||
827 | return WPS_ERROR_INVALID_PARAM; | 828 | return WPS_ERROR_INVALID_PARAM; |
829 | |||
830 | token->value.xdata = (void *)setting; | ||
828 | #endif | 831 | #endif |
829 | } | 832 | } |
830 | /* Store the setting number */ | ||
831 | token->value.i = i; | ||
832 | return 0; | 833 | return 0; |
833 | } | 834 | } |
834 | 835 | ||
@@ -972,7 +973,7 @@ static int parse_progressbar_tag(struct skin_element* element, | |||
972 | pb->image = PTRTOSKINOFFSET(skin_buffer, NULL); | 973 | pb->image = PTRTOSKINOFFSET(skin_buffer, NULL); |
973 | pb->slider = PTRTOSKINOFFSET(skin_buffer, NULL); | 974 | pb->slider = PTRTOSKINOFFSET(skin_buffer, NULL); |
974 | pb->backdrop = PTRTOSKINOFFSET(skin_buffer, NULL); | 975 | pb->backdrop = PTRTOSKINOFFSET(skin_buffer, NULL); |
975 | pb->setting_id = -1; | 976 | pb->setting = NULL; |
976 | pb->invert_fill_direction = false; | 977 | pb->invert_fill_direction = false; |
977 | pb->horizontal = true; | 978 | pb->horizontal = true; |
978 | 979 | ||
@@ -1157,7 +1158,8 @@ static int parse_progressbar_tag(struct skin_element* element, | |||
1157 | param++; | 1158 | param++; |
1158 | text = SKINOFFSETTOPTR(skin_buffer, param->data.text); | 1159 | text = SKINOFFSETTOPTR(skin_buffer, param->data.text); |
1159 | #ifndef __PCTOOL__ | 1160 | #ifndef __PCTOOL__ |
1160 | if (find_setting_by_cfgname(text, &pb->setting_id) == NULL) | 1161 | pb->setting = find_setting_by_cfgname(text, NULL); |
1162 | if (!pb->setting) | ||
1161 | return WPS_ERROR_INVALID_PARAM; | 1163 | return WPS_ERROR_INVALID_PARAM; |
1162 | #endif | 1164 | #endif |
1163 | } | 1165 | } |