summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/apps/settings.c b/apps/settings.c
index abb2b79dca..bfc943bef0 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -65,8 +65,10 @@ void dac_line_in(bool enable);
65#endif 65#endif
66struct user_settings global_settings; 66struct user_settings global_settings;
67char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */ 67char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */
68char rec_base_directory[] = REC_BASE_DIR;
68 69
69#define CONFIG_BLOCK_VERSION 8 70
71#define CONFIG_BLOCK_VERSION 9
70#define CONFIG_BLOCK_SIZE 512 72#define CONFIG_BLOCK_SIZE 512
71#define RTC_BLOCK_SIZE 44 73#define RTC_BLOCK_SIZE 44
72 74
@@ -156,7 +158,7 @@ Rest of config block, only saved to disk:
1560xB8 (char[20]) WPS file 1580xB8 (char[20]) WPS file
1570xCC (char[20]) Lang file 1590xCC (char[20]) Lang file
1580xE0 (char[20]) Font file 1600xE0 (char[20]) Font file
1590xF4 Prerecording time (bit 0-4) 1610xF4 Prerecording time (bit 0-4), Recording directory option (bit 5-6)
1600xF5-0xFF <unused> 1620xF5-0xFF <unused>
161 163
162*************************************/ 164*************************************/
@@ -439,7 +441,8 @@ int settings_save( void )
439 strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); 441 strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME);
440 strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); 442 strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME);
441 443
442 config_block[0xf4]=(unsigned char)global_settings.rec_prerecord_time; 444 config_block[0xf4]=((unsigned char)global_settings.rec_prerecord_time |
445 ((unsigned char)global_settings.rec_directory << 5));
443 446
444 if(save_config_buffer()) 447 if(save_config_buffer())
445 { 448 {
@@ -681,7 +684,7 @@ void settings_load(void)
681 } 684 }
682 685
683 if (config_block[0x1d] != 0xFF) 686 if (config_block[0x1d] != 0xFF)
684 memcpy(&global_settings.resume_seed,&config_block[0x1d], 4); 687 memcpy(&global_settings.resume_seed, &config_block[0x1d], 4);
685 688
686 if (config_block[0x21] != 0xFF) 689 if (config_block[0x21] != 0xFF)
687 { 690 {
@@ -766,8 +769,10 @@ void settings_load(void)
766 strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); 769 strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME);
767 strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); 770 strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME);
768 771
769 if (config_block[0xf4] != 0xff) 772 if (config_block[0xf4] != 0xff) {
770 global_settings.rec_prerecord_time = config_block[0xf4]; 773 global_settings.rec_prerecord_time = config_block[0xf4] & 0x1f;
774 global_settings.rec_directory = (config_block[0xf4] >> 5) & 3;
775 }
771 776
772#ifdef HAVE_LCD_CHARCELLS 777#ifdef HAVE_LCD_CHARCELLS
773 if (config_block[0xa8] != 0xff) 778 if (config_block[0xa8] != 0xff)
@@ -1101,6 +1106,10 @@ bool settings_load_config(char* file)
1101 else if (!strcasecmp(name, "prerecording time")) { 1106 else if (!strcasecmp(name, "prerecording time")) {
1102 set_cfg_int(&global_settings.rec_prerecord_time, value, 0, 30); 1107 set_cfg_int(&global_settings.rec_prerecord_time, value, 0, 30);
1103 } 1108 }
1109 else if (!strcasecmp(name, "rec directory")) {
1110 static char* options[] = {rec_base_directory, "current"};
1111 set_cfg_option(&global_settings.rec_directory, value, options, 2);
1112 }
1104#endif 1113#endif
1105 else if (!strcasecmp(name, "idle poweroff")) { 1114 else if (!strcasecmp(name, "idle poweroff")) {
1106 static char* options[] = {"off","1","2","3","4","5","6","7","8", 1115 static char* options[] = {"off","1","2","3","4","5","6","7","8",
@@ -1454,6 +1463,12 @@ bool settings_save_config(void)
1454 fprintf(fd, "prerecording time: %d\r\n", 1463 fprintf(fd, "prerecording time: %d\r\n",
1455 global_settings.rec_prerecord_time); 1464 global_settings.rec_prerecord_time);
1456 1465
1466 {
1467 static char* options[] = {rec_base_directory, "current"};
1468 fprintf(fd, "rec directory: %s\r\n",
1469 options[global_settings.rec_directory]);
1470 }
1471
1457#endif 1472#endif
1458 1473
1459 fprintf(fd, "#\r\n# Bookmarking\r\n#\r\n"); 1474 fprintf(fd, "#\r\n# Bookmarking\r\n#\r\n");
@@ -1513,6 +1528,7 @@ void settings_reset(void) {
1513 global_settings.rec_right_gain = 2; /* 0dB */ 1528 global_settings.rec_right_gain = 2; /* 0dB */
1514 global_settings.rec_editable = false; 1529 global_settings.rec_editable = false;
1515 global_settings.rec_prerecord_time = 0; 1530 global_settings.rec_prerecord_time = 0;
1531 global_settings.rec_directory = 0; /* rec_base_directory */
1516 global_settings.resume = RESUME_ASK; 1532 global_settings.resume = RESUME_ASK;
1517 global_settings.contrast = lcd_default_contrast(); 1533 global_settings.contrast = lcd_default_contrast();
1518 global_settings.invert = DEFAULT_INVERT_SETTING; 1534 global_settings.invert = DEFAULT_INVERT_SETTING;