summaryrefslogtreecommitdiff
path: root/apps/settings.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings.h')
-rw-r--r--apps/settings.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/apps/settings.h b/apps/settings.h
index cf53ae736c..fc9a004cfc 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -62,6 +62,30 @@
62#define FF_REWIND_60000 13 62#define FF_REWIND_60000 13
63 63
64 64
65/* These define "virtual pointers", which could either be a literal string,
66 or a mean a string ID if the pointer is in a certain range.
67 This helps to save space for menus and options. */
68
69#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
70#ifdef SIMULATOR
71/* a space which is defined in stubs.c */
72extern unsigned char vp_dummy[VIRT_SIZE];
73#define VIRT_PTR vp_dummy
74#else
75/* a location where we won't store strings, 0 is the fastest */
76#define VIRT_PTR ((unsigned char*)0)
77#endif
78
79/* form a "virtual pointer" out of a language ID */
80#define ID2P(id) (VIRT_PTR + id)
81
82/* resolve a pointer which could be a virtualized ID or a literal */
83#define P2STR(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? str(p-VIRT_PTR) : p)
84
85/* get the string ID from a virtual pointer, -1 if not virtual */
86#define P2ID(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? p-VIRT_PTR : -1)
87
88
65struct user_settings 89struct user_settings
66{ 90{
67 /* audio settings */ 91 /* audio settings */
@@ -224,7 +248,7 @@ struct user_settings
224enum optiontype { INT, BOOL }; 248enum optiontype { INT, BOOL };
225 249
226struct opt_items { 250struct opt_items {
227 char* string; 251 unsigned char* string;
228 int voice_id; 252 int voice_id;
229}; 253};
230 254
@@ -247,7 +271,7 @@ bool set_bool_options(char* string, bool* variable,
247 271
248bool set_bool(char* string, bool* variable ); 272bool set_bool(char* string, bool* variable );
249bool set_option(char* string, void* variable, enum optiontype type, 273bool set_option(char* string, void* variable, enum optiontype type,
250 struct opt_items* options, int numoptions, void (*function)(int)); 274 const struct opt_items* options, int numoptions, void (*function)(int));
251bool set_int(char* string, char* unit, int voice_unit, int* variable, 275bool set_int(char* string, char* unit, int voice_unit, int* variable,
252 void (*function)(int), int step, int min, int max ); 276 void (*function)(int), int step, int min, int max );
253bool set_time_screen(char* string, struct tm *tm); 277bool set_time_screen(char* string, struct tm *tm);