1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

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)
//exit(EXIT_FAILURE);
// else some fatal error
exit(EXIT_FAILURE);
}
const int sigaction_result = []() -> int

View File

@ -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;

View File

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

View File

@ -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)
{

View File

@ -10,7 +10,8 @@
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)
{
@ -28,7 +29,7 @@ std::vector<std::string> 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<std::string> 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();

View File

@ -44,7 +44,7 @@ struct VFSManagerEntry
};
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
{
@ -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;

View File

@ -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());