1
0
Fork 0
forked from len0rd/rockbox

The file browser now detects if ajbrec.ajz/archos.mod has been modified after a usb session, and asks if you want to reboot to the new version.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3783 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2003-06-29 22:39:35 +00:00
parent 2f836a655c
commit ba5dfbd71e
2 changed files with 48 additions and 0 deletions

View file

@ -1599,3 +1599,16 @@ desc: The plugin return an error code
eng: "Plugin returned error" eng: "Plugin returned error"
new: new:
##
## boot change detection
##
id: LANG_BOOT_CHANGED
desc: File browser discovered the boot file was changed
eng: "Boot changed"
new:
id: LANG_REBOOT_NOW
desc: Do you want to reboot?
eng: "Reboot now?"
new:

View file

@ -55,6 +55,9 @@
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include "widgets.h" #include "widgets.h"
#define BOOTFILE "ajbrec.ajz"
#else
#define BOOTFILE "archos.mod"
#endif #endif
/* Boot value of global_settings.max_files_in_dir */ /* Boot value of global_settings.max_files_in_dir */
@ -80,6 +83,9 @@ static char lastdir[MAX_PATH];
static char lastfile[MAX_PATH]; static char lastfile[MAX_PATH];
static char currdir[MAX_PATH]; static char currdir[MAX_PATH];
static bool reload_dir = false; static bool reload_dir = false;
static int boot_size = 0;
static int boot_cluster;
static bool boot_changed = false;
void browse_root(void) void browse_root(void)
{ {
@ -322,6 +328,17 @@ static int showdir(char *path, int start)
dptr->attr |= TREE_ATTR_ROCK; dptr->attr |= TREE_ATTR_ROCK;
} }
/* memorize/compare details about the boot file */
if ((currdir[1] == 0) && !strcmp(entry->d_name, BOOTFILE)) {
if (boot_size) {
if ((entry->size != boot_size) ||
(entry->startcluster != boot_cluster))
boot_changed = true;
}
boot_size = entry->size;
boot_cluster = entry->startcluster;
}
/* filter out all non-playlist files */ /* filter out all non-playlist files */
if ( global_settings.dirfilter == SHOW_PLAYLIST && if ( global_settings.dirfilter == SHOW_PLAYLIST &&
(!(dptr->attr & (!(dptr->attr &
@ -822,6 +839,24 @@ bool dirbrowse(char *root)
bool restore = false; bool restore = false;
button = button_get_w_tmo(HZ/5); button = button_get_w_tmo(HZ/5);
#ifndef SIMULATOR
if (boot_changed) {
lcd_clear_display();
lcd_puts(0,0,str(LANG_BOOT_CHANGED));
lcd_puts(0,1,str(LANG_REBOOT_NOW));
#ifdef HAVE_LCD_BITMAP
lcd_puts(0,3,str(LANG_CONFIRM_WITH_PLAY_RECORDER));
lcd_puts(0,4,str(LANG_CANCEL_WITH_ANY_RECORDER));
lcd_update();
#endif
if (button_get(true) == BUTTON_PLAY)
rolo_load("/" BOOTFILE);
restore = true;
boot_changed = false;
}
#endif
switch ( button ) { switch ( button ) {
case TREE_EXIT: case TREE_EXIT:
case BUTTON_RC_STOP: case BUTTON_RC_STOP: