From e41f21abc758c03da2c92228a8de053578d2fbcb Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 14 Jan 2014 23:03:48 +0400 Subject: [PATCH] Simple analog stick support (from KB) Left stick: arrows; right stick: PgDn/PgUp (vertical) and Home/End (horizontal) Added L10n functions' list (copied from old distr) Fixed "LoadShdr64 error: shstrndx too big" in ELF64 loader Other minor changes --- rpcs3/Emu/Cell/SPUThread.h | 31 ++-- rpcs3/Emu/Io/PadHandler.h | 40 ++++- rpcs3/Emu/Io/Windows/WindowsPadHandler.h | 5 + rpcs3/Emu/SysCalls/FuncList.cpp | 165 +++++++++++++++++++++ rpcs3/Emu/SysCalls/Modules.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp | 39 +++++ rpcs3/Emu/SysCalls/Modules/cellSync.cpp | 22 ++- rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp | 2 + rpcs3/Emu/SysCalls/Modules/sys_fs.cpp | 48 ++++-- rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp | 2 +- rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp | 31 +++- rpcs3/Loader/ELF64.cpp | 4 +- 12 files changed, 345 insertions(+), 46 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 84618e74a1..c6aadacdc7 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -2,6 +2,9 @@ #include "PPCThread.h" #include "Emu/event.h" #include "MFC.h" +#include + +extern std::mutex g_SyncMutex; //can provide compatability for CellSyncMutex through SPU<>PPU and SPU<>SPU static const char* spu_reg_name[128] = { @@ -293,7 +296,7 @@ public: }; volatile u64 m_indval; }; - wxCriticalSection m_lock; + std::mutex m_lock; public: @@ -311,7 +314,7 @@ public: { if (max_count > 1 || x86) { - wxCriticalSectionLocker lock(m_lock); + std::lock_guard lock(m_lock); if(!m_index) { return false; @@ -322,7 +325,7 @@ public: } else { //lock-free - if(!m_index) + if ((m_indval & 0xffffffff) == 0) return false; else { @@ -337,7 +340,7 @@ public: { if (max_count > 1 || x86) { - wxCriticalSectionLocker lock(m_lock); + std::lock_guard lock(m_lock); if(m_index >= max_count) { return false; @@ -347,11 +350,12 @@ public: } else { //lock-free - if(m_index) + if (m_indval & 0xffffffff) return false; else { - m_indval = ((u64)value << 32) | 1; + const u64 new_value = ((u64)value << 32) | 1; + m_indval = new_value; return true; } } @@ -361,7 +365,7 @@ public: { if (max_count > 1 || x86) { - wxCriticalSectionLocker lock(m_lock); + std::lock_guard lock(m_lock); if(m_index >= max_count) m_value[max_count-1] = value; //last message is overwritten else @@ -369,7 +373,8 @@ public: } else { //lock-free - m_indval = ((u64)value << 32) | 1; + const u64 new_value = ((u64)value << 32) | 1; + m_indval = new_value; } } @@ -377,7 +382,7 @@ public: { if (max_count > 1 || x86) { - wxCriticalSectionLocker lock(m_lock); + std::lock_guard lock(m_lock); if(m_index >= max_count) m_value[max_count-1] |= value; //last message is logically ORed else @@ -397,7 +402,7 @@ public: { if (max_count > 1 || x86) { - wxCriticalSectionLocker lock(m_lock); + std::lock_guard lock(m_lock); if(!m_index) res = 0; //result is undefined else @@ -422,7 +427,7 @@ public: { if (max_count > 1 || x86) { - wxCriticalSectionLocker lock(m_lock); + std::lock_guard lock(m_lock); return m_index; } else @@ -435,7 +440,7 @@ public: { if (max_count > 1 || x86) { - wxCriticalSectionLocker lock(m_lock); + std::lock_guard lock(m_lock); return max_count - m_index; } else @@ -524,8 +529,6 @@ public: case MFC_PUTLLC_CMD: case MFC_PUTLLUC_CMD: { - extern std::mutex g_SyncMutex; - //can provide compatability for CellSyncMutex through SPU<>PPU and SPU<>SPU if (op == MFC_GETLLAR_CMD) { g_SyncMutex.lock(); diff --git a/rpcs3/Emu/Io/PadHandler.h b/rpcs3/Emu/Io/PadHandler.h index 4e83d11cc7..d56be02df3 100644 --- a/rpcs3/Emu/Io/PadHandler.h +++ b/rpcs3/Emu/Io/PadHandler.h @@ -103,6 +103,24 @@ struct Button } }; +struct AnalogStick +{ + u32 m_offset; + u32 m_keyCodeMin; + u32 m_keyCodeMax; + bool m_min_pressed; + bool m_max_pressed; + + AnalogStick(u32 offset, u32 keyCodeMin, u32 keyCodeMax) + : m_min_pressed(false) + , m_max_pressed(false) + , m_offset(offset) + , m_keyCodeMin(keyCodeMin) + , m_keyCodeMax(keyCodeMax) + { + } +}; + struct Pad { u32 m_port_status; @@ -111,6 +129,7 @@ struct Pad u32 m_device_type; Array