Linux fixes

This commit is contained in:
Nekotekina 2015-01-09 01:17:26 +03:00
parent 1d0f2c16e0
commit 056f93f3e4
7 changed files with 48 additions and 25 deletions

View file

@ -370,8 +370,8 @@ void signal_handler(int sig, siginfo_t* info, void* uct)
} }
} }
// else some fatal error (not sure what will happen) // else some fatal error
//exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
const int sigaction_result = []() -> int const int sigaction_result = []() -> int

View file

@ -23,7 +23,7 @@
#define HLE_CALL_DEBUG #define HLE_CALL_DEBUG
#endif #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() inline void InitRotateMask()
{ {
static bool inited = false; static bool inited = false;

View file

@ -13,6 +13,8 @@
//#include "Emu/Cell/PPURecompiler.h" //#include "Emu/Cell/PPURecompiler.h"
#include "Emu/CPU/CPUThreadManager.h" #include "Emu/CPU/CPUThreadManager.h"
u64 rotate_mask[64][64];
PPUThread& GetCurrentPPUThread() PPUThread& GetCurrentPPUThread()
{ {
PPCThread* thread = GetCurrentPPCThread(); PPCThread* thread = GetCurrentPPCThread();

View file

@ -1,6 +1,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "Utilities/Log.h" #include "Utilities/Log.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/SysCalls/Callback.h"
#include "Emu/Cell/RawSPUThread.h" #include "Emu/Cell/RawSPUThread.h"
@ -136,9 +138,15 @@ bool RawSPUThread::Write32(const u64 addr, const u32 value)
case SPU_RunCntl_offs: case SPU_RunCntl_offs:
{ {
if (value == SPU_RUNCNTL_RUNNABLE) if (value == SPU_RUNCNTL_RUNNABLE)
{
// 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); SPU.Status.SetValue(SPU_STATUS_RUNNING);
Exec(); Exec();
});
} }
else if (value == SPU_RUNCNTL_STOP) else if (value == SPU_RUNCNTL_STOP)
{ {

View file

@ -10,7 +10,8 @@
std::vector<std::string> simplify_path_blocks(const std::string& path) std::vector<std::string> simplify_path_blocks(const std::string& path)
{ {
std::vector<std::string> path_blocks = std::move(fmt::split(fmt::tolower(path), { "/", "\\" })); // fmt::tolower() removed
std::vector<std::string> path_blocks = std::move(fmt::split(path, { "/", "\\" }));
for (size_t i = 0; i < path_blocks.size(); ++i) for (size_t i = 0; i < path_blocks.size(); ++i)
{ {
@ -28,7 +29,7 @@ std::vector<std::string> simplify_path_blocks(const std::string& path)
return path_blocks; 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<std::string> path_blocks = simplify_path_blocks(path); std::vector<std::string> path_blocks = simplify_path_blocks(path);
@ -37,7 +38,16 @@ std::string simplify_path(const std::string& path, bool is_dir)
std::string result = fmt::merge(path_blocks, "/"); std::string result = fmt::merge(path_blocks, "/");
return is_dir ? result + "/" : result; #ifdef _WIN32
if (is_ps3)
#endif
{
result = "/" + result;
}
if (is_dir) result = result + "/";
return result;
} }
VFS::~VFS() VFS::~VFS()
@ -47,11 +57,11 @@ VFS::~VFS()
void VFS::Mount(const std::string& ps3_path, const std::string& local_path, vfsDevice* device) 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); 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); m_devices.push_back(device);
if (m_devices.size() > 1) 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); 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, { "/", "\\" }); auto path_blocks = fmt::split(ps3_path, { "/", "\\" });
for (auto link : links) 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) 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) for (u32 i = 0; i < m_devices.size(); ++i)
{ {
@ -320,20 +330,23 @@ vfsDevice* VFS::GetDevice(const std::string& ps3_path, std::string& path) const
path += "/" + ps3_path_blocks[i]; path += "/" + ps3_path_blocks[i];
} }
path = simplify_path(path, false); path = simplify_path(path, false, false);
return m_devices[max_i]; return m_devices[max_i];
}; };
if (auto res = try_get_device(GetLinked(ps3_path))) if (!ps3_path.size() || ps3_path[0] != '/')
return res; {
if (auto res = try_get_device(GetLinked(cwd + ps3_path)))
return res;
return nullptr; return nullptr;
} }
return try_get_device(GetLinked(ps3_path));
// 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 vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path) const
{ {
size_t max_eq = 0; size_t max_eq = 0;
@ -374,14 +387,14 @@ vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path)
path += "/" + local_path_blocks[i]; path += "/" + local_path_blocks[i];
} }
path = simplify_path(path, false); path = simplify_path(path, false, true);
return m_devices[max_i]; return m_devices[max_i];
} }
void VFS::Init(const std::string& path) void VFS::Init(const std::string& path)
{ {
cwd = simplify_path(path, true); cwd = simplify_path(path, true, false);
UnMountAll(); UnMountAll();

View file

@ -44,7 +44,7 @@ struct VFSManagerEntry
}; };
std::vector<std::string> simplify_path_blocks(const std::string& path); std::vector<std::string> 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 struct VFS
{ {
@ -74,7 +74,7 @@ struct VFS
void UnMount(const std::string& ps3_path); void UnMount(const std::string& ps3_path);
void UnMountAll(); 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; vfsFileBase* OpenFile(const std::string& ps3_path, vfsOpenMode mode) const;
vfsDirBase* OpenDir(const std::string& ps3_path) const; vfsDirBase* OpenDir(const std::string& ps3_path) const;

View file

@ -29,7 +29,7 @@ bool vfsDir::Open(const std::string& path)
DirEntryInfo info; 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()); auto blocks = simplify_path_blocks(GetPath());