freemyipod r246 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r245‎ | r246 | r247 >
Date:20:17, 2 November 2010
Author:theseven
Status:new
Tags:
Comment:
UMSboot: Fix problems that occurred when more than 2MB of the file system were used
Modified paths:
  • /umsboot/main.c (modified) (history)

Diff [purge]

Index: umsboot/main.c
@@ -87,7 +87,7 @@
8888 ((uint16_t*)buffer)[0xb] = fatsectors;
8989 buffer[0x24] = 0x80;
9090 buffer[0x26] = 0x29;
91 - memcpy(&buffer[0x27], "UMSbUMSboot FAT16 ", 0x17);
 91+ memcpy(&buffer[0x27], "UBRDUMSboot FAT16 ", 0x17);
9292 ((uint16_t*)buffer)[0xff] = 0xaa55;
9393 return fatsectors;
9494 }
@@ -167,8 +167,8 @@
168168 while (cluster != 0xffff)
169169 {
170170 swap(fatsectors + cluster, dest++);
171 - cluster = *((uint16_t*)&ramdisk[swapmap[1 + (cluster / RAMDISK_SECTORSIZE)]]
172 - [(cluster % RAMDISK_SECTORSIZE) * 2]);
 171+ cluster = *((uint16_t*)&ramdisk[swapmap[1 + (cluster / (RAMDISK_SECTORSIZE / 2))]]
 172+ [(cluster % (RAMDISK_SECTORSIZE / 2)) * 2]);
173173 }
174174 lcdconsole_puts("Rearranging files...\n", 0, 0xffff);
175175 uint16_t offset = RAMDISK_SECTORS - totalclusters - 2;
@@ -191,10 +191,10 @@
192192 while (cluster != 0xffff)
193193 {
194194 swap(fatsectors + cluster, offset + dest++);
195 - cluster = *((uint16_t*)&ramdisk[swapmap[1 + (cluster / RAMDISK_SECTORSIZE)]]
196 - [(cluster % RAMDISK_SECTORSIZE) * 2]);
197 - if (cluster == 0xffff) ((uint16_t*)newfat)[dest - 1] = 0xffff;
198 - else ((uint16_t*)newfat)[dest - 1] = dest;
 195+ cluster = *((uint16_t*)&ramdisk[swapmap[1 + (cluster / (RAMDISK_SECTORSIZE / 2))]]
 196+ [(cluster % (RAMDISK_SECTORSIZE / 2)) * 2]);
 197+ if (cluster == 0xffff) newfat[dest - 1] = 0xffff;
 198+ else newfat[dest - 1] = dest;
199199 }
200200 }
201201 newptr += 0x20;