IOS: Add/move some useful enums/structs

This commit is contained in:
Léo Lam 2017-04-30 18:42:11 +02:00
parent b21174c326
commit e01624f64b
3 changed files with 36 additions and 9 deletions

View File

@ -23,6 +23,7 @@ enum ReturnCode : s32
IPC_EACCES = -1, // Permission denied
IPC_EEXIST = -2, // File exists
IPC_EINVAL = -4, // Invalid argument or fd
IPC_EMAX = -5, // Too many file descriptors open
IPC_ENOENT = -6, // File not found
IPC_EQUEUEFULL = -8, // Queue full
IPC_EIO = -12, // ECC error
@ -83,6 +84,7 @@ struct Request
enum OpenMode : s32
{
IOS_OPEN_NONE = 0,
IOS_OPEN_READ = 1,
IOS_OPEN_WRITE = 2,
IOS_OPEN_RW = (IOS_OPEN_READ | IOS_OPEN_WRITE)
@ -106,14 +108,15 @@ struct ReadWriteRequest final : Request
explicit ReadWriteRequest(u32 address);
};
struct SeekRequest final : Request
enum SeekMode : s32
{
enum SeekMode
{
IOS_SEEK_SET = 0,
IOS_SEEK_CUR = 1,
IOS_SEEK_END = 2,
};
};
struct SeekRequest final : Request
{
u32 offset = 0;
SeekMode mode = IOS_SEEK_SET;
explicit SeekRequest(u32 address);

View File

@ -169,15 +169,15 @@ IPCCommandResult FileIO::Seek(const SeekRequest& request)
u32 new_position = 0;
switch (request.mode)
{
case SeekRequest::IOS_SEEK_SET:
case IOS_SEEK_SET:
new_position = request.offset;
break;
case SeekRequest::IOS_SEEK_CUR:
case IOS_SEEK_CUR:
new_position = m_SeekPos + request.offset;
break;
case SeekRequest::IOS_SEEK_END:
case IOS_SEEK_END:
new_position = file_size + request.offset;
break;

View File

@ -55,6 +55,30 @@ enum IPCCommandType : u32
IPC_REPLY = 8,
};
enum ProcessId : u32
{
PID_KERNEL = 0,
PID_ES = 1,
PID_FS = 2,
PID_DI = 3,
PID_OH0 = 4,
PID_OH1 = 5,
PID_EHCI = 6,
PID_SDI = 7,
PID_USBETH = 8,
PID_NET = 9,
PID_WD = 10,
PID_WL = 11,
PID_KD = 12,
PID_NCD = 13,
PID_STM = 14,
PID_PPCBOOT = 15,
PID_SSL = 16,
PID_USB = 17,
PID_P2P = 18,
PID_UNKNOWN = 19,
};
// HLE for the IOS kernel: IPC, device management, syscalls, and Dolphin-specific, IOS-wide calls.
class Kernel
{