diff --git a/src/audio_core/sdl_audio.cpp b/src/audio_core/sdl_audio.cpp index 7fed42a44..d8b646bed 100644 --- a/src/audio_core/sdl_audio.cpp +++ b/src/audio_core/sdl_audio.cpp @@ -1,16 +1,14 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "sdl_audio.h" - -#include "common/assert.h" -#include "core/libraries/error_codes.h" - +#include #include #include #include -#include // std::unique_lock +#include "audio_core/sdl_audio.h" +#include "common/assert.h" +#include "core/libraries/audio/audioout_error.h" namespace Audio { @@ -19,7 +17,7 @@ constexpr int AUDIO_STREAM_BUFFER_THRESHOLD = 65536; // Define constant for buff s32 SDLAudio::AudioOutOpen(int type, u32 samples_num, u32 freq, Libraries::AudioOut::OrbisAudioOutParamFormat format) { using Libraries::AudioOut::OrbisAudioOutParamFormat; - std::unique_lock lock{m_mutex}; + std::scoped_lock lock{m_mutex}; for (int id = 0; id < portsOut.size(); id++) { auto& port = portsOut[id]; if (!port.isOpen) { diff --git a/src/core/libraries/app_content/app_content.cpp b/src/core/libraries/app_content/app_content.cpp index f912639eb..6f5f5c839 100644 --- a/src/core/libraries/app_content/app_content.cpp +++ b/src/core/libraries/app_content/app_content.cpp @@ -6,14 +6,11 @@ #include "app_content.h" #include "common/assert.h" #include "common/config.h" -#include "common/io_file.h" #include "common/logging/log.h" -#include "common/path_util.h" #include "common/singleton.h" -#include "common/string_util.h" #include "core/file_format/psf.h" #include "core/file_sys/fs.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/app_content/app_content_error.h" #include "core/libraries/libs.h" namespace Libraries::AppContent { @@ -260,7 +257,7 @@ int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initPar AddContInfo info{}; info.status = ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED; - strcpy(info.entitlementLabel, entitlement_label.c_str()); + entitlement_label.copy(info.entitlementLabel, sizeof(info.entitlementLabel)); addcont_info[addcont_count++] = info; } diff --git a/src/core/libraries/app_content/app_content_error.h b/src/core/libraries/app_content/app_content_error.h new file mode 100644 index 000000000..3a582b998 --- /dev/null +++ b/src/core/libraries/app_content/app_content_error.h @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// AppContent library +constexpr int ORBIS_APP_CONTENT_ERROR_PARAMETER = 0x80D90002; +constexpr int ORBIS_APP_CONTENT_ERROR_DRM_NO_ENTITLEMENT = 0x80D90007; +constexpr int ORBIS_APP_CONTENT_ERROR_NOT_FOUND = 0x80D90005; diff --git a/src/core/libraries/audio/audioout.cpp b/src/core/libraries/audio/audioout.cpp index 778d777c2..4dd27eb45 100644 --- a/src/core/libraries/audio/audioout.cpp +++ b/src/core/libraries/audio/audioout.cpp @@ -8,7 +8,7 @@ #include "common/assert.h" #include "common/logging/log.h" #include "core/libraries/audio/audioout.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/audio/audioout_error.h" #include "core/libraries/libs.h" namespace Libraries::AudioOut { diff --git a/src/core/libraries/audio/audioout_error.h b/src/core/libraries/audio/audioout_error.h new file mode 100644 index 000000000..7642e87e7 --- /dev/null +++ b/src/core/libraries/audio/audioout_error.h @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// AudioOut library +constexpr int ORBIS_AUDIO_OUT_ERROR_NOT_OPENED = 0x80260001; +constexpr int ORBIS_AUDIO_OUT_ERROR_BUSY = 0x80260002; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PORT = 0x80260003; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_POINTER = 0x80260004; +constexpr int ORBIS_AUDIO_OUT_ERROR_PORT_FULL = 0x80260005; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_SIZE = 0x80260006; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_FORMAT = 0x80260007; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ = 0x80260008; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_VOLUME = 0x80260009; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PORT_TYPE = 0x8026000A; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_CONF_TYPE = 0x8026000C; +constexpr int ORBIS_AUDIO_OUT_ERROR_OUT_OF_MEMORY = 0x8026000D; +constexpr int ORBIS_AUDIO_OUT_ERROR_ALREADY_INIT = 0x8026000E; +constexpr int ORBIS_AUDIO_OUT_ERROR_NOT_INIT = 0x8026000F; +constexpr int ORBIS_AUDIO_OUT_ERROR_MEMORY = 0x80260010; +constexpr int ORBIS_AUDIO_OUT_ERROR_SYSTEM_RESOURCE = 0x80260011; +constexpr int ORBIS_AUDIO_OUT_ERROR_TRANS_EVENT = 0x80260012; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_FLAG = 0x80260013; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_MIXLEVEL = 0x80260014; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_ARG = 0x80260015; +constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PARAM = 0x80260016; +constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_FATAL = 0x80260200; +constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_API_PARAM = 0x80260201; +constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_CONFIG = 0x80260202; +constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_NOT_INITIALIZED = 0x80260203; +constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_STATES_ID = 0x80260204; diff --git a/src/core/libraries/audio3d/audio3d_error.h b/src/core/libraries/audio3d/audio3d_error.h index ff9d9749c..626ac8699 100644 --- a/src/core/libraries/audio3d/audio3d_error.h +++ b/src/core/libraries/audio3d/audio3d_error.h @@ -3,6 +3,8 @@ #pragma once +#include "core/libraries/error_codes.h" + constexpr int ORBIS_AUDIO3D_ERROR_UNKNOWN = 0x80EA0001; constexpr int ORBIS_AUDIO3D_ERROR_INVALID_PORT = 0x80EA0002; constexpr int ORBIS_AUDIO3D_ERROR_INVALID_OBJECT = 0x80EA0003; diff --git a/src/core/libraries/avplayer/avplayer.cpp b/src/core/libraries/avplayer/avplayer.cpp index 1257473e1..176fda137 100644 --- a/src/core/libraries/avplayer/avplayer.cpp +++ b/src/core/libraries/avplayer/avplayer.cpp @@ -3,8 +3,8 @@ #include "common/logging/log.h" #include "core/libraries/avplayer/avplayer.h" +#include "core/libraries/avplayer/avplayer_error.h" #include "core/libraries/avplayer/avplayer_impl.h" -#include "core/libraries/error_codes.h" #include "core/libraries/libs.h" namespace Libraries::AvPlayer { diff --git a/src/core/libraries/avplayer/avplayer_error.h b/src/core/libraries/avplayer/avplayer_error.h new file mode 100644 index 000000000..ebe4d0dd3 --- /dev/null +++ b/src/core/libraries/avplayer/avplayer_error.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// AvPlayer library +constexpr int ORBIS_AVPLAYER_ERROR_INVALID_PARAMS = 0x806A0001; +constexpr int ORBIS_AVPLAYER_ERROR_OPERATION_FAILED = 0x806A0002; +constexpr int ORBIS_AVPLAYER_ERROR_NO_MEMORY = 0x806A0003; +constexpr int ORBIS_AVPLAYER_ERROR_NOT_SUPPORTED = 0x806A0004; +constexpr int ORBIS_AVPLAYER_ERROR_WAR_FILE_NONINTERLEAVED = 0x806A00A0; +constexpr int ORBIS_AVPLAYER_ERROR_WAR_LOOPING_BACK = 0x806A00A1; +constexpr int ORBIS_AVPLAYER_ERROR_WAR_JUMP_COMPLETE = 0x806A00A3; +constexpr int ORBIS_AVPLAYER_ERROR_INFO_MARLIN_ENCRY = 0x806A00B0; +constexpr int ORBIS_AVPLAYER_ERROR_INFO_PLAYREADY_ENCRY = 0x806A00B4; +constexpr int ORBIS_AVPLAYER_ERROR_INFO_AES_ENCRY = 0x806A00B5; +constexpr int ORBIS_AVPLAYER_ERROR_INFO_OTHER_ENCRY = 0x806A00BF; diff --git a/src/core/libraries/avplayer/avplayer_impl.cpp b/src/core/libraries/avplayer/avplayer_impl.cpp index 0f39acfdc..d9a67134c 100644 --- a/src/core/libraries/avplayer/avplayer_impl.cpp +++ b/src/core/libraries/avplayer/avplayer_impl.cpp @@ -2,8 +2,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/libraries/avplayer/avplayer_common.h" +#include "core/libraries/avplayer/avplayer_error.h" #include "core/libraries/avplayer/avplayer_impl.h" -#include "core/libraries/error_codes.h" #include "core/tls.h" namespace Libraries::AvPlayer { diff --git a/src/core/libraries/avplayer/avplayer_state.cpp b/src/core/libraries/avplayer/avplayer_state.cpp index 3d9840a1b..2ef7d7a56 100644 --- a/src/core/libraries/avplayer/avplayer_state.cpp +++ b/src/core/libraries/avplayer/avplayer_state.cpp @@ -3,9 +3,9 @@ #include "common/logging/log.h" #include "common/thread.h" +#include "core/libraries/avplayer/avplayer_error.h" #include "core/libraries/avplayer/avplayer_source.h" #include "core/libraries/avplayer/avplayer_state.h" -#include "core/libraries/error_codes.h" #include "core/tls.h" #include diff --git a/src/core/libraries/error_codes.h b/src/core/libraries/error_codes.h index 280ddf1cb..e1902b61c 100644 --- a/src/core/libraries/error_codes.h +++ b/src/core/libraries/error_codes.h @@ -3,626 +3,6 @@ #pragma once -// posix error codes -constexpr int POSIX_EPERM = 1; -constexpr int POSIX_ENOENT = 2; -constexpr int POSIX_ESRCH = 3; -constexpr int POSIX_EINTR = 4; -constexpr int POSIX_EIO = 5; -constexpr int POSIX_ENXIO = 6; -constexpr int POSIX_E2BIG = 7; -constexpr int POSIX_ENOEXEC = 8; -constexpr int POSIX_EBADF = 9; -constexpr int POSIX_ECHILD = 10; -constexpr int POSIX_EDEADLK = 11; -constexpr int POSIX_ENOMEM = 12; -constexpr int POSIX_EACCES = 13; -constexpr int POSIX_EFAULT = 14; -constexpr int POSIX_ENOTBLK = 15; -constexpr int POSIX_EBUSY = 16; -constexpr int POSIX_EEXIST = 17; -constexpr int POSIX_EXDEV = 18; -constexpr int POSIX_ENODEV = 19; -constexpr int POSIX_ENOTDIR = 20; -constexpr int POSIX_EISDIR = 21; -constexpr int POSIX_EINVAL = 22; -constexpr int POSIX_ENFILE = 23; -constexpr int POSIX_EMFILE = 24; -constexpr int POSIX_ENOTTY = 25; -constexpr int POSIX_ETXTBSY = 26; -constexpr int POSIX_EFBIG = 27; -constexpr int POSIX_ENOSPC = 28; -constexpr int POSIX_ESPIPE = 29; -constexpr int POSIX_EROFS = 30; -constexpr int POSIX_EMLINK = 31; -constexpr int POSIX_EPIPE = 32; -constexpr int POSIX_EDOM = 33; -constexpr int POSIX_ERANGE = 34; -constexpr int POSIX_EAGAIN = 35; -constexpr int POSIX_EWOULDBLOCK = 35; -constexpr int POSIX_EINPROGRESS = 36; -constexpr int POSIX_EALREADY = 37; -constexpr int POSIX_ENOTSOCK = 38; -constexpr int POSIX_EDESTADDRREQ = 39; -constexpr int POSIX_EMSGSIZE = 40; -constexpr int POSIX_EPROTOTYPE = 41; -constexpr int POSIX_ENOPROTOOPT = 42; -constexpr int POSIX_EPROTONOSUPPORT = 43; -constexpr int POSIX_ESOCKTNOSUPPORT = 44; -constexpr int POSIX_EOPNOTSUPP = 45; -constexpr int POSIX_ENOTSUP = 45; -constexpr int POSIX_EPFNOSUPPORT = 46; -constexpr int POSIX_EAFNOSUPPORT = 47; -constexpr int POSIX_EADDRINUSE = 48; -constexpr int POSIX_EADDRNOTAVAIL = 49; -constexpr int POSIX_ENETDOWN = 50; -constexpr int POSIX_ENETUNREACH = 51; -constexpr int POSIX_ENETRESET = 52; -constexpr int POSIX_ECONNABORTED = 53; -constexpr int POSIX_ECONNRESET = 54; -constexpr int POSIX_ENOBUFS = 55; -constexpr int POSIX_EISCONN = 56; -constexpr int POSIX_ENOTCONN = 57; -constexpr int POSIX_ESHUTDOWN = 58; -constexpr int POSIX_ETOOMANYREFS = 59; -constexpr int POSIX_ETIMEDOUT = 60; -constexpr int POSIX_ECONNREFUSED = 61; -constexpr int POSIX_ELOOP = 62; -constexpr int POSIX_ENAMETOOLONG = 63; -constexpr int POSIX_EHOSTDOWN = 64; -constexpr int POSIX_EHOSTUNREACH = 65; -constexpr int POSIX_ENOTEMPTY = 66; -constexpr int POSIX_EPROCLIM = 67; -constexpr int POSIX_EUSERS = 68; -constexpr int POSIX_EDQUOT = 69; -constexpr int POSIX_ESTALE = 70; -constexpr int POSIX_EREMOTE = 71; -constexpr int POSIX_EBADRPC = 72; -constexpr int POSIX_ERPCMISMATCH = 73; -constexpr int POSIX_EPROGUNAVAIL = 74; -constexpr int POSIX_EPROGMISMATCH = 75; -constexpr int POSIX_EPROCUNAVAIL = 76; -constexpr int POSIX_ENOLCK = 77; -constexpr int POSIX_ENOSYS = 78; -constexpr int POSIX_EFTYPE = 79; -constexpr int POSIX_EAUTH = 80; -constexpr int POSIX_ENEEDAUTH = 81; -constexpr int POSIX_EIDRM = 82; -constexpr int POSIX_ENOMSG = 83; -constexpr int POSIX_EOVERFLOW = 84; -constexpr int POSIX_ECANCELED = 85; -constexpr int POSIX_EILSEQ = 86; -constexpr int POSIX_ENOATTR = 87; -constexpr int POSIX_EDOOFUS = 88; -constexpr int POSIX_EBADMSG = 89; -constexpr int POSIX_EMULTIHOP = 90; -constexpr int POSIX_ENOLINK = 91; -constexpr int POSIX_EPROTO = 92; -constexpr int POSIX_ENOTCAPABLE = 93; -constexpr int POSIX_ECAPMODE = 94; -constexpr int POSIX_ENOBLK = 95; -constexpr int POSIX_EICV = 96; -constexpr int POSIX_ENOPLAYGOENT = 97; -constexpr int POSIX_EREVOKE = 98; -constexpr int POSIX_ESDKVERSION = 99; -constexpr int POSIX_ESTART = 100; -constexpr int POSIX_ESTOP = 101; -constexpr int POSIX_EINVALID2MB = 102; -constexpr int POSIX_ELAST = 102; -constexpr int POSIX_EADHOC = 160; -constexpr int POSIX_EINACTIVEDISABLED = 163; -constexpr int POSIX_ENETNODATA = 164; -constexpr int POSIX_ENETDESC = 165; -constexpr int POSIX_ENETDESCTIMEDOUT = 166; -constexpr int POSIX_ENETINTR = 167; -constexpr int POSIX_ERETURN = 205; -constexpr int POSIX_EFPOS = 152; -constexpr int POSIX_ENODATA = 1040; -constexpr int POSIX_ENOSR = 1050; -constexpr int POSIX_ENOSTR = 1051; -constexpr int POSIX_ENOTRECOVERABLE = 1056; -constexpr int POSIX_EOTHER = 1062; -constexpr int POSIX_EOWNERDEAD = 1064; -constexpr int POSIX_ETIME = 1074; - -constexpr int SCE_OK = 0; - -// kernel error codes -constexpr int SCE_KERNEL_ERROR_UNKNOWN = 0x80020000; -constexpr int SCE_KERNEL_ERROR_EPERM = 0x80020001; -constexpr int SCE_KERNEL_ERROR_ENOENT = 0x80020002; -constexpr int SCE_KERNEL_ERROR_ESRCH = 0x80020003; -constexpr int SCE_KERNEL_ERROR_EINTR = 0x80020004; -constexpr int SCE_KERNEL_ERROR_EIO = 0x80020005; -constexpr int SCE_KERNEL_ERROR_ENXIO = 0x80020006; -constexpr int SCE_KERNEL_ERROR_E2BIG = 0x80020007; -constexpr int SCE_KERNEL_ERROR_ENOEXEC = 0x80020008; -constexpr int SCE_KERNEL_ERROR_EBADF = 0x80020009; -constexpr int SCE_KERNEL_ERROR_ECHILD = 0x8002000A; -constexpr int SCE_KERNEL_ERROR_EDEADLK = 0x8002000B; -constexpr int SCE_KERNEL_ERROR_ENOMEM = 0x8002000C; -constexpr int SCE_KERNEL_ERROR_EACCES = 0x8002000D; -constexpr int SCE_KERNEL_ERROR_EFAULT = 0x8002000E; -constexpr int SCE_KERNEL_ERROR_ENOTBLK = 0x8002000F; -constexpr int SCE_KERNEL_ERROR_EBUSY = 0x80020010; -constexpr int SCE_KERNEL_ERROR_EEXIST = 0x80020011; -constexpr int SCE_KERNEL_ERROR_EXDEV = 0x80020012; -constexpr int SCE_KERNEL_ERROR_ENODEV = 0x80020013; -constexpr int SCE_KERNEL_ERROR_ENOTDIR = 0x80020014; -constexpr int SCE_KERNEL_ERROR_EISDIR = 0x80020015; -constexpr int SCE_KERNEL_ERROR_EINVAL = 0x80020016; -constexpr int SCE_KERNEL_ERROR_ENFILE = 0x80020017; -constexpr int SCE_KERNEL_ERROR_EMFILE = 0x80020018; -constexpr int SCE_KERNEL_ERROR_ENOTTY = 0x80020019; -constexpr int SCE_KERNEL_ERROR_ETXTBSY = 0x8002001A; -constexpr int SCE_KERNEL_ERROR_EFBIG = 0x8002001B; -constexpr int SCE_KERNEL_ERROR_ENOSPC = 0x8002001C; -constexpr int SCE_KERNEL_ERROR_ESPIPE = 0x8002001D; -constexpr int SCE_KERNEL_ERROR_EROFS = 0x8002001E; -constexpr int SCE_KERNEL_ERROR_EMLINK = 0x8002001F; -constexpr int SCE_KERNEL_ERROR_EPIPE = 0x80020020; -constexpr int SCE_KERNEL_ERROR_EDOM = 0x80020021; -constexpr int SCE_KERNEL_ERROR_ERANGE = 0x80020022; -constexpr int SCE_KERNEL_ERROR_EAGAIN = 0x80020023; -constexpr int SCE_KERNEL_ERROR_EWOULDBLOCK = 0x80020023; -constexpr int SCE_KERNEL_ERROR_EINPROGRESS = 0x80020024; -constexpr int SCE_KERNEL_ERROR_EALREADY = 0x80020025; -constexpr int SCE_KERNEL_ERROR_ENOTSOCK = 0x80020026; -constexpr int SCE_KERNEL_ERROR_EDESTADDRREQ = 0x80020027; -constexpr int SCE_KERNEL_ERROR_EMSGSIZE = 0x80020028; -constexpr int SCE_KERNEL_ERROR_EPROTOTYPE = 0x80020029; -constexpr int SCE_KERNEL_ERROR_ENOPROTOOPT = 0x8002002A; -constexpr int SCE_KERNEL_ERROR_EPROTONOSUPPORT = 0x8002002B; -constexpr int SCE_KERNEL_ERROR_ESOCKTNOSUPPORT = 0x8002002C; -constexpr int SCE_KERNEL_ERROR_EOPNOTSUPP = 0x8002002D; -constexpr int SCE_KERNEL_ERROR_ENOTSUP = 0x8002002D; -constexpr int SCE_KERNEL_ERROR_EPFNOSUPPORT = 0x8002002E; -constexpr int SCE_KERNEL_ERROR_EAFNOSUPPORT = 0x8002002F; -constexpr int SCE_KERNEL_ERROR_EADDRINUSE = 0x80020030; -constexpr int SCE_KERNEL_ERROR_EADDRNOTAVAIL = 0x80020031; -constexpr int SCE_KERNEL_ERROR_ENETDOWN = 0x80020032; -constexpr int SCE_KERNEL_ERROR_ENETUNREACH = 0x80020033; -constexpr int SCE_KERNEL_ERROR_ENETRESET = 0x80020034; -constexpr int SCE_KERNEL_ERROR_ECONNABORTED = 0x80020035; -constexpr int SCE_KERNEL_ERROR_ECONNRESET = 0x80020036; -constexpr int SCE_KERNEL_ERROR_ENOBUFS = 0x80020037; -constexpr int SCE_KERNEL_ERROR_EISCONN = 0x80020038; -constexpr int SCE_KERNEL_ERROR_ENOTCONN = 0x80020039; -constexpr int SCE_KERNEL_ERROR_ESHUTDOWN = 0x8002003A; -constexpr int SCE_KERNEL_ERROR_ETOOMANYREFS = 0x8002003B; -constexpr int SCE_KERNEL_ERROR_ETIMEDOUT = 0x8002003C; -constexpr int SCE_KERNEL_ERROR_ECONNREFUSED = 0x8002003D; -constexpr int SCE_KERNEL_ERROR_ELOOP = 0x8002003E; -constexpr int SCE_KERNEL_ERROR_ENAMETOOLONG = 0x8002003F; -constexpr int SCE_KERNEL_ERROR_EHOSTDOWN = 0x80020040; -constexpr int SCE_KERNEL_ERROR_EHOSTUNREACH = 0x80020041; -constexpr int SCE_KERNEL_ERROR_ENOTEMPTY = 0x80020042; -constexpr int SCE_KERNEL_ERROR_EPROCLIM = 0x80020043; -constexpr int SCE_KERNEL_ERROR_EUSERS = 0x80020044; -constexpr int SCE_KERNEL_ERROR_EDQUOT = 0x80020045; -constexpr int SCE_KERNEL_ERROR_ESTALE = 0x80020046; -constexpr int SCE_KERNEL_ERROR_EREMOTE = 0x80020047; -constexpr int SCE_KERNEL_ERROR_EBADRPC = 0x80020048; -constexpr int SCE_KERNEL_ERROR_ERPCMISMATCH = 0x80020049; -constexpr int SCE_KERNEL_ERROR_EPROGUNAVAIL = 0x8002004A; -constexpr int SCE_KERNEL_ERROR_EPROGMISMATCH = 0x8002004B; -constexpr int SCE_KERNEL_ERROR_EPROCUNAVAIL = 0x8002004C; -constexpr int SCE_KERNEL_ERROR_ENOLCK = 0x8002004D; -constexpr int SCE_KERNEL_ERROR_ENOSYS = 0x8002004E; -constexpr int SCE_KERNEL_ERROR_EFTYPE = 0x8002004F; -constexpr int SCE_KERNEL_ERROR_EAUTH = 0x80020050; -constexpr int SCE_KERNEL_ERROR_ENEEDAUTH = 0x80020051; -constexpr int SCE_KERNEL_ERROR_EIDRM = 0x80020052; -constexpr int SCE_KERNEL_ERROR_ENOMSG = 0x80020053; -constexpr int SCE_KERNEL_ERROR_EOVERFLOW = 0x80020054; -constexpr int SCE_KERNEL_ERROR_ECANCELED = 0x80020055; -constexpr int SCE_KERNEL_ERROR_EILSEQ = 0x80020056; -constexpr int SCE_KERNEL_ERROR_ENOATTR = 0x80020057; -constexpr int SCE_KERNEL_ERROR_EDOOFUS = 0x80020058; -constexpr int SCE_KERNEL_ERROR_EBADMSG = 0x80020059; -constexpr int SCE_KERNEL_ERROR_EMULTIHOP = 0x8002005A; -constexpr int SCE_KERNEL_ERROR_ENOLINK = 0x8002005B; -constexpr int SCE_KERNEL_ERROR_EPROTO = 0x8002005C; -constexpr int SCE_KERNEL_ERROR_ENOTCAPABLE = 0x8002005D; -constexpr int SCE_KERNEL_ERROR_ECAPMODE = 0x8002005E; -constexpr int SCE_KERNEL_ERROR_ENOBLK = 0x8002005F; -constexpr int SCE_KERNEL_ERROR_EICV = 0x80020060; -constexpr int SCE_KERNEL_ERROR_ENOPLAYGOENT = 0x80020061; -constexpr int SCE_KERNEL_ERROR_EREVOKE = 0x80020062; -constexpr int SCE_KERNEL_ERROR_ESDKVERSION = 0x80020063; -constexpr int SCE_KERNEL_ERROR_ESTART = 0x80020064; -constexpr int SCE_KERNEL_ERROR_ESTOP = 0x80020065; - -// videoOut -constexpr int SCE_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; // invalid argument -constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; // invalid addresses -constexpr int SCE_VIDEO_OUT_ERROR_INVALID_TILING_MODE = 0x80290007; // invalid tiling mode -constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO = 0x80290008; // invalid aspect ration -constexpr int SCE_VIDEO_OUT_ERROR_RESOURCE_BUSY = 0x80290009; // already opened -constexpr int SCE_VIDEO_OUT_ERROR_INVALID_INDEX = 0x8029000A; // invalid buffer index -constexpr int SCE_VIDEO_OUT_ERROR_INVALID_HANDLE = 0x8029000B; // invalid handle -constexpr int SCE_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE = 0x8029000C; // Invalid event queue -constexpr int SCE_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010; // slot already used -constexpr int SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; // flip queue is full -constexpr int SCE_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; // Invalid buffer attribute option - // Generic constexpr int ORBIS_OK = 0x00000000; constexpr int ORBIS_FAIL = 0xFFFFFFFF; - -// Libkernel library -constexpr int ORBIS_KERNEL_ERROR_UNKNOWN = 0x80020000; -constexpr int ORBIS_KERNEL_ERROR_EPERM = 0x80020001; -constexpr int ORBIS_KERNEL_ERROR_ENOENT = 0x80020002; -constexpr int ORBIS_KERNEL_ERROR_ESRCH = 0x80020003; -constexpr int ORBIS_KERNEL_ERROR_EINTR = 0x80020004; -constexpr int ORBIS_KERNEL_ERROR_EIO = 0x80020005; -constexpr int ORBIS_KERNEL_ERROR_ENXIO = 0x80020006; -constexpr int ORBIS_KERNEL_ERROR_E2BIG = 0x80020007; -constexpr int ORBIS_KERNEL_ERROR_ENOEXEC = 0x80020008; -constexpr int ORBIS_KERNEL_ERROR_EBADF = 0x80020009; -constexpr int ORBIS_KERNEL_ERROR_ECHILD = 0x8002000A; -constexpr int ORBIS_KERNEL_ERROR_EDEADLK = 0x8002000B; -constexpr int ORBIS_KERNEL_ERROR_ENOMEM = 0x8002000C; -constexpr int ORBIS_KERNEL_ERROR_EACCES = 0x8002000D; -constexpr int ORBIS_KERNEL_ERROR_EFAULT = 0x8002000E; -constexpr int ORBIS_KERNEL_ERROR_ENOTBLK = 0x8002000F; -constexpr int ORBIS_KERNEL_ERROR_EBUSY = 0x80020010; -constexpr int ORBIS_KERNEL_ERROR_EEXIST = 0x80020011; -constexpr int ORBIS_KERNEL_ERROR_EXDEV = 0x80020012; -constexpr int ORBIS_KERNEL_ERROR_ENODEV = 0x80020013; -constexpr int ORBIS_KERNEL_ERROR_ENOTDIR = 0x80020014; -constexpr int ORBIS_KERNEL_ERROR_EISDIR = 0x80020015; -constexpr int ORBIS_KERNEL_ERROR_EINVAL = 0x80020016; -constexpr int ORBIS_KERNEL_ERROR_ENFILE = 0x80020017; -constexpr int ORBIS_KERNEL_ERROR_EMFILE = 0x80020018; -constexpr int ORBIS_KERNEL_ERROR_ENOTTY = 0x80020019; -constexpr int ORBIS_KERNEL_ERROR_ETXTBSY = 0x8002001A; -constexpr int ORBIS_KERNEL_ERROR_EFBIG = 0x8002001B; -constexpr int ORBIS_KERNEL_ERROR_ENOSPC = 0x8002001C; -constexpr int ORBIS_KERNEL_ERROR_ESPIPE = 0x8002001D; -constexpr int ORBIS_KERNEL_ERROR_EROFS = 0x8002001E; -constexpr int ORBIS_KERNEL_ERROR_EMLINK = 0x8002001F; -constexpr int ORBIS_KERNEL_ERROR_EPIPE = 0x80020020; -constexpr int ORBIS_KERNEL_ERROR_EDOM = 0x80020021; -constexpr int ORBIS_KERNEL_ERROR_ERANGE = 0x80020022; -constexpr int ORBIS_KERNEL_ERROR_EAGAIN = 0x80020023; -constexpr int ORBIS_KERNEL_ERROR_EWOULDBLOCK = 0x80020023; -constexpr int ORBIS_KERNEL_ERROR_EINPROGRESS = 0x80020024; -constexpr int ORBIS_KERNEL_ERROR_EALREADY = 0x80020025; -constexpr int ORBIS_KERNEL_ERROR_ENOTSOCK = 0x80020026; -constexpr int ORBIS_KERNEL_ERROR_EDESTADDRREQ = 0x80020027; -constexpr int ORBIS_KERNEL_ERROR_EMSGSIZE = 0x80020028; -constexpr int ORBIS_KERNEL_ERROR_EPROTOTYPE = 0x80020029; -constexpr int ORBIS_KERNEL_ERROR_ENOPROTOOPT = 0x8002002A; -constexpr int ORBIS_KERNEL_ERROR_EPROTONOSUPPORT = 0x8002002B; -constexpr int ORBIS_KERNEL_ERROR_ESOCKTNOSUPPORT = 0x8002002C; -constexpr int ORBIS_KERNEL_ERROR_ENOTSUP = 0x8002002D; -constexpr int ORBIS_KERNEL_ERROR_EOPNOTSUPP = 0x8002002D; -constexpr int ORBIS_KERNEL_ERROR_EPFNOSUPPORT = 0x8002002E; -constexpr int ORBIS_KERNEL_ERROR_EAFNOSUPPORT = 0x8002002F; -constexpr int ORBIS_KERNEL_ERROR_EADDRINUSE = 0x80020030; -constexpr int ORBIS_KERNEL_ERROR_EADDRNOTAVAIL = 0x80020031; -constexpr int ORBIS_KERNEL_ERROR_ENETDOWN = 0x80020032; -constexpr int ORBIS_KERNEL_ERROR_ENETUNREACH = 0x80020033; -constexpr int ORBIS_KERNEL_ERROR_ENETRESET = 0x80020034; -constexpr int ORBIS_KERNEL_ERROR_ECONNABORTED = 0x80020035; -constexpr int ORBIS_KERNEL_ERROR_ECONNRESET = 0x80020036; -constexpr int ORBIS_KERNEL_ERROR_ENOBUFS = 0x80020037; -constexpr int ORBIS_KERNEL_ERROR_EISCONN = 0x80020038; -constexpr int ORBIS_KERNEL_ERROR_ENOTCONN = 0x80020039; -constexpr int ORBIS_KERNEL_ERROR_ESHUTDOWN = 0x8002003A; -constexpr int ORBIS_KERNEL_ERROR_ETOOMANYREFS = 0x8002003B; -constexpr int ORBIS_KERNEL_ERROR_ETIMEDOUT = 0x8002003C; -constexpr int ORBIS_KERNEL_ERROR_ECONNREFUSED = 0x8002003D; -constexpr int ORBIS_KERNEL_ERROR_ELOOP = 0x8002003E; -constexpr int ORBIS_KERNEL_ERROR_ENAMETOOLONG = 0x8002003F; -constexpr int ORBIS_KERNEL_ERROR_EHOSTDOWN = 0x80020040; -constexpr int ORBIS_KERNEL_ERROR_EHOSTUNREACH = 0x80020041; -constexpr int ORBIS_KERNEL_ERROR_ENOTEMPTY = 0x80020042; -constexpr int ORBIS_KERNEL_ERROR_EPROCLIM = 0x80020043; -constexpr int ORBIS_KERNEL_ERROR_EUSERS = 0x80020044; -constexpr int ORBIS_KERNEL_ERROR_EDQUOT = 0x80020045; -constexpr int ORBIS_KERNEL_ERROR_ESTALE = 0x80020046; -constexpr int ORBIS_KERNEL_ERROR_EREMOTE = 0x80020047; -constexpr int ORBIS_KERNEL_ERROR_EBADRPC = 0x80020048; -constexpr int ORBIS_KERNEL_ERROR_ERPCMISMATCH = 0x80020049; -constexpr int ORBIS_KERNEL_ERROR_EPROGUNAVAIL = 0x8002004A; -constexpr int ORBIS_KERNEL_ERROR_EPROGMISMATCH = 0x8002004B; -constexpr int ORBIS_KERNEL_ERROR_EPROCUNAVAIL = 0x8002004C; -constexpr int ORBIS_KERNEL_ERROR_ENOLCK = 0x8002004D; -constexpr int ORBIS_KERNEL_ERROR_ENOSYS = 0x8002004E; -constexpr int ORBIS_KERNEL_ERROR_EFTYPE = 0x8002004F; -constexpr int ORBIS_KERNEL_ERROR_EAUTH = 0x80020050; -constexpr int ORBIS_KERNEL_ERROR_ENEEDAUTH = 0x80020051; -constexpr int ORBIS_KERNEL_ERROR_EIDRM = 0x80020052; -constexpr int ORBIS_KERNEL_ERROR_ENOMSG = 0x80020053; -constexpr int ORBIS_KERNEL_ERROR_EOVERFLOW = 0x80020054; -constexpr int ORBIS_KERNEL_ERROR_ECANCELED = 0x80020055; -constexpr int ORBIS_KERNEL_ERROR_EILSEQ = 0x80020056; -constexpr int ORBIS_KERNEL_ERROR_ENOATTR = 0x80020057; -constexpr int ORBIS_KERNEL_ERROR_EDOOFUS = 0x80020058; -constexpr int ORBIS_KERNEL_ERROR_EBADMSG = 0x80020059; -constexpr int ORBIS_KERNEL_ERROR_EMULTIHOP = 0x8002005A; -constexpr int ORBIS_KERNEL_ERROR_ENOLINK = 0x8002005B; -constexpr int ORBIS_KERNEL_ERROR_EPROTO = 0x8002005C; -constexpr int ORBIS_KERNEL_ERROR_ENOTCAPABLE = 0x8002005D; -constexpr int ORBIS_KERNEL_ERROR_ECAPMODE = 0x8002005E; -constexpr int ORBIS_KERNEL_ERROR_ENOBLK = 0x8002005F; -constexpr int ORBIS_KERNEL_ERROR_EICV = 0x80020060; -constexpr int ORBIS_KERNEL_ERROR_ENOPLAYGOENT = 0x80020061; - -// AudioOut library -constexpr int ORBIS_AUDIO_OUT_ERROR_NOT_OPENED = 0x80260001; -constexpr int ORBIS_AUDIO_OUT_ERROR_BUSY = 0x80260002; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PORT = 0x80260003; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_POINTER = 0x80260004; -constexpr int ORBIS_AUDIO_OUT_ERROR_PORT_FULL = 0x80260005; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_SIZE = 0x80260006; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_FORMAT = 0x80260007; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ = 0x80260008; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_VOLUME = 0x80260009; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PORT_TYPE = 0x8026000A; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_CONF_TYPE = 0x8026000C; -constexpr int ORBIS_AUDIO_OUT_ERROR_OUT_OF_MEMORY = 0x8026000D; -constexpr int ORBIS_AUDIO_OUT_ERROR_ALREADY_INIT = 0x8026000E; -constexpr int ORBIS_AUDIO_OUT_ERROR_NOT_INIT = 0x8026000F; -constexpr int ORBIS_AUDIO_OUT_ERROR_MEMORY = 0x80260010; -constexpr int ORBIS_AUDIO_OUT_ERROR_SYSTEM_RESOURCE = 0x80260011; -constexpr int ORBIS_AUDIO_OUT_ERROR_TRANS_EVENT = 0x80260012; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_FLAG = 0x80260013; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_MIXLEVEL = 0x80260014; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_ARG = 0x80260015; -constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PARAM = 0x80260016; -constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_FATAL = 0x80260200; -constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_API_PARAM = 0x80260201; -constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_CONFIG = 0x80260202; -constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_NOT_INITIALIZED = 0x80260203; -constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_STATES_ID = 0x80260204; - -// VideoOut library -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_PIXEL_FORMAT = 0x80290003; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_PITCH = 0x80290004; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_RESOLUTION = 0x80290005; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_FLIP_MODE = 0x80290006; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_TILING_MODE = 0x80290007; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO = 0x80290008; -constexpr int ORBIS_VIDEO_OUT_ERROR_RESOURCE_BUSY = 0x80290009; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_INDEX = 0x8029000A; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE = 0x8029000B; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE = 0x8029000C; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT = 0x8029000D; -constexpr int ORBIS_VIDEO_OUT_ERROR_NO_EMPTY_SLOT = 0x8029000F; -constexpr int ORBIS_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010; -constexpr int ORBIS_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_MEMORY = 0x80290013; -constexpr int ORBIS_VIDEO_OUT_ERROR_MEMORY_NOT_PHYSICALLY_CONTIGUOUS = 0x80290014; -constexpr int ORBIS_VIDEO_OUT_ERROR_MEMORY_INVALID_ALIGNMENT = 0x80290015; -constexpr int ORBIS_VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE = 0x80290016; -constexpr int ORBIS_VIDEO_OUT_ERROR_OVERFLOW = 0x80290017; -constexpr int ORBIS_VIDEO_OUT_ERROR_NO_DEVICE = 0x80290018; -constexpr int ORBIS_VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE = 0x80290019; -constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; -constexpr int ORBIS_VIDEO_OUT_ERROR_UNKNOWN = 0x802900FE; -constexpr int ORBIS_VIDEO_OUT_ERROR_FATAL = 0x802900FF; -constexpr int ORBIS_VIDEO_OUT_ERROR_ENOMEM = 0x8029100C; - -// Pad library -constexpr int ORBIS_PAD_ERROR_INVALID_ARG = 0x80920001; -constexpr int ORBIS_PAD_ERROR_INVALID_PORT = 0x80920002; -constexpr int ORBIS_PAD_ERROR_INVALID_HANDLE = 0x80920003; -constexpr int ORBIS_PAD_ERROR_ALREADY_OPENED = 0x80920004; -constexpr int ORBIS_PAD_ERROR_NOT_INITIALIZED = 0x80920005; -constexpr int ORBIS_PAD_ERROR_INVALID_LIGHTBAR_SETTING = 0x80920006; -constexpr int ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED = 0x80920007; -constexpr int ORBIS_PAD_ERROR_DEVICE_NO_HANDLE = 0x80920008; -constexpr int ORBIS_PAD_ERROR_FATAL = 0x809200FF; -constexpr int ORBIS_PAD_ERROR_NOT_PERMITTED = 0x80920101; -constexpr int ORBIS_PAD_ERROR_INVALID_BUFFER_LENGTH = 0x80920102; -constexpr int ORBIS_PAD_ERROR_INVALID_REPORT_LENGTH = 0x80920103; -constexpr int ORBIS_PAD_ERROR_INVALID_REPORT_ID = 0x80920104; -constexpr int ORBIS_PAD_ERROR_SEND_AGAIN = 0x80920105; - -// UserService library -constexpr int ORBIS_USER_SERVICE_ERROR_INTERNAL = 0x80960001; -constexpr int ORBIS_USER_SERVICE_ERROR_NOT_INITIALIZED = 0x80960002; -constexpr int ORBIS_USER_SERVICE_ERROR_ALREADY_INITIALIZED = 0x80960003; -constexpr int ORBIS_USER_SERVICE_ERROR_NO_MEMORY = 0x80960004; -constexpr int ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT = 0x80960005; -constexpr int ORBIS_USER_SERVICE_ERROR_OPERATION_NOT_SUPPORTED = 0x80960006; -constexpr int ORBIS_USER_SERVICE_ERROR_NO_EVENT = 0x80960007; -constexpr int ORBIS_USER_SERVICE_ERROR_NOT_LOGGED_IN = 0x80960009; -constexpr int ORBIS_USER_SERVICE_ERROR_BUFFER_TOO_SHORT = 0x8096000A; - -// SystemService library -constexpr int ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER = 0x80A10003; -constexpr int ORBIS_SYSTEM_SERVICE_ERROR_NO_EVENT = 0x80A10004; - -// NpTrophy library -constexpr int ORBIS_NP_TROPHY_ERROR_UNKNOWN = 0x80551600; -constexpr int ORBIS_NP_TROPHY_ERROR_NOT_INITIALIZED = 0x80551601; -constexpr int ORBIS_NP_TROPHY_ERROR_ALREADY_INITIALIZED = 0x80551602; -constexpr int ORBIS_NP_TROPHY_ERROR_OUT_OF_MEMORY = 0x80551603; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_ARGUMENT = 0x80551604; -constexpr int ORBIS_NP_TROPHY_ERROR_INSUFFICIENT_BUFFER = 0x80551605; -constexpr int ORBIS_NP_TROPHY_ERROR_EXCEEDS_MAX = 0x80551606; -constexpr int ORBIS_NP_TROPHY_ERROR_ABORT = 0x80551607; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_HANDLE = 0x80551608; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_CONTEXT = 0x80551609; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TROPHY_ID = 0x8055160A; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_GROUP_ID = 0x8055160B; -constexpr int ORBIS_NP_TROPHY_ERROR_TROPHY_ALREADY_UNLOCKED = 0x8055160C; -constexpr int ORBIS_NP_TROPHY_ERROR_PLATINUM_CANNOT_UNLOCK = 0x8055160D; -constexpr int ORBIS_NP_TROPHY_ERROR_ACCOUNTID_NOT_MATCH = 0x8055160E; -constexpr int ORBIS_NP_TROPHY_ERROR_NOT_REGISTERED = 0x8055160F; -constexpr int ORBIS_NP_TROPHY_ERROR_ALREADY_REGISTERED = 0x80551610; -constexpr int ORBIS_NP_TROPHY_ERROR_BROKEN_DATA = 0x80551611; -constexpr int ORBIS_NP_TROPHY_ERROR_INSUFFICIENT_SPACE = 0x80551612; -constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_ALREADY_EXISTS = 0x80551613; -constexpr int ORBIS_NP_TROPHY_ERROR_ICON_FILE_NOT_FOUND = 0x80551614; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TRP_FILE_FORMAT = 0x80551616; -constexpr int ORBIS_NP_TROPHY_ERROR_UNSUPPORTED_TRP_FILE = 0x80551617; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TROPHY_CONF_FORMAT = 0x80551618; -constexpr int ORBIS_NP_TROPHY_ERROR_UNSUPPORTED_TROPHY_CONF = 0x80551619; -constexpr int ORBIS_NP_TROPHY_ERROR_TROPHY_NOT_UNLOCKED = 0x8055161A; -constexpr int ORBIS_NP_TROPHY_ERROR_USER_NOT_FOUND = 0x8055161C; -constexpr int ORBIS_NP_TROPHY_ERROR_USER_NOT_LOGGED_IN = 0x8055161D; -constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_USER_LOGOUT = 0x8055161E; -constexpr int ORBIS_NP_TROPHY_ERROR_USE_TRP_FOR_DEVELOPMENT = 0x8055161F; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_NP_SERVICE_LABEL = 0x80551621; -constexpr int ORBIS_NP_TROPHY_ERROR_NOT_SUPPORTED = 0x80551622; -constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_EXCEEDS_MAX = 0x80551623; -constexpr int ORBIS_NP_TROPHY_ERROR_HANDLE_EXCEEDS_MAX = 0x80551624; -constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_USER_ID = 0x80551625; -constexpr int ORBIS_NP_TROPHY_ERROR_TITLE_CONF_NOT_INSTALLED = 0x80551626; -constexpr int ORBIS_NP_TROPHY_ERROR_BROKEN_TITLE_CONF = 0x80551627; -constexpr int ORBIS_NP_TROPHY_ERROR_INCONSISTENT_TITLE_CONF = 0x80551628; -constexpr int ORBIS_NP_TROPHY_ERROR_TITLE_BACKGROUND = 0x80551629; -constexpr int ORBIS_NP_TROPHY_ERROR_SCREENSHOT_DISABLED = 0x8055162B; -constexpr int ORBIS_NP_TROPHY_ERROR_SCREENSHOT_DISPLAY_BUFFER_NOT_IN_USE = 0x8055162D; - -// AvPlayer library -constexpr int ORBIS_AVPLAYER_ERROR_INVALID_PARAMS = 0x806A0001; -constexpr int ORBIS_AVPLAYER_ERROR_OPERATION_FAILED = 0x806A0002; -constexpr int ORBIS_AVPLAYER_ERROR_NO_MEMORY = 0x806A0003; -constexpr int ORBIS_AVPLAYER_ERROR_NOT_SUPPORTED = 0x806A0004; -constexpr int ORBIS_AVPLAYER_ERROR_WAR_FILE_NONINTERLEAVED = 0x806A00A0; -constexpr int ORBIS_AVPLAYER_ERROR_WAR_LOOPING_BACK = 0x806A00A1; -constexpr int ORBIS_AVPLAYER_ERROR_WAR_JUMP_COMPLETE = 0x806A00A3; -constexpr int ORBIS_AVPLAYER_ERROR_INFO_MARLIN_ENCRY = 0x806A00B0; -constexpr int ORBIS_AVPLAYER_ERROR_INFO_PLAYREADY_ENCRY = 0x806A00B4; -constexpr int ORBIS_AVPLAYER_ERROR_INFO_AES_ENCRY = 0x806A00B5; -constexpr int ORBIS_AVPLAYER_ERROR_INFO_OTHER_ENCRY = 0x806A00BF; - -// AppContent library -constexpr int ORBIS_APP_CONTENT_ERROR_PARAMETER = 0x80D90002; -constexpr int ORBIS_APP_CONTENT_ERROR_DRM_NO_ENTITLEMENT = 0x80D90007; -constexpr int ORBIS_APP_CONTENT_ERROR_NOT_FOUND = 0x80D90005; - -// Fiber library -constexpr int ORBIS_FIBER_ERROR_NULL = 0x80590001; -constexpr int ORBIS_FIBER_ERROR_ALIGNMENT = 0x80590002; -constexpr int ORBIS_FIBER_ERROR_RANGE = 0x80590003; -constexpr int ORBIS_FIBER_ERROR_INVALID = 0x80590004; -constexpr int ORBIS_FIBER_ERROR_PERMISSION = 0x80590005; -constexpr int ORBIS_FIBER_ERROR_STATE = 0x80590006; - -// ImeDialog library -constexpr int ORBIS_ERROR_DIALOG_ERROR_NOT_INITIALIZED = 0x80ED0001; -constexpr int ORBIS_ERROR_DIALOG_ERROR_ALREADY_INITIALIZED = 0x80ED0002; -constexpr int ORBIS_ERROR_DIALOG_ERROR_PARAM_INVALID = 0x80ED0003; -constexpr int ORBIS_ERROR_DIALOG_ERROR_UNEXPECTED_FATAL = 0x80ED0004; -constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_STATE = 0x80ED0005; -constexpr int ORBIS_ERROR_DIALOG_ERROR_SERVICE_BUSY = 0x80ED0006; -constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_USER_ID = 0x80ED0007; - -// Ime library -constexpr int ORBIS_IME_ERROR_BUSY = 0x80BC0001; -constexpr int ORBIS_IME_ERROR_NOT_OPENED = 0x80BC0002; -constexpr int ORBIS_IME_ERROR_NO_MEMORY = 0x80BC0003; -constexpr int ORBIS_IME_ERROR_CONNECTION_FAILED = 0x80BC0004; -constexpr int ORBIS_IME_ERROR_TOO_MANY_REQUESTS = 0x80BC0005; -constexpr int ORBIS_IME_ERROR_INVALID_TEXT = 0x80BC0006; -constexpr int ORBIS_IME_ERROR_EVENT_OVERFLOW = 0x80BC0007; -constexpr int ORBIS_IME_ERROR_NOT_ACTIVE = 0x80BC0008; -constexpr int ORBIS_IME_ERROR_IME_SUSPENDING = 0x80BC0009; -constexpr int ORBIS_IME_ERROR_DEVICE_IN_USE = 0x80BC000A; -constexpr int ORBIS_IME_ERROR_INVALID_USER_ID = 0x80BC0010; -constexpr int ORBIS_IME_ERROR_INVALID_TYPE = 0x80BC0011; -constexpr int ORBIS_IME_ERROR_INVALID_SUPPORTED_LANGUAGES = 0x80BC0012; -constexpr int ORBIS_IME_ERROR_INVALID_ENTER_LABEL = 0x80BC0013; -constexpr int ORBIS_IME_ERROR_INVALID_INPUT_METHOD = 0x80BC0014; -constexpr int ORBIS_IME_ERROR_INVALID_OPTION = 0x80BC0015; -constexpr int ORBIS_IME_ERROR_INVALID_MAX_TEXT_LENGTH = 0x80BC0016; -constexpr int ORBIS_IME_ERROR_INVALID_INPUT_TEXT_BUFFER = 0x80BC0017; -constexpr int ORBIS_IME_ERROR_INVALID_POSX = 0x80BC0018; -constexpr int ORBIS_IME_ERROR_INVALID_POSY = 0x80BC0019; -constexpr int ORBIS_IME_ERROR_INVALID_HORIZONTAL_ALIGNMENT = 0x80BC001A; -constexpr int ORBIS_IME_ERROR_INVALID_VERTICAL_ALIGNMENT = 0x80BC001B; -constexpr int ORBIS_IME_ERROR_INVALID_EXTENDED = 0x80BC001C; -constexpr int ORBIS_IME_ERROR_INVALID_KEYBOARD_TYPE = 0x80BC001D; -constexpr int ORBIS_IME_ERROR_INVALID_WORK = 0x80BC0020; -constexpr int ORBIS_IME_ERROR_INVALID_ARG = 0x80BC0021; -constexpr int ORBIS_IME_ERROR_INVALID_HANDLER = 0x80BC0022; -constexpr int ORBIS_IME_ERROR_NO_RESOURCE_ID = 0x80BC0023; -constexpr int ORBIS_IME_ERROR_INVALID_MODE = 0x80BC0024; -constexpr int ORBIS_IME_ERROR_INVALID_PARAM = 0x80BC0030; -constexpr int ORBIS_IME_ERROR_INVALID_ADDRESS = 0x80BC0031; -constexpr int ORBIS_IME_ERROR_INVALID_RESERVED = 0x80BC0032; -constexpr int ORBIS_IME_ERROR_INVALID_TIMING = 0x80BC0033; -constexpr int ORBIS_IME_ERROR_INTERNAL = 0x80BC00FF; - -// Videodec2 library -constexpr int ORBIS_VIDEODEC2_ERROR_API_FAIL = 0x811D0100; -constexpr int ORBIS_VIDEODEC2_ERROR_STRUCT_SIZE = 0x811D0101; -constexpr int ORBIS_VIDEODEC2_ERROR_ARGUMENT_POINTER = 0x811D0102; -constexpr int ORBIS_VIDEODEC2_ERROR_DECODER_INSTANCE = 0x811D0103; -constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_SIZE = 0x811D0104; -constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_POINTER = 0x811D0105; -constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_SIZE = 0x811D0106; -constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_POINTER = 0x811D0107; -constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_ALIGNMENT = 0x811D0108; -constexpr int ORBIS_VIDEODEC2_ERROR_NOT_ONION_MEMORY = 0x811D0109; -constexpr int ORBIS_VIDEODEC2_ERROR_NOT_GARLIC_MEMORY = 0x811D010A; -constexpr int ORBIS_VIDEODEC2_ERROR_NOT_DIRECT_MEMORY = 0x811D010B; -constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_INFO = 0x811D010C; -constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT_SIZE = 0x811D010D; -constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT_POINTER = 0x811D010E; -constexpr int ORBIS_VIDEODEC2_ERROR_OUTPUT_INFO = 0x811D010F; -constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_QUEUE = 0x811D0110; -constexpr int ORBIS_VIDEODEC2_ERROR_FATAL_STATE = 0x811D0111; -constexpr int ORBIS_VIDEODEC2_ERROR_PRESET_VALUE = 0x811D0112; -constexpr int ORBIS_VIDEODEC2_ERROR_CONFIG_INFO = 0x811D0200; -constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_PIPE_ID = 0x811D0201; -constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_QUEUE_ID = 0x811D0202; -constexpr int ORBIS_VIDEODEC2_ERROR_RESOURCE_TYPE = 0x811D0203; -constexpr int ORBIS_VIDEODEC2_ERROR_CODEC_TYPE = 0x811D0204; -constexpr int ORBIS_VIDEODEC2_ERROR_PROFILE_LEVEL = 0x811D0205; -constexpr int ORBIS_VIDEODEC2_ERROR_PIPELINE_DEPTH = 0x811D0206; -constexpr int ORBIS_VIDEODEC2_ERROR_AFFINITY_MASK = 0x811D0207; -constexpr int ORBIS_VIDEODEC2_ERROR_THREAD_PRIORITY = 0x811D0208; -constexpr int ORBIS_VIDEODEC2_ERROR_DPB_FRAME_COUNT = 0x811D0209; -constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_WIDTH_HEIGHT = 0x811D020A; -constexpr int ORBIS_VIDEODEC2_ERROR_EXTRA_CONFIG_INFO = 0x811D020B; -constexpr int ORBIS_VIDEODEC2_ERROR_NEW_SEQUENCE = 0x811D0300; -constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT = 0x811D0301; -constexpr int ORBIS_VIDEODEC2_ERROR_OVERSIZE_DECODE = 0x811D0302; -constexpr int ORBIS_VIDEODEC2_ERROR_INVALID_SEQUENCE = 0x811D0303; -constexpr int ORBIS_VIDEODEC2_ERROR_FATAL_STREAM = 0x811D0304; - -// Videodec library -constexpr int ORBIS_VIDEODEC_ERROR_API_FAIL = 0x80C10000; -constexpr int ORBIS_VIDEODEC_ERROR_CODEC_TYPE = 0x80C10001; -constexpr int ORBIS_VIDEODEC_ERROR_STRUCT_SIZE = 0x80C10002; -constexpr int ORBIS_VIDEODEC_ERROR_HANDLE = 0x80C10003; -constexpr int ORBIS_VIDEODEC_ERROR_CPU_MEMORY_SIZE = 0x80C10004; -constexpr int ORBIS_VIDEODEC_ERROR_CPU_MEMORY_POINTER = 0x80C10005; -constexpr int ORBIS_VIDEODEC_ERROR_CPU_GPU_MEMORY_SIZE = 0x80C10006; -constexpr int ORBIS_VIDEODEC_ERROR_CPU_GPU_MEMORY_POINTER = 0x80C10007; -constexpr int ORBIS_VIDEODEC_ERROR_SHADER_CONTEXT_POINTER = 0x80C10008; -constexpr int ORBIS_VIDEODEC_ERROR_AU_SIZE = 0x80C10009; -constexpr int ORBIS_VIDEODEC_ERROR_AU_POINTER = 0x80C1000A; -constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_SIZE = 0x80C1000B; -constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_POINTER = 0x80C1000C; -constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_ALIGNMENT = 0x80C1000D; -constexpr int ORBIS_VIDEODEC_ERROR_CONFIG_INFO = 0x80C1000E; -constexpr int ORBIS_VIDEODEC_ERROR_ARGUMENT_POINTER = 0x80C1000F; -constexpr int ORBIS_VIDEODEC_ERROR_NEW_SEQUENCE = 0x80C10010; -constexpr int ORBIS_VIDEODEC_ERROR_DECODE_AU = 0x80C10011; -constexpr int ORBIS_VIDEODEC_ERROR_MISMATCH_SPEC = 0x80C10012; -constexpr int ORBIS_VIDEODEC_ERROR_INVALID_SEQUENCE = 0x80C10013; -constexpr int ORBIS_VIDEODEC_ERROR_FATAL_STREAM = 0x80C10014; -constexpr int ORBIS_VIDEODEC_ERROR_FATAL_STATE = 0x80C10015; - -// PngDec library -constexpr int ORBIS_PNG_DEC_ERROR_INVALID_ADDR = 0x80690001; -constexpr int ORBIS_PNG_DEC_ERROR_INVALID_SIZE = 0x80690002; -constexpr int ORBIS_PNG_DEC_ERROR_INVALID_PARAM = 0x80690003; -constexpr int ORBIS_PNG_DEC_ERROR_INVALID_HANDLE = 0x80690004; -constexpr int ORBIS_PNG_DEC_ERROR_INVALID_WORK_MEMORY = 0x80690005; -constexpr int ORBIS_PNG_DEC_ERROR_INVALID_DATA = 0x80690010; -constexpr int ORBIS_PNG_DEC_ERROR_UNSUPPORT_DATA = 0x80690011; -constexpr int ORBIS_PNG_DEC_ERROR_DECODE_ERROR = 0x80690012; -constexpr int ORBIS_PNG_DEC_ERROR_FATAL = 0x80690020; \ No newline at end of file diff --git a/src/core/libraries/fiber/fiber.cpp b/src/core/libraries/fiber/fiber.cpp index 92bf894b5..c28d8d734 100644 --- a/src/core/libraries/fiber/fiber.cpp +++ b/src/core/libraries/fiber/fiber.cpp @@ -4,7 +4,7 @@ #include "fiber.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/fiber/fiber_error.h" #include "core/libraries/libs.h" #include "core/tls.h" diff --git a/src/core/libraries/fiber/fiber_error.h b/src/core/libraries/fiber/fiber_error.h new file mode 100644 index 000000000..c89fe30b1 --- /dev/null +++ b/src/core/libraries/fiber/fiber_error.h @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// Fiber library +constexpr int ORBIS_FIBER_ERROR_NULL = 0x80590001; +constexpr int ORBIS_FIBER_ERROR_ALIGNMENT = 0x80590002; +constexpr int ORBIS_FIBER_ERROR_RANGE = 0x80590003; +constexpr int ORBIS_FIBER_ERROR_INVALID = 0x80590004; +constexpr int ORBIS_FIBER_ERROR_PERMISSION = 0x80590005; +constexpr int ORBIS_FIBER_ERROR_STATE = 0x80590006; diff --git a/src/core/libraries/gnmdriver/gnm_error.h b/src/core/libraries/gnmdriver/gnm_error.h index eab684a24..b8e57f6f5 100644 --- a/src/core/libraries/gnmdriver/gnm_error.h +++ b/src/core/libraries/gnmdriver/gnm_error.h @@ -3,6 +3,8 @@ #pragma once +#include "core/libraries/error_codes.h" + constexpr int ORBIS_GNM_ERROR_SUBMISSION_FAILED_INVALID_ARGUMENT = 0x80D11000; constexpr int ORBIS_GNM_ERROR_SUBMISSION_NOT_ENOUGH_RESOURCES = 0x80D11001; constexpr int ORBIS_GNM_ERROR_SUBMISSION_AND_FLIP_FAILED_INVALID_COMMAND_BUFFER = 0x80D11080; diff --git a/src/core/libraries/gnmdriver/gnmdriver.cpp b/src/core/libraries/gnmdriver/gnmdriver.cpp index 70cf09a97..10d121afe 100644 --- a/src/core/libraries/gnmdriver/gnmdriver.cpp +++ b/src/core/libraries/gnmdriver/gnmdriver.cpp @@ -11,7 +11,8 @@ #include "common/slot_vector.h" #include "core/address_space.h" #include "core/debug_state.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/gnmdriver/gnm_error.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/kernel/process.h" #include "core/libraries/libs.h" #include "core/libraries/videoout/video_out.h" diff --git a/src/core/libraries/ime/ime.cpp b/src/core/libraries/ime/ime.cpp index efb988c72..d4c6d16a3 100644 --- a/src/core/libraries/ime/ime.cpp +++ b/src/core/libraries/ime/ime.cpp @@ -2,14 +2,12 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include -#include "ime.h" -#include "ime_ui.h" - #include "common/logging/log.h" -#include "common/singleton.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/ime/ime.h" +#include "core/libraries/ime/ime_error.h" +#include "core/libraries/ime/ime_ui.h" #include "core/libraries/libs.h" -#include "core/linker.h" +#include "core/tls.h" namespace Libraries::Ime { diff --git a/src/core/libraries/ime/ime_dialog.cpp b/src/core/libraries/ime/ime_dialog.cpp index 63b52706a..8922a06f8 100644 --- a/src/core/libraries/ime/ime_dialog.cpp +++ b/src/core/libraries/ime/ime_dialog.cpp @@ -4,7 +4,7 @@ #include #include #include "common/logging/log.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/ime/ime_error.h" #include "core/libraries/libs.h" #include "ime_dialog.h" #include "ime_dialog_ui.h" @@ -274,4 +274,4 @@ void RegisterlibSceImeDialog(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("gyTyVn+bXMw", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, sceImeDialogTerm); }; -} // namespace Libraries::ImeDialog \ No newline at end of file +} // namespace Libraries::ImeDialog diff --git a/src/core/libraries/ime/ime_error.h b/src/core/libraries/ime/ime_error.h new file mode 100644 index 000000000..77eeada39 --- /dev/null +++ b/src/core/libraries/ime/ime_error.h @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// ImeDialog library +constexpr int ORBIS_ERROR_DIALOG_ERROR_NOT_INITIALIZED = 0x80ED0001; +constexpr int ORBIS_ERROR_DIALOG_ERROR_ALREADY_INITIALIZED = 0x80ED0002; +constexpr int ORBIS_ERROR_DIALOG_ERROR_PARAM_INVALID = 0x80ED0003; +constexpr int ORBIS_ERROR_DIALOG_ERROR_UNEXPECTED_FATAL = 0x80ED0004; +constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_STATE = 0x80ED0005; +constexpr int ORBIS_ERROR_DIALOG_ERROR_SERVICE_BUSY = 0x80ED0006; +constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_USER_ID = 0x80ED0007; + +// Ime library +constexpr int ORBIS_IME_ERROR_BUSY = 0x80BC0001; +constexpr int ORBIS_IME_ERROR_NOT_OPENED = 0x80BC0002; +constexpr int ORBIS_IME_ERROR_NO_MEMORY = 0x80BC0003; +constexpr int ORBIS_IME_ERROR_CONNECTION_FAILED = 0x80BC0004; +constexpr int ORBIS_IME_ERROR_TOO_MANY_REQUESTS = 0x80BC0005; +constexpr int ORBIS_IME_ERROR_INVALID_TEXT = 0x80BC0006; +constexpr int ORBIS_IME_ERROR_EVENT_OVERFLOW = 0x80BC0007; +constexpr int ORBIS_IME_ERROR_NOT_ACTIVE = 0x80BC0008; +constexpr int ORBIS_IME_ERROR_IME_SUSPENDING = 0x80BC0009; +constexpr int ORBIS_IME_ERROR_DEVICE_IN_USE = 0x80BC000A; +constexpr int ORBIS_IME_ERROR_INVALID_USER_ID = 0x80BC0010; +constexpr int ORBIS_IME_ERROR_INVALID_TYPE = 0x80BC0011; +constexpr int ORBIS_IME_ERROR_INVALID_SUPPORTED_LANGUAGES = 0x80BC0012; +constexpr int ORBIS_IME_ERROR_INVALID_ENTER_LABEL = 0x80BC0013; +constexpr int ORBIS_IME_ERROR_INVALID_INPUT_METHOD = 0x80BC0014; +constexpr int ORBIS_IME_ERROR_INVALID_OPTION = 0x80BC0015; +constexpr int ORBIS_IME_ERROR_INVALID_MAX_TEXT_LENGTH = 0x80BC0016; +constexpr int ORBIS_IME_ERROR_INVALID_INPUT_TEXT_BUFFER = 0x80BC0017; +constexpr int ORBIS_IME_ERROR_INVALID_POSX = 0x80BC0018; +constexpr int ORBIS_IME_ERROR_INVALID_POSY = 0x80BC0019; +constexpr int ORBIS_IME_ERROR_INVALID_HORIZONTAL_ALIGNMENT = 0x80BC001A; +constexpr int ORBIS_IME_ERROR_INVALID_VERTICAL_ALIGNMENT = 0x80BC001B; +constexpr int ORBIS_IME_ERROR_INVALID_EXTENDED = 0x80BC001C; +constexpr int ORBIS_IME_ERROR_INVALID_KEYBOARD_TYPE = 0x80BC001D; +constexpr int ORBIS_IME_ERROR_INVALID_WORK = 0x80BC0020; +constexpr int ORBIS_IME_ERROR_INVALID_ARG = 0x80BC0021; +constexpr int ORBIS_IME_ERROR_INVALID_HANDLER = 0x80BC0022; +constexpr int ORBIS_IME_ERROR_NO_RESOURCE_ID = 0x80BC0023; +constexpr int ORBIS_IME_ERROR_INVALID_MODE = 0x80BC0024; +constexpr int ORBIS_IME_ERROR_INVALID_PARAM = 0x80BC0030; +constexpr int ORBIS_IME_ERROR_INVALID_ADDRESS = 0x80BC0031; +constexpr int ORBIS_IME_ERROR_INVALID_RESERVED = 0x80BC0032; +constexpr int ORBIS_IME_ERROR_INVALID_TIMING = 0x80BC0033; +constexpr int ORBIS_IME_ERROR_INTERNAL = 0x80BC00FF; diff --git a/src/core/libraries/kernel/equeue.cpp b/src/core/libraries/kernel/equeue.cpp index d4f7eabaa..a2f4108b4 100644 --- a/src/core/libraries/kernel/equeue.cpp +++ b/src/core/libraries/kernel/equeue.cpp @@ -4,8 +4,8 @@ #include "common/assert.h" #include "common/debug.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/equeue.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/libs.h" namespace Libraries::Kernel { diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index d0ffa21ca..1b95e5270 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -6,8 +6,8 @@ #include "common/scope_exit.h" #include "common/singleton.h" #include "core/file_sys/fs.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/file_system.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/libs.h" #include "kernel.h" @@ -128,12 +128,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::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(); @@ -141,7 +141,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) { @@ -166,7 +166,7 @@ size_t PS4_SYSV_ABI sceKernelWrite(int d, const void* buf, size_t nbytes) { auto* h = Common::Singleton::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}; @@ -175,7 +175,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::Instance(); @@ -184,15 +184,15 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) { bool ro = false; const auto host_path = mnt->GetHostPath(path, &ro); if (host_path.empty()) { - return SCE_KERNEL_ERROR_EACCES; + return ORBIS_KERNEL_ERROR_EACCES; } if (ro) { - return SCE_KERNEL_ERROR_EROFS; + return ORBIS_KERNEL_ERROR_EROFS; } if (std::filesystem::is_directory(host_path)) { - return SCE_KERNEL_ERROR_EPERM; + return ORBIS_KERNEL_ERROR_EPERM; } auto* file = h->GetFile(host_path); @@ -201,7 +201,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) { @@ -231,7 +231,7 @@ s64 PS4_SYSV_ABI sceKernelLseek(int d, s64 offset, int whence) { std::scoped_lock lk{file->m_mutex}; if (!file->f.Seek(offset, origin)) { LOG_CRITICAL(Kernel_Fs, "sceKernelLseek: failed to seek"); - return SCE_KERNEL_ERROR_EINVAL; + return ORBIS_KERNEL_ERROR_EINVAL; } return file->f.Tell(); } @@ -257,7 +257,7 @@ s64 PS4_SYSV_ABI sceKernelRead(int d, void* buf, size_t nbytes) { auto* h = Common::Singleton::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}; @@ -277,7 +277,7 @@ 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::Instance(); @@ -285,21 +285,21 @@ int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) { const auto dir_name = mnt->GetHostPath(path, &ro); if (std::filesystem::exists(dir_name)) { - return SCE_KERNEL_ERROR_EEXIST; + return ORBIS_KERNEL_ERROR_EEXIST; } if (ro) { - return SCE_KERNEL_ERROR_EROFS; + return ORBIS_KERNEL_ERROR_EROFS; } // CUSA02456: path = /aotl after sceSaveDataMount(mode = 1) std::error_code ec; if (dir_name.empty() || !std::filesystem::create_directory(dir_name, ec)) { - 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; } @@ -323,13 +323,13 @@ int PS4_SYSV_ABI sceKernelRmdir(const char* path) { if (dir_name.empty()) { LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, permission denied", fmt::UTF(dir_name.u8string())); - return SCE_KERNEL_ERROR_EACCES; + return ORBIS_KERNEL_ERROR_EACCES; } if (ro) { LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, directory is read only", fmt::UTF(dir_name.u8string())); - return SCE_KERNEL_ERROR_EROFS; + return ORBIS_KERNEL_ERROR_EROFS; } if (!std::filesystem::is_directory(dir_name)) { @@ -411,7 +411,7 @@ int PS4_SYSV_ABI sceKernelCheckReachability(const char* path) { auto* mnt = Common::Singleton::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; } @@ -514,15 +514,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) { @@ -605,11 +605,11 @@ s32 PS4_SYSV_ABI sceKernelRename(const char* from, const char* to) { return ORBIS_KERNEL_ERROR_ENOENT; } if (ro) { - return SCE_KERNEL_ERROR_EROFS; + return ORBIS_KERNEL_ERROR_EROFS; } const auto dst_path = mnt->GetHostPath(to, &ro); if (ro) { - return SCE_KERNEL_ERROR_EROFS; + return ORBIS_KERNEL_ERROR_EROFS; } const bool src_is_dir = std::filesystem::is_directory(src_path); const bool dst_is_dir = std::filesystem::is_directory(dst_path); diff --git a/src/core/libraries/kernel/kernel.cpp b/src/core/libraries/kernel/kernel.cpp index 512e77bc6..de88a02e4 100644 --- a/src/core/libraries/kernel/kernel.cpp +++ b/src/core/libraries/kernel/kernel.cpp @@ -2,47 +2,34 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include - #include #include "common/assert.h" #include "common/debug.h" #include "common/logging/log.h" #include "common/polyfill_thread.h" -#include "common/singleton.h" #include "common/thread.h" -#include "core/file_sys/fs.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/equeue.h" #include "core/libraries/kernel/file_system.h" #include "core/libraries/kernel/kernel.h" #include "core/libraries/kernel/memory.h" +#include "core/libraries/kernel/orbis_error.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/process.h" #include "core/libraries/kernel/threads.h" #include "core/libraries/kernel/threads/exception.h" #include "core/libraries/kernel/time.h" #include "core/libraries/libs.h" -#include "core/linker.h" - -#ifdef _WIN64 -#include -#include -#include -#else -#ifdef __APPLE__ -#include -#endif -#endif namespace Libraries::Kernel { static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; // dummy return boost::asio::io_context io_context; -std::mutex m_asio_req; -std::condition_variable_any cv_asio_req; -std::atomic asio_requests; -std::jthread service_thread; +static std::mutex m_asio_req; +static std::condition_variable_any cv_asio_req; +static std::atomic asio_requests; +static std::jthread service_thread; void KernelSignalRequest() { std::unique_lock lock{m_asio_req}; @@ -93,16 +80,12 @@ int* PS4_SYSV_ABI __Error() { return &g_posix_errno; } -void ErrSceToPosix(int result) { - const int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP - ? result + -SCE_KERNEL_ERROR_UNKNOWN - : POSIX_EOTHER; - g_posix_errno = rt; +void ErrSceToPosix(int error) { + g_posix_errno = error - ORBIS_KERNEL_ERROR_UNKNOWN; } -int ErrnoToSceKernelError(int e) { - const auto res = SCE_KERNEL_ERROR_UNKNOWN + e; - return res > SCE_KERNEL_ERROR_ESTOP ? SCE_KERNEL_ERROR_UNKNOWN : res; +int ErrnoToSceKernelError(int error) { + return error + ORBIS_KERNEL_ERROR_UNKNOWN; } void SetPosixErrno(int e) { diff --git a/src/core/libraries/kernel/kernel.h b/src/core/libraries/kernel/kernel.h index f6865d22f..8e7f475ad 100644 --- a/src/core/libraries/kernel/kernel.h +++ b/src/core/libraries/kernel/kernel.h @@ -5,9 +5,8 @@ #include #include -#include "common/logging/log.h" #include "common/types.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/kernel/orbis_error.h" namespace Core::Loader { class SymbolsResolver; @@ -38,7 +37,7 @@ struct WrapperImpl { u32 ret = f(args...); if (ret != 0) { // LOG_ERROR(Lib_Kernel, "Function {} returned {}", std::string_view{name.value}, ret); - ret += SCE_KERNEL_ERROR_UNKNOWN; + ret += ORBIS_KERNEL_ERROR_UNKNOWN; } return ret; } diff --git a/src/core/libraries/kernel/memory.cpp b/src/core/libraries/kernel/memory.cpp index 4d55fc2a3..606c5c185 100644 --- a/src/core/libraries/kernel/memory.cpp +++ b/src/core/libraries/kernel/memory.cpp @@ -9,9 +9,9 @@ #include "common/scope_exit.h" #include "common/singleton.h" #include "core/file_sys/fs.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/kernel.h" #include "core/libraries/kernel/memory.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/libs.h" #include "core/linker.h" #include "core/memory.h" @@ -28,20 +28,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(); @@ -53,7 +53,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, @@ -111,7 +111,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(addr), flags, info); @@ -123,16 +123,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; } } @@ -141,7 +141,7 @@ s32 PS4_SYSV_ABI sceKernelReserveVirtualRange(void** addr, u64 len, int flags, u const auto map_flags = static_cast(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, @@ -149,16 +149,16 @@ int PS4_SYSV_ABI sceKernelMapNamedDirectMemory(void** addr, u64 len, int prot, i const char* name) { 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; } } @@ -357,20 +357,20 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolExpand(u64 searchStart, u64 searchEnd, size_ size_t alignment, u64* 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::Is64KBAligned(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::Is64KBAligned(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(); @@ -391,16 +391,16 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolReserve(void* addrIn, size_t len, size_t ali if (addrIn == nullptr) { LOG_ERROR(Kernel_Vmm, "Address is invalid!"); - return SCE_KERNEL_ERROR_EINVAL; + return ORBIS_KERNEL_ERROR_EINVAL; } if (len == 0 || !Common::Is2MBAligned(len)) { LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 2MB aligned!"); - return SCE_KERNEL_ERROR_EINVAL; + return ORBIS_KERNEL_ERROR_EINVAL; } if (alignment != 0) { if ((!std::has_single_bit(alignment) && !Common::Is2MBAligned(alignment))) { LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!"); - return SCE_KERNEL_ERROR_EINVAL; + return ORBIS_KERNEL_ERROR_EINVAL; } } @@ -415,11 +415,11 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolReserve(void* addrIn, size_t len, size_t ali s32 PS4_SYSV_ABI sceKernelMemoryPoolCommit(void* addr, size_t len, int type, int prot, int flags) { if (addr == nullptr) { LOG_ERROR(Kernel_Vmm, "Address is invalid!"); - return SCE_KERNEL_ERROR_EINVAL; + return ORBIS_KERNEL_ERROR_EINVAL; } if (len == 0 || !Common::Is64KBAligned(len)) { LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 64KB aligned!"); - return SCE_KERNEL_ERROR_EINVAL; + return ORBIS_KERNEL_ERROR_EINVAL; } LOG_INFO(Kernel_Vmm, "addr = {}, len = {:#x}, type = {:#x}, prot = {:#x}, flags = {:#x}", @@ -434,11 +434,11 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolCommit(void* addr, size_t len, int type, int s32 PS4_SYSV_ABI sceKernelMemoryPoolDecommit(void* addr, size_t len, int flags) { if (addr == nullptr) { LOG_ERROR(Kernel_Vmm, "Address is invalid!"); - return SCE_KERNEL_ERROR_EINVAL; + return ORBIS_KERNEL_ERROR_EINVAL; } if (len == 0 || !Common::Is64KBAligned(len)) { LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 64KB aligned!"); - return SCE_KERNEL_ERROR_EINVAL; + return ORBIS_KERNEL_ERROR_EINVAL; } LOG_INFO(Kernel_Vmm, "addr = {}, len = {:#x}, flags = {:#x}", fmt::ptr(addr), len, flags); @@ -493,7 +493,7 @@ int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len) { } auto* memory = Core::Memory::Instance(); memory->UnmapMemory(std::bit_cast(addr), len); - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI posix_munmap(void* addr, size_t len) { diff --git a/src/core/libraries/kernel/orbis_error.h b/src/core/libraries/kernel/orbis_error.h new file mode 100644 index 000000000..d19b3f3f1 --- /dev/null +++ b/src/core/libraries/kernel/orbis_error.h @@ -0,0 +1,108 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// Libkernel library +constexpr int ORBIS_KERNEL_ERROR_UNKNOWN = 0x80020000; +constexpr int ORBIS_KERNEL_ERROR_EPERM = 0x80020001; +constexpr int ORBIS_KERNEL_ERROR_ENOENT = 0x80020002; +constexpr int ORBIS_KERNEL_ERROR_ESRCH = 0x80020003; +constexpr int ORBIS_KERNEL_ERROR_EINTR = 0x80020004; +constexpr int ORBIS_KERNEL_ERROR_EIO = 0x80020005; +constexpr int ORBIS_KERNEL_ERROR_ENXIO = 0x80020006; +constexpr int ORBIS_KERNEL_ERROR_E2BIG = 0x80020007; +constexpr int ORBIS_KERNEL_ERROR_ENOEXEC = 0x80020008; +constexpr int ORBIS_KERNEL_ERROR_EBADF = 0x80020009; +constexpr int ORBIS_KERNEL_ERROR_ECHILD = 0x8002000A; +constexpr int ORBIS_KERNEL_ERROR_EDEADLK = 0x8002000B; +constexpr int ORBIS_KERNEL_ERROR_ENOMEM = 0x8002000C; +constexpr int ORBIS_KERNEL_ERROR_EACCES = 0x8002000D; +constexpr int ORBIS_KERNEL_ERROR_EFAULT = 0x8002000E; +constexpr int ORBIS_KERNEL_ERROR_ENOTBLK = 0x8002000F; +constexpr int ORBIS_KERNEL_ERROR_EBUSY = 0x80020010; +constexpr int ORBIS_KERNEL_ERROR_EEXIST = 0x80020011; +constexpr int ORBIS_KERNEL_ERROR_EXDEV = 0x80020012; +constexpr int ORBIS_KERNEL_ERROR_ENODEV = 0x80020013; +constexpr int ORBIS_KERNEL_ERROR_ENOTDIR = 0x80020014; +constexpr int ORBIS_KERNEL_ERROR_EISDIR = 0x80020015; +constexpr int ORBIS_KERNEL_ERROR_EINVAL = 0x80020016; +constexpr int ORBIS_KERNEL_ERROR_ENFILE = 0x80020017; +constexpr int ORBIS_KERNEL_ERROR_EMFILE = 0x80020018; +constexpr int ORBIS_KERNEL_ERROR_ENOTTY = 0x80020019; +constexpr int ORBIS_KERNEL_ERROR_ETXTBSY = 0x8002001A; +constexpr int ORBIS_KERNEL_ERROR_EFBIG = 0x8002001B; +constexpr int ORBIS_KERNEL_ERROR_ENOSPC = 0x8002001C; +constexpr int ORBIS_KERNEL_ERROR_ESPIPE = 0x8002001D; +constexpr int ORBIS_KERNEL_ERROR_EROFS = 0x8002001E; +constexpr int ORBIS_KERNEL_ERROR_EMLINK = 0x8002001F; +constexpr int ORBIS_KERNEL_ERROR_EPIPE = 0x80020020; +constexpr int ORBIS_KERNEL_ERROR_EDOM = 0x80020021; +constexpr int ORBIS_KERNEL_ERROR_ERANGE = 0x80020022; +constexpr int ORBIS_KERNEL_ERROR_EAGAIN = 0x80020023; +constexpr int ORBIS_KERNEL_ERROR_EWOULDBLOCK = 0x80020023; +constexpr int ORBIS_KERNEL_ERROR_EINPROGRESS = 0x80020024; +constexpr int ORBIS_KERNEL_ERROR_EALREADY = 0x80020025; +constexpr int ORBIS_KERNEL_ERROR_ENOTSOCK = 0x80020026; +constexpr int ORBIS_KERNEL_ERROR_EDESTADDRREQ = 0x80020027; +constexpr int ORBIS_KERNEL_ERROR_EMSGSIZE = 0x80020028; +constexpr int ORBIS_KERNEL_ERROR_EPROTOTYPE = 0x80020029; +constexpr int ORBIS_KERNEL_ERROR_ENOPROTOOPT = 0x8002002A; +constexpr int ORBIS_KERNEL_ERROR_EPROTONOSUPPORT = 0x8002002B; +constexpr int ORBIS_KERNEL_ERROR_ESOCKTNOSUPPORT = 0x8002002C; +constexpr int ORBIS_KERNEL_ERROR_ENOTSUP = 0x8002002D; +constexpr int ORBIS_KERNEL_ERROR_EOPNOTSUPP = 0x8002002D; +constexpr int ORBIS_KERNEL_ERROR_EPFNOSUPPORT = 0x8002002E; +constexpr int ORBIS_KERNEL_ERROR_EAFNOSUPPORT = 0x8002002F; +constexpr int ORBIS_KERNEL_ERROR_EADDRINUSE = 0x80020030; +constexpr int ORBIS_KERNEL_ERROR_EADDRNOTAVAIL = 0x80020031; +constexpr int ORBIS_KERNEL_ERROR_ENETDOWN = 0x80020032; +constexpr int ORBIS_KERNEL_ERROR_ENETUNREACH = 0x80020033; +constexpr int ORBIS_KERNEL_ERROR_ENETRESET = 0x80020034; +constexpr int ORBIS_KERNEL_ERROR_ECONNABORTED = 0x80020035; +constexpr int ORBIS_KERNEL_ERROR_ECONNRESET = 0x80020036; +constexpr int ORBIS_KERNEL_ERROR_ENOBUFS = 0x80020037; +constexpr int ORBIS_KERNEL_ERROR_EISCONN = 0x80020038; +constexpr int ORBIS_KERNEL_ERROR_ENOTCONN = 0x80020039; +constexpr int ORBIS_KERNEL_ERROR_ESHUTDOWN = 0x8002003A; +constexpr int ORBIS_KERNEL_ERROR_ETOOMANYREFS = 0x8002003B; +constexpr int ORBIS_KERNEL_ERROR_ETIMEDOUT = 0x8002003C; +constexpr int ORBIS_KERNEL_ERROR_ECONNREFUSED = 0x8002003D; +constexpr int ORBIS_KERNEL_ERROR_ELOOP = 0x8002003E; +constexpr int ORBIS_KERNEL_ERROR_ENAMETOOLONG = 0x8002003F; +constexpr int ORBIS_KERNEL_ERROR_EHOSTDOWN = 0x80020040; +constexpr int ORBIS_KERNEL_ERROR_EHOSTUNREACH = 0x80020041; +constexpr int ORBIS_KERNEL_ERROR_ENOTEMPTY = 0x80020042; +constexpr int ORBIS_KERNEL_ERROR_EPROCLIM = 0x80020043; +constexpr int ORBIS_KERNEL_ERROR_EUSERS = 0x80020044; +constexpr int ORBIS_KERNEL_ERROR_EDQUOT = 0x80020045; +constexpr int ORBIS_KERNEL_ERROR_ESTALE = 0x80020046; +constexpr int ORBIS_KERNEL_ERROR_EREMOTE = 0x80020047; +constexpr int ORBIS_KERNEL_ERROR_EBADRPC = 0x80020048; +constexpr int ORBIS_KERNEL_ERROR_ERPCMISMATCH = 0x80020049; +constexpr int ORBIS_KERNEL_ERROR_EPROGUNAVAIL = 0x8002004A; +constexpr int ORBIS_KERNEL_ERROR_EPROGMISMATCH = 0x8002004B; +constexpr int ORBIS_KERNEL_ERROR_EPROCUNAVAIL = 0x8002004C; +constexpr int ORBIS_KERNEL_ERROR_ENOLCK = 0x8002004D; +constexpr int ORBIS_KERNEL_ERROR_ENOSYS = 0x8002004E; +constexpr int ORBIS_KERNEL_ERROR_EFTYPE = 0x8002004F; +constexpr int ORBIS_KERNEL_ERROR_EAUTH = 0x80020050; +constexpr int ORBIS_KERNEL_ERROR_ENEEDAUTH = 0x80020051; +constexpr int ORBIS_KERNEL_ERROR_EIDRM = 0x80020052; +constexpr int ORBIS_KERNEL_ERROR_ENOMSG = 0x80020053; +constexpr int ORBIS_KERNEL_ERROR_EOVERFLOW = 0x80020054; +constexpr int ORBIS_KERNEL_ERROR_ECANCELED = 0x80020055; +constexpr int ORBIS_KERNEL_ERROR_EILSEQ = 0x80020056; +constexpr int ORBIS_KERNEL_ERROR_ENOATTR = 0x80020057; +constexpr int ORBIS_KERNEL_ERROR_EDOOFUS = 0x80020058; +constexpr int ORBIS_KERNEL_ERROR_EBADMSG = 0x80020059; +constexpr int ORBIS_KERNEL_ERROR_EMULTIHOP = 0x8002005A; +constexpr int ORBIS_KERNEL_ERROR_ENOLINK = 0x8002005B; +constexpr int ORBIS_KERNEL_ERROR_EPROTO = 0x8002005C; +constexpr int ORBIS_KERNEL_ERROR_ENOTCAPABLE = 0x8002005D; +constexpr int ORBIS_KERNEL_ERROR_ECAPMODE = 0x8002005E; +constexpr int ORBIS_KERNEL_ERROR_ENOBLK = 0x8002005F; +constexpr int ORBIS_KERNEL_ERROR_EICV = 0x80020060; +constexpr int ORBIS_KERNEL_ERROR_ENOPLAYGOENT = 0x80020061; diff --git a/src/core/libraries/kernel/posix_error.h b/src/core/libraries/kernel/posix_error.h new file mode 100644 index 000000000..0f7cf3e50 --- /dev/null +++ b/src/core/libraries/kernel/posix_error.h @@ -0,0 +1,128 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// Posix error codes +constexpr int POSIX_EPERM = 1; +constexpr int POSIX_ENOENT = 2; +constexpr int POSIX_ESRCH = 3; +constexpr int POSIX_EINTR = 4; +constexpr int POSIX_EIO = 5; +constexpr int POSIX_ENXIO = 6; +constexpr int POSIX_E2BIG = 7; +constexpr int POSIX_ENOEXEC = 8; +constexpr int POSIX_EBADF = 9; +constexpr int POSIX_ECHILD = 10; +constexpr int POSIX_EDEADLK = 11; +constexpr int POSIX_ENOMEM = 12; +constexpr int POSIX_EACCES = 13; +constexpr int POSIX_EFAULT = 14; +constexpr int POSIX_ENOTBLK = 15; +constexpr int POSIX_EBUSY = 16; +constexpr int POSIX_EEXIST = 17; +constexpr int POSIX_EXDEV = 18; +constexpr int POSIX_ENODEV = 19; +constexpr int POSIX_ENOTDIR = 20; +constexpr int POSIX_EISDIR = 21; +constexpr int POSIX_EINVAL = 22; +constexpr int POSIX_ENFILE = 23; +constexpr int POSIX_EMFILE = 24; +constexpr int POSIX_ENOTTY = 25; +constexpr int POSIX_ETXTBSY = 26; +constexpr int POSIX_EFBIG = 27; +constexpr int POSIX_ENOSPC = 28; +constexpr int POSIX_ESPIPE = 29; +constexpr int POSIX_EROFS = 30; +constexpr int POSIX_EMLINK = 31; +constexpr int POSIX_EPIPE = 32; +constexpr int POSIX_EDOM = 33; +constexpr int POSIX_ERANGE = 34; +constexpr int POSIX_EAGAIN = 35; +constexpr int POSIX_EWOULDBLOCK = 35; +constexpr int POSIX_EINPROGRESS = 36; +constexpr int POSIX_EALREADY = 37; +constexpr int POSIX_ENOTSOCK = 38; +constexpr int POSIX_EDESTADDRREQ = 39; +constexpr int POSIX_EMSGSIZE = 40; +constexpr int POSIX_EPROTOTYPE = 41; +constexpr int POSIX_ENOPROTOOPT = 42; +constexpr int POSIX_EPROTONOSUPPORT = 43; +constexpr int POSIX_ESOCKTNOSUPPORT = 44; +constexpr int POSIX_EOPNOTSUPP = 45; +constexpr int POSIX_ENOTSUP = 45; +constexpr int POSIX_EPFNOSUPPORT = 46; +constexpr int POSIX_EAFNOSUPPORT = 47; +constexpr int POSIX_EADDRINUSE = 48; +constexpr int POSIX_EADDRNOTAVAIL = 49; +constexpr int POSIX_ENETDOWN = 50; +constexpr int POSIX_ENETUNREACH = 51; +constexpr int POSIX_ENETRESET = 52; +constexpr int POSIX_ECONNABORTED = 53; +constexpr int POSIX_ECONNRESET = 54; +constexpr int POSIX_ENOBUFS = 55; +constexpr int POSIX_EISCONN = 56; +constexpr int POSIX_ENOTCONN = 57; +constexpr int POSIX_ESHUTDOWN = 58; +constexpr int POSIX_ETOOMANYREFS = 59; +constexpr int POSIX_ETIMEDOUT = 60; +constexpr int POSIX_ECONNREFUSED = 61; +constexpr int POSIX_ELOOP = 62; +constexpr int POSIX_ENAMETOOLONG = 63; +constexpr int POSIX_EHOSTDOWN = 64; +constexpr int POSIX_EHOSTUNREACH = 65; +constexpr int POSIX_ENOTEMPTY = 66; +constexpr int POSIX_EPROCLIM = 67; +constexpr int POSIX_EUSERS = 68; +constexpr int POSIX_EDQUOT = 69; +constexpr int POSIX_ESTALE = 70; +constexpr int POSIX_EREMOTE = 71; +constexpr int POSIX_EBADRPC = 72; +constexpr int POSIX_ERPCMISMATCH = 73; +constexpr int POSIX_EPROGUNAVAIL = 74; +constexpr int POSIX_EPROGMISMATCH = 75; +constexpr int POSIX_EPROCUNAVAIL = 76; +constexpr int POSIX_ENOLCK = 77; +constexpr int POSIX_ENOSYS = 78; +constexpr int POSIX_EFTYPE = 79; +constexpr int POSIX_EAUTH = 80; +constexpr int POSIX_ENEEDAUTH = 81; +constexpr int POSIX_EIDRM = 82; +constexpr int POSIX_ENOMSG = 83; +constexpr int POSIX_EOVERFLOW = 84; +constexpr int POSIX_ECANCELED = 85; +constexpr int POSIX_EILSEQ = 86; +constexpr int POSIX_ENOATTR = 87; +constexpr int POSIX_EDOOFUS = 88; +constexpr int POSIX_EBADMSG = 89; +constexpr int POSIX_EMULTIHOP = 90; +constexpr int POSIX_ENOLINK = 91; +constexpr int POSIX_EPROTO = 92; +constexpr int POSIX_ENOTCAPABLE = 93; +constexpr int POSIX_ECAPMODE = 94; +constexpr int POSIX_ENOBLK = 95; +constexpr int POSIX_EICV = 96; +constexpr int POSIX_ENOPLAYGOENT = 97; +constexpr int POSIX_EREVOKE = 98; +constexpr int POSIX_ESDKVERSION = 99; +constexpr int POSIX_ESTART = 100; +constexpr int POSIX_ESTOP = 101; +constexpr int POSIX_EINVALID2MB = 102; +constexpr int POSIX_ELAST = 102; +constexpr int POSIX_EADHOC = 160; +constexpr int POSIX_EINACTIVEDISABLED = 163; +constexpr int POSIX_ENETNODATA = 164; +constexpr int POSIX_ENETDESC = 165; +constexpr int POSIX_ENETDESCTIMEDOUT = 166; +constexpr int POSIX_ENETINTR = 167; +constexpr int POSIX_ERETURN = 205; +constexpr int POSIX_EFPOS = 152; +constexpr int POSIX_ENODATA = 1040; +constexpr int POSIX_ENOSR = 1050; +constexpr int POSIX_ENOSTR = 1051; +constexpr int POSIX_ENOTRECOVERABLE = 1056; +constexpr int POSIX_EOTHER = 1062; +constexpr int POSIX_EOWNERDEAD = 1064; +constexpr int POSIX_ETIME = 1074; diff --git a/src/core/libraries/kernel/process.cpp b/src/core/libraries/kernel/process.cpp index fc1d6e137..15e4ff820 100644 --- a/src/core/libraries/kernel/process.cpp +++ b/src/core/libraries/kernel/process.cpp @@ -5,7 +5,7 @@ #include "common/elf_info.h" #include "common/logging/log.h" #include "core/file_sys/fs.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/kernel/process.h" #include "core/libraries/libs.h" #include "core/linker.h" @@ -91,7 +91,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; diff --git a/src/core/libraries/kernel/threads/condvar.cpp b/src/core/libraries/kernel/threads/condvar.cpp index 4437af964..cbe8f6ca7 100644 --- a/src/core/libraries/kernel/threads/condvar.cpp +++ b/src/core/libraries/kernel/threads/condvar.cpp @@ -3,8 +3,8 @@ #include #include "common/assert.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/kernel.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/kernel/threads/sleepq.h" #include "core/libraries/libs.h" diff --git a/src/core/libraries/kernel/threads/event_flag.cpp b/src/core/libraries/kernel/threads/event_flag.cpp index b0f08b91c..39925153c 100644 --- a/src/core/libraries/kernel/threads/event_flag.cpp +++ b/src/core/libraries/kernel/threads/event_flag.cpp @@ -7,7 +7,7 @@ #include "common/assert.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/libs.h" namespace Libraries::Kernel { diff --git a/src/core/libraries/kernel/threads/mutex.cpp b/src/core/libraries/kernel/threads/mutex.cpp index fc0bf09bd..4f11e32da 100644 --- a/src/core/libraries/kernel/threads/mutex.cpp +++ b/src/core/libraries/kernel/threads/mutex.cpp @@ -3,10 +3,9 @@ #include #include "common/assert.h" -#include "common/scope_exit.h" #include "common/types.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/kernel.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/libs.h" diff --git a/src/core/libraries/kernel/threads/pthread.cpp b/src/core/libraries/kernel/threads/pthread.cpp index 18ddcb9bf..4629980c9 100644 --- a/src/core/libraries/kernel/threads/pthread.cpp +++ b/src/core/libraries/kernel/threads/pthread.cpp @@ -4,8 +4,8 @@ #include "common/assert.h" #include "common/thread.h" #include "core/debug_state.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/kernel.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/kernel/threads/thread_state.h" #include "core/libraries/libs.h" @@ -380,7 +380,7 @@ int PS4_SYSV_ABI posix_sched_get_priority_min() { int PS4_SYSV_ABI posix_pthread_rename_np(PthreadT thread, const char* name) { LOG_INFO(Kernel_Pthread, "name = {}", name); thread->name = name; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI posix_pthread_getschedparam(PthreadT pthread, SchedPolicy* policy, diff --git a/src/core/libraries/kernel/threads/pthread_attr.cpp b/src/core/libraries/kernel/threads/pthread_attr.cpp index ead0ff7df..a8e60ccf8 100644 --- a/src/core/libraries/kernel/threads/pthread_attr.cpp +++ b/src/core/libraries/kernel/threads/pthread_attr.cpp @@ -1,8 +1,8 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/kernel.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/kernel/threads/thread_state.h" #include "core/libraries/libs.h" diff --git a/src/core/libraries/kernel/threads/pthread_spec.cpp b/src/core/libraries/kernel/threads/pthread_spec.cpp index f0803b671..9e625da32 100644 --- a/src/core/libraries/kernel/threads/pthread_spec.cpp +++ b/src/core/libraries/kernel/threads/pthread_spec.cpp @@ -1,9 +1,8 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "common/assert.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/kernel.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/libs.h" diff --git a/src/core/libraries/kernel/threads/rwlock.cpp b/src/core/libraries/kernel/threads/rwlock.cpp index 2d5a4cdb6..affaaf994 100644 --- a/src/core/libraries/kernel/threads/rwlock.cpp +++ b/src/core/libraries/kernel/threads/rwlock.cpp @@ -1,8 +1,8 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/kernel.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/libs.h" diff --git a/src/core/libraries/kernel/threads/semaphore.cpp b/src/core/libraries/kernel/threads/semaphore.cpp index db14c298c..9903ed5b3 100644 --- a/src/core/libraries/kernel/threads/semaphore.cpp +++ b/src/core/libraries/kernel/threads/semaphore.cpp @@ -5,9 +5,11 @@ #include #include #include + #include "common/logging/log.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/kernel.h" +#include "core/libraries/kernel/orbis_error.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/kernel/time.h" #include "core/libraries/libs.h" @@ -41,7 +43,7 @@ public: } if (timeout && *timeout == 0) { - return SCE_KERNEL_ERROR_ETIMEDOUT; + return ORBIS_KERNEL_ERROR_ETIMEDOUT; } // Create waiting thread object and add it into the list of waiters. @@ -50,7 +52,7 @@ public: // Perform the wait. const s32 result = waiter.Wait(lk, timeout); - if (result == SCE_KERNEL_ERROR_ETIMEDOUT) { + if (result == ORBIS_KERNEL_ERROR_ETIMEDOUT) { wait_list.erase(it); } return result; @@ -120,15 +122,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& lk, u32* timeout) { @@ -223,7 +225,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; } sem->Delete(); return ORBIS_OK; diff --git a/src/core/libraries/kernel/threads/thread_state.cpp b/src/core/libraries/kernel/threads/thread_state.cpp index e968c39ae..6c2d4d7ef 100644 --- a/src/core/libraries/kernel/threads/thread_state.cpp +++ b/src/core/libraries/kernel/threads/thread_state.cpp @@ -4,7 +4,7 @@ #include #include "common/alignment.h" #include "common/scope_exit.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/kernel/posix_error.h" #include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/kernel/threads/sleepq.h" #include "core/libraries/kernel/threads/thread_state.h" diff --git a/src/core/libraries/kernel/time.cpp b/src/core/libraries/kernel/time.cpp index 76ea5e353..b959f2ece 100644 --- a/src/core/libraries/kernel/time.cpp +++ b/src/core/libraries/kernel/time.cpp @@ -5,7 +5,7 @@ #include "common/assert.h" #include "common/native_clock.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/kernel/time.h" #include "core/libraries/libs.h" @@ -80,7 +80,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) { @@ -105,9 +105,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) { @@ -126,11 +126,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); @@ -197,7 +197,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) { @@ -221,9 +221,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, @@ -237,9 +237,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; } namespace Dev { diff --git a/src/core/libraries/libpng/pngdec.cpp b/src/core/libraries/libpng/pngdec.cpp index fb9fae4d6..16920ee5d 100644 --- a/src/core/libraries/libpng/pngdec.cpp +++ b/src/core/libraries/libpng/pngdec.cpp @@ -4,9 +4,9 @@ #include #include "common/assert.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/libpng/pngdec.h" +#include "core/libraries/libpng/pngdec_error.h" #include "core/libraries/libs.h" -#include "pngdec.h" namespace Libraries::PngDec { @@ -279,4 +279,4 @@ void RegisterlibScePngDec(Core::Loader::SymbolsResolver* sym) { scePngDecDecodeWithInputControl); }; -} // namespace Libraries::PngDec \ No newline at end of file +} // namespace Libraries::PngDec diff --git a/src/core/libraries/libpng/pngdec_error.h b/src/core/libraries/libpng/pngdec_error.h new file mode 100644 index 000000000..9745ed5d1 --- /dev/null +++ b/src/core/libraries/libpng/pngdec_error.h @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// PngDec library +constexpr int ORBIS_PNG_DEC_ERROR_INVALID_ADDR = 0x80690001; +constexpr int ORBIS_PNG_DEC_ERROR_INVALID_SIZE = 0x80690002; +constexpr int ORBIS_PNG_DEC_ERROR_INVALID_PARAM = 0x80690003; +constexpr int ORBIS_PNG_DEC_ERROR_INVALID_HANDLE = 0x80690004; +constexpr int ORBIS_PNG_DEC_ERROR_INVALID_WORK_MEMORY = 0x80690005; +constexpr int ORBIS_PNG_DEC_ERROR_INVALID_DATA = 0x80690010; +constexpr int ORBIS_PNG_DEC_ERROR_UNSUPPORT_DATA = 0x80690011; +constexpr int ORBIS_PNG_DEC_ERROR_DECODE_ERROR = 0x80690012; +constexpr int ORBIS_PNG_DEC_ERROR_FATAL = 0x80690020; diff --git a/src/core/libraries/np_trophy/np_trophy.cpp b/src/core/libraries/np_trophy/np_trophy.cpp index e8fd57ef1..9324ed6bb 100644 --- a/src/core/libraries/np_trophy/np_trophy.cpp +++ b/src/core/libraries/np_trophy/np_trophy.cpp @@ -7,10 +7,10 @@ #include "common/logging/log.h" #include "common/path_util.h" #include "common/slot_vector.h" -#include "core/libraries/error_codes.h" #include "core/libraries/libs.h" -#include "np_trophy.h" -#include "trophy_ui.h" +#include "core/libraries/np_trophy/np_trophy.h" +#include "core/libraries/np_trophy/np_trophy_error.h" +#include "core/libraries/np_trophy/trophy_ui.h" namespace Libraries::NpTrophy { diff --git a/src/core/libraries/np_trophy/np_trophy_error.h b/src/core/libraries/np_trophy/np_trophy_error.h new file mode 100644 index 000000000..9506d9ca4 --- /dev/null +++ b/src/core/libraries/np_trophy/np_trophy_error.h @@ -0,0 +1,49 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// NpTrophy library +constexpr int ORBIS_NP_TROPHY_ERROR_UNKNOWN = 0x80551600; +constexpr int ORBIS_NP_TROPHY_ERROR_NOT_INITIALIZED = 0x80551601; +constexpr int ORBIS_NP_TROPHY_ERROR_ALREADY_INITIALIZED = 0x80551602; +constexpr int ORBIS_NP_TROPHY_ERROR_OUT_OF_MEMORY = 0x80551603; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_ARGUMENT = 0x80551604; +constexpr int ORBIS_NP_TROPHY_ERROR_INSUFFICIENT_BUFFER = 0x80551605; +constexpr int ORBIS_NP_TROPHY_ERROR_EXCEEDS_MAX = 0x80551606; +constexpr int ORBIS_NP_TROPHY_ERROR_ABORT = 0x80551607; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_HANDLE = 0x80551608; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_CONTEXT = 0x80551609; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TROPHY_ID = 0x8055160A; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_GROUP_ID = 0x8055160B; +constexpr int ORBIS_NP_TROPHY_ERROR_TROPHY_ALREADY_UNLOCKED = 0x8055160C; +constexpr int ORBIS_NP_TROPHY_ERROR_PLATINUM_CANNOT_UNLOCK = 0x8055160D; +constexpr int ORBIS_NP_TROPHY_ERROR_ACCOUNTID_NOT_MATCH = 0x8055160E; +constexpr int ORBIS_NP_TROPHY_ERROR_NOT_REGISTERED = 0x8055160F; +constexpr int ORBIS_NP_TROPHY_ERROR_ALREADY_REGISTERED = 0x80551610; +constexpr int ORBIS_NP_TROPHY_ERROR_BROKEN_DATA = 0x80551611; +constexpr int ORBIS_NP_TROPHY_ERROR_INSUFFICIENT_SPACE = 0x80551612; +constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_ALREADY_EXISTS = 0x80551613; +constexpr int ORBIS_NP_TROPHY_ERROR_ICON_FILE_NOT_FOUND = 0x80551614; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TRP_FILE_FORMAT = 0x80551616; +constexpr int ORBIS_NP_TROPHY_ERROR_UNSUPPORTED_TRP_FILE = 0x80551617; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TROPHY_CONF_FORMAT = 0x80551618; +constexpr int ORBIS_NP_TROPHY_ERROR_UNSUPPORTED_TROPHY_CONF = 0x80551619; +constexpr int ORBIS_NP_TROPHY_ERROR_TROPHY_NOT_UNLOCKED = 0x8055161A; +constexpr int ORBIS_NP_TROPHY_ERROR_USER_NOT_FOUND = 0x8055161C; +constexpr int ORBIS_NP_TROPHY_ERROR_USER_NOT_LOGGED_IN = 0x8055161D; +constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_USER_LOGOUT = 0x8055161E; +constexpr int ORBIS_NP_TROPHY_ERROR_USE_TRP_FOR_DEVELOPMENT = 0x8055161F; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_NP_SERVICE_LABEL = 0x80551621; +constexpr int ORBIS_NP_TROPHY_ERROR_NOT_SUPPORTED = 0x80551622; +constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_EXCEEDS_MAX = 0x80551623; +constexpr int ORBIS_NP_TROPHY_ERROR_HANDLE_EXCEEDS_MAX = 0x80551624; +constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_USER_ID = 0x80551625; +constexpr int ORBIS_NP_TROPHY_ERROR_TITLE_CONF_NOT_INSTALLED = 0x80551626; +constexpr int ORBIS_NP_TROPHY_ERROR_BROKEN_TITLE_CONF = 0x80551627; +constexpr int ORBIS_NP_TROPHY_ERROR_INCONSISTENT_TITLE_CONF = 0x80551628; +constexpr int ORBIS_NP_TROPHY_ERROR_TITLE_BACKGROUND = 0x80551629; +constexpr int ORBIS_NP_TROPHY_ERROR_SCREENSHOT_DISABLED = 0x8055162B; +constexpr int ORBIS_NP_TROPHY_ERROR_SCREENSHOT_DISPLAY_BUFFER_NOT_IN_USE = 0x8055162D; diff --git a/src/core/libraries/pad/pad.cpp b/src/core/libraries/pad/pad.cpp index a1897d047..3aa536bca 100644 --- a/src/core/libraries/pad/pad.cpp +++ b/src/core/libraries/pad/pad.cpp @@ -1,12 +1,11 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "common/assert.h" #include "common/config.h" #include "common/logging/log.h" #include "common/singleton.h" -#include "core/libraries/error_codes.h" #include "core/libraries/libs.h" +#include "core/libraries/pad/pad_errors.h" #include "input/controller.h" #include "pad.h" @@ -100,7 +99,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; @@ -115,7 +114,7 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn pInfo->connectionType = ORBIS_PAD_PORT_TYPE_SPECIAL; pInfo->deviceClass = (OrbisPadDeviceClass)Config::getSpecialPadClass(); } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI scePadGetDataInternal() { @@ -382,7 +381,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() { diff --git a/src/core/libraries/pad/pad_errors.h b/src/core/libraries/pad/pad_errors.h new file mode 100644 index 000000000..182c89219 --- /dev/null +++ b/src/core/libraries/pad/pad_errors.h @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// Pad library +constexpr int ORBIS_PAD_ERROR_INVALID_ARG = 0x80920001; +constexpr int ORBIS_PAD_ERROR_INVALID_PORT = 0x80920002; +constexpr int ORBIS_PAD_ERROR_INVALID_HANDLE = 0x80920003; +constexpr int ORBIS_PAD_ERROR_ALREADY_OPENED = 0x80920004; +constexpr int ORBIS_PAD_ERROR_NOT_INITIALIZED = 0x80920005; +constexpr int ORBIS_PAD_ERROR_INVALID_LIGHTBAR_SETTING = 0x80920006; +constexpr int ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED = 0x80920007; +constexpr int ORBIS_PAD_ERROR_DEVICE_NO_HANDLE = 0x80920008; +constexpr int ORBIS_PAD_ERROR_FATAL = 0x809200FF; +constexpr int ORBIS_PAD_ERROR_NOT_PERMITTED = 0x80920101; +constexpr int ORBIS_PAD_ERROR_INVALID_BUFFER_LENGTH = 0x80920102; +constexpr int ORBIS_PAD_ERROR_INVALID_REPORT_LENGTH = 0x80920103; +constexpr int ORBIS_PAD_ERROR_INVALID_REPORT_ID = 0x80920104; +constexpr int ORBIS_PAD_ERROR_SEND_AGAIN = 0x80920105; diff --git a/src/core/libraries/rtc/rtc.cpp b/src/core/libraries/rtc/rtc.cpp index 1b8802970..1e4aadccf 100644 --- a/src/core/libraries/rtc/rtc.cpp +++ b/src/core/libraries/rtc/rtc.cpp @@ -4,7 +4,6 @@ #include #include "common/logging/log.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/process.h" #include "core/libraries/kernel/time.h" #include "core/libraries/libs.h" @@ -49,7 +48,7 @@ int PS4_SYSV_ABI sceRtcCheckValid(OrbisRtcDateTime* pTime) { if (pTime->microsecond >= 1000000) return ORBIS_RTC_ERROR_INVALID_MICROSECOND; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcCompareTick(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2) { @@ -102,7 +101,7 @@ int PS4_SYSV_ABI sceRtcConvertUtcToLocalTime(OrbisRtcTick* pTickUtc, OrbisRtcTic } int PS4_SYSV_ABI sceRtcEnd() { - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcFormatRFC2822(char* pszDateTime, const OrbisRtcTick* pTickUtc, @@ -253,7 +252,7 @@ int PS4_SYSV_ABI sceRtcFormatRFC2822(char* pszDateTime, const OrbisRtcTick* pTic } } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcFormatRFC2822LocalTime(char* pszDateTime, const OrbisRtcTick* pTickUtc) { @@ -374,7 +373,7 @@ int PS4_SYSV_ABI sceRtcFormatRFC3339Precise(char* pszDateTime, const OrbisRtcTic pszDateTime[i] = formattedString.c_str()[i]; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcFormatRFC3339PreciseLocalTime(char* pszDateTime, @@ -397,13 +396,13 @@ int PS4_SYSV_ABI sceRtcGetCurrentAdNetworkTick(OrbisRtcTick* pTick) { Kernel::OrbisKernelTimespec clocktime; int returnValue = Kernel::sceKernelClockGettime(Kernel::ORBIS_CLOCK_REALTIME, &clocktime); - if (returnValue == SCE_OK) { + if (returnValue == ORBIS_OK) { pTick->tick = clocktime.tv_nsec / 1000 + clocktime.tv_sec * 1000000 + UNIX_EPOCH_TICKS; } else { return ORBIS_RTC_ERROR_NOT_INITIALIZED; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcGetCurrentClock(OrbisRtcDateTime* pTime, int timeZone) { @@ -415,7 +414,7 @@ int PS4_SYSV_ABI sceRtcGetCurrentClock(OrbisRtcDateTime* pTime, int timeZone) { Kernel::OrbisKernelTimespec clocktime; int returnValue = Kernel::sceKernelClockGettime(Kernel::ORBIS_CLOCK_REALTIME, &clocktime); - if (returnValue == SCE_OK) { + if (returnValue == ORBIS_OK) { OrbisRtcTick clockTick; clockTick.tick = clocktime.tv_nsec / 1000 + clocktime.tv_sec * 1000000 + UNIX_EPOCH_TICKS; @@ -461,13 +460,13 @@ int PS4_SYSV_ABI sceRtcGetCurrentDebugNetworkTick(OrbisRtcTick* pTick) { Kernel::OrbisKernelTimespec clocktime; int returnValue = Kernel::sceKernelClockGettime(Kernel::ORBIS_CLOCK_REALTIME, &clocktime); - if (returnValue == SCE_OK) { + if (returnValue == ORBIS_OK) { pTick->tick = clocktime.tv_nsec / 1000 + clocktime.tv_sec * 1000000 + UNIX_EPOCH_TICKS; } else { return ORBIS_RTC_ERROR_NOT_INITIALIZED; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcGetCurrentNetworkTick(OrbisRtcTick* pTick) { @@ -479,13 +478,13 @@ int PS4_SYSV_ABI sceRtcGetCurrentNetworkTick(OrbisRtcTick* pTick) { Kernel::OrbisKernelTimespec clocktime; int returnValue = Kernel::sceKernelClockGettime(Kernel::ORBIS_CLOCK_REALTIME, &clocktime); - if (returnValue == SCE_OK) { + if (returnValue == ORBIS_OK) { pTick->tick = clocktime.tv_nsec / 1000 + clocktime.tv_sec * 1000000 + UNIX_EPOCH_TICKS; } else { return ORBIS_RTC_ERROR_NOT_INITIALIZED; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcGetCurrentRawNetworkTick(OrbisRtcTick* pTick) { @@ -497,13 +496,13 @@ int PS4_SYSV_ABI sceRtcGetCurrentRawNetworkTick(OrbisRtcTick* pTick) { Kernel::OrbisKernelTimespec clocktime; int returnValue = Kernel::sceKernelClockGettime(Kernel::ORBIS_CLOCK_REALTIME, &clocktime); - if (returnValue == SCE_OK) { + if (returnValue == ORBIS_OK) { pTick->tick = clocktime.tv_nsec / 1000 + clocktime.tv_sec * 1000000 + UNIX_EPOCH_TICKS; } else { return ORBIS_RTC_ERROR_NOT_INITIALIZED; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcGetCurrentTick(OrbisRtcTick* pTick) { @@ -519,7 +518,7 @@ int PS4_SYSV_ABI sceRtcGetCurrentTick(OrbisRtcTick* pTick) { pTick->tick = clocktime.tv_nsec / 1000 + clocktime.tv_sec * 1000000 + UNIX_EPOCH_TICKS; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcGetDayOfWeek(int year, int month, int day) { @@ -583,7 +582,7 @@ int PS4_SYSV_ABI sceRtcGetDosTime(OrbisRtcDateTime* pTime, unsigned int* dosTime return ORBIS_RTC_ERROR_INVALID_POINTER; int isValid = sceRtcCheckValid(pTime); - if (isValid != SCE_OK) { + if (isValid != ORBIS_OK) { return isValid; } @@ -594,7 +593,7 @@ int PS4_SYSV_ABI sceRtcGetDosTime(OrbisRtcDateTime* pTime, unsigned int* dosTime *dosTime |= (pTime->month & 0x0F) << 21; *dosTime |= ((pTime->year - 1980) & 0x7F) << 25; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcGetTick(OrbisRtcDateTime* pTime, OrbisRtcTick* pTick) { @@ -629,7 +628,7 @@ int PS4_SYSV_ABI sceRtcGetTick(OrbisRtcDateTime* pTime, OrbisRtcTick* pTick) { pTick->tick = days + msec; - return SCE_OK; + return ORBIS_OK; } unsigned int PS4_SYSV_ABI sceRtcGetTickResolution() { @@ -645,7 +644,7 @@ int PS4_SYSV_ABI sceRtcGetTime_t(OrbisRtcDateTime* pTime, time_t* llTime) { return ORBIS_RTC_ERROR_INVALID_POINTER; int isValid = sceRtcCheckValid(pTime); - if (isValid != SCE_OK) { + if (isValid != ORBIS_OK) { return isValid; } @@ -658,7 +657,7 @@ int PS4_SYSV_ABI sceRtcGetTime_t(OrbisRtcDateTime* pTime, time_t* llTime) { *llTime = (timeTick.tick - UNIX_EPOCH_TICKS) / 1000000; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcGetWin32FileTime(OrbisRtcDateTime* pTime, uint64_t* ulWin32Time) { @@ -668,7 +667,7 @@ int PS4_SYSV_ABI sceRtcGetWin32FileTime(OrbisRtcDateTime* pTime, uint64_t* ulWin return ORBIS_RTC_ERROR_INVALID_POINTER; int isValid = sceRtcCheckValid(pTime); - if (isValid != SCE_OK) { + if (isValid != ORBIS_OK) { return isValid; } @@ -681,11 +680,11 @@ int PS4_SYSV_ABI sceRtcGetWin32FileTime(OrbisRtcDateTime* pTime, uint64_t* ulWin *ulWin32Time = (timeTick.tick - WIN32_FILETIME_EPOCH_TICKS) * 10; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcInit() { - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcIsLeapYear(int yearInt) { @@ -790,7 +789,7 @@ int PS4_SYSV_ABI sceRtcParseDateTime(OrbisRtcTick* pTickUtc, const char* pszDate sceRtcGetTick(&dateTime, pTickUtc); } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcParseRFC3339(OrbisRtcTick* pTickUtc, const char* pszDateTime) { @@ -825,7 +824,7 @@ int PS4_SYSV_ABI sceRtcParseRFC3339(OrbisRtcTick* pTickUtc, const char* pszDateT } } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcSetConf() { @@ -869,7 +868,7 @@ int PS4_SYSV_ABI sceRtcSetDosTime(OrbisRtcDateTime* pTime, u32 dosTime) { pTime->day = days & 0x1f; pTime->month = (days >> 5) & 0x0f; pTime->year = (days >> 9) + 1980; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcSetTick(OrbisRtcDateTime* pTime, OrbisRtcTick* pTick) { @@ -918,7 +917,7 @@ int PS4_SYSV_ABI sceRtcSetTick(OrbisRtcDateTime* pTime, OrbisRtcTick* pTick) { msec %= 1000000; pTime->microsecond = msec; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcSetTime_t(OrbisRtcDateTime* pTime, time_t llTime) { @@ -946,7 +945,7 @@ int PS4_SYSV_ABI sceRtcSetTime_t(OrbisRtcDateTime* pTime, time_t llTime) { newTick.tick += UNIX_EPOCH_TICKS; sceRtcSetTick(pTime, &newTick); - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcSetWin32FileTime(OrbisRtcDateTime* pTime, int64_t ulWin32Time) { @@ -962,7 +961,7 @@ int PS4_SYSV_ABI sceRtcSetWin32FileTime(OrbisRtcDateTime* pTime, int64_t ulWin32 sceRtcSetTick(pTime, &convertedTick); - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddDays(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, int32_t lAdd) { @@ -973,7 +972,7 @@ int PS4_SYSV_ABI sceRtcTickAddDays(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, i pTick1->tick = (lAdd * 86400000000) + pTick2->tick; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddHours(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, int32_t lAdd) { @@ -984,7 +983,7 @@ int PS4_SYSV_ABI sceRtcTickAddHours(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, pTick1->tick = (lAdd * 3600000000) + pTick2->tick; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddMicroseconds(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, @@ -996,7 +995,7 @@ int PS4_SYSV_ABI sceRtcTickAddMicroseconds(OrbisRtcTick* pTick1, OrbisRtcTick* p pTick1->tick = lAdd + pTick2->tick; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddMinutes(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, int64_t lAdd) { @@ -1007,7 +1006,7 @@ int PS4_SYSV_ABI sceRtcTickAddMinutes(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2 pTick1->tick = (lAdd * 60000000) + pTick2->tick; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddMonths(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, int32_t lAdd) { @@ -1018,7 +1017,7 @@ int PS4_SYSV_ABI sceRtcTickAddMonths(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, if (lAdd == 0) { pTick1->tick = pTick2->tick; - return SCE_OK; + return ORBIS_OK; } OrbisRtcDateTime time; @@ -1054,13 +1053,13 @@ int PS4_SYSV_ABI sceRtcTickAddMonths(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, } int timeIsValid = sceRtcCheckValid(&time); - if (timeIsValid == SCE_OK) { + if (timeIsValid == ORBIS_OK) { sceRtcGetTick(&time, pTick1); } else { return timeIsValid; } - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddSeconds(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, int64_t lAdd) { @@ -1071,7 +1070,7 @@ int PS4_SYSV_ABI sceRtcTickAddSeconds(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2 pTick1->tick = (lAdd * 1000000) + pTick2->tick; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddTicks(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, int64_t lAdd) { @@ -1082,7 +1081,7 @@ int PS4_SYSV_ABI sceRtcTickAddTicks(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, pTick1->tick = lAdd + pTick2->tick; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddWeeks(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, int32_t lAdd) { @@ -1093,7 +1092,7 @@ int PS4_SYSV_ABI sceRtcTickAddWeeks(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, pTick1->tick = (lAdd * 604800000000) + pTick2->tick; - return SCE_OK; + return ORBIS_OK; } int PS4_SYSV_ABI sceRtcTickAddYears(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, int32_t lAdd) { @@ -1106,7 +1105,7 @@ int PS4_SYSV_ABI sceRtcTickAddYears(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, if (lAdd == 0) { pTick1->tick = pTick2->tick; - return SCE_OK; + return ORBIS_OK; } sceRtcSetTick(&time, pTick1); @@ -1114,13 +1113,13 @@ int PS4_SYSV_ABI sceRtcTickAddYears(OrbisRtcTick* pTick1, OrbisRtcTick* pTick2, time.year += lAdd; int timeIsValid = sceRtcCheckValid(&time); - if (timeIsValid == SCE_OK) { + if (timeIsValid == ORBIS_OK) { sceRtcGetTick(&time, pTick1); } else { return timeIsValid; } - return SCE_OK; + return ORBIS_OK; } void RegisterlibSceRtc(Core::Loader::SymbolsResolver* sym) { diff --git a/src/core/libraries/rtc/rtc_error.h b/src/core/libraries/rtc/rtc_error.h index 3af5a68fd..406c6fb56 100644 --- a/src/core/libraries/rtc/rtc_error.h +++ b/src/core/libraries/rtc/rtc_error.h @@ -3,6 +3,8 @@ #pragma once +#include "core/libraries/error_codes.h" + constexpr int ORBIS_RTC_ERROR_DATETIME_UNINITIALIZED = 0x7FFEF9FE; constexpr int ORBIS_RTC_ERROR_INVALID_PARAMETER = 0x80010602; constexpr int ORBIS_RTC_ERROR_INVALID_TICK_PARAMETER = 0x80010603; @@ -29,4 +31,4 @@ constexpr int ORBIS_RTC_ERROR_INVALID_DAY = 0x80B5000A; constexpr int ORBIS_RTC_ERROR_INVALID_HOUR = 0x80B5000B; constexpr int ORBIS_RTC_ERROR_INVALID_MINUTE = 0x80B5000C; constexpr int ORBIS_RTC_ERROR_INVALID_SECOND = 0x80B5000D; -constexpr int ORBIS_RTC_ERROR_INVALID_MICROSECOND = 0x80B5000E; \ No newline at end of file +constexpr int ORBIS_RTC_ERROR_INVALID_MICROSECOND = 0x80B5000E; diff --git a/src/core/libraries/system/systemservice.cpp b/src/core/libraries/system/systemservice.cpp index 4e7f9257a..be0c84e0b 100644 --- a/src/core/libraries/system/systemservice.cpp +++ b/src/core/libraries/system/systemservice.cpp @@ -3,9 +3,9 @@ #include "common/config.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" #include "core/libraries/libs.h" #include "core/libraries/system/systemservice.h" +#include "core/libraries/system/systemservice_error.h" namespace Libraries::SystemService { diff --git a/src/core/libraries/system/systemservice_error.h b/src/core/libraries/system/systemservice_error.h new file mode 100644 index 000000000..ca59fab65 --- /dev/null +++ b/src/core/libraries/system/systemservice_error.h @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// SystemService library +constexpr int ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER = 0x80A10003; +constexpr int ORBIS_SYSTEM_SERVICE_ERROR_NO_EVENT = 0x80A10004; diff --git a/src/core/libraries/system/userservice.cpp b/src/core/libraries/system/userservice.cpp index 140ca8921..cc21cb75f 100644 --- a/src/core/libraries/system/userservice.cpp +++ b/src/core/libraries/system/userservice.cpp @@ -4,9 +4,9 @@ #include "common/config.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" #include "core/libraries/libs.h" #include "core/libraries/system/userservice.h" +#include "core/libraries/system/userservice_error.h" namespace Libraries::UserService { diff --git a/src/core/libraries/system/userservice_error.h b/src/core/libraries/system/userservice_error.h new file mode 100644 index 000000000..40921df9f --- /dev/null +++ b/src/core/libraries/system/userservice_error.h @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// UserService library +constexpr int ORBIS_USER_SERVICE_ERROR_INTERNAL = 0x80960001; +constexpr int ORBIS_USER_SERVICE_ERROR_NOT_INITIALIZED = 0x80960002; +constexpr int ORBIS_USER_SERVICE_ERROR_ALREADY_INITIALIZED = 0x80960003; +constexpr int ORBIS_USER_SERVICE_ERROR_NO_MEMORY = 0x80960004; +constexpr int ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT = 0x80960005; +constexpr int ORBIS_USER_SERVICE_ERROR_OPERATION_NOT_SUPPORTED = 0x80960006; +constexpr int ORBIS_USER_SERVICE_ERROR_NO_EVENT = 0x80960007; +constexpr int ORBIS_USER_SERVICE_ERROR_NOT_LOGGED_IN = 0x80960009; +constexpr int ORBIS_USER_SERVICE_ERROR_BUFFER_TOO_SHORT = 0x8096000A; diff --git a/src/core/libraries/videodec/videodec.cpp b/src/core/libraries/videodec/videodec.cpp index 8d6ea4988..6c9a9b8c0 100644 --- a/src/core/libraries/videodec/videodec.cpp +++ b/src/core/libraries/videodec/videodec.cpp @@ -1,12 +1,11 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "videodec.h" - #include "common/logging/log.h" -#include "core/libraries/error_codes.h" #include "core/libraries/libs.h" -#include "videodec_impl.h" +#include "core/libraries/videodec/videodec.h" +#include "core/libraries/videodec/videodec_error.h" +#include "core/libraries/videodec/videodec_impl.h" namespace Libraries::Videodec { @@ -134,4 +133,4 @@ void RegisterlibSceVideodec(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("f8AgDv-1X8A", "libSceVideodec", 1, "libSceVideodec", 1, 1, sceVideodecReset); }; -} // namespace Libraries::Videodec \ No newline at end of file +} // namespace Libraries::Videodec diff --git a/src/core/libraries/videodec/videodec2.cpp b/src/core/libraries/videodec/videodec2.cpp index fe2b82bea..0bd68afbd 100644 --- a/src/core/libraries/videodec/videodec2.cpp +++ b/src/core/libraries/videodec/videodec2.cpp @@ -1,13 +1,12 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "videodec2.h" -#include "videodec2_impl.h" - #include "common/assert.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" #include "core/libraries/libs.h" +#include "core/libraries/videodec/videodec2.h" +#include "core/libraries/videodec/videodec2_impl.h" +#include "core/libraries/videodec/videodec_error.h" namespace Libraries::Vdec2 { @@ -197,4 +196,4 @@ void RegisterlibSceVdec2(Core::Loader::SymbolsResolver* sym) { sceVideodec2GetPictureInfo); } -} // namespace Libraries::Vdec2 \ No newline at end of file +} // namespace Libraries::Vdec2 diff --git a/src/core/libraries/videodec/videodec2_impl.cpp b/src/core/libraries/videodec/videodec2_impl.cpp index 37270fa8c..8daa48828 100644 --- a/src/core/libraries/videodec/videodec2_impl.cpp +++ b/src/core/libraries/videodec/videodec2_impl.cpp @@ -3,10 +3,9 @@ #include "videodec2_impl.h" -#include "common/alignment.h" #include "common/assert.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/videodec/videodec_error.h" // The av_err2str macro in libavutil/error.h does not play nice with C++ #ifdef av_err2str diff --git a/src/core/libraries/videodec/videodec_error.h b/src/core/libraries/videodec/videodec_error.h new file mode 100644 index 000000000..4e0066e5e --- /dev/null +++ b/src/core/libraries/videodec/videodec_error.h @@ -0,0 +1,68 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// Videodec library +constexpr int ORBIS_VIDEODEC_ERROR_API_FAIL = 0x80C10000; +constexpr int ORBIS_VIDEODEC_ERROR_CODEC_TYPE = 0x80C10001; +constexpr int ORBIS_VIDEODEC_ERROR_STRUCT_SIZE = 0x80C10002; +constexpr int ORBIS_VIDEODEC_ERROR_HANDLE = 0x80C10003; +constexpr int ORBIS_VIDEODEC_ERROR_CPU_MEMORY_SIZE = 0x80C10004; +constexpr int ORBIS_VIDEODEC_ERROR_CPU_MEMORY_POINTER = 0x80C10005; +constexpr int ORBIS_VIDEODEC_ERROR_CPU_GPU_MEMORY_SIZE = 0x80C10006; +constexpr int ORBIS_VIDEODEC_ERROR_CPU_GPU_MEMORY_POINTER = 0x80C10007; +constexpr int ORBIS_VIDEODEC_ERROR_SHADER_CONTEXT_POINTER = 0x80C10008; +constexpr int ORBIS_VIDEODEC_ERROR_AU_SIZE = 0x80C10009; +constexpr int ORBIS_VIDEODEC_ERROR_AU_POINTER = 0x80C1000A; +constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_SIZE = 0x80C1000B; +constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_POINTER = 0x80C1000C; +constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_ALIGNMENT = 0x80C1000D; +constexpr int ORBIS_VIDEODEC_ERROR_CONFIG_INFO = 0x80C1000E; +constexpr int ORBIS_VIDEODEC_ERROR_ARGUMENT_POINTER = 0x80C1000F; +constexpr int ORBIS_VIDEODEC_ERROR_NEW_SEQUENCE = 0x80C10010; +constexpr int ORBIS_VIDEODEC_ERROR_DECODE_AU = 0x80C10011; +constexpr int ORBIS_VIDEODEC_ERROR_MISMATCH_SPEC = 0x80C10012; +constexpr int ORBIS_VIDEODEC_ERROR_INVALID_SEQUENCE = 0x80C10013; +constexpr int ORBIS_VIDEODEC_ERROR_FATAL_STREAM = 0x80C10014; +constexpr int ORBIS_VIDEODEC_ERROR_FATAL_STATE = 0x80C10015; + +// Videodec2 library +constexpr int ORBIS_VIDEODEC2_ERROR_API_FAIL = 0x811D0100; +constexpr int ORBIS_VIDEODEC2_ERROR_STRUCT_SIZE = 0x811D0101; +constexpr int ORBIS_VIDEODEC2_ERROR_ARGUMENT_POINTER = 0x811D0102; +constexpr int ORBIS_VIDEODEC2_ERROR_DECODER_INSTANCE = 0x811D0103; +constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_SIZE = 0x811D0104; +constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_POINTER = 0x811D0105; +constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_SIZE = 0x811D0106; +constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_POINTER = 0x811D0107; +constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_ALIGNMENT = 0x811D0108; +constexpr int ORBIS_VIDEODEC2_ERROR_NOT_ONION_MEMORY = 0x811D0109; +constexpr int ORBIS_VIDEODEC2_ERROR_NOT_GARLIC_MEMORY = 0x811D010A; +constexpr int ORBIS_VIDEODEC2_ERROR_NOT_DIRECT_MEMORY = 0x811D010B; +constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_INFO = 0x811D010C; +constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT_SIZE = 0x811D010D; +constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT_POINTER = 0x811D010E; +constexpr int ORBIS_VIDEODEC2_ERROR_OUTPUT_INFO = 0x811D010F; +constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_QUEUE = 0x811D0110; +constexpr int ORBIS_VIDEODEC2_ERROR_FATAL_STATE = 0x811D0111; +constexpr int ORBIS_VIDEODEC2_ERROR_PRESET_VALUE = 0x811D0112; +constexpr int ORBIS_VIDEODEC2_ERROR_CONFIG_INFO = 0x811D0200; +constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_PIPE_ID = 0x811D0201; +constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_QUEUE_ID = 0x811D0202; +constexpr int ORBIS_VIDEODEC2_ERROR_RESOURCE_TYPE = 0x811D0203; +constexpr int ORBIS_VIDEODEC2_ERROR_CODEC_TYPE = 0x811D0204; +constexpr int ORBIS_VIDEODEC2_ERROR_PROFILE_LEVEL = 0x811D0205; +constexpr int ORBIS_VIDEODEC2_ERROR_PIPELINE_DEPTH = 0x811D0206; +constexpr int ORBIS_VIDEODEC2_ERROR_AFFINITY_MASK = 0x811D0207; +constexpr int ORBIS_VIDEODEC2_ERROR_THREAD_PRIORITY = 0x811D0208; +constexpr int ORBIS_VIDEODEC2_ERROR_DPB_FRAME_COUNT = 0x811D0209; +constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_WIDTH_HEIGHT = 0x811D020A; +constexpr int ORBIS_VIDEODEC2_ERROR_EXTRA_CONFIG_INFO = 0x811D020B; +constexpr int ORBIS_VIDEODEC2_ERROR_NEW_SEQUENCE = 0x811D0300; +constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT = 0x811D0301; +constexpr int ORBIS_VIDEODEC2_ERROR_OVERSIZE_DECODE = 0x811D0302; +constexpr int ORBIS_VIDEODEC2_ERROR_INVALID_SEQUENCE = 0x811D0303; +constexpr int ORBIS_VIDEODEC2_ERROR_FATAL_STREAM = 0x811D0304; diff --git a/src/core/libraries/videodec/videodec_impl.cpp b/src/core/libraries/videodec/videodec_impl.cpp index a244c4a61..cf4846971 100644 --- a/src/core/libraries/videodec/videodec_impl.cpp +++ b/src/core/libraries/videodec/videodec_impl.cpp @@ -6,7 +6,7 @@ #include "common/alignment.h" #include "common/assert.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" +#include "core/libraries/videodec/videodec_error.h" // The av_err2str macro in libavutil/error.h does not play nice with C++ #ifdef av_err2str diff --git a/src/core/libraries/videoout/driver.cpp b/src/core/libraries/videoout/driver.cpp index d8013614c..0e79ae7c8 100644 --- a/src/core/libraries/videoout/driver.cpp +++ b/src/core/libraries/videoout/driver.cpp @@ -8,10 +8,9 @@ #include "common/debug.h" #include "common/thread.h" #include "core/debug_state.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/time.h" #include "core/libraries/videoout/driver.h" -#include "core/platform.h" +#include "core/libraries/videoout/videoout_error.h" #include "video_core/renderer_vulkan/vk_presenter.h" extern std::unique_ptr presenter; @@ -298,7 +297,7 @@ void VideoOutDriver::PresentThread(std::stop_token token) { { // Needs lock here as can be concurrently read by `sceVideoOutGetVblankStatus` - std::unique_lock lock{main_port.vo_mutex}; + std::scoped_lock lock{main_port.vo_mutex}; vblank_status.count++; vblank_status.processTime = Libraries::Kernel::sceKernelGetProcessTime(); vblank_status.tsc = Libraries::Kernel::sceKernelReadTsc(); diff --git a/src/core/libraries/videoout/video_out.cpp b/src/core/libraries/videoout/video_out.cpp index 0258074d3..7b403a134 100644 --- a/src/core/libraries/videoout/video_out.cpp +++ b/src/core/libraries/videoout/video_out.cpp @@ -4,12 +4,11 @@ #include "common/assert.h" #include "common/config.h" #include "common/logging/log.h" -#include "core/libraries/error_codes.h" #include "core/libraries/libs.h" #include "core/libraries/system/userservice.h" #include "core/libraries/videoout/driver.h" #include "core/libraries/videoout/video_out.h" -#include "core/loader/symbols_resolver.h" +#include "core/libraries/videoout/videoout_error.h" #include "core/platform.h" #include "video_core/renderer_vulkan/vk_presenter.h" @@ -156,7 +155,7 @@ s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode int PS4_SYSV_ABI sceVideoOutGetEventId(const Kernel::SceKernelEvent* ev) { if (ev == nullptr) { - return SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS; + return ORBIS_VIDEO_OUT_ERROR_INVALID_ADDRESS; } if (ev->filter != Kernel::SceKernelEvent::Filter::VideoOut) { return ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE; @@ -166,7 +165,7 @@ int PS4_SYSV_ABI sceVideoOutGetEventId(const Kernel::SceKernelEvent* ev) { int PS4_SYSV_ABI sceVideoOutGetEventData(const Kernel::SceKernelEvent* ev, int64_t* data) { if (ev == nullptr || data == nullptr) { - return SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS; + return ORBIS_VIDEO_OUT_ERROR_INVALID_ADDRESS; } if (ev->filter != Kernel::SceKernelEvent::Filter::VideoOut) { return ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE; @@ -204,7 +203,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); diff --git a/src/core/libraries/videoout/videoout_error.h b/src/core/libraries/videoout/videoout_error.h new file mode 100644 index 000000000..b1ed18c92 --- /dev/null +++ b/src/core/libraries/videoout/videoout_error.h @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/libraries/error_codes.h" + +// VideoOut library +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_PIXEL_FORMAT = 0x80290003; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_PITCH = 0x80290004; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_RESOLUTION = 0x80290005; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_FLIP_MODE = 0x80290006; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_TILING_MODE = 0x80290007; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO = 0x80290008; +constexpr int ORBIS_VIDEO_OUT_ERROR_RESOURCE_BUSY = 0x80290009; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_INDEX = 0x8029000A; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE = 0x8029000B; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE = 0x8029000C; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT = 0x8029000D; +constexpr int ORBIS_VIDEO_OUT_ERROR_NO_EMPTY_SLOT = 0x8029000F; +constexpr int ORBIS_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010; +constexpr int ORBIS_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_MEMORY = 0x80290013; +constexpr int ORBIS_VIDEO_OUT_ERROR_MEMORY_NOT_PHYSICALLY_CONTIGUOUS = 0x80290014; +constexpr int ORBIS_VIDEO_OUT_ERROR_MEMORY_INVALID_ALIGNMENT = 0x80290015; +constexpr int ORBIS_VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE = 0x80290016; +constexpr int ORBIS_VIDEO_OUT_ERROR_OVERFLOW = 0x80290017; +constexpr int ORBIS_VIDEO_OUT_ERROR_NO_DEVICE = 0x80290018; +constexpr int ORBIS_VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE = 0x80290019; +constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; +constexpr int ORBIS_VIDEO_OUT_ERROR_UNKNOWN = 0x802900FE; +constexpr int ORBIS_VIDEO_OUT_ERROR_FATAL = 0x802900FF; +constexpr int ORBIS_VIDEO_OUT_ERROR_ENOMEM = 0x8029100C; diff --git a/src/core/memory.cpp b/src/core/memory.cpp index f638e5e1a..15fde2a57 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -5,10 +5,9 @@ #include "common/assert.h" #include "common/config.h" #include "common/debug.h" -#include "core/libraries/error_codes.h" #include "core/libraries/kernel/memory.h" +#include "core/libraries/kernel/orbis_error.h" #include "core/memory.h" -#include "video_core/renderer_vulkan/vk_instance.h" #include "video_core/renderer_vulkan/vk_rasterizer.h" namespace Core { @@ -268,7 +267,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