From 9c16e12390fa78fe7acd1ebbb2454f31221cce8a Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Fri, 14 Feb 2003 14:14:55 +0000 Subject: Expanded .cfg loader to include most settings. Based on Christian Determann's patch. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3260 a1c6a512-1295-4272-9138-f99709370657 --- apps/settings.c | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) (limited to 'apps/settings.c') diff --git a/apps/settings.c b/apps/settings.c index c7ab9e411c..946286dc75 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -519,6 +519,8 @@ void settings_apply(void) cpu_sleep(global_settings.cpu_sleep); } +static void set_cfg_bool(bool* variable, char* value); + /* * load settings from disk or RTC RAM */ @@ -527,6 +529,8 @@ void settings_load(void) DEBUGF( "reload_all_settings()\n" ); + // set_cfg_bool(&global_settings.playlist_shuffle, "off"); + /* populate settings with default values */ settings_reset(); @@ -776,6 +780,39 @@ static void set_sound(char* value, int type, int* setting) #endif } +static void set_cfg_bool(bool* variable, char* value) +{ + /* look for the 'n' in 'on' */ + if ((value[1] & 0xdf) == 'N') + *variable = true; + else + *variable = false; +} + +static void set_cfg_int(int* variable, char* value, int min, int max ) +{ + *variable = atoi(value); + + if (*variable < min) + *variable = min; + else + if (*variable > max) + *variable = max; +} + +static void set_cfg_option(int* variable, char* value, + char* options[], int numoptions ) +{ + int i; + + for (i=0; i