From 537e40afb500c1ca8941b757dec4aa9db082099c Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 19 Jan 2020 10:45:52 -0800 Subject: [PATCH] Only update DIMAR and DILENGTH if transfer completed without error Turns out, Gamecube games actually do check DILENGTH, and if DILENGTH is at 0, they'll think the transfer completed successfully even if DEINT is used, since after all, surely that means everything was sent. That caused all sorts of issues, from audio looping when a disc is removed since it's re-using the same buffer to just flat-out crashing instead of showing the disc removed screen. --- Source/Core/Core/HW/DVD/DVDInterface.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/HW/DVD/DVDInterface.cpp b/Source/Core/Core/HW/DVD/DVDInterface.cpp index 4404425e82..a7b04ddcd3 100644 --- a/Source/Core/Core/HW/DVD/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVD/DVDInterface.cpp @@ -1283,8 +1283,11 @@ void FinishExecutingCommand(ReplyType reply_type, DIInterruptType interrupt_type else if (reply_type == ReplyType::Interrupt || reply_type == ReplyType::IOS) transfer_size = s_DILENGTH; - s_DIMAR += transfer_size; - s_DILENGTH -= transfer_size; + if (interrupt_type == DIInterruptType::TCINT) + { + s_DIMAR += transfer_size; + s_DILENGTH -= transfer_size; + } switch (reply_type) {