From 8be6beed6a9038ed3dd732bc02368e068a27b7b8 Mon Sep 17 00:00:00 2001 From: "memberTwo.mb2" Date: Sat, 8 Nov 2008 14:20:27 +0000 Subject: [PATCH] DC WIP: fifo set/reset hack git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1096 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/CommandProcessor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/Core/Src/HW/CommandProcessor.cpp b/Source/Core/Core/Src/HW/CommandProcessor.cpp index 6e89213d8f..45be3701af 100644 --- a/Source/Core/Core/Src/HW/CommandProcessor.cpp +++ b/Source/Core/Core/Src/HW/CommandProcessor.cpp @@ -451,6 +451,12 @@ void Write16(const u16 _Value, const u32 _Address) case FIFO_RW_DISTANCE_LO: LOG(COMMANDPROCESSOR,"try to write to %s : %04x",((_Address & 0xFFF) == FIFO_RW_DISTANCE_HI) ? "FIFO_RW_DISTANCE_HI" : "FIFO_RW_DISTANCE_LO", _Value); _dbg_assert_msg_(COMMANDPROCESSOR, _Value==0, "WTF? attempt to overwrite fifo CPReadWriteDistance with a value(%04x) != 0 ",_Value); + // TODO: break this hack + // hack: if fifo is not empty and readable then spin until flushed + // sleeping here is not a perf issue since GXSetFifo shouldn't be called too much often. + while((fifo.CPReadWriteDistance>0) && (fifo.bFF_GPReadEnable==1)) + Common::SleepCurrentThread(1); + _dbg_assert_msg_(COMMANDPROCESSOR, !(fifo.CPReadWriteDistance!=0 && fifo.bFF_GPReadEnable==0), "Is that bad? WARNING: reset a not empty and not readable fifo.\n CPReadWriteDistance: %08x | fifo.bFF_GPReadEnable: %i",fifo.CPReadWriteDistance,fifo.bFF_GPReadEnable); #ifdef _WIN32 InterlockedExchange((LONG*)&fifo.CPReadWriteDistance, 0); #else