diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-17 22:53:12 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-17 22:53:12 +0000 |
commit | 0b41f0599f62ec9099197bbe6f4dd7144cebe0df (patch) | |
tree | 927f23ea1a943777baa0e7cf1f8070608c3847d7 | |
parent | 2fecb713ea07f06b5219a75c95909b986c2468a5 (diff) | |
download | rockbox-0b41f0599f62ec9099197bbe6f4dd7144cebe0df.tar.gz rockbox-0b41f0599f62ec9099197bbe6f4dd7144cebe0df.zip |
unify pointers to value for configfile, and add TYPE_BOOL type, used by
pictureflow
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19786 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/brickmania.c | 2 | ||||
-rw-r--r-- | apps/plugins/chopper.c | 2 | ||||
-rw-r--r-- | apps/plugins/dice.c | 4 | ||||
-rw-r--r-- | apps/plugins/jpeg/jpeg.c | 12 | ||||
-rw-r--r-- | apps/plugins/lib/configfile.c | 25 | ||||
-rw-r--r-- | apps/plugins/lib/configfile.h | 11 | ||||
-rw-r--r-- | apps/plugins/mazezam.c | 8 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_settings.c | 34 | ||||
-rw-r--r-- | apps/plugins/oscilloscope.c | 10 | ||||
-rw-r--r-- | apps/plugins/pacbox/pacbox.c | 14 | ||||
-rw-r--r-- | apps/plugins/pictureflow.c | 37 | ||||
-rw-r--r-- | apps/plugins/solitaire.c | 2 | ||||
-rw-r--r-- | apps/plugins/sudoku/sudoku.c | 6 | ||||
-rw-r--r-- | apps/plugins/wavrecord.c | 9 | ||||
-rw-r--r-- | apps/plugins/wormlet.c | 17 | ||||
-rw-r--r-- | apps/plugins/zxbox/spmain.c | 18 |
16 files changed, 120 insertions, 91 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index d0e4a593a0..5c915c92f2 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c | |||
@@ -813,7 +813,7 @@ int highscore; | |||
813 | #define MAX_POINTS 200000 /* i dont think it needs to be more */ | 813 | #define MAX_POINTS 200000 /* i dont think it needs to be more */ |
814 | static struct configdata config[] = | 814 | static struct configdata config[] = |
815 | { | 815 | { |
816 | {TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL} | 816 | {TYPE_INT, 0, MAX_POINTS, { .int_p = &highscore }, "highscore", NULL} |
817 | }; | 817 | }; |
818 | 818 | ||
819 | void int_game(int new_game) | 819 | void int_game(int new_game) |
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index 971aeb8512..594c4e48bd 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c | |||
@@ -181,7 +181,7 @@ static int score; | |||
181 | #define MAX_POINTS 50000 | 181 | #define MAX_POINTS 50000 |
182 | static struct configdata config[] = | 182 | static struct configdata config[] = |
183 | { | 183 | { |
184 | {TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL} | 184 | {TYPE_INT, 0, MAX_POINTS, { .int_p = &highscore }, "highscore", NULL} |
185 | }; | 185 | }; |
186 | 186 | ||
187 | struct CBlock | 187 | struct CBlock |
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c index 46b39a67ae..5ef5d5099d 100644 --- a/apps/plugins/dice.c +++ b/apps/plugins/dice.c | |||
@@ -63,8 +63,8 @@ static int nb_sides_values[] = { 3, 4, 6, 8, 10, 12, 20, 100 }; | |||
63 | static char *sides_conf[] = {"3", "4", "6", "8", "10", "12", "20", "100" }; | 63 | static char *sides_conf[] = {"3", "4", "6", "8", "10", "12", "20", "100" }; |
64 | static struct configdata config[] = | 64 | static struct configdata config[] = |
65 | { | 65 | { |
66 | {TYPE_INT, 0, MAX_DICES, &dice.nb_dices, "dice count", NULL, NULL}, | 66 | {TYPE_INT, 0, MAX_DICES, { .int_p = &dice.nb_dices}, "dice count", NULL}, |
67 | {TYPE_ENUM, 0, 8, &sides_index, "side count", sides_conf, NULL} | 67 | {TYPE_ENUM, 0, 8, { .int_p = &sides_index }, "side count", sides_conf} |
68 | }; | 68 | }; |
69 | 69 | ||
70 | void dice_init(struct dices* dice); | 70 | void dice_init(struct dices* dice); |
diff --git a/apps/plugins/jpeg/jpeg.c b/apps/plugins/jpeg/jpeg.c index 82d9186298..649cca8288 100644 --- a/apps/plugins/jpeg/jpeg.c +++ b/apps/plugins/jpeg/jpeg.c | |||
@@ -122,13 +122,13 @@ static struct jpeg_settings old_settings; | |||
122 | static struct configdata jpeg_config[] = | 122 | static struct configdata jpeg_config[] = |
123 | { | 123 | { |
124 | #ifdef HAVE_LCD_COLOR | 124 | #ifdef HAVE_LCD_COLOR |
125 | { TYPE_ENUM, 0, COLOUR_NUM_MODES, &jpeg_settings.colour_mode, | 125 | { TYPE_ENUM, 0, COLOUR_NUM_MODES, { .int_p = &jpeg_settings.colour_mode }, |
126 | "Colour Mode", (char *[]){ "Colour", "Grayscale" }, NULL }, | 126 | "Colour Mode", (char *[]){ "Colour", "Grayscale" } }, |
127 | { TYPE_ENUM, 0, DITHER_NUM_MODES, &jpeg_settings.dither_mode, | 127 | { TYPE_ENUM, 0, DITHER_NUM_MODES, { .int_p = &jpeg_settings.dither_mode }, |
128 | "Dither Mode", (char *[]){ "None", "Ordered", "Diffusion" }, NULL }, | 128 | "Dither Mode", (char *[]){ "None", "Ordered", "Diffusion" } }, |
129 | #endif | 129 | #endif |
130 | { TYPE_INT, SS_MIN_TIMEOUT, SS_MAX_TIMEOUT, &jpeg_settings.ss_timeout, | 130 | { TYPE_INT, SS_MIN_TIMEOUT, SS_MAX_TIMEOUT, |
131 | "Slideshow Time", NULL, NULL}, | 131 | { .int_p = &jpeg_settings.ss_timeout }, "Slideshow Time", NULL }, |
132 | }; | 132 | }; |
133 | 133 | ||
134 | #if LCD_DEPTH > 1 | 134 | #if LCD_DEPTH > 1 |
diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c index 419109f904..063efdde2e 100644 --- a/apps/plugins/lib/configfile.c +++ b/apps/plugins/lib/configfile.c | |||
@@ -59,15 +59,21 @@ int configfile_save(const char *filename, struct configdata *cfg, | |||
59 | /* pre-allocate 10 bytes for INT */ | 59 | /* pre-allocate 10 bytes for INT */ |
60 | rb->fdprintf(fd, "%s: %10d\n", | 60 | rb->fdprintf(fd, "%s: %10d\n", |
61 | cfg[i].name, | 61 | cfg[i].name, |
62 | *cfg[i].val); | 62 | *cfg[i].int_p); |
63 | break; | ||
64 | |||
65 | case TYPE_BOOL: | ||
66 | rb->fdprintf(fd, "%s: 10%d\n", | ||
67 | cfg[i].name, | ||
68 | (int)*cfg[i].bool_p); | ||
63 | break; | 69 | break; |
64 | 70 | ||
65 | case TYPE_ENUM: | 71 | case TYPE_ENUM: |
66 | rb->fdprintf(fd, "%s: %s\n", | 72 | rb->fdprintf(fd, "%s: %s\n", |
67 | cfg[i].name, | 73 | cfg[i].name, |
68 | cfg[i].values[*cfg[i].val]); | 74 | cfg[i].values[*cfg[i].int_p]); |
69 | break; | 75 | break; |
70 | 76 | ||
71 | case TYPE_STRING: | 77 | case TYPE_STRING: |
72 | rb->fdprintf(fd, "%s: %s\n", | 78 | rb->fdprintf(fd, "%s: %s\n", |
73 | cfg[i].name, | 79 | cfg[i].name, |
@@ -116,17 +122,22 @@ int configfile_load(const char *filename, struct configdata *cfg, | |||
116 | tmp = rb->atoi(val); | 122 | tmp = rb->atoi(val); |
117 | /* Only set it if it's within range */ | 123 | /* Only set it if it's within range */ |
118 | if(tmp >= cfg[i].min && tmp <= cfg[i].max) | 124 | if(tmp >= cfg[i].min && tmp <= cfg[i].max) |
119 | *cfg[i].val = tmp; | 125 | *cfg[i].int_p = tmp; |
120 | break; | 126 | break; |
121 | 127 | ||
128 | case TYPE_BOOL: | ||
129 | tmp = rb->atoi(val); | ||
130 | *cfg[i].bool_p = (bool)tmp; | ||
131 | break; | ||
132 | |||
122 | case TYPE_ENUM: | 133 | case TYPE_ENUM: |
123 | for(j = 0;j < cfg[i].max;j++) { | 134 | for(j = 0;j < cfg[i].max;j++) { |
124 | if(!rb->strcmp(cfg[i].values[j], val)) { | 135 | if(!rb->strcmp(cfg[i].values[j], val)) { |
125 | *cfg[i].val = j; | 136 | *cfg[i].int_p = j; |
126 | } | 137 | } |
127 | } | 138 | } |
128 | break; | 139 | break; |
129 | 140 | ||
130 | case TYPE_STRING: | 141 | case TYPE_STRING: |
131 | rb->strncpy(cfg[i].string, val, cfg[i].max); | 142 | rb->strncpy(cfg[i].string, val, cfg[i].max); |
132 | break; | 143 | break; |
diff --git a/apps/plugins/lib/configfile.h b/apps/plugins/lib/configfile.h index 0804a5930d..5dc31735a3 100644 --- a/apps/plugins/lib/configfile.h +++ b/apps/plugins/lib/configfile.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define TYPE_INT 1 | 24 | #define TYPE_INT 1 |
25 | #define TYPE_ENUM 2 | 25 | #define TYPE_ENUM 2 |
26 | #define TYPE_STRING 3 | 26 | #define TYPE_STRING 3 |
27 | #define TYPE_BOOL 4 | ||
27 | 28 | ||
28 | struct configdata | 29 | struct configdata |
29 | { | 30 | { |
@@ -31,12 +32,14 @@ struct configdata | |||
31 | int min; /* Min value for integers, should be 0 for enums */ | 32 | int min; /* Min value for integers, should be 0 for enums */ |
32 | int max; /* Max value for enums and integers, | 33 | int max; /* Max value for enums and integers, |
33 | buffer size for strings */ | 34 | buffer size for strings */ |
34 | int *val; /* Pointer to integer/enum value, | 35 | union |
35 | NULL if the item is a string */ | 36 | { |
37 | int *int_p; | ||
38 | bool *bool_p; | ||
39 | char *string; | ||
40 | }; /* Pointer to value, a union of the possible types */ | ||
36 | char *name; /* Pointer to the name of the item */ | 41 | char *name; /* Pointer to the name of the item */ |
37 | char **values; /* List of strings for enums, NULL if not enum */ | 42 | char **values; /* List of strings for enums, NULL if not enum */ |
38 | char *string; /* Pointer to a string buffer if the item is a string, | ||
39 | NULL otherwise */ | ||
40 | }; | 43 | }; |
41 | 44 | ||
42 | /* configfile_save - Given configdata entries this function will | 45 | /* configfile_save - Given configdata entries this function will |
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 8981986144..6b9ad43cc7 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c | |||
@@ -807,8 +807,8 @@ static void game_loop(struct resume_data *r) | |||
807 | static void resume_load_data (struct resume_data *r, struct resume_data *old) | 807 | static void resume_load_data (struct resume_data *r, struct resume_data *old) |
808 | { | 808 | { |
809 | struct configdata config[] = { | 809 | struct configdata config[] = { |
810 | {TYPE_INT,0,MAZEZAM_NUM_LEVELS-1,&(r->level), | 810 | {TYPE_INT,0,MAZEZAM_NUM_LEVELS-1, { .int_p = &(r->level) }, |
811 | MAZEZAM_CONFIG_LEVELS_NAME,NULL,NULL} | 811 | MAZEZAM_CONFIG_LEVELS_NAME,NULL} |
812 | }; | 812 | }; |
813 | 813 | ||
814 | if (configfile_load(MAZEZAM_CONFIG_FILENAME,config, | 814 | if (configfile_load(MAZEZAM_CONFIG_FILENAME,config, |
@@ -827,8 +827,8 @@ static void resume_load_data (struct resume_data *r, struct resume_data *old) | |||
827 | static void resume_save_data (struct resume_data *r, struct resume_data *old) | 827 | static void resume_save_data (struct resume_data *r, struct resume_data *old) |
828 | { | 828 | { |
829 | struct configdata config[] = { | 829 | struct configdata config[] = { |
830 | {TYPE_INT,0,MAZEZAM_NUM_LEVELS-1,&(r->level), | 830 | {TYPE_INT,0,MAZEZAM_NUM_LEVELS-1, {.int_p = &(r->level) }, |
831 | MAZEZAM_CONFIG_LEVELS_NAME,NULL,NULL} | 831 | MAZEZAM_CONFIG_LEVELS_NAME,NULL} |
832 | }; | 832 | }; |
833 | 833 | ||
834 | /* To reduce disk usage, only write the file if the resume data has | 834 | /* To reduce disk usage, only write the file if the resume data has |
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index 3e83f8bc17..4b77518f54 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c | |||
@@ -178,25 +178,27 @@ struct mpeg_settings settings; | |||
178 | 178 | ||
179 | static struct configdata config[] = | 179 | static struct configdata config[] = |
180 | { | 180 | { |
181 | {TYPE_INT, 0, 2, &settings.showfps, "Show FPS", NULL, NULL}, | 181 | {TYPE_INT, 0, 2, { .int_p = &settings.showfps }, "Show FPS", NULL}, |
182 | {TYPE_INT, 0, 2, &settings.limitfps, "Limit FPS", NULL, NULL}, | 182 | {TYPE_INT, 0, 2, { .int_p = &settings.limitfps }, "Limit FPS", NULL}, |
183 | {TYPE_INT, 0, 2, &settings.skipframes, "Skip frames", NULL, NULL}, | 183 | {TYPE_INT, 0, 2, { .int_p = &settings.skipframes }, "Skip frames", NULL}, |
184 | {TYPE_INT, 0, INT_MAX, &settings.resume_count, "Resume count", | 184 | {TYPE_INT, 0, INT_MAX, { .int_p = &settings.resume_count }, "Resume count", |
185 | NULL, NULL}, | 185 | NULL}, |
186 | {TYPE_INT, 0, MPEG_RESUME_NUM_OPTIONS, &settings.resume_options, | 186 | {TYPE_INT, 0, MPEG_RESUME_NUM_OPTIONS, |
187 | "Resume options", NULL, NULL}, | 187 | { .int_p = &settings.resume_options }, "Resume options", NULL}, |
188 | #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) | 188 | #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) |
189 | {TYPE_INT, 0, INT_MAX, &settings.displayoptions, "Display options", | 189 | {TYPE_INT, 0, INT_MAX, { .int_p = &settings.displayoptions }, |
190 | NULL, NULL}, | 190 | "Display options", NULL}, |
191 | #endif | 191 | #endif |
192 | {TYPE_INT, 0, 2, &settings.tone_controls, "Tone controls", NULL, NULL}, | 192 | {TYPE_INT, 0, 2, { .int_p = &settings.tone_controls }, "Tone controls", |
193 | {TYPE_INT, 0, 2, &settings.channel_modes, "Channel modes", NULL, NULL}, | 193 | NULL}, |
194 | {TYPE_INT, 0, 2, &settings.crossfeed, "Crossfeed", NULL, NULL}, | 194 | {TYPE_INT, 0, 2, { .int_p = &settings.channel_modes }, "Channel modes", |
195 | {TYPE_INT, 0, 2, &settings.equalizer, "Equalizer", NULL, NULL}, | 195 | NULL}, |
196 | {TYPE_INT, 0, 2, &settings.dithering, "Dithering", NULL, NULL}, | 196 | {TYPE_INT, 0, 2, { .int_p = &settings.crossfeed }, "Crossfeed", NULL}, |
197 | {TYPE_INT, 0, 2, { .int_p = &settings.equalizer }, "Equalizer", NULL}, | ||
198 | {TYPE_INT, 0, 2, { .int_p = &settings.dithering }, "Dithering", NULL}, | ||
197 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 199 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
198 | {TYPE_INT, -1, INT_MAX, &settings.backlight_brightness, | 200 | {TYPE_INT, -1, INT_MAX, { .int_p = &settings.backlight_brightness }, |
199 | "Backlight brightness", NULL, NULL}, | 201 | "Backlight brightness", NULL}, |
200 | #endif | 202 | #endif |
201 | }; | 203 | }; |
202 | 204 | ||
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index ab3c5b2e39..9401c62d1f 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c | |||
@@ -312,10 +312,12 @@ static char *advance_str[2] = { "scroll", "wrap" }; | |||
312 | static char *orientation_str[2] = { "horizontal", "vertical" }; | 312 | static char *orientation_str[2] = { "horizontal", "vertical" }; |
313 | 313 | ||
314 | struct configdata disk_config[] = { | 314 | struct configdata disk_config[] = { |
315 | { TYPE_INT, 1, 99, &osc_disk.delay, "delay", NULL, NULL }, | 315 | { TYPE_INT, 1, 99, { .int_p = &osc_disk.delay }, "delay", NULL }, |
316 | { TYPE_ENUM, 0, MAX_DRAW, &osc_disk.draw, "draw", draw_str, NULL }, | 316 | { TYPE_ENUM, 0, MAX_DRAW, { .int_p = &osc_disk.draw }, "draw", draw_str }, |
317 | { TYPE_ENUM, 0, MAX_ADV, &osc_disk.advance, "advance", advance_str, NULL }, | 317 | { TYPE_ENUM, 0, MAX_ADV, { .int_p = &osc_disk.advance }, "advance", |
318 | { TYPE_ENUM, 0, MAX_OSC, &osc_disk.orientation, "orientation", orientation_str, NULL } | 318 | advance_str }, |
319 | { TYPE_ENUM, 0, MAX_OSC, { .int_p = &osc_disk.orientation }, "orientation", | ||
320 | orientation_str } | ||
319 | }; | 321 | }; |
320 | 322 | ||
321 | 323 | ||
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index ef5d4f5c0e..560e185704 100644 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c | |||
@@ -57,11 +57,15 @@ static char* showfps_options[] = {"No", "Yes"}; | |||
57 | 57 | ||
58 | static struct configdata config[] = | 58 | static struct configdata config[] = |
59 | { | 59 | { |
60 | {TYPE_ENUM, 0, 2, &settings.difficulty, "Difficulty", difficulty_options, NULL}, | 60 | {TYPE_ENUM, 0, 2, { .int_p = &settings.difficulty }, "Difficulty", |
61 | {TYPE_ENUM, 0, 4, &settings.numlives, "Pacmen Per Game", numlives_options, NULL}, | 61 | difficulty_options}, |
62 | {TYPE_ENUM, 0, 4, &settings.bonus, "Bonus", bonus_options, NULL}, | 62 | {TYPE_ENUM, 0, 4, { .int_p = &settings.numlives }, "Pacmen Per Game", |
63 | {TYPE_ENUM, 0, 2, &settings.ghostnames, "Ghost Names", ghostnames_options , NULL}, | 63 | numlives_options}, |
64 | {TYPE_ENUM, 0, 2, &settings.showfps, "Show FPS", showfps_options, NULL}, | 64 | {TYPE_ENUM, 0, 4, { .int_p = &settings.bonus }, "Bonus", bonus_options}, |
65 | {TYPE_ENUM, 0, 2, { .int_p = &settings.ghostnames }, "Ghost Names", | ||
66 | ghostnames_options}, | ||
67 | {TYPE_ENUM, 0, 2, { .int_p = &settings.showfps }, "Show FPS", | ||
68 | showfps_options}, | ||
65 | }; | 69 | }; |
66 | 70 | ||
67 | static bool loadFile( const char * name, unsigned char * buf, int len ) | 71 | static bool loadFile( const char * name, unsigned char * buf, int len ) |
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 807ba19e7e..b107227e40 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -203,22 +203,25 @@ static int slide_spacing = (LCD_WIDTH - DISPLAY_WIDTH) / 8; | |||
203 | static int center_margin = (LCD_WIDTH - DISPLAY_WIDTH) / 16; | 203 | static int center_margin = (LCD_WIDTH - DISPLAY_WIDTH) / 16; |
204 | static int num_slides = 4; | 204 | static int num_slides = 4; |
205 | static int zoom = 100; | 205 | static int zoom = 100; |
206 | static int show_fps = false; | 206 | static bool show_fps = false; |
207 | static int resize = true; | 207 | static bool resize = true; |
208 | static int cache_version = 0; | 208 | static int cache_version = 0; |
209 | static int show_album_name = album_name_top; | 209 | static int show_album_name = album_name_top; |
210 | 210 | ||
211 | static struct configdata config[] = | 211 | static struct configdata config[] = |
212 | { | 212 | { |
213 | { TYPE_INT, 0, MAX_SPACING, &slide_spacing, "slide spacing", NULL, NULL }, | 213 | { TYPE_INT, 0, MAX_SPACING, { .int_p = &slide_spacing }, "slide spacing", |
214 | { TYPE_INT, 0, MAX_MARGIN, ¢er_margin, "center margin", NULL, NULL }, | 214 | NULL }, |
215 | { TYPE_INT, 0, MAX_SLIDES_COUNT, &num_slides, "slides count", NULL, NULL }, | 215 | { TYPE_INT, 0, MAX_MARGIN, { .int_p = ¢er_margin }, "center margin", |
216 | { TYPE_INT, 0, 300, &zoom, "zoom", NULL, NULL }, | 216 | NULL }, |
217 | { TYPE_INT, 0, 1, &show_fps, "show fps", NULL, NULL }, | 217 | { TYPE_INT, 0, MAX_SLIDES_COUNT, { .int_p = &num_slides }, "slides count", |
218 | { TYPE_INT, 0, 1, &resize, "resize", NULL, NULL }, | 218 | NULL }, |
219 | { TYPE_INT, 0, 100, &cache_version, "cache version", NULL, NULL }, | 219 | { TYPE_INT, 0, 300, { .int_p = &zoom }, "zoom", NULL }, |
220 | { TYPE_ENUM, 0, 2, &show_album_name, "show album name", | 220 | { TYPE_BOOL, 0, 1, { .bool_p = &show_fps }, "show fps", NULL }, |
221 | show_album_name_conf, NULL } | 221 | { TYPE_BOOL, 0, 1, { .bool_p = &resize }, "resize", NULL }, |
222 | { TYPE_INT, 0, 100, { .int_p = &cache_version }, "cache version", NULL }, | ||
223 | { TYPE_ENUM, 0, 2, { .int_p = &show_album_name }, "show album name", | ||
224 | show_album_name_conf } | ||
222 | }; | 225 | }; |
223 | 226 | ||
224 | #define CONFIG_NUM_ITEMS (sizeof(config) / sizeof(struct configdata)) | 227 | #define CONFIG_NUM_ITEMS (sizeof(config) / sizeof(struct configdata)) |
@@ -1555,7 +1558,6 @@ int settings_menu(void) | |||
1555 | { | 1558 | { |
1556 | int selection = 0; | 1559 | int selection = 0; |
1557 | bool old_val; | 1560 | bool old_val; |
1558 | bool new_val; | ||
1559 | 1561 | ||
1560 | MENUITEM_STRINGLIST(settings_menu, "PictureFlow Settings", NULL, "Show FPS", | 1562 | MENUITEM_STRINGLIST(settings_menu, "PictureFlow Settings", NULL, "Show FPS", |
1561 | "Spacing", "Center margin", "Number of slides", "Zoom", | 1563 | "Spacing", "Center margin", "Number of slides", "Zoom", |
@@ -1565,9 +1567,7 @@ int settings_menu(void) | |||
1565 | selection=rb->do_menu(&settings_menu,&selection, NULL, false); | 1567 | selection=rb->do_menu(&settings_menu,&selection, NULL, false); |
1566 | switch(selection) { | 1568 | switch(selection) { |
1567 | case 0: | 1569 | case 0: |
1568 | new_val = show_fps; | 1570 | rb->set_bool("Show FPS", &show_fps); |
1569 | rb->set_bool("Show FPS", &new_val); | ||
1570 | show_fps = new_val; | ||
1571 | reset_track_list(); | 1571 | reset_track_list(); |
1572 | break; | 1572 | break; |
1573 | 1573 | ||
@@ -1607,10 +1607,9 @@ int settings_menu(void) | |||
1607 | reset_slides(); | 1607 | reset_slides(); |
1608 | break; | 1608 | break; |
1609 | case 6: | 1609 | case 6: |
1610 | old_val = new_val = resize; | 1610 | old_val = resize; |
1611 | rb->set_bool("Resize Covers", &new_val); | 1611 | rb->set_bool("Resize Covers", &resize); |
1612 | resize = new_val; | 1612 | if (old_val == resize) /* changed? */ |
1613 | if (old_val == new_val) /* changed? */ | ||
1614 | break; | 1613 | break; |
1615 | /* fallthrough if changed, since cache needs to be rebuilt */ | 1614 | /* fallthrough if changed, since cache needs to be rebuilt */ |
1616 | case 7: | 1615 | case 7: |
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 2f5f2dc4a8..bbf7c11291 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -749,7 +749,7 @@ struct sol_config sol_disk = {0}; | |||
749 | struct sol_config sol; | 749 | struct sol_config sol; |
750 | 750 | ||
751 | static struct configdata config[] = { | 751 | static struct configdata config[] = { |
752 | { TYPE_INT, 0, 1, &sol_disk.draw_type, "draw_type", NULL, NULL }, | 752 | { TYPE_INT, 0, 1, { .int_p = &sol_disk.draw_type }, "draw_type", NULL } |
753 | }; | 753 | }; |
754 | 754 | ||
755 | char draw_option_string[32]; | 755 | char draw_option_string[32]; |
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index 88fd0bd8ec..69c41f476e 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c | |||
@@ -245,10 +245,12 @@ static char *mark_str[2] = { "hide", "show" }; | |||
245 | 245 | ||
246 | struct configdata disk_config[] = { | 246 | struct configdata disk_config[] = { |
247 | #ifdef HAVE_LCD_COLOR | 247 | #ifdef HAVE_LCD_COLOR |
248 | { TYPE_ENUM, 0, 2, &sudcfg_disk.number_display, "numbers", number_str, NULL }, | 248 | { TYPE_ENUM, 0, 2, { .int_p = &sudcfg_disk.number_display }, "numbers", |
249 | number_str }, | ||
249 | #endif | 250 | #endif |
250 | #ifdef SUDOKU_BUTTON_POSSIBLE | 251 | #ifdef SUDOKU_BUTTON_POSSIBLE |
251 | { TYPE_ENUM, 0, 2, &sudcfg_disk.show_markings, "markings", mark_str, NULL }, | 252 | { TYPE_ENUM, 0, 2, { .int_p = &sudcfg_disk.show_markings }, "markings", |
253 | mark_str }, | ||
252 | #endif | 254 | #endif |
253 | }; | 255 | }; |
254 | #endif | 256 | #endif |
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c index 69d243e12b..58a103dfe2 100644 --- a/apps/plugins/wavrecord.c +++ b/apps/plugins/wavrecord.c | |||
@@ -3191,9 +3191,12 @@ static char *source_str[WAV_NUM_SRC] = { "line in", "mic", | |||
3191 | HAVE_SPDIF_REC_("spdif",) }; | 3191 | HAVE_SPDIF_REC_("spdif",) }; |
3192 | 3192 | ||
3193 | struct configdata disk_config[] = { | 3193 | struct configdata disk_config[] = { |
3194 | { TYPE_ENUM, 0, 9, &reccfg_disk.samplerate, "sample rate", samplerate_str, NULL }, | 3194 | { TYPE_ENUM, 0, 9, { .int_p = &reccfg_disk.samplerate }, "sample rate", |
3195 | { TYPE_ENUM, 0, 2, &reccfg_disk.channels, "channels", channel_str, NULL }, | 3195 | samplerate_str }, |
3196 | { TYPE_ENUM, 0, WAV_NUM_SRC, &reccfg_disk.source, "source", source_str, NULL }, | 3196 | { TYPE_ENUM, 0, 2, { .int_p = &reccfg_disk.channels }, "channels", |
3197 | channel_str }, | ||
3198 | { TYPE_ENUM, 0, WAV_NUM_SRC, { .int_p = &reccfg_disk.source }, "source", | ||
3199 | source_str }, | ||
3197 | }; | 3200 | }; |
3198 | 3201 | ||
3199 | static char recfilename[MAX_PATH]; | 3202 | static char recfilename[MAX_PATH]; |
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c index abb2653501..ee8046275f 100644 --- a/apps/plugins/wormlet.c +++ b/apps/plugins/wormlet.c | |||
@@ -468,15 +468,14 @@ static int players = 1; | |||
468 | 468 | ||
469 | static struct configdata config[] = | 469 | static struct configdata config[] = |
470 | { | 470 | { |
471 | {TYPE_INT, 0, 1024, &highscore, "highscore", NULL, NULL}, | 471 | {TYPE_INT, 0, 1024, { .int_p = &highscore }, "highscore", NULL}, |
472 | {TYPE_INT, 0, 15, &arghs_per_food, "arghs per food", NULL, NULL}, | 472 | {TYPE_INT, 0, 15, { .int_p = &arghs_per_food }, "arghs per food", NULL}, |
473 | {TYPE_INT, 0, 15, &argh_size, "argh size", NULL, NULL}, | 473 | {TYPE_INT, 0, 15, { .int_p = &argh_size }, "argh size", NULL}, |
474 | {TYPE_INT, 0, 15, &food_size, "food size", NULL, NULL}, | 474 | {TYPE_INT, 0, 15, { .int_p = &food_size }, "food size", NULL}, |
475 | {TYPE_INT, 0, 3, &players, "players", NULL, NULL}, | 475 | {TYPE_INT, 0, 3, { .int_p = &players }, "players", NULL}, |
476 | {TYPE_INT, 0, 3, &worm_count, "worms", NULL, NULL}, | 476 | {TYPE_INT, 0, 3, { .int_p = &worm_count }, "worms", NULL}, |
477 | {TYPE_INT, 0, 20, &speed, "speed", NULL, NULL}, | 477 | {TYPE_INT, 0, 20, { .int_p = &speed }, "speed", NULL}, |
478 | {TYPE_INT, 0, 15, &worm_food, "Worm Growth Per Food", NULL, NULL}//, | 478 | {TYPE_INT, 0, 15, { .int_p = &worm_food }, "Worm Growth Per Food", NULL} |
479 | //{TYPE_INT, 0, 3, &use_remote, "use remote", NULL, NULL} | ||
480 | }; | 479 | }; |
481 | 480 | ||
482 | #ifdef DEBUG_WORMLET | 481 | #ifdef DEBUG_WORMLET |
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c index e304d8b52d..b7d20ecf5e 100644 --- a/apps/plugins/zxbox/spmain.c +++ b/apps/plugins/zxbox/spmain.c | |||
@@ -75,13 +75,17 @@ static char* showfps_options[] = {"No", "Yes"};*/ | |||
75 | 75 | ||
76 | static struct configdata config[] = | 76 | static struct configdata config[] = |
77 | { | 77 | { |
78 | {TYPE_ENUM, 0, 2, &settings.invert_colors, "Invert Colors", noyes_options, NULL}, | 78 | {TYPE_ENUM, 0, 2, { .int_p = &settings.invert_colors }, "Invert Colors", |
79 | {TYPE_ENUM, 0, 2, &settings.kempston, "Map keys to kempston", noyes_options, NULL}, | 79 | noyes_options}, |
80 | {TYPE_ENUM, 0, 2, &settings.showfps, "Show Speed", noyes_options, NULL}, | 80 | {TYPE_ENUM, 0, 2, { .int_p = &settings.kempston }, "Map keys to kempston", |
81 | {TYPE_ENUM, 0, 2, &settings.sound, "Sound", noyes_options, NULL}, | 81 | noyes_options}, |
82 | {TYPE_INT, 0, 9, &settings.frameskip, "Frameskip", NULL, NULL}, | 82 | {TYPE_ENUM, 0, 2, { .int_p = &settings.showfps }, "Show Speed", |
83 | {TYPE_INT, 1, 10, &settings.volume, "Volume", NULL, NULL}, | 83 | noyes_options}, |
84 | {TYPE_STRING, 0, 5, NULL,"Key Mapping", NULL, (char*)&settings.keymap}, | 84 | {TYPE_ENUM, 0, 2, { .int_p = &settings.sound }, "Sound", noyes_options}, |
85 | {TYPE_INT, 0, 9, { .int_p = &settings.frameskip }, "Frameskip", NULL}, | ||
86 | {TYPE_INT, 1, 10, { .int_p = &settings.volume }, "Volume", NULL}, | ||
87 | {TYPE_STRING, 0, 5, { .string = (char*)&settings.keymap }, "Key Mapping", | ||
88 | NULL}, | ||
85 | }; | 89 | }; |
86 | int spcf_read_conf_file(const char *filename) | 90 | int spcf_read_conf_file(const char *filename) |
87 | { | 91 | { |