Check for error 001 out of bounds reads in DVDThread

All out of bounds reads should return the appropriate DI error, but it also
makes sense to have the error 001 read happen there.
This commit is contained in:
Pokechu22 2019-10-07 10:37:33 -07:00
parent ef2fc5a49b
commit 7d6b9bcb40
1 changed files with 18 additions and 4 deletions

View File

@ -342,20 +342,34 @@ static void FinishRead(u64 id, s64 cycles_late)
(CoreTiming::GetTicks() - request.time_started_ticks) /
(SystemTimers::GetTicksPerSecond() / 1000000));
DVDInterface::DIInterruptType interrupt;
if (buffer.size() != request.length)
{
PanicAlertT("The disc could not be read (at 0x%" PRIx64 " - 0x%" PRIx64 ").",
request.dvd_offset, request.dvd_offset + request.length);
if (request.dvd_offset != 0x118280000 && request.dvd_offset != 0x1FB500000)
{
PanicAlertT("The disc could not be read (at 0x%" PRIx64 " - 0x%" PRIx64 ").",
request.dvd_offset, request.dvd_offset + request.length);
}
else
{
// Part of the error 001 check.
INFO_LOG(DVDINTERFACE, "Ignoring out of bounds test read (at 0x%" PRIx64 " - 0x%" PRIx64 ")",
request.dvd_offset, request.dvd_offset + request.length);
}
DVDInterface::SetHighError(DVDInterface::ERROR_BLOCK_OOB);
interrupt = DVDInterface::DIInterruptType::DEINT;
}
else
{
if (request.copy_to_ram)
Memory::CopyToEmu(request.output_address, buffer.data(), request.length);
interrupt = DVDInterface::DIInterruptType::TCINT;
}
// Notify the emulated software that the command has been executed
DVDInterface::FinishExecutingCommand(request.reply_type, DVDInterface::DIInterruptType::TCINT,
cycles_late, buffer);
DVDInterface::FinishExecutingCommand(request.reply_type, interrupt, cycles_late, buffer);
}
static void DVDThread()