diff options
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/Src/HW/CommandProcessor.cpp | 15 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/Fifo.cpp | 7 |
2 files changed, 20 insertions, 2 deletions
diff --git a/Source/Core/Core/Src/HW/CommandProcessor.cpp b/Source/Core/Core/Src/HW/CommandProcessor.cpp index b9bcc3978d..f9af5f798b 100644 --- a/Source/Core/Core/Src/HW/CommandProcessor.cpp +++ b/Source/Core/Core/Src/HW/CommandProcessor.cpp @@ -157,11 +157,16 @@ void Init() #ifdef _WIN32
InitializeCriticalSection(&fifo.sync);
+#else
+ fifo.sync = new Common::CriticalSection(0);
#endif
}
void Shutdown()
{
+#ifndef _WIN32
+ delete fifo.sync;
+#endif
}
void Read16(u16& _rReturnValue, const u32 _Address)
@@ -249,6 +254,8 @@ void Write16(const u16 _Value, const u32 _Address) }
#ifdef _WIN32
EnterCriticalSection(&fifo.sync);
+ #else
+ fifo.sync->Enter();
#endif
}
@@ -332,9 +339,11 @@ void Write16(const u16 _Value, const u32 _Address) // update the registers and run the fifo
// This will recursively enter fifo.sync, TODO(ector): is this good?
UpdateFifoRegister();
-#ifdef _WIN32
if (Core::g_CoreStartupParameter.bUseDualCore)
+#ifdef _WIN32
LeaveCriticalSection(&fifo.sync);
+#else
+ fifo.sync->Leave();
#endif
fifo.bPauseRead = false; // pauseread is not actually used anywhere! TOOD(ector): huh!
}
@@ -369,6 +378,10 @@ void GatherPipeBursted() Common::SleepCurrentThread(1);
#ifdef _WIN32
InterlockedExchangeAdd((LONG*)&fifo.CPReadWriteDistance, GPFifo::GATHER_PIPE_SIZE);
+#else
+ fifo.sync->Enter();
+ fifo.CPReadWriteDistance += GPFifo::GATHER_PIPE_SIZE;
+ fifo.sync->Leave();
#endif
// check if we are in sync
diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 7f96ea1789..af2405ff28 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -181,7 +181,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) #if defined(THREAD_VIDEO_WAKEUP_ONIDLE) && defined(_WIN32)
while(_fifo.CPReadWriteDistance > 0)
#else
- int count = 200;
+ int count = 200;
while(_fifo.CPReadWriteDistance > 0 && count)
#endif
{
@@ -200,12 +200,17 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize) u8 *uData = video_initialize.pGetMemoryPointer(_fifo.CPReadPointer);
#ifdef _WIN32
EnterCriticalSection(&_fifo.sync);
+#else
+ _fifo.sync->Enter();
#endif
_fifo.CPReadPointer += 32;
Video_SendFifoData(uData);
#ifdef _WIN32
InterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -32);
LeaveCriticalSection(&_fifo.sync);
+#else
+ _fifo.CPReadWriteDistance -= 32;
+ _fifo.sync->Leave();
#endif
// increase the ReadPtr
if (_fifo.CPReadPointer >= _fifo.CPEnd)
|
