Sansa Multiboot Root Redirect Enhance + bug fix
filename buffer was too small to retrieve redirect path if redirected to sd root remove <SD1> as it is redundant Change-Id: I1326601f1ba4a18d6bc173798759eb762b55528c
This commit is contained in:
parent
ee87bfb933
commit
bc3fa53937
2 changed files with 35 additions and 34 deletions
|
@ -2526,20 +2526,21 @@ static bool dbg_skin_engine(void)
|
|||
#if defined(HAVE_BOOTDATA) && !defined(SIMULATOR)
|
||||
static bool dbg_boot_data(void)
|
||||
{
|
||||
unsigned int crc = 0;
|
||||
unsigned int crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff);
|
||||
struct simplelist_info info;
|
||||
info.scroll_all = true;
|
||||
simplelist_info_init(&info, "Boot data", 1, NULL);
|
||||
simplelist_set_line_count(0);
|
||||
crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff);
|
||||
|
||||
#if defined(HAVE_MULTIBOOT)
|
||||
char rootpath[VOL_MAX_LEN+2] = RB_ROOT_CONTENTS_DIR;
|
||||
char rootpath[MAX_PATH / 2] = RB_ROOT_CONTENTS_DIR;
|
||||
int boot_volume = 0;
|
||||
if(crc == boot_data.crc)
|
||||
{
|
||||
boot_volume = boot_data.boot_volume; /* boot volume contained in uint8_t payload */
|
||||
get_redirect_dir(rootpath, sizeof(rootpath), boot_volume, "", "");
|
||||
rootpath[path_strip_trailing_separators(rootpath,NULL)] = '\0';
|
||||
int rtlen = get_redirect_dir(rootpath, sizeof(rootpath), boot_volume, "", "");
|
||||
while (rtlen > 0 && rootpath[--rtlen] == PATH_SEPCH) /* remove extra separators */
|
||||
rootpath[rtlen] = '\0';
|
||||
}
|
||||
simplelist_addline("Boot Volume: <%lu>", boot_volume);
|
||||
simplelist_addline("Root:");
|
||||
|
|
|
@ -138,49 +138,49 @@ static inline void fileop_onsync_internal(struct filestr_base *stream)
|
|||
|
||||
static inline void volume_onmount_internal(IF_MV_NONVOID(int volume))
|
||||
{
|
||||
#ifdef HAVE_MULTIVOLUME
|
||||
char path[VOL_MAX_LEN+2];
|
||||
make_volume_root(volume, path);
|
||||
#else
|
||||
const char *path = PATH_ROOTSTR;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR) && !defined(BOOTLOADER)
|
||||
static char rtpath[VOL_MAX_LEN+2] = RB_ROOT_CONTENTS_DIR;
|
||||
static bool redirected = false;
|
||||
int boot_volume = 0;
|
||||
unsigned int crc = 0;
|
||||
crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff);
|
||||
if (crc == boot_data.crc)
|
||||
char path[VOL_MAX_LEN+2];
|
||||
char rtpath[MAX_PATH / 2];
|
||||
make_volume_root(volume, path);
|
||||
|
||||
unsigned int crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff);
|
||||
if (crc > 0 && crc == boot_data.crc)
|
||||
{
|
||||
root_mount_path(path, 0); /*root could be different folder don't hide*/
|
||||
boot_volume = boot_data.boot_volume; /* boot volume contained in uint8_t payload */
|
||||
//root_mount_path(path, volume == boot_volume ? NSITEM_HIDDEN : 0);
|
||||
if (!redirected && volume == boot_volume)
|
||||
/* we need to mount the drive before we can access it */
|
||||
root_mount_path(path, 0); /* root could be different folder don't hide */
|
||||
|
||||
if (volume == boot_data.boot_volume) /* boot volume contained in uint8_t payload */
|
||||
{
|
||||
if (get_redirect_dir(rtpath, sizeof(rtpath), volume, "", "") < 0)
|
||||
{ /* Error occurred, card removed? Set root to default */
|
||||
root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS);
|
||||
}
|
||||
else
|
||||
redirected = true;
|
||||
}
|
||||
if (redirected && volume == boot_volume)
|
||||
int rtlen = get_redirect_dir(rtpath, sizeof(rtpath), volume, "", "");
|
||||
while (rtlen > 0 && rtpath[--rtlen] == PATH_SEPCH)
|
||||
rtpath[rtlen] = '\0'; /* remove extra separators */
|
||||
|
||||
if (rtlen <= 0 || rtpath[rtlen] == VOL_END_TOK)
|
||||
root_unmount_volume(volume); /* unmount so root can be hidden*/
|
||||
|
||||
if (rtlen <= 0) /* Error occurred, card removed? Set root to default */
|
||||
goto standard_redirect;
|
||||
root_mount_path(rtpath, NSITEM_CONTENTS);
|
||||
}
|
||||
|
||||
} /*CRC OK*/
|
||||
else
|
||||
{
|
||||
standard_redirect:
|
||||
root_mount_path(path, RB_ROOT_VOL_HIDDEN(volume) ? NSITEM_HIDDEN : 0);
|
||||
if (volume == path_strip_volume(RB_ROOT_CONTENTS_DIR, NULL, false))
|
||||
root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS);
|
||||
}
|
||||
#else /*ndef HAVE_MULTIBOOT */
|
||||
|
||||
#elif defined(HAVE_MULTIVOLUME)
|
||||
char path[VOL_MAX_LEN+2];
|
||||
make_volume_root(volume, path);
|
||||
root_mount_path(path, RB_ROOT_VOL_HIDDEN(volume) ? NSITEM_HIDDEN : 0);
|
||||
#ifdef HAVE_MULTIVOLUME
|
||||
if (volume == path_strip_volume(RB_ROOT_CONTENTS_DIR, NULL, false))
|
||||
#endif
|
||||
root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS);
|
||||
#else
|
||||
const char *path = PATH_ROOTSTR;
|
||||
root_mount_path(path, RB_ROOT_VOL_HIDDEN(volume) ? NSITEM_HIDDEN : 0);
|
||||
root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS);
|
||||
#endif /* HAVE_MULTIBOOT */
|
||||
|
||||
#ifdef HAVE_DIRCACHE
|
||||
|
|
Loading…
Reference in a new issue