2013-03-26 15:08:56 +01:00
|
|
|
Index: fat.c
|
|
|
|
===================================================================
|
|
|
|
--- fat.c.orig
|
|
|
|
+++ fat.c
|
2021-06-21 07:49:47 +02:00
|
|
|
@@ -729,6 +729,7 @@ static int fat_32_read(Fs_t *This, union
|
2013-03-26 15:08:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
static int old_fat_read(Fs_t *This, union bootsector *boot,
|
|
|
|
+ int config_fat_bits,
|
2021-06-21 07:49:47 +02:00
|
|
|
uint32_t tot_sectors, int nodups)
|
2013-03-26 15:08:56 +01:00
|
|
|
{
|
|
|
|
This->writeAllFats = 1;
|
2021-06-21 07:49:47 +02:00
|
|
|
@@ -743,7 +744,7 @@ static int old_fat_read(Fs_t *This, unio
|
2013-03-26 15:08:56 +01:00
|
|
|
if(check_media_type(This,boot, tot_sectors))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
- if(This->num_clus >= FAT12) {
|
|
|
|
+ if(This->num_clus >= FAT12 || config_fat_bits == 16) {
|
|
|
|
set_fat16(This);
|
|
|
|
/* third FAT byte must be 0xff */
|
|
|
|
if(!mtools_skip_check && readByte(This, 3) != 0xff)
|
2021-06-21 07:49:47 +02:00
|
|
|
@@ -759,6 +760,7 @@ static int old_fat_read(Fs_t *This, unio
|
2013-03-26 15:08:56 +01:00
|
|
|
* structures.
|
|
|
|
*/
|
|
|
|
int fat_read(Fs_t *This, union bootsector *boot,
|
|
|
|
+ int fat_bits,
|
2021-06-21 07:49:47 +02:00
|
|
|
uint32_t tot_sectors, int nodups)
|
2013-03-26 15:08:56 +01:00
|
|
|
{
|
|
|
|
This->fat_error = 0;
|
2021-06-21 07:49:47 +02:00
|
|
|
@@ -769,7 +771,7 @@ int fat_read(Fs_t *This, union bootsecto
|
2013-03-26 15:08:56 +01:00
|
|
|
This->lastFatSectorData = 0;
|
|
|
|
|
|
|
|
if(This->fat_len)
|
|
|
|
- return old_fat_read(This, boot, tot_sectors, nodups);
|
|
|
|
+ return old_fat_read(This, boot, fat_bits, tot_sectors, nodups);
|
|
|
|
else
|
|
|
|
return fat_32_read(This, boot, tot_sectors);
|
|
|
|
}
|
|
|
|
Index: init.c
|
|
|
|
===================================================================
|
|
|
|
--- init.c.orig
|
|
|
|
+++ init.c
|
2021-06-21 07:49:47 +02:00
|
|
|
@@ -530,7 +530,7 @@ Stream_t *fs_init(char drive, int mode,
|
2013-03-26 15:08:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* read the FAT sectors */
|
|
|
|
- if(fat_read(This, &boot, tot_sectors, dev.use_2m&0x7f)){
|
|
|
|
+ if(fat_read(This, &boot, dev.fat_bits, tot_sectors, dev.use_2m&0x7f)){
|
2021-06-21 07:49:47 +02:00
|
|
|
fprintf(stderr, "Error reading FAT\n");
|
2013-03-26 15:08:56 +01:00
|
|
|
This->num_fat = 1;
|
|
|
|
FREE(&This->Next);
|
|
|
|
Index: fsP.h
|
|
|
|
===================================================================
|
|
|
|
--- fsP.h.orig
|
|
|
|
+++ fsP.h
|
2021-06-21 07:49:47 +02:00
|
|
|
@@ -94,6 +94,7 @@ void fatAllocate(Fs_t *This, unsigned in
|
2013-03-26 15:08:56 +01:00
|
|
|
void fatEncode(Fs_t *This, unsigned int pos, unsigned int value);
|
|
|
|
|
|
|
|
int fat_read(Fs_t *This, union bootsector *boot,
|
2021-06-21 07:49:47 +02:00
|
|
|
+ int fat_bits,
|
|
|
|
uint32_t tot_sectors, int nodups);
|
2013-03-26 15:08:56 +01:00
|
|
|
void fat_write(Fs_t *This);
|
2021-06-21 07:49:47 +02:00
|
|
|
int zero_fat(Fs_t *Fs, uint8_t media_descriptor);
|