[FREELDR]

- Set the partition count to 0 for a floppy drive so it can be told apart from a cd-rom drive
- Add a last-chance sector size detection algorithm based on the partition number
- Add the same detection code to the xbox code too (it is essentially the same as what was already there just with more comments)
- Change DiskNormalizeSystemPath so it doesn't try to "normalize" a floppy boot path
- Fixes bug #5233

svn path=/trunk/; revision=47051
This commit is contained in:
Cameron Gutman
2010-04-27 22:12:11 +00:00
parent d39102cd83
commit 5f783c4e2d
4 changed files with 33 additions and 4 deletions
@@ -452,7 +452,23 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
SectorCount = Geometry.Sectors;
}
else
return EINVAL;
{
DPRINTM(DPRINT_HWDETECT, "Using legacy sector size detection\n");
/* Fall back to legacy detection */
if (DrivePartition == 0xff)
{
/* This is a CD-ROM device */
SectorSize = 2048;
}
else
{
/* This is either a floppy disk device (DrivePartition == 0) or
* a hard disk device (DrivePartition != 0 && DrivePartition != 0xFF) but
* it doesn't matter which one because they both have 512 bytes per sector */
SectorSize = 512;
}
}
if (DrivePartition != 0xff && DrivePartition != 0)
{
@@ -138,7 +138,20 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
if (!DissectArcPath(Path, FileName, &DriveNumber, &DrivePartition))
return EINVAL;
SectorSize = (DrivePartition == 0xff ? 2048 : 512);
if (DrivePartition == 0xff)
{
/* This is a CD-ROM device */
SectorSize = 2048;
}
else
{
/* This is either a floppy disk device (DrivePartition == 0) or
* a hard disk device (DrivePartition != 0 && DrivePartition != 0xFF) but
* it doesn't matter which one because they both have 512 bytes per sector */
SectorSize = 512;
}
if (DrivePartition != 0xff && DrivePartition != 0)
{
if (!XboxDiskGetPartitionEntry(DriveNumber, DrivePartition, &PartitionTableEntry))
+1 -1
View File
@@ -136,7 +136,7 @@ DiskNormalizeSystemPath(char *SystemPath, unsigned Size)
return FALSE;
}
if (0 != PartitionNumber)
if (0 != PartitionNumber || DriveNumber < 0x80)
{
return TRUE;
}
@@ -60,7 +60,7 @@ BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* B
if (p == NULL)
return FALSE;
p++;
*BootPartition = 0xff;
*BootPartition = 0;
}
else if (_strnicmp(p, "cdrom(", 6) == 0)
{