From 5f9bc138980668c5f5583f6898bb362ef67c9375 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 21 Jan 2014 03:34:16 +0400 Subject: [PATCH] Some bugs fixed --- rpcs3/Emu/FS/vfsDevice.cpp | 4 +- rpcs3/Emu/GS/RSXThread.cpp | 8 ++-- rpcs3/Emu/Memory/Memory.cpp | 87 +++++++++++++++++++++---------------- 3 files changed, 55 insertions(+), 44 deletions(-) diff --git a/rpcs3/Emu/FS/vfsDevice.cpp b/rpcs3/Emu/FS/vfsDevice.cpp index f9e8af0eeb..084269e50d 100644 --- a/rpcs3/Emu/FS/vfsDevice.cpp +++ b/rpcs3/Emu/FS/vfsDevice.cpp @@ -93,8 +93,7 @@ wxString vfsDevice::ErasePath(const wxString& path, u32 start_dir_count, u32 end wxString vfsDevice::GetRoot(const wxString& path) { - return wxFileName(path, wxPATH_UNIX).GetPath(); - /* + //return wxFileName(path, wxPATH_UNIX).GetPath(); if(path.IsEmpty()) return wxEmptyString; u32 first_dir = path.Len() - 1; @@ -119,7 +118,6 @@ wxString vfsDevice::GetRoot(const wxString& path) } return path(0, first_dir + 1); - */ } wxString vfsDevice::GetRootPs3(const wxString& path) diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index de48ee2cf7..78b398f586 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -1452,9 +1452,11 @@ void RSXThread::Task() { wxCriticalSectionLocker lock(m_cs_main); - u32 put, get; - se_t::func(put, std::atomic_load((volatile std::atomic*)((u8*)m_ctrl + offsetof(CellGcmControl, put)))); - se_t::func(get, std::atomic_load((volatile std::atomic*)((u8*)m_ctrl + offsetof(CellGcmControl, get)))); + //u32 put, get; + //se_t::func(put, std::atomic_load((volatile std::atomic*)((u8*)m_ctrl + offsetof(CellGcmControl, put)))); + //se_t::func(get, std::atomic_load((volatile std::atomic*)((u8*)m_ctrl + offsetof(CellGcmControl, get)))); + const u32 put = re(m_ctrl->put); + const u32 get = re(m_ctrl->get); if(put == get || !Emu.IsRunning()) { diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index 99834ef2e9..343bab55c2 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -99,24 +99,28 @@ __forceinline const u8 MemoryBlock::FastRead8(const u64 addr) const __forceinline const u16 MemoryBlock::FastRead16(const u64 addr) const { - return ((u16)FastRead8(addr) << 8) | (u16)FastRead8(addr + 1); + volatile const u16 data = *(u16*)GetMem(addr); + return re(data); } __forceinline const u32 MemoryBlock::FastRead32(const u64 addr) const { - return ((u32)FastRead16(addr) << 16) | (u32)FastRead16(addr + 2); + volatile const u32 data = *(u32*)GetMem(addr); + return re(data); } __forceinline const u64 MemoryBlock::FastRead64(const u64 addr) const { - return ((u64)FastRead32(addr) << 32) | (u64)FastRead32(addr + 4); + volatile const u64 data = *(u64*)GetMem(addr); + return re(data); } __forceinline const u128 MemoryBlock::FastRead128(const u64 addr) { + volatile const u128 data = *(u128*)GetMem(addr); u128 ret; - ret.lo = FastRead64(addr); - ret.hi = FastRead64(addr + 8); + ret.lo = re(data.hi); + ret.hi = re(data.lo); return ret; } @@ -128,8 +132,8 @@ bool MemoryBlock::Read8(const u64 addr, u8* value) return false; } - *value = std::atomic_load((volatile std::atomic*)GetMem(FixAddr(addr))); - + //*value = std::atomic_load((volatile std::atomic*)GetMem(FixAddr(addr))); + *value = FastRead8(FixAddr(addr)); return true; } @@ -141,8 +145,8 @@ bool MemoryBlock::Read16(const u64 addr, u16* value) return false; } - se_t::func(*value, std::atomic_load((volatile std::atomic*)GetMem(FixAddr(addr)))); - + //se_t::func(*value, std::atomic_load((volatile std::atomic*)GetMem(FixAddr(addr)))); + *value = FastRead16(FixAddr(addr)); return true; } @@ -154,7 +158,8 @@ bool MemoryBlock::Read32(const u64 addr, u32* value) return false; } - se_t::func(*value, std::atomic_load((volatile std::atomic*)GetMem(FixAddr(addr)))); + //se_t::func(*value, std::atomic_load((volatile std::atomic*)GetMem(FixAddr(addr)))); + *value = FastRead32(FixAddr(addr)); return true; } @@ -166,7 +171,8 @@ bool MemoryBlock::Read64(const u64 addr, u64* value) return false; } - se_t::func(*value, std::atomic_load((volatile std::atomic*)GetMem(FixAddr(addr)))); + //se_t::func(*value, std::atomic_load((volatile std::atomic*)GetMem(FixAddr(addr)))); + *value = FastRead64(FixAddr(addr)); return true; } @@ -178,9 +184,10 @@ bool MemoryBlock::Read128(const u64 addr, u128* value) return false; } - u64 f_addr = FixAddr(addr); - se_t::func(value->lo, std::atomic_load((volatile std::atomic*)GetMem(f_addr))); - se_t::func(value->hi, std::atomic_load((volatile std::atomic*)GetMem(f_addr + 8))); + //u64 f_addr = FixAddr(addr); + //se_t::func(value->lo, std::atomic_load((volatile std::atomic*)GetMem(f_addr))); + //se_t::func(value->hi, std::atomic_load((volatile std::atomic*)GetMem(f_addr + 8))); + *value = FastRead128(FixAddr(addr)); return true; } @@ -191,33 +198,33 @@ __forceinline void MemoryBlock::FastWrite8(const u64 addr, const u8 value) __forceinline void MemoryBlock::FastWrite16(const u64 addr, const u16 value) { - FastWrite8(addr, (u8)(value >> 8)); - FastWrite8(addr+1, (u8)value); + *(u16*)GetMem(addr) = re(value); } __forceinline void MemoryBlock::FastWrite32(const u64 addr, const u32 value) { - FastWrite16(addr, (u16)(value >> 16)); - FastWrite16(addr+2, (u16)value); + *(u32*)GetMem(addr) = re(value); } __forceinline void MemoryBlock::FastWrite64(const u64 addr, const u64 value) { - FastWrite32(addr, (u32)(value >> 32)); - FastWrite32(addr+4, (u32)value); + *(u64*)GetMem(addr) = re(value); } __forceinline void MemoryBlock::FastWrite128(const u64 addr, const u128 value) { - FastWrite64(addr, value.lo); - FastWrite64(addr+8, value.hi); + u128 res; + res.lo = re(value.hi); + res.hi = re(value.lo); + *(u128*)GetMem(addr) = res; } bool MemoryBlock::Write8(const u64 addr, const u8 value) { if(!IsMyAddress(addr) || IsLocked(addr)) return false; - std::atomic_store((std::atomic*)GetMem(FixAddr(addr)), value); + //std::atomic_store((std::atomic*)GetMem(FixAddr(addr)), value); + FastWrite8(FixAddr(addr), value); return true; } @@ -225,9 +232,10 @@ bool MemoryBlock::Write16(const u64 addr, const u16 value) { if(!IsMyAddress(addr) || IsLocked(addr)) return false; - u16 re_value; - se_t::func(re_value, value); - std::atomic_store((std::atomic*)GetMem(FixAddr(addr)), re_value); + //u16 re_value; + //se_t::func(re_value, value); + //std::atomic_store((std::atomic*)GetMem(FixAddr(addr)), re_value); + FastWrite16(FixAddr(addr), value); return true; } @@ -235,9 +243,10 @@ bool MemoryBlock::Write32(const u64 addr, const u32 value) { if(!IsMyAddress(addr) || IsLocked(addr)) return false; - u32 re_value; - se_t::func(re_value, value); - std::atomic_store((std::atomic*)GetMem(FixAddr(addr)), re_value); + //u32 re_value; + //se_t::func(re_value, value); + //std::atomic_store((std::atomic*)GetMem(FixAddr(addr)), re_value); + FastWrite32(FixAddr(addr), value); return true; } @@ -245,9 +254,10 @@ bool MemoryBlock::Write64(const u64 addr, const u64 value) { if(!IsMyAddress(addr) || IsLocked(addr)) return false; - u64 re_value; - se_t::func(re_value, value); - std::atomic_store((std::atomic*)GetMem(FixAddr(addr)), re_value); + //u64 re_value; + //se_t::func(re_value, value); + //std::atomic_store((std::atomic*)GetMem(FixAddr(addr)), re_value); + FastWrite64(FixAddr(addr), value); return true; } @@ -255,12 +265,13 @@ bool MemoryBlock::Write128(const u64 addr, const u128 value) { if(!IsMyAddress(addr) || IsLocked(addr)) return false; - u64 f_addr = FixAddr(addr); - u64 re_value; - se_t::func(re_value, value.lo); - std::atomic_store((std::atomic*)GetMem(f_addr), re_value); - se_t::func(re_value, value.hi); - std::atomic_store((std::atomic*)GetMem(f_addr + 8), re_value); + //u64 f_addr = FixAddr(addr); + //u64 re_value; + //se_t::func(re_value, value.lo); + //std::atomic_store((std::atomic*)GetMem(f_addr), re_value); + //se_t::func(re_value, value.hi); + //std::atomic_store((std::atomic*)GetMem(f_addr + 8), re_value); + FastWrite128(FixAddr(addr), value); return true; }