From c47f8c042c81926ee88d5d8739ff1988d4113d42 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Thu, 3 Jul 2003 22:13:39 +0000 Subject: 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 --- apps/main.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'apps') 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) -- cgit v1.2.3