From ca13d4f2ef2cef1c1f19bae7fd892e62c5156ea2 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 27 Dec 2013 15:35:08 +0400 Subject: [PATCH] SPU LQX Hack removed, Critical Section for m_status removed. --- rpcs3/Emu/Cell/SPUInterpreter.h | 6 ------ rpcs3/Emu/Cell/SPUThread.h | 18 +++++++++--------- rpcs3/Emu/System.cpp | 9 +-------- rpcs3/Emu/System.h | 14 +++++++------- 4 files changed, 17 insertions(+), 30 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/Emu/Cell/SPUInterpreter.h index 01b7fb8866..1dcb845bd5 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/Emu/Cell/SPUInterpreter.h @@ -393,12 +393,6 @@ private: { u32 a = CPU.GPR[ra]._u32[3], b = CPU.GPR[rb]._u32[3]; - if(b & 0xf) - { - ConLog.Warning("LQX HACK (a[0x%x] + b[0x%x(0x%x)])", a, b << 3, b); - b <<= 3; - } - u32 lsa = (a + b) & 0x3fff0; if(!CPU.IsGoodLSA(lsa)) diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index bcd9391f7a..d881fc580c 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -288,12 +288,12 @@ public: private: union _CRT_ALIGN(8) { struct { - u32 m_index; + volatile u32 m_index; u32 m_value[max_count]; }; - u64 m_indval; + volatile u64 m_indval; }; - long m_lock; + volatile long m_lock; public: @@ -577,12 +577,12 @@ public: { case SPU_WrOutIntrMbox: ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v); - if (!SPU.OutIntr_Mbox.Push(v)) do _mm_pause(); while (!SPU.OutIntr_Mbox.Push(v) && !Emu.IsStopped()); + while (!SPU.OutIntr_Mbox.Push(v) && !Emu.IsStopped()) Sleep(1); break; case SPU_WrOutMbox: ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v); - if (!SPU.Out_MBox.Push(v)) do _mm_pause(); while (!SPU.Out_MBox.Push(v) && !Emu.IsStopped()); + while (!SPU.Out_MBox.Push(v) && !Emu.IsStopped()) Sleep(1); break; case MFC_WrTagMask: @@ -634,22 +634,22 @@ public: switch(ch) { case SPU_RdInMbox: - if (!SPU.In_MBox.Pop(v)) do _mm_pause(); while (!SPU.In_MBox.Pop(v) && !Emu.IsStopped()); + while (!SPU.In_MBox.Pop(v) && !Emu.IsStopped()) Sleep(1); ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]); break; case MFC_RdTagStat: - if (!Prxy.TagStatus.Pop(v)) do _mm_pause(); while (!Prxy.TagStatus.Pop(v) && !Emu.IsStopped()); + while (!Prxy.TagStatus.Pop(v) && !Emu.IsStopped()) Sleep(1); //ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]); break; case SPU_RdSigNotify1: - if (!SPU.SNR[0].Pop(v)) do _mm_pause(); while (!SPU.SNR[0].Pop(v) && !Emu.IsStopped()); + while (!SPU.SNR[0].Pop(v) && !Emu.IsStopped()) Sleep(1); //ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]); break; case SPU_RdSigNotify2: - if (!SPU.SNR[1].Pop(v)) do _mm_pause(); while (!SPU.SNR[1].Pop(v) && !Emu.IsStopped()); + while (!SPU.SNR[1].Pop(v) && !Emu.IsStopped()) Sleep(1); //ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]); break; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 368ac13a8e..3e79a860be 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -354,7 +354,6 @@ void Emulator::Load() thread.Run(); - wxCriticalSectionLocker lock(m_cs_status); m_status = Ready; #ifndef QT_UI wxGetApp().SendDbgCommand(DID_READY_EMU); @@ -379,7 +378,6 @@ void Emulator::Run() wxGetApp().SendDbgCommand(DID_START_EMU); #endif - wxCriticalSectionLocker lock(m_cs_status); //ConLog.Write("run..."); m_status = Running; @@ -403,7 +401,6 @@ void Emulator::Pause() wxGetApp().SendDbgCommand(DID_PAUSE_EMU); #endif - wxCriticalSectionLocker lock(m_cs_status); m_status = Paused; #ifndef QT_UI wxGetApp().SendDbgCommand(DID_PAUSED_EMU); @@ -418,7 +415,6 @@ void Emulator::Resume() wxGetApp().SendDbgCommand(DID_RESUME_EMU); #endif - wxCriticalSectionLocker lock(m_cs_status); m_status = Running; CheckStatus(); @@ -436,10 +432,7 @@ void Emulator::Stop() #ifndef QT_UI wxGetApp().SendDbgCommand(DID_STOP_EMU); #endif - { - wxCriticalSectionLocker lock(m_cs_status); - m_status = Stopped; - } + m_status = Stopped; m_rsx_callback = 0; diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 04da0a30e8..78b9146937 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -1,5 +1,6 @@ #pragma once +#include #include "Gui/MemoryViewer.h" #include "Emu/CPU/CPUThreadManager.h" #include "Emu/Io/Pad.h" @@ -64,9 +65,8 @@ class Emulator InterpreterDisAsm, Interpreter, }; - - mutable wxCriticalSection m_cs_status; - Status m_status; + + volatile uint m_status; uint m_mode; u32 m_rsx_callback; @@ -159,10 +159,10 @@ public: void SavePoints(const std::string& path); void LoadPoints(const std::string& path); - __forceinline bool IsRunning() const { wxCriticalSectionLocker lock(m_cs_status); return m_status == Running; } - __forceinline bool IsPaused() const { wxCriticalSectionLocker lock(m_cs_status); return m_status == Paused; } - __forceinline bool IsStopped() const { wxCriticalSectionLocker lock(m_cs_status); return m_status == Stopped; } - __forceinline bool IsReady() const { wxCriticalSectionLocker lock(m_cs_status); return m_status == Ready; } + __forceinline bool IsRunning() const { return m_status == Running; } + __forceinline bool IsPaused() const { return m_status == Paused; } + __forceinline bool IsStopped() const { return m_status == Stopped; } + __forceinline bool IsReady() const { return m_status == Ready; } }; extern Emulator Emu; \ No newline at end of file