DVDInterface: Increase the latency for read commands

Hardware tested using cached reads.

Fixes Ed, Edd n Eddy. https://bugs.dolphin-emu.org/issues/10373
This commit is contained in:
JosJuice 2020-07-05 15:48:03 +02:00
parent 0dbe8fb2ea
commit 327b985718

View File

@ -43,9 +43,11 @@
#include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/OnScreenDisplay.h"
// The minimum time it takes for the DVD drive to process a command (in // The minimum time it takes for the DVD drive to process a command (in microseconds)
// microseconds) constexpr u64 MINIMUM_COMMAND_LATENCY_US = 300;
constexpr u64 COMMAND_LATENCY_US = 300;
// The time it takes for a read command to start (in microseconds)
constexpr u64 READ_COMMAND_LATENCY_US = 600;
// The size of the streaming buffer. // The size of the streaming buffer.
constexpr u64 STREAMING_BUFFER_SIZE = 1024 * 1024; constexpr u64 STREAMING_BUFFER_SIZE = 1024 * 1024;
@ -1182,10 +1184,10 @@ void ExecuteCommand(ReplyType reply_type)
if (!command_handled_by_thread) if (!command_handled_by_thread)
{ {
// TODO: Needs testing to determine if COMMAND_LATENCY_US is accurate for this // TODO: Needs testing to determine if MINIMUM_COMMAND_LATENCY_US is accurate for this
CoreTiming::ScheduleEvent(COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000), CoreTiming::ScheduleEvent(
s_finish_executing_command, MINIMUM_COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000),
PackFinishExecutingCommandUserdata(reply_type, interrupt_type)); s_finish_executing_command, PackFinishExecutingCommandUserdata(reply_type, interrupt_type));
} }
} }
@ -1201,10 +1203,10 @@ void PerformDecryptingRead(u32 position, u32 length, u32 output_address,
if (!command_handled_by_thread) if (!command_handled_by_thread)
{ {
// TODO: Needs testing to determine if COMMAND_LATENCY_US is accurate for this // TODO: Needs testing to determine if MINIMUM_COMMAND_LATENCY_US is accurate for this
CoreTiming::ScheduleEvent(COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000), CoreTiming::ScheduleEvent(
s_finish_executing_command, MINIMUM_COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000),
PackFinishExecutingCommandUserdata(reply_type, interrupt_type)); s_finish_executing_command, PackFinishExecutingCommandUserdata(reply_type, interrupt_type));
} }
} }
@ -1378,8 +1380,8 @@ void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& partition, u
"Schedule reads: offset=0x%" PRIx64 " length=0x%" PRIx32 " address=0x%" PRIx32, offset, "Schedule reads: offset=0x%" PRIx64 " length=0x%" PRIx32 " address=0x%" PRIx32, offset,
length, output_address); length, output_address);
// The DVD drive's minimum turnaround time on a command, based on a hardware test. s64 ticks_until_completion =
s64 ticks_until_completion = COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000); READ_COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000);
u32 buffered_blocks = 0; u32 buffered_blocks = 0;
u32 unbuffered_blocks = 0; u32 unbuffered_blocks = 0;