DEV9: Fix off by one error on LBA range check

This commit is contained in:
TheLastRar 2022-02-06 16:32:19 +00:00 committed by lightningterror
parent 990d7ad0f7
commit 5d2bcfaa38
1 changed files with 1 additions and 1 deletions

View File

@ -396,7 +396,7 @@ bool ATA::HDD_CanAccess(int* sectors)
s64 posEnd; s64 posEnd;
s64 maxLBA; s64 maxLBA;
maxLBA = std::min<s64>((s64)config.HddSize * 1024 * 1024 / 512, hddImageSize); maxLBA = std::min<s64>((s64)config.HddSize * 1024 * 1024 / 512, hddImageSize) - 1;
if ((regSelect & 0x40) == 0) //CHS mode if ((regSelect & 0x40) == 0) //CHS mode
maxLBA = std::min<s64>(maxLBA, curCylinders * curHeads * curSectors); maxLBA = std::min<s64>(maxLBA, curCylinders * curHeads * curSectors);