* FAT12/16/32 Driver Version (Incl LFN)\r
* \r
* NOTE: This driver will only support _reading_ long file names, not\r
- * writing. I don't even know why i'm adding write-support. FAT sucks.\r
+ * writing. I don't even know why I'm adding write-support. FAT sucks.\r
* \r
* Known Bugs:\r
* - LFN Is buggy in FAT_ReadDir\r
* \todo Implement changing of the parent directory when a file is written to\r
* \todo Implement file creation / deletion\r
*/\r
-#define DEBUG 1\r
+#define DEBUG 0\r
#define VERBOSE 1\r
\r
#define CACHE_FAT 1 //!< Caches the FAT in memory\r
-#define USE_LFN 0 //!< Enables the use of Long File Names\r
+#define USE_LFN 1 //!< Enables the use of Long File Names\r
#define SUPPORT_WRITE 0\r
\r
#include <acess.h>\r
if(Cluster) *Cluster = cluster;\r
}\r
\r
+ LOG("cluster = %08x", cluster);\r
+ \r
// Bounds Checking (Used to spot corruption)\r
if(cluster > disk->ClusterCount + 2)\r
{\r
return 1;\r
}\r
\r
+ LOG("addr = 0x%llx", addr);\r
// Read Sector\r
if(VFS_ReadAt(disk->fileHandle, addr, 512, Buffer) != 512)\r
{\r
\r
if(FAT_int_ReadDirSector(Node, ID/16, fileinfo))\r
{\r
+ LOG("End of chain, end of dir");\r
LEAVE('n');\r
return NULL;\r
}\r
// Offset in sector\r
a = ID % 16;\r
\r
- LOG("a = %i", a);\r
- \r
- LOG("name[0] = 0x%x", (Uint8)fileinfo[a].name[0]);\r
+ LOG("fileinfo[%i].name[0] = 0x%x", a, (Uint8)fileinfo[a].name[0]);\r
\r
// Check if this is the last entry\r
if( fileinfo[a].name[0] == '\0' ) {\r
// Check for empty entry\r
if( (Uint8)fileinfo[a].name[0] == 0xE5 ) {\r
LOG("Empty Entry");\r
+ #if 0 // Stop on empty entry?\r
+ LEAVE('n');\r
+ return NULL; // Stop\r
+ #else\r
LEAVE('p', VFS_SKIP);\r
return VFS_SKIP; // Skip\r
+ #endif\r
}\r
\r
#if USE_LFN\r
{\r
// Remove LFN if it does not apply\r
if(lfnId != i) lfn[0] = '\0';\r
+ #else\r
+ if(fileinfo[i&0xF].attrib == ATTR_LFN) continue;\r
#endif\r
// Get Real Filename\r
FAT_int_ProperFilename(tmpName, fileinfo[i&0xF].name);\r