mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
Fix for Win 3.x corrupt Group files in FAT image files #2381
This is a fix for #2381. Month ago joncampbell fixed a FAT image problem: scandisk detected file length errors in some created files. But this fix creates a problem with corrupted GRP files in windows 3.1x installations (see #1758). With this new patch both problems are gone: no file size and no group file problems anymore. The creation and extension of windows 3.1x group files is weird: It's done with multiple position and write commands, some of them are writings of 1 or zero bytes at all.
This commit is contained in:
@@ -440,10 +440,9 @@ bool fatFile::Write(const uint8_t * data, uint16_t *size) {
|
||||
if(loadedSector) myDrive->writeSector(currentSector, sectorBuffer);
|
||||
loadedSector = false;
|
||||
|
||||
if (sizedec == 0) { curSectOff = 0; goto finalizeWrite; }
|
||||
|
||||
currentSector = myDrive->getAbsoluteSectFromBytePos(firstCluster, seekpos);
|
||||
if(currentSector == 0) {
|
||||
if (sizedec == 0) goto finalizeWrite;
|
||||
/* EOC reached before EOF - try to increase file allocation */
|
||||
myDrive->appendCluster(firstCluster);
|
||||
/* Try getting sector again */
|
||||
|
Reference in New Issue
Block a user