*Another fix for ntfs write

This commit is contained in:
dimok321 2010-02-25 14:55:42 +00:00
parent 0908027ad8
commit e4b48d2712
3 changed files with 11 additions and 17 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>1.0 r915</version>
<release_date>201002222143</release_date>
<version>1.0 r916</version>
<release_date>201002251225</release_date>
<short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

View File

@ -421,21 +421,11 @@ static s64 ntfs_device_gekko_io_writebytes(struct ntfs_device *dev, s64 offset,
// Read the first and last sectors of the buffer from disc (if required)
// NOTE: This is done because the data does not line up with the sector boundaries,
// we just read in the buffer edges where the data overlaps with the rest of the disc
if(offset % fd->sectorSize != 0) {
if (!ntfs_device_gekko_io_readsectors(dev, sec_start, 1, buffer)) {
ntfs_log_perror("read failure @ sector %d\n", sec_start);
ntfs_free(buffer);
errno = EIO;
return -1;
}
}
if((count % fd->sectorSize != 0) || buffer_offset > 0) {
if (!ntfs_device_gekko_io_readsectors(dev, sec_start + sec_count-1, 1, buffer + ((sec_count - 1) * fd->sectorSize))) {
ntfs_log_perror("read failure @ sector %d\n", sec_start + sec_count);
ntfs_free(buffer);
errno = EIO;
return -1;
}
if (!ntfs_device_gekko_io_readsectors(dev, sec_start, sec_count, buffer)) {
ntfs_log_perror("read failure @ sector %d\n", sec_start);
ntfs_free(buffer);
errno = EIO;
return -1;
}
// Copy the data into the write buffer

View File

@ -273,6 +273,10 @@ s32 USBStorage2_WriteSectors(u32 sector, u32 numSectors, const void *buffer)
/* Write data */
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector, numSectors, buf, len);
/* Free memory */
if (buf != buffer)
iosFree(hid, buf);
return ret;
}