summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c51
1 files changed, 18 insertions, 33 deletions
diff --git a/apps/settings.c b/apps/settings.c
index d6e555f03e..e5fbfb5e06 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -62,7 +62,7 @@
62struct user_settings global_settings; 62struct user_settings global_settings;
63char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */ 63char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */
64 64
65#define CONFIG_BLOCK_VERSION 6 65#define CONFIG_BLOCK_VERSION 7
66#define CONFIG_BLOCK_SIZE 512 66#define CONFIG_BLOCK_SIZE 512
67#define RTC_BLOCK_SIZE 44 67#define RTC_BLOCK_SIZE 44
68 68
@@ -98,10 +98,10 @@ offset abs
980x12 0x26 <(int) Resume playlist index, or -1 if no playlist resume> 980x12 0x26 <(int) Resume playlist index, or -1 if no playlist resume>
990x16 0x2a <(int) Byte offset into resume file> 990x16 0x2a <(int) Byte offset into resume file>
1000x1a 0x2e <time until disk spindown> 1000x1a 0x2e <time until disk spindown>
1010x1b 0x2f <browse current, play selected, queue_resume> 1010x1b 0x2f <browse current, play selected, recursive dir insert>
1020x1c 0x30 <peak meter hold timeout (bit 0-4), 1020x1c 0x30 <peak meter hold timeout (bit 0-4),
103 rec_editable (bit 7)> 103 rec_editable (bit 7)>
1040x1d 0x31 <(int) queue resume index> 1040x1d 0x31 <unused>
1050x21 0x35 <repeat mode (bit 0-1), rec. channels (bit 2), 1050x21 0x35 <repeat mode (bit 0-1), rec. channels (bit 2),
106 mic gain (bit 4-7)> 106 mic gain (bit 4-7)>
1070x22 0x36 <rec. quality (bit 0-2), source (bit 3-4), frequency (bit 5-7)> 1070x22 0x36 <rec. quality (bit 0-2), source (bit 3-4), frequency (bit 5-7)>
@@ -144,9 +144,9 @@ Rest of config block, only saved to disk:
1440xB8 (char[20]) WPS file 1440xB8 (char[20]) WPS file
1450xCC (char[20]) Lang file 1450xCC (char[20]) Lang file
1460xE0 (char[20]) Font file 1460xE0 (char[20]) Font file
1470xF4 (int) Playlist first index 1470xF4 <unused>
1480xF8 (int) Playlist shuffle seed 1480xF8 <unused>
1490xFC-0x1FF (char[260]) Resume playlist (path/to/dir or path/to/playlist.m3u) 1490xFC <unused>
150 150
151*************************************/ 151*************************************/
152 152
@@ -343,18 +343,19 @@ int settings_save( void )
343 343
344 memcpy(&config_block[0x12], &global_settings.resume_index, 4); 344 memcpy(&config_block[0x12], &global_settings.resume_index, 4);
345 memcpy(&config_block[0x16], &global_settings.resume_offset, 4); 345 memcpy(&config_block[0x16], &global_settings.resume_offset, 4);
346 DEBUGF( "+Resume index %X offset %X\n",
347 global_settings.resume_index,
348 global_settings.resume_offset );
346 349
347 config_block[0x1a] = (unsigned char)global_settings.disk_spindown; 350 config_block[0x1a] = (unsigned char)global_settings.disk_spindown;
348 config_block[0x1b] = (unsigned char) 351 config_block[0x1b] = (unsigned char)
349 (((global_settings.browse_current & 1)) | 352 (((global_settings.browse_current & 1)) |
350 ((global_settings.play_selected & 1) << 1) | 353 ((global_settings.play_selected & 1) << 1) |
351 ((global_settings.queue_resume & 3) << 2)); 354 ((global_settings.recursive_dir_insert & 1) << 2));
352 355
353 config_block[0x1c] = (unsigned char)global_settings.peak_meter_hold | 356 config_block[0x1c] = (unsigned char)global_settings.peak_meter_hold |
354 (global_settings.rec_editable?0x80:0); 357 (global_settings.rec_editable?0x80:0);
355 358
356 memcpy(&config_block[0x1d], &global_settings.queue_resume_index, 4);
357
358 config_block[0x21] = (unsigned char) 359 config_block[0x21] = (unsigned char)
359 ((global_settings.repeat_mode & 3) | 360 ((global_settings.repeat_mode & 3) |
360 ((global_settings.rec_channels & 1) << 2) | 361 ((global_settings.rec_channels & 1) << 2) |
@@ -415,17 +416,6 @@ int settings_save( void )
415 strncpy(&config_block[0xb8], global_settings.wps_file, MAX_FILENAME); 416 strncpy(&config_block[0xb8], global_settings.wps_file, MAX_FILENAME);
416 strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); 417 strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME);
417 strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); 418 strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME);
418 memcpy(&config_block[0xF4], &global_settings.resume_first_index, 4);
419 memcpy(&config_block[0xF8], &global_settings.resume_seed, 4);
420
421 strncpy(&config_block[0xFC], global_settings.resume_file, MAX_PATH);
422 DEBUGF( "+Resume file %s\n",global_settings.resume_file );
423 DEBUGF( "+Resume index %X offset %X\n",
424 global_settings.resume_index,
425 global_settings.resume_offset );
426 DEBUGF( "+Resume shuffle %s seed %X\n",
427 global_settings.playlist_shuffle?"on":"off",
428 global_settings.resume_seed );
429 419
430 if(save_config_buffer()) 420 if(save_config_buffer())
431 { 421 {
@@ -655,7 +645,8 @@ void settings_load(void)
655 if (config_block[0x1b] != 0xFF) { 645 if (config_block[0x1b] != 0xFF) {
656 global_settings.browse_current = (config_block[0x1b]) & 1; 646 global_settings.browse_current = (config_block[0x1b]) & 1;
657 global_settings.play_selected = (config_block[0x1b] >> 1) & 1; 647 global_settings.play_selected = (config_block[0x1b] >> 1) & 1;
658 global_settings.queue_resume = (config_block[0x1b] >> 2) & 3; 648 global_settings.recursive_dir_insert =
649 (config_block[0x1b] >> 2) & 1;
659 } 650 }
660 651
661 if (config_block[0x1c] != 0xFF) { 652 if (config_block[0x1c] != 0xFF) {
@@ -664,10 +655,6 @@ void settings_load(void)
664 (config_block[0x1c] & 0x80)?true:false; 655 (config_block[0x1c] & 0x80)?true:false;
665 } 656 }
666 657
667 if (config_block[0x1d] != 0xFF)
668 memcpy(&global_settings.queue_resume_index, &config_block[0x1d],
669 4);
670
671 if (config_block[0x21] != 0xFF) 658 if (config_block[0x21] != 0xFF)
672 { 659 {
673 global_settings.repeat_mode = config_block[0x21] & 3; 660 global_settings.repeat_mode = config_block[0x21] & 3;
@@ -745,14 +732,9 @@ void settings_load(void)
745 global_settings.max_files_in_playlist = 732 global_settings.max_files_in_playlist =
746 config_block[0xaa] | (config_block[0xab] << 8); 733 config_block[0xaa] | (config_block[0xab] << 8);
747 734
748 memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4);
749 memcpy(&global_settings.resume_seed, &config_block[0xF8], 4);
750
751 strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME); 735 strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME);
752 strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); 736 strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME);
753 strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); 737 strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME);
754 strncpy(global_settings.resume_file, &config_block[0xFC], MAX_PATH);
755 global_settings.resume_file[MAX_PATH]=0;
756#ifdef HAVE_LCD_CHARCELLS 738#ifdef HAVE_LCD_CHARCELLS
757 if (config_block[0xa8] != 0xff) 739 if (config_block[0xa8] != 0xff)
758 global_settings.jump_scroll = config_block[0xa8]; 740 global_settings.jump_scroll = config_block[0xa8];
@@ -1097,6 +1079,8 @@ bool settings_load_config(char* file)
1097 else if (!strcasecmp(name, "max files in playlist")) 1079 else if (!strcasecmp(name, "max files in playlist"))
1098 set_cfg_int(&global_settings.max_files_in_playlist, value, 1080 set_cfg_int(&global_settings.max_files_in_playlist, value,
1099 1000, 20000); 1081 1000, 20000);
1082 else if (!strcasecmp(name, "recursive directory insert"))
1083 set_cfg_bool(&global_settings.recursive_dir_insert, value);
1100 } 1084 }
1101 1085
1102 close(fd); 1086 close(fd);
@@ -1385,6 +1369,9 @@ bool settings_save_config(void)
1385 fprintf(fd, "max files in playlist: %d\r\n", 1369 fprintf(fd, "max files in playlist: %d\r\n",
1386 global_settings.max_files_in_playlist); 1370 global_settings.max_files_in_playlist);
1387 1371
1372 fprintf(fd, "recursive directory insert: %s\r\n",
1373 boolopt[global_settings.recursive_dir_insert]);
1374
1388 close(fd); 1375 close(fd);
1389 1376
1390 lcd_clear_display(); 1377 lcd_clear_display();
@@ -1450,9 +1437,6 @@ void settings_reset(void) {
1450 global_settings.ff_rewind_accel = DEFAULT_FF_REWIND_ACCEL_SETTING; 1437 global_settings.ff_rewind_accel = DEFAULT_FF_REWIND_ACCEL_SETTING;
1451 global_settings.resume_index = -1; 1438 global_settings.resume_index = -1;
1452 global_settings.resume_offset = -1; 1439 global_settings.resume_offset = -1;
1453 global_settings.save_queue_resume = true;
1454 global_settings.queue_resume = 0;
1455 global_settings.queue_resume_index = -1;
1456 global_settings.disk_spindown = 5; 1440 global_settings.disk_spindown = 5;
1457 global_settings.disk_poweroff = false; 1441 global_settings.disk_poweroff = false;
1458 global_settings.buffer_margin = 0; 1442 global_settings.buffer_margin = 0;
@@ -1475,6 +1459,7 @@ void settings_reset(void) {
1475 global_settings.max_files_in_dir = 400; 1459 global_settings.max_files_in_dir = 400;
1476 global_settings.max_files_in_playlist = 10000; 1460 global_settings.max_files_in_playlist = 10000;
1477 global_settings.show_icons = true; 1461 global_settings.show_icons = true;
1462 global_settings.recursive_dir_insert = false;
1478} 1463}
1479 1464
1480bool set_bool(char* string, bool* variable ) 1465bool set_bool(char* string, bool* variable )