VOGONS


First post, by NewRisingSun

User metadata
Rank Oldbie
Rank
Oldbie

In dos/drive_fat.cpp, there are several instances of or similar to

	if (!loadedSector) {
currentSector = myDrive->getAbsoluteSectFromBytePos(firstCluster, seekpos);
if(currentSector == 0) {
/* EOC reached before EOF */
*size = 0;
loadedSector = false;
return true;
}
curSectOff = 0;
myDrive->loadedDisk->Read_AbsoluteSector(currentSector, sectorBuffer);
loadedSector = true;
}

Why is curSectOff set to zero instead of "seekpos % myDrive->getSectorSize();"? Setting it to zero breaks at least two games: installing Prince of Persia 2 from floppy disk images and "Icon: Quest for the Ring" (which uses FCBs). Changing curSectOffs to the modulus of seekpos fixes both games while to my knowledge not breaking anything else. loadedSector can be false because fatFile::Seek reads a sector into sectorBuffer without setting loadedSector to true (which is also strange, but there may be a reason for it).