diff options
author | Franklin Wei <git@fwei.tk> | 2017-10-23 17:41:11 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-10-23 17:41:11 -0400 |
commit | a644489ccf8a6665274e1666011e9e137cc8ad19 (patch) | |
tree | 9b70c59fe876046f73cccaad8bdb9262ab629876 /apps/plugins/puzzles | |
parent | ef1306764e6443d67612542654f252b376c5993e (diff) | |
download | rockbox-a644489ccf8a6665274e1666011e9e137cc8ad19.tar.gz rockbox-a644489ccf8a6665274e1666011e9e137cc8ad19.zip |
puzzles: adapt frontend to upstream changes
Change-Id: Idd911ac4ac6c2efa3c6b064be6058979d7a15447
Diffstat (limited to 'apps/plugins/puzzles')
-rw-r--r-- | apps/plugins/puzzles/rockbox.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index d6a47a4202..37d15b75b5 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c | |||
@@ -873,7 +873,7 @@ void frontend_default_color(frontend *fe, float *out) | |||
873 | *out++ = BG_B; | 873 | *out++ = BG_B; |
874 | } | 874 | } |
875 | 875 | ||
876 | void fatal(char *fmt, ...) | 876 | void fatal(const char *fmt, ...) |
877 | { | 877 | { |
878 | va_list ap; | 878 | va_list ap; |
879 | 879 | ||
@@ -970,7 +970,7 @@ static void int_chooser(config_item *cfgs, int idx, int val) | |||
970 | config_item *cfg = cfgs + idx; | 970 | config_item *cfg = cfgs + idx; |
971 | int old_val = val; | 971 | int old_val = val; |
972 | 972 | ||
973 | rb->snprintf(cfg->sval, MAX_STRLEN, "%d", val); | 973 | rb->snprintf(cfg->u.string.sval, MAX_STRLEN, "%d", val); |
974 | 974 | ||
975 | rb->lcd_clear_display(); | 975 | rb->lcd_clear_display(); |
976 | 976 | ||
@@ -1002,7 +1002,7 @@ static void int_chooser(config_item *cfgs, int idx, int val) | |||
1002 | if(val != old_val) | 1002 | if(val != old_val) |
1003 | rb->splash(HZ, "Canceled."); | 1003 | rb->splash(HZ, "Canceled."); |
1004 | val = old_val; | 1004 | val = old_val; |
1005 | rb->snprintf(cfg->sval, MAX_STRLEN, "%d", val); | 1005 | rb->snprintf(cfg->u.string.sval, MAX_STRLEN, "%d", val); |
1006 | rb->lcd_scroll_stop(); | 1006 | rb->lcd_scroll_stop(); |
1007 | return; | 1007 | return; |
1008 | } | 1008 | } |
@@ -1016,7 +1016,7 @@ static void int_chooser(config_item *cfgs, int idx, int val) | |||
1016 | for(int i = 0; i < CHOOSER_MAX_INCR; ++i) | 1016 | for(int i = 0; i < CHOOSER_MAX_INCR; ++i) |
1017 | { | 1017 | { |
1018 | val += d; | 1018 | val += d; |
1019 | rb->snprintf(cfg->sval, MAX_STRLEN, "%d", val); | 1019 | rb->snprintf(cfg->u.string.sval, MAX_STRLEN, "%d", val); |
1020 | ret = midend_set_config(me, CFG_SETTINGS, cfgs); | 1020 | ret = midend_set_config(me, CFG_SETTINGS, cfgs); |
1021 | if(!ret) | 1021 | if(!ret) |
1022 | { | 1022 | { |
@@ -1037,7 +1037,7 @@ static void int_chooser(config_item *cfgs, int idx, int val) | |||
1037 | 1037 | ||
1038 | /* reset value */ | 1038 | /* reset value */ |
1039 | val -= d * CHOOSER_MAX_INCR; | 1039 | val -= d * CHOOSER_MAX_INCR; |
1040 | rb->snprintf(cfg->sval, MAX_STRLEN, "%d", val); | 1040 | rb->snprintf(cfg->u.string.sval, MAX_STRLEN, "%d", val); |
1041 | assert(!midend_set_config(me, CFG_SETTINGS, cfgs)); | 1041 | assert(!midend_set_config(me, CFG_SETTINGS, cfgs)); |
1042 | } | 1042 | } |
1043 | } | 1043 | } |
@@ -1058,14 +1058,14 @@ static bool do_configure_item(config_item *cfgs, int idx) | |||
1058 | rb->lcd_set_foreground(LCD_WHITE); | 1058 | rb->lcd_set_foreground(LCD_WHITE); |
1059 | rb->lcd_set_background(LCD_BLACK); | 1059 | rb->lcd_set_background(LCD_BLACK); |
1060 | 1060 | ||
1061 | if(is_integer(cfg->sval)) | 1061 | if(is_integer(cfg->u.string.sval)) |
1062 | { | 1062 | { |
1063 | int val = atoi(cfg->sval); | 1063 | int val = atoi(cfg->u.string.sval); |
1064 | 1064 | ||
1065 | /* we now free the original string and give int_chooser() | 1065 | /* we now free the original string and give int_chooser() |
1066 | * a clean buffer to work with */ | 1066 | * a clean buffer to work with */ |
1067 | sfree(cfg->sval); | 1067 | sfree(cfg->u.string.sval); |
1068 | cfg->sval = newstr; | 1068 | cfg->u.string.sval = newstr; |
1069 | 1069 | ||
1070 | int_chooser(cfgs, idx, val); | 1070 | int_chooser(cfgs, idx, val); |
1071 | 1071 | ||
@@ -1075,32 +1075,32 @@ static bool do_configure_item(config_item *cfgs, int idx) | |||
1075 | return true; | 1075 | return true; |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | rb->strlcpy(newstr, cfg->sval, MAX_STRLEN); | 1078 | rb->strlcpy(newstr, cfg->u.string.sval, MAX_STRLEN); |
1079 | if(rb->kbd_input(newstr, MAX_STRLEN) < 0) | 1079 | if(rb->kbd_input(newstr, MAX_STRLEN) < 0) |
1080 | { | 1080 | { |
1081 | sfree(newstr); | 1081 | sfree(newstr); |
1082 | return false; | 1082 | return false; |
1083 | } | 1083 | } |
1084 | sfree(cfg->sval); | 1084 | sfree(cfg->u.string.sval); |
1085 | cfg->sval = newstr; | 1085 | cfg->u.string.sval = newstr; |
1086 | return true; | 1086 | return true; |
1087 | } | 1087 | } |
1088 | case C_BOOLEAN: | 1088 | case C_BOOLEAN: |
1089 | { | 1089 | { |
1090 | bool res = cfg->ival != 0; | 1090 | bool res = cfg->u.boolean.bval != 0; |
1091 | rb->set_bool(cfg->name, &res); | 1091 | rb->set_bool(cfg->name, &res); |
1092 | 1092 | ||
1093 | /* seems to reset backdrop */ | 1093 | /* seems to reset backdrop */ |
1094 | rb->lcd_set_backdrop(NULL); | 1094 | rb->lcd_set_backdrop(NULL); |
1095 | 1095 | ||
1096 | cfg->ival = res; | 1096 | cfg->u.boolean.bval = res; |
1097 | break; | 1097 | break; |
1098 | } | 1098 | } |
1099 | case C_CHOICES: | 1099 | case C_CHOICES: |
1100 | { | 1100 | { |
1101 | int sel = list_choose(cfg->sval, cfg->name, cfg->ival); | 1101 | int sel = list_choose(cfg->u.choices.choicenames, cfg->name, cfg->u.choices.selected); |
1102 | if(sel >= 0) | 1102 | if(sel >= 0) |
1103 | cfg->ival = sel; | 1103 | cfg->u.choices.selected = sel; |
1104 | break; | 1104 | break; |
1105 | } | 1105 | } |
1106 | default: | 1106 | default: |
@@ -1172,7 +1172,7 @@ static bool config_menu(void) | |||
1172 | 1172 | ||
1173 | char *old_str = NULL; | 1173 | char *old_str = NULL; |
1174 | if(old.type == C_STRING) | 1174 | if(old.type == C_STRING) |
1175 | old_str = dupstr(old.sval); | 1175 | old_str = dupstr(old.u.string.sval); |
1176 | 1176 | ||
1177 | bool freed_str = do_configure_item(config, pos); | 1177 | bool freed_str = do_configure_item(config, pos); |
1178 | char *err = midend_set_config(me, CFG_SETTINGS, config); | 1178 | char *err = midend_set_config(me, CFG_SETTINGS, config); |
@@ -1185,7 +1185,7 @@ static bool config_menu(void) | |||
1185 | memcpy(config + pos, &old, sizeof(old)); | 1185 | memcpy(config + pos, &old, sizeof(old)); |
1186 | 1186 | ||
1187 | if(old.type == C_STRING && freed_str) | 1187 | if(old.type == C_STRING && freed_str) |
1188 | config[pos].sval = old_str; | 1188 | config[pos].u.string.sval = old_str; |
1189 | } | 1189 | } |
1190 | else | 1190 | else |
1191 | { | 1191 | { |