mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-10 20:53:15 +00:00
Merge pull request #293 from shadps4-emu/misc-fixes3
Various linux fixes
This commit is contained in:
commit
0de914995f
14 changed files with 172 additions and 165 deletions
|
@ -7,8 +7,6 @@
|
|||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/event_queues.h"
|
||||
|
||||
#include <boost/asio/placeholders.hpp>
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
extern boost::asio::io_context io_context;
|
||||
|
@ -136,8 +134,7 @@ s32 PS4_SYSV_ABI sceKernelAddHRTimerEvent(SceKernelEqueue eq, int id, timespec*
|
|||
event.timer = std::make_unique<boost::asio::steady_timer>(
|
||||
io_context, std::chrono::microseconds(total_us - HrTimerSpinlockThresholdUs));
|
||||
|
||||
event.timer->async_wait(
|
||||
std::bind(SmallTimerCallback, boost::asio::placeholders::error, eq, event.event));
|
||||
event.timer->async_wait(std::bind(SmallTimerCallback, std::placeholders::_1, eq, event.event));
|
||||
|
||||
if (!eq->AddEvent(event)) {
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
std::vector<Core::FileSys::DirEntry> GetDirectoryEntries(const std::string& path) {
|
||||
std::vector<Core::FileSys::DirEntry> GetDirectoryEntries(const std::filesystem::path& path) {
|
||||
std::vector<Core::FileSys::DirEntry> files;
|
||||
for (const auto& entry : std::filesystem::directory_iterator(path)) {
|
||||
auto& dir_entry = files.emplace_back();
|
||||
|
@ -58,7 +58,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
|
|||
if (directory) {
|
||||
file->is_directory = true;
|
||||
file->m_guest_name = path;
|
||||
file->m_host_name = mnt->GetHostDirectory(file->m_guest_name);
|
||||
file->m_host_name = mnt->GetHostPath(file->m_guest_name);
|
||||
if (!std::filesystem::is_directory(file->m_host_name)) { // directory doesn't exist
|
||||
h->DeleteHandle(handle);
|
||||
return ORBIS_KERNEL_ERROR_ENOTDIR;
|
||||
|
@ -72,7 +72,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
|
|||
}
|
||||
} else {
|
||||
file->m_guest_name = path;
|
||||
file->m_host_name = mnt->GetHostFile(file->m_guest_name);
|
||||
file->m_host_name = mnt->GetHostPath(file->m_guest_name);
|
||||
int e = 0;
|
||||
if (read) {
|
||||
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read);
|
||||
|
@ -165,8 +165,7 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
|||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
|
||||
std::string host_path = mnt->GetHostFile(path);
|
||||
|
||||
const auto host_path = mnt->GetHostPath(path);
|
||||
if (host_path.empty()) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
|
@ -175,7 +174,7 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
|||
return SCE_KERNEL_ERROR_EPERM;
|
||||
}
|
||||
|
||||
auto* file = h->getFile(host_path);
|
||||
auto* file = h->GetFile(host_path);
|
||||
if (file != nullptr) {
|
||||
file->f.Unlink();
|
||||
}
|
||||
|
@ -250,7 +249,7 @@ int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) {
|
|||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string dir_name = mnt->GetHostFile(path);
|
||||
const auto dir_name = mnt->GetHostPath(path);
|
||||
if (std::filesystem::exists(dir_name)) {
|
||||
return SCE_KERNEL_ERROR_EEXIST;
|
||||
}
|
||||
|
@ -279,7 +278,7 @@ int PS4_SYSV_ABI posix_mkdir(const char* path, u16 mode) {
|
|||
int PS4_SYSV_ABI sceKernelStat(const char* path, OrbisKernelStat* sb) {
|
||||
LOG_INFO(Kernel_Fs, "(PARTIAL) path = {}", path);
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
const auto& path_name = mnt->GetHostFile(path);
|
||||
const auto path_name = mnt->GetHostPath(path);
|
||||
std::memset(sb, 0, sizeof(OrbisKernelStat));
|
||||
const bool is_dir = std::filesystem::is_directory(path_name);
|
||||
const bool is_file = std::filesystem::is_regular_file(path_name);
|
||||
|
@ -314,7 +313,7 @@ int PS4_SYSV_ABI posix_stat(const char* path, OrbisKernelStat* sb) {
|
|||
|
||||
int PS4_SYSV_ABI sceKernelCheckReachability(const char* path) {
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
std::string path_name = mnt->GetHostFile(path);
|
||||
const auto path_name = mnt->GetHostPath(path);
|
||||
if (!std::filesystem::exists(path_name)) {
|
||||
return SCE_KERNEL_ERROR_ENOENT;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ s32 PS4_SYSV_ABI sceKernelLoadStartModule(const char* moduleFileName, size_t arg
|
|||
}
|
||||
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
const auto path = mnt->GetHostFile(moduleFileName);
|
||||
const auto path = mnt->GetHostPath(moduleFileName);
|
||||
|
||||
// Load PRX module and relocate any modules that import it.
|
||||
auto* linker = Common::Singleton<Core::Linker>::Instance();
|
||||
|
|
|
@ -1006,17 +1006,7 @@ ScePthread PThreadPool::Create() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
auto* ret = new PthreadInternal{};
|
||||
#else
|
||||
// TODO: Linux specific hack
|
||||
static u8* hint_address = reinterpret_cast<u8*>(0x7FFFFC000ULL);
|
||||
auto* ret = reinterpret_cast<PthreadInternal*>(
|
||||
mmap(hint_address, sizeof(PthreadInternal), PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0));
|
||||
hint_address += Common::AlignUp(sizeof(PthreadInternal), 4_KB);
|
||||
#endif
|
||||
|
||||
ret->is_free = false;
|
||||
ret->is_detached = false;
|
||||
ret->is_almost_done = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue