summaryrefslogtreecommitdiff
path: root/firmware/include/dircache_redirect.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include/dircache_redirect.h')
-rw-r--r--firmware/include/dircache_redirect.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/firmware/include/dircache_redirect.h b/firmware/include/dircache_redirect.h
index 9a8de2fecd..e8cf8dc8f5 100644
--- a/firmware/include/dircache_redirect.h
+++ b/firmware/include/dircache_redirect.h
@@ -25,6 +25,12 @@
25#include "dir.h" 25#include "dir.h"
26#include "dircache.h" 26#include "dircache.h"
27 27
28#if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR)
29#include "rb-loader.h"
30#include "bootdata.h"
31#include "crc32.h"
32#endif
33
28/*** 34/***
29 ** Internal redirects that depend upon whether or not dircache is made 35 ** Internal redirects that depend upon whether or not dircache is made
30 ** 36 **
@@ -132,11 +138,47 @@ static inline void volume_onmount_internal(IF_MV_NONVOID(int volume))
132#else 138#else
133 const char *path = PATH_ROOTSTR; 139 const char *path = PATH_ROOTSTR;
134#endif 140#endif
141
142#if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR)
143 static char rtpath[VOL_MAX_LEN+2] = RB_ROOT_CONTENTS_DIR;
144 static bool redirected = false;
145 int boot_volume = 0;
146 unsigned int crc = 0;
147
148 crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff);
149 if (crc == boot_data.crc)
150 {
151 root_mount_path(path, 0); /*root could be different folder don't hide*/
152 boot_volume = boot_data.boot_volume; /* boot volume contained in uint8_t payload */
153 //root_mount_path(path, volume == boot_volume ? NSITEM_HIDDEN : 0);
154 if (!redirected && volume == boot_volume)
155 {
156 if (get_redirect_dir(rtpath, sizeof(rtpath), volume, "", "") < 0)
157 { /* Error occurred, card removed? Set root to default */
158 root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS);
159 }
160 else
161 redirected = true;
162 }
163 if (redirected && volume == boot_volume)
164 root_mount_path(rtpath, NSITEM_CONTENTS);
165 } /*CRC OK*/
166 else
167 {
168 root_mount_path(path, RB_ROOT_VOL_HIDDEN(volume) ? NSITEM_HIDDEN : 0);
169 if (volume == path_strip_volume(RB_ROOT_CONTENTS_DIR, NULL, false))
170 root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS);
171 }
172#else
173
135 root_mount_path(path, RB_ROOT_VOL_HIDDEN(volume) ? NSITEM_HIDDEN : 0); 174 root_mount_path(path, RB_ROOT_VOL_HIDDEN(volume) ? NSITEM_HIDDEN : 0);
136#ifdef HAVE_MULTIVOLUME 175#ifdef HAVE_MULTIVOLUME
137 if (volume == path_strip_volume(RB_ROOT_CONTENTS_DIR, NULL, false)) 176 if (volume == path_strip_volume(RB_ROOT_CONTENTS_DIR, NULL, false))
138#endif 177#endif
139 root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS); 178 root_mount_path(RB_ROOT_CONTENTS_DIR, NSITEM_CONTENTS);
179
180#endif /* HAVE_MULTIBOOT */
181
140#ifdef HAVE_DIRCACHE 182#ifdef HAVE_DIRCACHE
141 dircache_mount(); 183 dircache_mount();
142#endif 184#endif