diff options
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/apps/tree.c b/apps/tree.c index e5c515f06b..6e52942b45 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -658,6 +658,26 @@ bool pageupdown(int* ds, int* dc, int numentries, int tree_max_on_screen ) | |||
658 | } | 658 | } |
659 | #endif | 659 | #endif |
660 | 660 | ||
661 | static void storefile(char* filename, char* setting, int maxlen) | ||
662 | { | ||
663 | int len = strlen(filename); | ||
664 | int extlen = 0; | ||
665 | char* ptr = filename + len; | ||
666 | |||
667 | while (*ptr != '.') { | ||
668 | extlen++; | ||
669 | ptr--; | ||
670 | } | ||
671 | |||
672 | if (strcmp(ROCKBOX_DIR, currdir) || (len > maxlen-extlen)) | ||
673 | return; | ||
674 | |||
675 | strncpy(setting, filename, len-extlen); | ||
676 | setting[len-extlen]=0; | ||
677 | |||
678 | settings_save(); | ||
679 | } | ||
680 | |||
661 | bool dirbrowse(char *root) | 681 | bool dirbrowse(char *root) |
662 | { | 682 | { |
663 | int numentries=0; | 683 | int numentries=0; |
@@ -771,6 +791,7 @@ bool dirbrowse(char *root) | |||
771 | int seed = current_tick; | 791 | int seed = current_tick; |
772 | bool play = false; | 792 | bool play = false; |
773 | int start_index=0; | 793 | int start_index=0; |
794 | |||
774 | lcd_stop_scroll(); | 795 | lcd_stop_scroll(); |
775 | switch ( file->attr & TREE_ATTR_MASK ) { | 796 | switch ( file->attr & TREE_ATTR_MASK ) { |
776 | case TREE_ATTR_M3U: | 797 | case TREE_ATTR_M3U: |
@@ -802,7 +823,9 @@ bool dirbrowse(char *root) | |||
802 | case TREE_ATTR_WPS: | 823 | case TREE_ATTR_WPS: |
803 | snprintf(buf, sizeof buf, "%s/%s", | 824 | snprintf(buf, sizeof buf, "%s/%s", |
804 | currdir, file->name); | 825 | currdir, file->name); |
805 | wps_load_custom(buf); | 826 | wps_load(buf,true); |
827 | storefile(file->name, global_settings.wps_file, | ||
828 | MAX_FILENAME); | ||
806 | restore = true; | 829 | restore = true; |
807 | break; | 830 | break; |
808 | 831 | ||
@@ -824,6 +847,10 @@ bool dirbrowse(char *root) | |||
824 | snprintf(buf, sizeof buf, "%s/%s", | 847 | snprintf(buf, sizeof buf, "%s/%s", |
825 | currdir, file->name); | 848 | currdir, file->name); |
826 | if(!lang_load(buf)) { | 849 | if(!lang_load(buf)) { |
850 | storefile(file->name, | ||
851 | global_settings.lang_file, | ||
852 | MAX_FILENAME); | ||
853 | |||
827 | lcd_clear_display(); | 854 | lcd_clear_display(); |
828 | #ifdef HAVE_LCD_CHARCELLS | 855 | #ifdef HAVE_LCD_CHARCELLS |
829 | lcd_puts(0, 0, str(LANG_LANGUAGE_LOADED)); | 856 | lcd_puts(0, 0, str(LANG_LANGUAGE_LOADED)); |
@@ -849,6 +876,9 @@ bool dirbrowse(char *root) | |||
849 | snprintf(buf, sizeof buf, "%s/%s", | 876 | snprintf(buf, sizeof buf, "%s/%s", |
850 | currdir, file->name); | 877 | currdir, file->name); |
851 | font_load(buf); | 878 | font_load(buf); |
879 | storefile(file->name, global_settings.font_file, | ||
880 | MAX_FILENAME); | ||
881 | |||
852 | lcd_getstringsize("A", &fw, &fh); | 882 | lcd_getstringsize("A", &fw, &fh); |
853 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 883 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
854 | /* make sure cursor is on screen */ | 884 | /* make sure cursor is on screen */ |