From 7d6b9bcb40b6ace3cbc82324e5f9bb194406d00a Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 7 Oct 2019 10:37:33 -0700 Subject: [PATCH] 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. --- Source/Core/Core/HW/DVD/DVDThread.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/HW/DVD/DVDThread.cpp b/Source/Core/Core/HW/DVD/DVDThread.cpp index af60fb16c6..5f28518a91 100644 --- a/Source/Core/Core/HW/DVD/DVDThread.cpp +++ b/Source/Core/Core/HW/DVD/DVDThread.cpp @@ -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()