diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-07-03 22:13:39 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-07-03 22:13:39 +0000 |
commit | c47f8c042c81926ee88d5d8739ff1988d4113d42 (patch) | |
tree | 478955a6932fe5efa5aee34c83a4773268ca1af7 /apps/main.c | |
parent | d4735224bbb27fae62a852c882e6524c6fd716d6 (diff) |
detect cold start (from flash) and look for archos.mod/ajbrec.ajz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3808 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/main.c')
-rw-r--r-- | apps/main.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/apps/main.c b/apps/main.c index b7e02151fb..820c9c3088 100644 --- a/apps/main.c +++ b/apps/main.c @@ -50,6 +50,7 @@ #include "wps-display.h" #include "playlist.h" #include "buffer.h" +#include "rolo.h" char appsversion[]=APPSVERSION; @@ -97,6 +98,7 @@ void init(void) { int rc, i; struct partinfo* pinfo; + bool coldstart; /* starting from Flash */ system_init(); kernel_init(); @@ -131,6 +133,9 @@ void init(void) button_init(); + /* if nobody initialized ATA before, I consider this a cold start */ + coldstart = (PACR2 & 0x4000) != 0; + rc = ata_init(); if(rc) { @@ -168,7 +173,7 @@ void init(void) dbg_partitions(); } } - + settings_load(); status_init(); @@ -188,6 +193,22 @@ void init(void) global_settings.channel_config ); power_init(); + + if (coldstart && !usb_detect()) + { /* when starting from flash, this time _we_ have to yield */ + int fd; +#ifdef HAVE_LCD_CHARCELLS + static const char filename[] = "/archos.mod"; +#else + static const char filename[] = "/ajbrec.ajz"; +#endif + fd = open(filename, O_RDONLY); + if(fd >= 0) /* no complaint if it doesn't exit */ + { + close(fd); + rolo_load((char*)filename); /* start if it does */ + } + } } int main(void) |