// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

// Generic
constexpr int ORBIS_OK = 0x00000000;
constexpr int ORBIS_FAIL = 0xFFFFFFFF;

// Libkernel library
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;
