From 1830342d66d1b819133e7de6f80a3d8035892d68 Mon Sep 17 00:00:00 2001 From: skidau Date: Tue, 23 Nov 2010 10:51:14 +0000 Subject: [PATCH] Quick FIFO fix for Donkey Kong Country Returns. Added a FIFO breakpoint check in the main FIFO loop. Aligned some of the FIFO registers to 32 byte boundaries, matching the VideoSoftware plug-in code. Fixes issue 3536. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6461 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/CommandProcessor.cpp | 11 +++-------- Source/Core/VideoCommon/Src/Fifo.cpp | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp index d3394c4840..53911b4691 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp @@ -469,7 +469,7 @@ void Write16(const u16 _Value, const u32 _Address) break; case FIFO_END_LO: - // Somtimes this value is not aligned with 32B, e.g. New Super Mario Bros. Wii + // Sometimes this value is not aligned with 32B, e.g. New Super Mario Bros. Wii WriteLow ((u32 &)fifo.CPEnd, _Value & 0xFFE0); DEBUG_LOG(COMMANDPROCESSOR,"\t write to FIFO_END_LO : %04x", _Value); break; @@ -517,16 +517,11 @@ void Write16(const u16 _Value, const u32 _Address) break; case FIFO_BP_LO: - WriteLow ((u32 &)fifo.CPBreakpoint, _Value); -// Ayuanx: What if BP is not aligned ... -// WriteLow ((u32 &)fifo.CPBreakpoint, (_Value + 31) & 0xFFE0); + WriteLow ((u32 &)fifo.CPBreakpoint, _Value & 0xFFE0); DEBUG_LOG(COMMANDPROCESSOR,"write to FIFO_BP_LO : %04x", _Value); break; case FIFO_BP_HI: WriteHigh((u32 &)fifo.CPBreakpoint, _Value); -// Ayuanx: If it is set at the very end, it would never be achieved ... -// if (fifo.CPBreakpoint == fifo.CPEnd + 32) -// fifo.CPBreakpoint = fifo.CPBase; DEBUG_LOG(COMMANDPROCESSOR,"write to FIFO_BP_HI : %04x", _Value); break; @@ -539,7 +534,7 @@ void Write16(const u16 _Value, const u32 _Address) DEBUG_LOG(COMMANDPROCESSOR,"try to write to FIFO_RW_DISTANCE_HI : %04x", _Value); break; case FIFO_RW_DISTANCE_LO: - WriteLow((u32 &)fifo.CPReadWriteDistance, _Value); + WriteLow((u32 &)fifo.CPReadWriteDistance, _Value & 0xFFE0); DEBUG_LOG(COMMANDPROCESSOR,"try to write to FIFO_RW_DISTANCE_LO : %04x", _Value); break; diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 5169129c2e..73f438a0ee 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -146,7 +146,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) // check if we are able to run this buffer - while (_fifo.bFF_GPReadEnable && _fifo.CPReadWriteDistance) + while (_fifo.bFF_GPReadEnable && (_fifo.CPReadWriteDistance || (_fifo.bFF_BPEnable && !_fifo.bFF_Breakpoint))) { // while the FIFO is processing data we activate this for sync with emulator thread. CommandProcessor::isFifoBusy = true;