diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index fad62683d0..a848315d9e 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -370,8 +370,8 @@ void signal_handler(int sig, siginfo_t* info, void* uct) } } - // else some fatal error (not sure what will happen) - //exit(EXIT_FAILURE); + // else some fatal error + exit(EXIT_FAILURE); } const int sigaction_result = []() -> int diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 6349e52fd9..6db581ff70 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -23,7 +23,7 @@ #define HLE_CALL_DEBUG #endif -static u64 rotate_mask[64][64]; +extern u64 rotate_mask[64][64]; // defined in PPUThread.cpp, static didn't work correctly in GCC 4.9 for some reason inline void InitRotateMask() { static bool inited = false; diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 0364198974..ccd6b0ff42 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -13,6 +13,8 @@ //#include "Emu/Cell/PPURecompiler.h" #include "Emu/CPU/CPUThreadManager.h" +u64 rotate_mask[64][64]; + PPUThread& GetCurrentPPUThread() { PPCThread* thread = GetCurrentPPCThread(); diff --git a/rpcs3/Emu/Cell/RawSPUThread.cpp b/rpcs3/Emu/Cell/RawSPUThread.cpp index 92e0425628..9ee54411c0 100644 --- a/rpcs3/Emu/Cell/RawSPUThread.cpp +++ b/rpcs3/Emu/Cell/RawSPUThread.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "Utilities/Log.h" #include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Callback.h" #include "Emu/Cell/RawSPUThread.h" @@ -137,8 +139,14 @@ bool RawSPUThread::Write32(const u64 addr, const u32 value) { if (value == SPU_RUNCNTL_RUNNABLE) { - SPU.Status.SetValue(SPU_STATUS_RUNNING); - Exec(); + // calling Exec() directly in SIGSEGV handler may cause problems + // (probably because Exec() creates new thread, faults of this thread aren't handled by this handler anymore) + Emu.GetCallbackManager().Async([this]() + { + SPU.Status.SetValue(SPU_STATUS_RUNNING); + Exec(); + }); + } else if (value == SPU_RUNCNTL_STOP) { diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index 01489759a6..f65cfbdcb2 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -10,7 +10,8 @@ std::vector simplify_path_blocks(const std::string& path) { - std::vector path_blocks = std::move(fmt::split(fmt::tolower(path), { "/", "\\" })); + // fmt::tolower() removed + std::vector path_blocks = std::move(fmt::split(path, { "/", "\\" })); for (size_t i = 0; i < path_blocks.size(); ++i) { @@ -28,7 +29,7 @@ std::vector simplify_path_blocks(const std::string& path) return path_blocks; } -std::string simplify_path(const std::string& path, bool is_dir) +std::string simplify_path(const std::string& path, bool is_dir, bool is_ps3) { std::vector path_blocks = simplify_path_blocks(path); @@ -36,8 +37,17 @@ std::string simplify_path(const std::string& path, bool is_dir) return ""; std::string result = fmt::merge(path_blocks, "/"); + +#ifdef _WIN32 + if (is_ps3) +#endif + { + result = "/" + result; + } - return is_dir ? result + "/" : result; + if (is_dir) result = result + "/"; + + return result; } VFS::~VFS() @@ -47,11 +57,11 @@ VFS::~VFS() void VFS::Mount(const std::string& ps3_path, const std::string& local_path, vfsDevice* device) { - std::string simpl_ps3_path = simplify_path(ps3_path, true); + std::string simpl_ps3_path = simplify_path(ps3_path, true, true); UnMount(simpl_ps3_path); - device->SetPath(simpl_ps3_path, simplify_path(local_path, true)); + device->SetPath(simpl_ps3_path, simplify_path(local_path, true, false)); m_devices.push_back(device); if (m_devices.size() > 1) @@ -65,9 +75,9 @@ void VFS::Link(const std::string& mount_point, const std::string& ps3_path) links[simplify_path_blocks(mount_point)] = simplify_path_blocks(ps3_path); } -std::string VFS::GetLinked(std::string ps3_path) const +std::string VFS::GetLinked(const std::string& ps3_path) const { - ps3_path = fmt::tolower(ps3_path); + // fmt::tolower removed auto path_blocks = fmt::split(ps3_path, { "/", "\\" }); for (auto link : links) @@ -95,7 +105,7 @@ std::string VFS::GetLinked(std::string ps3_path) const void VFS::UnMount(const std::string& ps3_path) { - std::string simpl_ps3_path = simplify_path(ps3_path, true); + std::string simpl_ps3_path = simplify_path(ps3_path, true, true); for (u32 i = 0; i < m_devices.size(); ++i) { @@ -320,18 +330,21 @@ vfsDevice* VFS::GetDevice(const std::string& ps3_path, std::string& path) const path += "/" + ps3_path_blocks[i]; } - path = simplify_path(path, false); - + path = simplify_path(path, false, false); + return m_devices[max_i]; }; - if (auto res = try_get_device(GetLinked(ps3_path))) - return res; + if (!ps3_path.size() || ps3_path[0] != '/') + { + return nullptr; + } - if (auto res = try_get_device(GetLinked(cwd + ps3_path))) - return res; + return try_get_device(GetLinked(ps3_path)); - return nullptr; + // What is it? cwd is real path, ps3_path is ps3 path, but GetLinked accepts ps3 path + //if (auto res = try_get_device(GetLinked(cwd + ps3_path))) + // return res; } vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path) const @@ -374,14 +387,14 @@ vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path) path += "/" + local_path_blocks[i]; } - path = simplify_path(path, false); + path = simplify_path(path, false, true); return m_devices[max_i]; } void VFS::Init(const std::string& path) { - cwd = simplify_path(path, true); + cwd = simplify_path(path, true, false); UnMountAll(); diff --git a/rpcs3/Emu/FS/VFS.h b/rpcs3/Emu/FS/VFS.h index aad5121211..38a63e94c4 100644 --- a/rpcs3/Emu/FS/VFS.h +++ b/rpcs3/Emu/FS/VFS.h @@ -44,7 +44,7 @@ struct VFSManagerEntry }; std::vector simplify_path_blocks(const std::string& path); -std::string simplify_path(const std::string& path, bool is_dir); +std::string simplify_path(const std::string& path, bool is_dir, bool is_ps3); struct VFS { @@ -74,7 +74,7 @@ struct VFS void UnMount(const std::string& ps3_path); void UnMountAll(); - std::string GetLinked(std::string ps3_path) const; + std::string GetLinked(const std::string& ps3_path) const; vfsFileBase* OpenFile(const std::string& ps3_path, vfsOpenMode mode) const; vfsDirBase* OpenDir(const std::string& ps3_path) const; diff --git a/rpcs3/Emu/FS/vfsDir.cpp b/rpcs3/Emu/FS/vfsDir.cpp index a6e2cc565f..c8c7c0a9d4 100644 --- a/rpcs3/Emu/FS/vfsDir.cpp +++ b/rpcs3/Emu/FS/vfsDir.cpp @@ -29,7 +29,7 @@ bool vfsDir::Open(const std::string& path) DirEntryInfo info; - m_cwd = simplify_path(Emu.GetVFS().GetLinked(0 && m_stream && m_stream->IsOpened() ? m_stream->GetPath() : path), true); + m_cwd = simplify_path(Emu.GetVFS().GetLinked(0 && m_stream && m_stream->IsOpened() ? m_stream->GetPath() : path), true, true); auto blocks = simplify_path_blocks(GetPath());