mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-21 12:04:45 +00:00
ERROR
Removed error_codes present in separate files, unifying them all in one place; Removed some duplicates; Added the remaining codes present in psdevwiki.
This commit is contained in:
parent
6f4e1a47b9
commit
a5bdf10d5b
19 changed files with 9132 additions and 808 deletions
|
@ -166,7 +166,6 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
|
|||
src/core/libraries/system/msgdialog.h
|
||||
src/core/libraries/system/posix.cpp
|
||||
src/core/libraries/system/posix.h
|
||||
src/core/libraries/save_data/error_codes.h
|
||||
src/core/libraries/save_data/savedata.cpp
|
||||
src/core/libraries/save_data/savedata.h
|
||||
src/core/libraries/system/savedatadialog.cpp
|
||||
|
@ -183,7 +182,6 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
|
|||
src/core/libraries/rtc/rtc.h
|
||||
src/core/libraries/disc_map/disc_map.cpp
|
||||
src/core/libraries/disc_map/disc_map.h
|
||||
src/core/libraries/disc_map/disc_map_codes.h
|
||||
src/core/libraries/avplayer/avplayer.cpp
|
||||
src/core/libraries/avplayer/avplayer.h
|
||||
)
|
||||
|
@ -217,7 +215,6 @@ set(DIALOGS_LIB src/core/libraries/dialogs/error_dialog.cpp
|
|||
src/core/libraries/dialogs/error_dialog.h
|
||||
src/core/libraries/dialogs/ime_dialog.cpp
|
||||
src/core/libraries/dialogs/ime_dialog.h
|
||||
src/core/libraries/dialogs/error_codes.h
|
||||
)
|
||||
|
||||
set(PAD_LIB src/core/libraries/pad/pad.cpp
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_NOT_INITIALIZED = 0x80ED0001; // not initialized
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_ALREADY_INITIALIZED = 0x80ED0002; // already initialized
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_PARAM_INVALID = 0x80ED0003; // Parameter is invalid
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_UNEXPECTED_FATAL = 0x80ED0004; // Unexpected fatal error
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_STATE = 0x80ED0005; // not in a callable state
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_SERVICE_BUSY = 0x80ED0006; // Process is busy
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_USER_ID = 0x80ED0007; // Invalid user ID
|
|
@ -5,7 +5,6 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "error_codes.h"
|
||||
#include "error_dialog.h"
|
||||
|
||||
namespace Libraries::ErrorDialog {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "disc_map.h"
|
||||
#include "disc_map_codes.h"
|
||||
|
||||
namespace Libraries::DiscMap {
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -117,12 +117,12 @@ int PS4_SYSV_ABI sceKernelClose(int d) {
|
|||
return ORBIS_KERNEL_ERROR_EPERM;
|
||||
}
|
||||
if (d == 2003) { // dev/urandom case
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
auto* file = h->GetFile(d);
|
||||
if (file == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EBADF;
|
||||
return ORBIS_KERNEL_ERROR_EBADF;
|
||||
}
|
||||
if (!file->is_directory) {
|
||||
file->f.Close();
|
||||
|
@ -130,7 +130,7 @@ int PS4_SYSV_ABI sceKernelClose(int d) {
|
|||
file->is_opened = false;
|
||||
LOG_INFO(Kernel_Fs, "Closing {}", file->m_guest_name);
|
||||
h->DeleteHandle(d);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_close(int d) {
|
||||
|
@ -156,7 +156,7 @@ size_t PS4_SYSV_ABI sceKernelWrite(int d, const void* buf, size_t nbytes) {
|
|||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
auto* file = h->GetFile(d);
|
||||
if (file == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EBADF;
|
||||
return ORBIS_KERNEL_ERROR_EBADF;
|
||||
}
|
||||
|
||||
std::scoped_lock lk{file->m_mutex};
|
||||
|
@ -165,7 +165,7 @@ size_t PS4_SYSV_ABI sceKernelWrite(int d, const void* buf, size_t nbytes) {
|
|||
|
||||
int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
||||
if (path == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
|
@ -173,11 +173,11 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
|||
|
||||
const auto host_path = mnt->GetHostPath(path);
|
||||
if (host_path.empty()) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
|
||||
if (std::filesystem::is_directory(host_path)) {
|
||||
return SCE_KERNEL_ERROR_EPERM;
|
||||
return ORBIS_KERNEL_ERROR_EPERM;
|
||||
}
|
||||
|
||||
auto* file = h->GetFile(host_path);
|
||||
|
@ -186,7 +186,7 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
|||
}
|
||||
|
||||
LOG_INFO(Kernel_Fs, "Unlinked {}", path);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
size_t PS4_SYSV_ABI _readv(int d, const SceKernelIovec* iov, int iovcnt) {
|
||||
|
@ -239,7 +239,7 @@ s64 PS4_SYSV_ABI sceKernelRead(int d, void* buf, size_t nbytes) {
|
|||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
auto* file = h->GetFile(d);
|
||||
if (file == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EBADF;
|
||||
return ORBIS_KERNEL_ERROR_EBADF;
|
||||
}
|
||||
|
||||
std::scoped_lock lk{file->m_mutex};
|
||||
|
@ -259,21 +259,21 @@ int PS4_SYSV_ABI posix_read(int d, void* buf, size_t nbytes) {
|
|||
int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) {
|
||||
LOG_INFO(Kernel_Fs, "path = {} mode = {}", path, mode);
|
||||
if (path == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
const auto dir_name = mnt->GetHostPath(path);
|
||||
if (std::filesystem::exists(dir_name)) {
|
||||
return SCE_KERNEL_ERROR_EEXIST;
|
||||
return ORBIS_KERNEL_ERROR_EEXIST;
|
||||
}
|
||||
|
||||
// CUSA02456: path = /aotl after sceSaveDataMount(mode = 1)
|
||||
if (dir_name.empty() || !std::filesystem::create_directory(dir_name)) {
|
||||
return SCE_KERNEL_ERROR_EIO;
|
||||
return ORBIS_KERNEL_ERROR_EIO;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(dir_name)) {
|
||||
return SCE_KERNEL_ERROR_ENOENT;
|
||||
return ORBIS_KERNEL_ERROR_ENOENT;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ int PS4_SYSV_ABI sceKernelCheckReachability(const char* path) {
|
|||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
const auto path_name = mnt->GetHostPath(path);
|
||||
if (!std::filesystem::exists(path_name)) {
|
||||
return SCE_KERNEL_ERROR_ENOENT;
|
||||
return ORBIS_KERNEL_ERROR_ENOENT;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -400,15 +400,15 @@ int PS4_SYSV_ABI sceKernelFtruncate(int fd, s64 length) {
|
|||
auto* file = h->GetFile(fd);
|
||||
|
||||
if (file == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EBADF;
|
||||
return ORBIS_KERNEL_ERROR_EBADF;
|
||||
}
|
||||
|
||||
if (file->m_host_name.empty()) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
|
||||
file->f.SetSize(length);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
static int GetDents(int fd, char* buf, int nbytes, s64* basep) {
|
||||
|
|
|
@ -90,7 +90,7 @@ int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len) {
|
|||
}
|
||||
auto* memory = Core::Memory::Instance();
|
||||
memory->UnmapMemory(std::bit_cast<VAddr>(addr), len);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
struct iovec {
|
||||
|
@ -114,15 +114,15 @@ int* PS4_SYSV_ABI __Error() {
|
|||
}
|
||||
|
||||
void ErrSceToPosix(int result) {
|
||||
const int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
const int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
g_posix_errno = rt;
|
||||
}
|
||||
|
||||
int ErrnoToSceKernelError(int e) {
|
||||
const auto res = SCE_KERNEL_ERROR_UNKNOWN + e;
|
||||
return res > SCE_KERNEL_ERROR_ESTOP ? SCE_KERNEL_ERROR_UNKNOWN : res;
|
||||
const auto res = ORBIS_KERNEL_ERROR_UNKNOWN + e;
|
||||
return res > ORBIS_KERNEL_ERROR_ESTOP ? ORBIS_KERNEL_ERROR_UNKNOWN : res;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceKernelMmap(void* addr, u64 len, int prot, int flags, int fd, size_t offset,
|
||||
|
@ -285,7 +285,7 @@ s32 PS4_SYSV_ABI sceKernelGetModuleInfoForUnwind(VAddr addr, int flags,
|
|||
OrbisModuleInfoForUnwind* info) {
|
||||
if (flags >= 3) {
|
||||
std::memset(info, 0, sizeof(OrbisModuleInfoForUnwind));
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (!info) {
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
|
|
|
@ -22,20 +22,20 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
|
|||
u64 alignment, int memoryType, s64* physAddrOut) {
|
||||
if (searchStart < 0 || searchEnd <= searchStart) {
|
||||
LOG_ERROR(Kernel_Vmm, "Provided address range is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
const bool is_in_range = searchEnd - searchStart >= len;
|
||||
if (len <= 0 || !Common::Is16KBAligned(len) || !is_in_range) {
|
||||
LOG_ERROR(Kernel_Vmm, "Provided address range is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (alignment != 0 && !Common::Is16KBAligned(alignment)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (physAddrOut == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "Result physical address pointer is null!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
auto* memory = Core::Memory::Instance();
|
||||
|
@ -47,7 +47,7 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
|
|||
"alignment = {:#x}, memoryType = {:#x}, physAddrOut = {:#x}",
|
||||
searchStart, searchEnd, len, alignment, memoryType, phys_addr);
|
||||
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceKernelAllocateMainDirectMemory(size_t len, size_t alignment, int memoryType,
|
||||
|
@ -96,7 +96,7 @@ s32 PS4_SYSV_ABI sceKernelVirtualQuery(const void* addr, int flags, OrbisVirtual
|
|||
size_t infoSize) {
|
||||
LOG_INFO(Kernel_Vmm, "called addr = {}, flags = {:#x}", fmt::ptr(addr), flags);
|
||||
if (!addr) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
auto* memory = Core::Memory::Instance();
|
||||
return memory->VirtualQuery(std::bit_cast<VAddr>(addr), flags, info);
|
||||
|
@ -108,16 +108,16 @@ s32 PS4_SYSV_ABI sceKernelReserveVirtualRange(void** addr, u64 len, int flags, u
|
|||
|
||||
if (addr == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "Address is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (len == 0 || !Common::Is16KBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 16KB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (alignment != 0) {
|
||||
if ((!std::has_single_bit(alignment) && !Common::Is16KBAligned(alignment))) {
|
||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ s32 PS4_SYSV_ABI sceKernelReserveVirtualRange(void** addr, u64 len, int flags, u
|
|||
const auto map_flags = static_cast<Core::MemoryMapFlags>(flags);
|
||||
memory->Reserve(addr, in_addr, len, map_flags, alignment);
|
||||
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceKernelMapNamedDirectMemory(void** addr, u64 len, int prot, int flags,
|
||||
|
@ -139,16 +139,16 @@ int PS4_SYSV_ABI sceKernelMapNamedDirectMemory(void** addr, u64 len, int prot, i
|
|||
|
||||
if (len == 0 || !Common::Is16KBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 16KB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (!Common::Is16KBAligned(directMemoryStart)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Start address is not 16KB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (alignment != 0) {
|
||||
if ((!std::has_single_bit(alignment) && !Common::Is16KBAligned(alignment))) {
|
||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,11 +74,11 @@ int PS4_SYSV_ABI scePthreadAttrInit(ScePthreadAttr* attr) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case ENOMEM:
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,35 +90,35 @@ int PS4_SYSV_ABI scePthreadAttrDestroy(ScePthreadAttr* attr) {
|
|||
*attr = nullptr;
|
||||
|
||||
if (result == 0) {
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrSetguardsize(ScePthreadAttr* attr, size_t guard_size) {
|
||||
if (attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
(*attr)->guard_size = guard_size;
|
||||
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrGetguardsize(const ScePthreadAttr* attr, size_t* guard_size) {
|
||||
if (guard_size == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
*guard_size = (*attr)->guard_size;
|
||||
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrGetinheritsched(const ScePthreadAttr* attr, int* inherit_sched) {
|
||||
|
||||
if (inherit_sched == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_attr_getinheritsched(&(*attr)->pth_attr, inherit_sched);
|
||||
|
@ -134,12 +134,12 @@ int PS4_SYSV_ABI scePthreadAttrGetinheritsched(const ScePthreadAttr* attr, int*
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return (result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL);
|
||||
return (result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrGetdetachstate(const ScePthreadAttr* attr, int* state) {
|
||||
if (state == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
// int result = pthread_attr_getdetachstate(&(*attr)->pth_attr, state);
|
||||
|
@ -157,12 +157,12 @@ int PS4_SYSV_ABI scePthreadAttrGetdetachstate(const ScePthreadAttr* attr, int* s
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return (result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL);
|
||||
return (result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) {
|
||||
if (attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int pstate = PTHREAD_CREATE_JOINABLE;
|
||||
|
@ -180,12 +180,12 @@ int PS4_SYSV_ABI scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachst
|
|||
// int result = pthread_attr_setdetachstate(&(*attr)->pth_attr, pstate);
|
||||
int result = 0;
|
||||
(*attr)->detached = (pstate == PTHREAD_CREATE_DETACHED);
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inheritSched) {
|
||||
if (attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int pinherit_sched = PTHREAD_INHERIT_SCHED;
|
||||
|
@ -202,14 +202,14 @@ int PS4_SYSV_ABI scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inherit
|
|||
|
||||
int result = pthread_attr_setinheritsched(&(*attr)->pth_attr, pinherit_sched);
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrGetschedparam(const ScePthreadAttr* attr,
|
||||
SceKernelSchedParam* param) {
|
||||
|
||||
if (param == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_attr_getschedparam(&(*attr)->pth_attr, param);
|
||||
|
@ -222,13 +222,13 @@ int PS4_SYSV_ABI scePthreadAttrGetschedparam(const ScePthreadAttr* attr,
|
|||
param->sched_priority = 700;
|
||||
}
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrSetschedparam(ScePthreadAttr* attr,
|
||||
const SceKernelSchedParam* param) {
|
||||
if (param == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
SceKernelSchedParam pparam{};
|
||||
|
@ -243,12 +243,12 @@ int PS4_SYSV_ABI scePthreadAttrSetschedparam(ScePthreadAttr* attr,
|
|||
// We always use SCHED_OTHER for now, so don't call this for now.
|
||||
// int result = pthread_attr_setschedparam(&(*attr)->pth_attr, &pparam);
|
||||
int result = 0;
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrGetschedpolicy(const ScePthreadAttr* attr, int* policy) {
|
||||
if (policy == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_attr_getschedpolicy(&(*attr)->pth_attr, policy);
|
||||
|
@ -267,12 +267,12 @@ int PS4_SYSV_ABI scePthreadAttrGetschedpolicy(const ScePthreadAttr* attr, int* p
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy) {
|
||||
if (attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int ppolicy = SCHED_OTHER; // winpthreads only supports SCHED_OTHER
|
||||
|
@ -282,7 +282,7 @@ int PS4_SYSV_ABI scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy)
|
|||
|
||||
(*attr)->policy = policy;
|
||||
int result = pthread_attr_setschedpolicy(&(*attr)->pth_attr, ppolicy);
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
ScePthread PS4_SYSV_ABI scePthreadSelf() {
|
||||
|
@ -294,51 +294,51 @@ int PS4_SYSV_ABI scePthreadAttrSetaffinity(ScePthreadAttr* pattr,
|
|||
LOG_INFO(Kernel_Pthread, "called");
|
||||
|
||||
if (pattr == nullptr || *pattr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
(*pattr)->affinity = mask;
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrGetaffinity(const ScePthreadAttr* pattr,
|
||||
/* SceKernelCpumask*/ u64* mask) {
|
||||
if (pattr == nullptr || *pattr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
*mask = (*pattr)->affinity;
|
||||
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrGetstackaddr(const ScePthreadAttr* attr, void** stack_addr) {
|
||||
|
||||
if (stack_addr == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
size_t stack_size = 0;
|
||||
int result = pthread_attr_getstack(&(*attr)->pth_attr, stack_addr, &stack_size);
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrGetstacksize(const ScePthreadAttr* attr, size_t* stack_size) {
|
||||
|
||||
if (stack_size == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_attr_getstacksize(&(*attr)->pth_attr, stack_size);
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrSetstackaddr(ScePthreadAttr* attr, void* addr) {
|
||||
|
||||
if (addr == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
size_t stack_size = 0;
|
||||
|
@ -346,25 +346,25 @@ int PS4_SYSV_ABI scePthreadAttrSetstackaddr(ScePthreadAttr* attr, void* addr) {
|
|||
|
||||
int result = pthread_attr_setstack(&(*attr)->pth_attr, addr, stack_size);
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrSetstacksize(ScePthreadAttr* attr, size_t stack_size) {
|
||||
|
||||
if (stack_size == 0 || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_attr_setstacksize(&(*attr)->pth_attr, stack_size);
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_pthread_attr_init(ScePthreadAttr* attr) {
|
||||
int result = scePthreadAttrInit(attr);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -374,8 +374,8 @@ int PS4_SYSV_ABI posix_pthread_attr_init(ScePthreadAttr* attr) {
|
|||
int PS4_SYSV_ABI posix_pthread_attr_setstacksize(ScePthreadAttr* attr, size_t stacksize) {
|
||||
int result = scePthreadAttrSetstacksize(attr, stacksize);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ int PS4_SYSV_ABI scePthreadSetaffinity(ScePthread thread, const /*SceKernelCpuma
|
|||
LOG_INFO(Kernel_Pthread, "called");
|
||||
|
||||
if (thread == nullptr) {
|
||||
return SCE_KERNEL_ERROR_ESRCH;
|
||||
return ORBIS_KERNEL_ERROR_ESRCH;
|
||||
}
|
||||
|
||||
auto result = scePthreadAttrSetaffinity(&thread->attr, mask);
|
||||
|
@ -398,7 +398,7 @@ int PS4_SYSV_ABI scePthreadGetaffinity(ScePthread thread, /*SceKernelCpumask*/ u
|
|||
LOG_INFO(Kernel_Pthread, "called");
|
||||
|
||||
if (thread == nullptr) {
|
||||
return SCE_KERNEL_ERROR_ESRCH;
|
||||
return ORBIS_KERNEL_ERROR_ESRCH;
|
||||
}
|
||||
|
||||
auto result = scePthreadAttrGetaffinity(&thread->attr, mask);
|
||||
|
@ -426,7 +426,7 @@ int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMut
|
|||
const ScePthreadMutexattr* attr;
|
||||
|
||||
if (mutex == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (mutex_attr == nullptr) {
|
||||
attr = g_pthread_cxt->getDefaultMutexattr();
|
||||
|
@ -453,22 +453,22 @@ int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMut
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case EAGAIN:
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
return ORBIS_KERNEL_ERROR_EAGAIN;
|
||||
case EINVAL:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
case ENOMEM:
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadMutexDestroy(ScePthreadMutex* mutex) {
|
||||
|
||||
if (mutex == nullptr || *mutex == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_mutex_destroy(&(*mutex)->pth_mutex);
|
||||
|
@ -480,12 +480,12 @@ int PS4_SYSV_ABI scePthreadMutexDestroy(ScePthreadMutex* mutex) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case EBUSY:
|
||||
return SCE_KERNEL_ERROR_EBUSY;
|
||||
return ORBIS_KERNEL_ERROR_EBUSY;
|
||||
case EINVAL:
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
int PS4_SYSV_ABI scePthreadMutexattrInit(ScePthreadMutexattr* attr) {
|
||||
|
@ -498,11 +498,11 @@ int PS4_SYSV_ABI scePthreadMutexattrInit(ScePthreadMutexattr* attr) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case ENOMEM:
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -525,7 +525,7 @@ int PS4_SYSV_ABI scePthreadMutexattrSettype(ScePthreadMutexattr* attr, int type)
|
|||
|
||||
int result = pthread_mutexattr_settype(&(*attr)->pth_mutex_attr, ptype);
|
||||
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int protocol) {
|
||||
|
@ -550,13 +550,13 @@ int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int p
|
|||
int result = pthread_mutexattr_setprotocol(&(*attr)->pth_mutex_attr, pprotocol);
|
||||
#endif
|
||||
(*attr)->pprotocol = pprotocol;
|
||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||
return result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
|
||||
mutex = createMutex(mutex);
|
||||
if (mutex == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_mutex_lock(&(*mutex)->pth_mutex);
|
||||
|
@ -566,22 +566,22 @@ int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case EAGAIN:
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
return ORBIS_KERNEL_ERROR_EAGAIN;
|
||||
case EINVAL:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
case EDEADLK:
|
||||
return SCE_KERNEL_ERROR_EDEADLK;
|
||||
return ORBIS_KERNEL_ERROR_EDEADLK;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) {
|
||||
mutex = createMutex(mutex);
|
||||
if (mutex == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_mutex_unlock(&(*mutex)->pth_mutex);
|
||||
|
@ -591,13 +591,13 @@ int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case EINVAL:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
case EPERM:
|
||||
return SCE_KERNEL_ERROR_EPERM;
|
||||
return ORBIS_KERNEL_ERROR_EPERM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,11 +609,11 @@ int PS4_SYSV_ABI scePthreadMutexattrDestroy(ScePthreadMutexattr* attr) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case ENOMEM:
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -635,7 +635,7 @@ ScePthreadCond* createCond(ScePthreadCond* addr) {
|
|||
int PS4_SYSV_ABI scePthreadCondInit(ScePthreadCond* cond, const ScePthreadCondattr* attr,
|
||||
const char* name) {
|
||||
if (cond == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
if (attr == nullptr) {
|
||||
|
@ -658,15 +658,15 @@ int PS4_SYSV_ABI scePthreadCondInit(ScePthreadCond* cond, const ScePthreadCondat
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case EAGAIN:
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
return ORBIS_KERNEL_ERROR_EAGAIN;
|
||||
case EINVAL:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
case ENOMEM:
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -677,34 +677,34 @@ int PS4_SYSV_ABI scePthreadCondattrInit(ScePthreadCondattr* attr) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case ENOMEM:
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadCondBroadcast(ScePthreadCond* cond) {
|
||||
cond = createCond(cond);
|
||||
if (cond == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_cond_broadcast(&(*cond)->cond);
|
||||
|
||||
LOG_TRACE(Kernel_Pthread, "called name={}, result={}", (*cond)->name, result);
|
||||
|
||||
return (result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL);
|
||||
return (result == 0 ? ORBIS_OK : ORBIS_KERNEL_ERROR_EINVAL);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadCondTimedwait(ScePthreadCond* cond, ScePthreadMutex* mutex, u64 usec) {
|
||||
cond = createCond(cond);
|
||||
if (cond == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (mutex == nullptr || *mutex == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
timespec time{};
|
||||
time.tv_sec = usec / 1000000;
|
||||
|
@ -715,21 +715,21 @@ int PS4_SYSV_ABI scePthreadCondTimedwait(ScePthreadCond* cond, ScePthreadMutex*
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case ETIMEDOUT:
|
||||
return SCE_KERNEL_ERROR_ETIMEDOUT;
|
||||
return ORBIS_KERNEL_ERROR_ETIMEDOUT;
|
||||
case EINTR:
|
||||
return SCE_KERNEL_ERROR_EINTR;
|
||||
return ORBIS_KERNEL_ERROR_EINTR;
|
||||
case EAGAIN:
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
return ORBIS_KERNEL_ERROR_EAGAIN;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadCondDestroy(ScePthreadCond* cond) {
|
||||
if (cond == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
int result = pthread_cond_destroy(&(*cond)->cond);
|
||||
|
||||
|
@ -740,11 +740,11 @@ int PS4_SYSV_ABI scePthreadCondDestroy(ScePthreadCond* cond) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case EBUSY:
|
||||
return SCE_KERNEL_ERROR_EBUSY;
|
||||
return ORBIS_KERNEL_ERROR_EBUSY;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -752,8 +752,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_init(ScePthreadMutex* mutex, const ScePthre
|
|||
// LOG_INFO(Kernel_Pthread, "posix pthread_mutex_init redirect to scePthreadMutexInit");
|
||||
int result = scePthreadMutexInit(mutex, attr, nullptr);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -764,8 +764,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex) {
|
|||
// LOG_INFO(Kernel_Pthread, "posix pthread_mutex_lock redirect to scePthreadMutexLock");
|
||||
int result = scePthreadMutexLock(mutex);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -776,8 +776,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex) {
|
|||
// LOG_INFO(Kernel_Pthread, "posix pthread_mutex_unlock redirect to scePthreadMutexUnlock");
|
||||
int result = scePthreadMutexUnlock(mutex);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -787,8 +787,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex) {
|
|||
int PS4_SYSV_ABI posix_pthread_mutex_destroy(ScePthreadMutex* mutex) {
|
||||
int result = scePthreadMutexDestroy(mutex);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -798,8 +798,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_destroy(ScePthreadMutex* mutex) {
|
|||
int PS4_SYSV_ABI posix_pthread_cond_wait(ScePthreadCond* cond, ScePthreadMutex* mutex) {
|
||||
int result = scePthreadCondWait(cond, mutex);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -810,8 +810,8 @@ int PS4_SYSV_ABI posix_pthread_cond_timedwait(ScePthreadCond* cond, ScePthreadMu
|
|||
u64 usec) {
|
||||
int result = scePthreadCondTimedwait(cond, mutex, usec);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -821,8 +821,8 @@ int PS4_SYSV_ABI posix_pthread_cond_timedwait(ScePthreadCond* cond, ScePthreadMu
|
|||
int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond) {
|
||||
int result = scePthreadCondBroadcast(cond);
|
||||
if (result != 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -832,8 +832,8 @@ int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond) {
|
|||
int PS4_SYSV_ABI posix_pthread_mutexattr_init(ScePthreadMutexattr* attr) {
|
||||
int result = scePthreadMutexattrInit(attr);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -843,8 +843,8 @@ int PS4_SYSV_ABI posix_pthread_mutexattr_init(ScePthreadMutexattr* attr) {
|
|||
int PS4_SYSV_ABI posix_pthread_mutexattr_settype(ScePthreadMutexattr* attr, int type) {
|
||||
int result = scePthreadMutexattrSettype(attr, type);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -905,7 +905,7 @@ static int pthread_mutex_timedlock(pthread_mutex_t* mutex, const struct timespec
|
|||
int PS4_SYSV_ABI scePthreadMutexTimedlock(ScePthreadMutex* mutex, u64 usec) {
|
||||
mutex = createMutex(mutex);
|
||||
if (mutex == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
timespec time{};
|
||||
|
@ -915,21 +915,21 @@ int PS4_SYSV_ABI scePthreadMutexTimedlock(ScePthreadMutex* mutex, u64 usec) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case ETIMEDOUT:
|
||||
return SCE_KERNEL_ERROR_ETIMEDOUT;
|
||||
return ORBIS_KERNEL_ERROR_ETIMEDOUT;
|
||||
case EINTR:
|
||||
return SCE_KERNEL_ERROR_EINTR;
|
||||
return ORBIS_KERNEL_ERROR_EINTR;
|
||||
case EAGAIN:
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
return ORBIS_KERNEL_ERROR_EAGAIN;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static int pthread_copy_attributes(ScePthreadAttr* dst, const ScePthreadAttr* src) {
|
||||
if (dst == nullptr || *dst == nullptr || src == nullptr || *src == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
u64 mask = 0;
|
||||
|
@ -970,7 +970,7 @@ static int pthread_copy_attributes(ScePthreadAttr* dst, const ScePthreadAttr* sr
|
|||
|
||||
int PS4_SYSV_ABI scePthreadAttrGet(ScePthread thread, ScePthreadAttr* attr) {
|
||||
if (thread == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
return pthread_copy_attributes(attr, &thread->attr);
|
||||
|
@ -1003,7 +1003,7 @@ static void* run_thread(void* arg) {
|
|||
int PS4_SYSV_ABI scePthreadCreate(ScePthread* thread, const ScePthreadAttr* attr,
|
||||
PthreadEntryFunc start_routine, void* arg, const char* name) {
|
||||
if (thread == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
auto* pthread_pool = g_pthread_cxt->GetPthreadPool();
|
||||
|
@ -1040,17 +1040,17 @@ int PS4_SYSV_ABI scePthreadCreate(ScePthread* thread, const ScePthreadAttr* attr
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case ENOMEM:
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
case EAGAIN:
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
return ORBIS_KERNEL_ERROR_EAGAIN;
|
||||
case EDEADLK:
|
||||
return SCE_KERNEL_ERROR_EDEADLK;
|
||||
return ORBIS_KERNEL_ERROR_EDEADLK;
|
||||
case EPERM:
|
||||
return SCE_KERNEL_ERROR_EPERM;
|
||||
return ORBIS_KERNEL_ERROR_EPERM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1089,9 +1089,9 @@ int PS4_SYSV_ABI scePthreadAttrGetstack(ScePthreadAttr* attr, void** addr, size_
|
|||
LOG_INFO(Kernel_Pthread, "scePthreadAttrGetstack: result = {}", result);
|
||||
|
||||
if (result == 0) {
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadAttrSetstack(ScePthreadAttr* attr, void* addr, size_t size) {
|
||||
|
@ -1134,7 +1134,7 @@ ScePthread PS4_SYSV_ABI posix_pthread_self() {
|
|||
int PS4_SYSV_ABI scePthreadCondSignal(ScePthreadCond* cond) {
|
||||
cond = createCond(cond);
|
||||
if (cond == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int result = pthread_cond_signal(&(*cond)->cond);
|
||||
|
@ -1143,21 +1143,21 @@ int PS4_SYSV_ABI scePthreadCondSignal(ScePthreadCond* cond) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case EBUSY:
|
||||
return SCE_KERNEL_ERROR_EBUSY;
|
||||
return ORBIS_KERNEL_ERROR_EBUSY;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadCondWait(ScePthreadCond* cond, ScePthreadMutex* mutex) {
|
||||
cond = createCond(cond);
|
||||
if (cond == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (mutex == nullptr || *mutex == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
int result = pthread_cond_wait(&(*cond)->cond, &(*mutex)->pth_mutex);
|
||||
|
||||
|
@ -1165,19 +1165,19 @@ int PS4_SYSV_ABI scePthreadCondWait(ScePthreadCond* cond, ScePthreadMutex* mutex
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case EINTR:
|
||||
return SCE_KERNEL_ERROR_EINTR;
|
||||
return ORBIS_KERNEL_ERROR_EINTR;
|
||||
case EAGAIN:
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
return ORBIS_KERNEL_ERROR_EAGAIN;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadCondattrDestroy(ScePthreadCondattr* attr) {
|
||||
if (attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
int result = pthread_condattr_destroy(&(*attr)->cond_attr);
|
||||
|
||||
|
@ -1185,11 +1185,11 @@ int PS4_SYSV_ABI scePthreadCondattrDestroy(ScePthreadCondattr* attr) {
|
|||
|
||||
switch (result) {
|
||||
case 0:
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
case ENOMEM:
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
default:
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1254,8 +1254,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_trylock(ScePthreadMutex* mutex) {
|
|||
int PS4_SYSV_ABI posix_pthread_attr_destroy(ScePthreadAttr* attr) {
|
||||
int result = scePthreadAttrDestroy(attr);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -1266,8 +1266,8 @@ int PS4_SYSV_ABI posix_pthread_attr_setschedparam(ScePthreadAttr* attr,
|
|||
const SceKernelSchedParam* param) {
|
||||
int result = scePthreadAttrSetschedparam(attr, param);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -1277,8 +1277,8 @@ int PS4_SYSV_ABI posix_pthread_attr_setschedparam(ScePthreadAttr* attr,
|
|||
int PS4_SYSV_ABI posix_pthread_attr_setinheritsched(ScePthreadAttr* attr, int inheritSched) {
|
||||
int result = scePthreadAttrSetinheritsched(attr, inheritSched);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -1288,8 +1288,8 @@ int PS4_SYSV_ABI posix_pthread_attr_setinheritsched(ScePthreadAttr* attr, int in
|
|||
int PS4_SYSV_ABI posix_pthread_setprio(ScePthread thread, int prio) {
|
||||
int result = scePthreadSetprio(thread, prio);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -1300,8 +1300,8 @@ int PS4_SYSV_ABI posix_pthread_attr_setdetachstate(ScePthreadAttr* attr, int det
|
|||
// LOG_INFO(Kernel_Pthread, "posix pthread_mutexattr_init redirect to scePthreadMutexattrInit");
|
||||
int result = scePthreadAttrSetdetachstate(attr, detachstate);
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -1313,8 +1313,8 @@ int PS4_SYSV_ABI posix_pthread_create_name_np(ScePthread* thread, const ScePthre
|
|||
const char* name) {
|
||||
int result = scePthreadCreate(thread, attr, start_routine, arg, name);
|
||||
if (result != 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -1347,8 +1347,8 @@ int PS4_SYSV_ABI posix_pthread_cond_init(ScePthreadCond* cond, const ScePthreadC
|
|||
// LOG_INFO(Kernel_Pthread, "posix pthread_mutex_init redirect to scePthreadMutexInit");
|
||||
int result = scePthreadCondInit(cond, attr, "NoName");
|
||||
if (result < 0) {
|
||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
int rt = result > ORBIS_KERNEL_ERROR_UNKNOWN && result <= ORBIS_KERNEL_ERROR_ESTOP
|
||||
? result + -ORBIS_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
return rt;
|
||||
}
|
||||
|
@ -1491,7 +1491,7 @@ int PS4_SYSV_ABI posix_pthread_condattr_destroy(ScePthreadCondattr* attr) {
|
|||
|
||||
int PS4_SYSV_ABI posix_pthread_condattr_setclock(ScePthreadCondattr* attr, clockid_t clock) {
|
||||
(*attr)->clock = clock;
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_pthread_getschedparam(ScePthread thread, int* policy,
|
||||
|
@ -1511,7 +1511,7 @@ int PS4_SYSV_ABI posix_pthread_attr_getschedpolicy(const ScePthreadAttr* attr, i
|
|||
int PS4_SYSV_ABI scePthreadRename(ScePthread thread, const char* name) {
|
||||
thread->name = name;
|
||||
LOG_INFO(Kernel_Pthread, "scePthreadRename: name = {}", thread->name);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
void pthreadSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
|
|
|
@ -100,15 +100,15 @@ public:
|
|||
|
||||
int GetResult(bool timed_out) {
|
||||
if (timed_out) {
|
||||
return SCE_KERNEL_ERROR_ETIMEDOUT;
|
||||
return ORBIS_KERNEL_ERROR_ETIMEDOUT;
|
||||
}
|
||||
if (was_deleted) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
if (was_cancled) {
|
||||
return SCE_KERNEL_ERROR_ECANCELED;
|
||||
return ORBIS_KERNEL_ERROR_ECANCELED;
|
||||
}
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int Wait(std::unique_lock<std::mutex>& lk, u32* timeout) {
|
||||
|
@ -203,7 +203,7 @@ int PS4_SYSV_ABI sceKernelCancelSema(OrbisKernelSema sem, s32 setCount, s32* pNu
|
|||
|
||||
int PS4_SYSV_ABI sceKernelDeleteSema(OrbisKernelSema sem) {
|
||||
if (!sem) {
|
||||
return SCE_KERNEL_ERROR_ESRCH;
|
||||
return ORBIS_KERNEL_ERROR_ESRCH;
|
||||
}
|
||||
delete sem;
|
||||
return ORBIS_OK;
|
||||
|
|
|
@ -82,7 +82,7 @@ u32 PS4_SYSV_ABI sceKernelSleep(u32 seconds) {
|
|||
|
||||
int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
||||
if (tp == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EFAULT;
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
clockid_t pclock_id = CLOCK_REALTIME;
|
||||
switch (clock_id) {
|
||||
|
@ -107,9 +107,9 @@ int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
|||
tp->tv_sec = t.tv_sec;
|
||||
tp->tv_nsec = t.tv_nsec;
|
||||
if (result == 0) {
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_clock_gettime(s32 clock_id, OrbisKernelTimespec* time) {
|
||||
|
@ -128,11 +128,11 @@ int PS4_SYSV_ABI posix_nanosleep(const OrbisKernelTimespec* rqtp, OrbisKernelTim
|
|||
|
||||
int PS4_SYSV_ABI sceKernelNanosleep(const OrbisKernelTimespec* rqtp, OrbisKernelTimespec* rmtp) {
|
||||
if (!rqtp || !rmtp) {
|
||||
return SCE_KERNEL_ERROR_EFAULT;
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
|
||||
if (rqtp->tv_sec < 0 || rqtp->tv_nsec < 0) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
return posix_nanosleep(rqtp, rmtp);
|
||||
|
@ -185,7 +185,7 @@ s32 PS4_SYSV_ABI sceKernelGettimezone(OrbisKernelTimezone* tz) {
|
|||
|
||||
int PS4_SYSV_ABI posix_clock_getres(u32 clock_id, OrbisKernelTimespec* res) {
|
||||
if (res == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EFAULT;
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
clockid_t pclock_id = CLOCK_REALTIME;
|
||||
switch (clock_id) {
|
||||
|
@ -209,9 +209,9 @@ int PS4_SYSV_ABI posix_clock_getres(u32 clock_id, OrbisKernelTimespec* res) {
|
|||
res->tv_sec = t.tv_sec;
|
||||
res->tv_nsec = t.tv_nsec;
|
||||
if (result == 0) {
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceKernelConvertLocaltimeToUtc(time_t param_1, int64_t param_2, time_t* seconds,
|
||||
|
@ -225,9 +225,9 @@ int PS4_SYSV_ABI sceKernelConvertLocaltimeToUtc(time_t param_1, int64_t param_2,
|
|||
if (dst_seconds)
|
||||
*dst_seconds = timezone->tz_dsttime * 60;
|
||||
} else {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
void timeSymbolsRegister(Core::Loader::SymbolsResolver* sym) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -96,7 +96,7 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn
|
|||
pInfo->connectedCount = 1;
|
||||
pInfo->connected = false;
|
||||
pInfo->deviceClass = ORBIS_PAD_DEVICE_CLASS_STANDARD;
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
pInfo->touchPadInfo.pixelDensity = 1;
|
||||
pInfo->touchPadInfo.resolution.x = 1920;
|
||||
|
@ -107,7 +107,7 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn
|
|||
pInfo->connectedCount = 1;
|
||||
pInfo->connected = 1;
|
||||
pInfo->deviceClass = ORBIS_PAD_DEVICE_CLASS_STANDARD;
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePadGetDataInternal() {
|
||||
|
@ -350,7 +350,7 @@ int PS4_SYSV_ABI scePadReadState(s32 handle, OrbisPadData* pData) {
|
|||
pData->connectedCount = 1; // connectedCount;
|
||||
pData->deviceUniqueDataLen = 0;
|
||||
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePadReadStateExt() {
|
||||
|
|
|
@ -39,22 +39,4 @@ typedef enum OrbisPlayGoInstallSpeedValue {
|
|||
ORBIS_PLAYGO_INSTALL_SPEED_SUSPENDED = 0,
|
||||
ORBIS_PLAYGO_INSTALL_SPEED_TRICKLE = 1,
|
||||
ORBIS_PLAYGO_INSTALL_SPEED_FULL = 2
|
||||
} OrbisPlayGoInstallSpeedValue;
|
||||
|
||||
constexpr int ORBIS_PLAYGO_ERROR_UNKNOWN = -2135818239; /* 0x80B20001 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_FATAL = -2135818238; /* 0x80B20002 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_NO_MEMORY = -2135818237; /* 0x80B20003 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_INVALID_ARGUMENT = -2135818236; /* 0x80B20004 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_NOT_INITIALIZED = -2135818235; /* 0x80B20005 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_ALREADY_INITIALIZED = -2135818234; /* 0x80B20006 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_ALREADY_STARTED = -2135818233; /* 0x80B20007 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_NOT_STARTED = -2135818232; /* 0x80B20008 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_BAD_HANDLE = -2135818231; /* 0x80B20009 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_BAD_POINTER = -2135818230; /* 0x80B2000A */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_BAD_SIZE = -2135818229; /* 0x80B2000B */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_BAD_CHUNK_ID = -2135818228; /* 0x80B2000C */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_BAD_SPEED = -2135818227; /* 0x80B2000D */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_NOT_SUPPORT_PLAYGO = -2135818226; /* 0x80B2000E */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_EPERM = -2135818225; /* 0x80B2000F */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_BAD_LOCUS = -2135818224; /* 0x80B20010 */
|
||||
constexpr int ORBIS_PLAYGO_ERROR_NEED_DATA_DISC = -2135818223; /* 0x80B20011 */
|
||||
} OrbisPlayGoInstallSpeedValue;
|
|
@ -11,7 +11,7 @@ namespace Libraries::Random {
|
|||
s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, size_t size) {
|
||||
LOG_TRACE(Lib_Random, "called");
|
||||
if (size > SCE_RANDOM_MAX_SIZE) {
|
||||
return SCE_RANDOM_ERROR_INVALID;
|
||||
return ORBIS_RANDOM_ERROR_INVALID;
|
||||
}
|
||||
|
||||
for (auto i = 0; i < size; ++i) {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_PARAMETER = 0x809F0000;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_NOT_INITIALIZED = 0x809F0001;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_OUT_OF_MEMORY = 0x809F0002;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_BUSY = 0x809F0003;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_NOT_MOUNTED = 0x809F0004;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_NO_PERMISSION = 0x809F0005;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_FINGERPRINT_MISMATCH = 0x809F0006;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_EXISTS = 0x809F0007;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_NOT_FOUND = 0x809F0008;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_NO_SPACE_FS = 0x809F000A;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_INTERNAL = 0x809F000B;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_MOUNT_FULL = 0x809F000C;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_BAD_MOUNTED = 0x809F000D;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_FILE_NOT_FOUND = 0x809F000E;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_BROKEN = 0x809F000F;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_INVALID_LOGIN_USER = 0x809F0011;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_MEMORY_NOT_READY = 0x809F0012;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_BACKUP_BUSY = 0x809F0013;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_NOT_REGIST_CALLBACK = 0x809F0015;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_BUSY_FOR_SAVING = 0x809F0016;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_LIMITATION_OVER = 0x809F0017;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_EVENT_BUSY = 0x809F0018;
|
||||
constexpr int ORBIS_SAVE_DATA_ERROR_PARAMSFO_TRANSFER_TITLE_ID_NOT_FOUND = 0x809F0019;
|
|
@ -12,7 +12,6 @@
|
|||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/save_data/savedata.h"
|
||||
#include "error_codes.h"
|
||||
|
||||
namespace Libraries::SaveData {
|
||||
bool is_rw_mode = false;
|
||||
|
|
|
@ -177,7 +177,7 @@ s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, FlipStatus* status) {
|
|||
|
||||
s32 PS4_SYSV_ABI sceVideoOutGetVblankStatus(int handle, SceVideoOutVblankStatus* status) {
|
||||
if (status == nullptr) {
|
||||
return SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS;
|
||||
return ORBIS_VIDEO_OUT_ERROR_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
auto* port = driver->GetPort(handle);
|
||||
|
@ -321,4 +321,4 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
|||
sceVideoOutGetDeviceCapabilityInfo);
|
||||
}
|
||||
|
||||
} // namespace Libraries::VideoOut
|
||||
} // namespace Libraries::VideoOut
|
|
@ -136,7 +136,7 @@ int MemoryManager::MapMemory(void** out_addr, VAddr virtual_addr, size_t size, M
|
|||
// Certain games perform flexible mappings on loop to determine
|
||||
// the available flexible memory size. Questionable but we need to handle this.
|
||||
if (type == VMAType::Flexible && flexible_usage + size > total_flexible_size) {
|
||||
return SCE_KERNEL_ERROR_ENOMEM;
|
||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||
}
|
||||
|
||||
// When virtual addr is zero, force it to virtual_base. The guest cannot pass Fixed
|
||||
|
|
Loading…
Add table
Reference in a new issue