mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
IOS HLE: Clean up return codes
- Use an enum instead of defines. - Only use the FS_ prefix for return codes which are actually related to FS stuff, not for everything. - Remove duplicated error codes and clean up the names.
This commit is contained in:
parent
7a5fe4b7ed
commit
7dcb3c5d55
@ -378,7 +378,7 @@ static s32 OpenDevice(const u32 address)
|
||||
{
|
||||
device = GetUnusedESDevice();
|
||||
if (!device)
|
||||
return FS_EESEXHAUSTED;
|
||||
return IPC_EESEXHAUSTED;
|
||||
}
|
||||
else if (device_name.find("/dev/") == 0)
|
||||
{
|
||||
@ -392,7 +392,7 @@ static s32 OpenDevice(const u32 address)
|
||||
if (!device)
|
||||
{
|
||||
ERROR_LOG(WII_IPC_HLE, "Unknown device: %s", device_name.c_str());
|
||||
return FS_ENOENT;
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
Memory::Write_U32(new_fd, address + 4);
|
||||
@ -418,7 +418,7 @@ static IPCCommandResult HandleCommand(const u32 address)
|
||||
const auto device = (fd >= 0 && fd < IPC_MAX_FDS) ? s_fdmap[fd] : nullptr;
|
||||
if (!device)
|
||||
{
|
||||
Memory::Write_U32(FS_EINVAL, address + 4);
|
||||
Memory::Write_U32(IPC_EINVAL, address + 4);
|
||||
return IWII_IPC_HLE_Device::GetDefaultReply();
|
||||
}
|
||||
|
||||
@ -426,8 +426,8 @@ static IPCCommandResult HandleCommand(const u32 address)
|
||||
{
|
||||
case IPC_CMD_CLOSE:
|
||||
s_fdmap[fd].reset();
|
||||
// A close on a valid device returns FS_SUCCESS.
|
||||
Memory::Write_U32(FS_SUCCESS, address + 4);
|
||||
// A close on a valid device returns IPC_SUCCESS.
|
||||
Memory::Write_U32(IPC_SUCCESS, address + 4);
|
||||
return device->Close(address);
|
||||
case IPC_CMD_READ:
|
||||
return device->Read(address);
|
||||
|
@ -14,30 +14,32 @@
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
|
||||
#define FS_SUCCESS (u32)0 // Success
|
||||
#define FS_EACCES (u32) - 1 // Permission denied
|
||||
#define FS_EEXIST (u32) - 2 // File exists
|
||||
#define FS_EINVAL (u32) - 4 // Invalid argument Invalid FD
|
||||
#define FS_ENOENT (u32) - 6 // File not found
|
||||
#define FS_EBUSY (u32) - 8 // Resource busy
|
||||
#define FS_EIO (u32) - 12 // Returned on ECC error
|
||||
#define FS_ENOMEM (u32) - 22 // Alloc failed during request
|
||||
#define FS_EFATAL (u32) - 101 // Fatal error
|
||||
#define FS_EACCESS (u32) - 102 // Permission denied
|
||||
#define FS_ECORRUPT (u32) - 103 // returned for "corrupted" NAND
|
||||
#define FS_EEXIST2 (u32) - 105 // File exists
|
||||
#define FS_ENOENT2 (u32) - 106 // File not found
|
||||
#define FS_ENFILE (u32) - 107 // Too many fds open
|
||||
#define FS_EFBIG (u32) - 108 // Max block count reached?
|
||||
#define FS_EFDEXHAUSTED (u32) - 109 // Too many fds open
|
||||
#define FS_ENAMELEN (u32) - 110 // Pathname is too long
|
||||
#define FS_EFDOPEN (u32) - 111 // FD is already open
|
||||
#define FS_EIO2 (u32) - 114 // Returned on ECC error
|
||||
#define FS_ENOTEMPTY (u32) - 115 // Directory not empty
|
||||
#define FS_EDIRDEPTH (u32) - 116 // Max directory depth exceeded
|
||||
#define FS_EBUSY2 (u32) - 118 // Resource busy
|
||||
//#define FS_EFATAL (u32)-119 // Fatal error not used by IOS as fatal ERROR
|
||||
#define FS_EESEXHAUSTED (u32) - 1016 // Max of 2 ES handles at a time
|
||||
enum IOSReturnCode : s32
|
||||
{
|
||||
IPC_SUCCESS = 0, // Success
|
||||
IPC_EACCES = -1, // Permission denied
|
||||
IPC_EEXIST = -2, // File exists
|
||||
IPC_EINVAL = -4, // Invalid argument or fd
|
||||
IPC_ENOENT = -6, // File not found
|
||||
IPC_EQUEUEFULL = -8, // Queue full
|
||||
IPC_EIO = -12, // ECC error
|
||||
IPC_ENOMEM = -22, // Alloc failed during request
|
||||
FS_EINVAL = -101, // Invalid path
|
||||
FS_EACCESS = -102, // Permission denied
|
||||
FS_ECORRUPT = -103, // Corrupted NAND
|
||||
FS_EEXIST = -105, // File exists
|
||||
FS_ENOENT = -106, // No such file or directory
|
||||
FS_ENFILE = -107, // Too many fds open
|
||||
FS_EFBIG = -108, // Max block count reached?
|
||||
FS_EFDEXHAUSTED = -109, // Too many fds open
|
||||
FS_ENAMELEN = -110, // Pathname is too long
|
||||
FS_EFDOPEN = -111, // FD is already open
|
||||
FS_EIO = -114, // ECC error
|
||||
FS_ENOTEMPTY = -115, // Directory not empty
|
||||
FS_EDIRDEPTH = -116, // Max directory depth exceeded
|
||||
FS_EBUSY = -118, // Resource busy
|
||||
IPC_EESEXHAUSTED = -1016, // Max of 2 ES handles exceeded
|
||||
};
|
||||
|
||||
// A struct for IOS ioctlv calls
|
||||
struct SIOCtlVBuffer
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_fs.h"
|
||||
|
||||
static std::map<std::string, std::weak_ptr<File::IOFile>> openFiles;
|
||||
|
||||
@ -108,7 +107,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Open(u32 command_address, u32 mode)
|
||||
WARN_LOG(WII_IPC_FILEIO, "FileIO: Open (%s) failed - File doesn't exist %s", Modes[mode],
|
||||
m_filepath.c_str());
|
||||
if (command_address)
|
||||
Memory::Write_U32(FS_FILE_NOT_EXIST, command_address + 4);
|
||||
Memory::Write_U32(FS_ENOENT, command_address + 4);
|
||||
}
|
||||
|
||||
m_Active = true;
|
||||
@ -161,13 +160,13 @@ void CWII_IPC_HLE_Device_FileIO::OpenFile()
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
|
||||
{
|
||||
u32 ReturnValue = FS_RESULT_FATAL;
|
||||
u32 ReturnValue = FS_EINVAL;
|
||||
const s32 SeekPosition = Memory::Read_U32(_CommandAddress + 0xC);
|
||||
const s32 Mode = Memory::Read_U32(_CommandAddress + 0x10);
|
||||
|
||||
if (m_file->IsOpen())
|
||||
{
|
||||
ReturnValue = FS_RESULT_FATAL;
|
||||
ReturnValue = FS_EINVAL;
|
||||
|
||||
const s32 fileSize = (s32)m_file->GetSize();
|
||||
DEBUG_LOG(WII_IPC_FILEIO, "FileIO: Seek Pos: 0x%08x, Mode: %i (%s, Length=0x%08x)",
|
||||
@ -210,14 +209,14 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
|
||||
default:
|
||||
{
|
||||
PanicAlert("CWII_IPC_HLE_Device_FileIO Unsupported seek mode %i", Mode);
|
||||
ReturnValue = FS_RESULT_FATAL;
|
||||
ReturnValue = FS_EINVAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ReturnValue = FS_FILE_NOT_EXIST;
|
||||
ReturnValue = FS_ENOENT;
|
||||
}
|
||||
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
|
||||
|
||||
@ -259,7 +258,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Read(u32 _CommandAddress)
|
||||
ERROR_LOG(WII_IPC_FILEIO, "FileIO: Failed to read from %s (Addr=0x%08x Size=0x%x) - file could "
|
||||
"not be opened or does not exist",
|
||||
m_Name.c_str(), Address, Size);
|
||||
ReturnValue = FS_FILE_NOT_EXIST;
|
||||
ReturnValue = FS_ENOENT;
|
||||
}
|
||||
|
||||
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
|
||||
@ -299,7 +298,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::Write(u32 _CommandAddress)
|
||||
ERROR_LOG(WII_IPC_FILEIO, "FileIO: Failed to read from %s (Addr=0x%08x Size=0x%x) - file could "
|
||||
"not be opened or does not exist",
|
||||
m_Name.c_str(), Address, Size);
|
||||
ReturnValue = FS_FILE_NOT_EXIST;
|
||||
ReturnValue = FS_ENOENT;
|
||||
}
|
||||
|
||||
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
|
||||
@ -332,7 +331,7 @@ IPCCommandResult CWII_IPC_HLE_Device_FileIO::IOCtl(u32 _CommandAddress)
|
||||
}
|
||||
else
|
||||
{
|
||||
ReturnValue = FS_FILE_NOT_EXIST;
|
||||
ReturnValue = FS_ENOENT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -73,7 +73,7 @@ static u64 ComputeTotalFileSize(const File::FSTEntry& parentEntry)
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
{
|
||||
u32 ReturnValue = FS_RESULT_OK;
|
||||
u32 ReturnValue = IPC_SUCCESS;
|
||||
SIOCtlVBuffer CommandBuffer(_CommandAddress);
|
||||
|
||||
// Prepare the out buffer(s) with zeros as a safety precaution
|
||||
@ -94,7 +94,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
if (!IsValidWiiPath(relative_path))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", relative_path.c_str());
|
||||
ReturnValue = FS_RESULT_FATAL;
|
||||
ReturnValue = FS_EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
if (!File::Exists(DirName))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "FS: Search not found: %s", DirName.c_str());
|
||||
ReturnValue = FS_FILE_NOT_EXIST;
|
||||
ReturnValue = FS_ENOENT;
|
||||
break;
|
||||
}
|
||||
else if (!File::IsDirectory(DirName))
|
||||
@ -114,8 +114,8 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
// It's not a directory, so error.
|
||||
// Games don't usually seem to care WHICH error they get, as long as it's <
|
||||
// Well the system menu CARES!
|
||||
WARN_LOG(WII_IPC_FILEIO, "\tNot a directory - return FS_RESULT_FATAL");
|
||||
ReturnValue = FS_RESULT_FATAL;
|
||||
WARN_LOG(WII_IPC_FILEIO, "\tNot a directory - return FS_EINVAL");
|
||||
ReturnValue = FS_EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
Memory::Write_U32((u32)numFiles, CommandBuffer.PayloadBuffer[1].m_Address);
|
||||
}
|
||||
|
||||
ReturnValue = FS_RESULT_OK;
|
||||
ReturnValue = IPC_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -185,7 +185,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
if (!IsValidWiiPath(relativepath))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", relativepath.c_str());
|
||||
ReturnValue = FS_RESULT_FATAL;
|
||||
ReturnValue = FS_EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
|
||||
fsBlocks = (u32)(totalSize / (16 * 1024)); // one bock is 16kb
|
||||
}
|
||||
ReturnValue = FS_RESULT_OK;
|
||||
ReturnValue = IPC_SUCCESS;
|
||||
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: fsBlock: %i, iNodes: %i", fsBlocks, iNodes);
|
||||
}
|
||||
@ -225,7 +225,7 @@ IPCCommandResult CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
|
||||
{
|
||||
fsBlocks = 0;
|
||||
iNodes = 0;
|
||||
ReturnValue = FS_RESULT_OK;
|
||||
ReturnValue = IPC_SUCCESS;
|
||||
WARN_LOG(WII_IPC_FILEIO, "FS: fsBlock failed, cannot find directory: %s", path.c_str());
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
|
||||
std::memcpy(Memory::GetPointer(_BufferOut), &fs, sizeof(NANDStat));
|
||||
|
||||
return FS_RESULT_OK;
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -307,7 +307,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
if (!IsValidWiiPath(wii_path))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
std::string DirName(HLE_IPC_BuildFilename(wii_path));
|
||||
Addr += 64;
|
||||
@ -322,7 +322,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
_dbg_assert_msg_(WII_IPC_FILEIO, File::IsDirectory(DirName), "FS: CREATE_DIR %s failed",
|
||||
DirName.c_str());
|
||||
|
||||
return FS_RESULT_OK;
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -338,7 +338,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
if (!IsValidWiiPath(wii_path))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
||||
Addr += 64;
|
||||
@ -359,7 +359,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
DEBUG_LOG(WII_IPC_FILEIO, " OtherPerm: 0x%02x", OtherPerm);
|
||||
DEBUG_LOG(WII_IPC_FILEIO, " Attributes: 0x%02x", Attributes);
|
||||
|
||||
return FS_RESULT_OK;
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -376,7 +376,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
if (!IsValidWiiPath(wii_path))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
||||
u8 OwnerPerm = 0x3; // read/write
|
||||
@ -398,7 +398,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
else
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR unknown %s", Filename.c_str());
|
||||
return FS_FILE_NOT_EXIST;
|
||||
return FS_ENOENT;
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
Addr += 1;
|
||||
}
|
||||
|
||||
return FS_RESULT_OK;
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -435,7 +435,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
if (!IsValidWiiPath(wii_path))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
||||
Offset += 64;
|
||||
@ -452,7 +452,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
WARN_LOG(WII_IPC_FILEIO, "FS: DeleteFile %s - failed!!!", Filename.c_str());
|
||||
}
|
||||
|
||||
return FS_RESULT_OK;
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -465,7 +465,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
if (!IsValidWiiPath(wii_path))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
std::string Filename = HLE_IPC_BuildFilename(wii_path);
|
||||
Offset += 64;
|
||||
@ -474,7 +474,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
if (!IsValidWiiPath(wii_path_rename))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path_rename.c_str());
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
std::string FilenameRename = HLE_IPC_BuildFilename(wii_path_rename);
|
||||
Offset += 64;
|
||||
@ -497,10 +497,10 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
{
|
||||
ERROR_LOG(WII_IPC_FILEIO, "FS: Rename %s to %s - failed", Filename.c_str(),
|
||||
FilenameRename.c_str());
|
||||
return FS_FILE_NOT_EXIST;
|
||||
return FS_ENOENT;
|
||||
}
|
||||
|
||||
return FS_RESULT_OK;
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -517,7 +517,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
if (!IsValidWiiPath(wii_path))
|
||||
{
|
||||
WARN_LOG(WII_IPC_FILEIO, "Not a valid path: %s", wii_path.c_str());
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
std::string Filename(HLE_IPC_BuildFilename(wii_path));
|
||||
Addr += 64;
|
||||
@ -541,8 +541,8 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
// check if the file already exist
|
||||
if (File::Exists(Filename))
|
||||
{
|
||||
INFO_LOG(WII_IPC_FILEIO, "\tresult = FS_RESULT_EXISTS");
|
||||
return FS_FILE_EXIST;
|
||||
INFO_LOG(WII_IPC_FILEIO, "\tresult = FS_EEXIST");
|
||||
return FS_EEXIST;
|
||||
}
|
||||
|
||||
// create the file
|
||||
@ -552,11 +552,11 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
{
|
||||
ERROR_LOG(WII_IPC_FILEIO, "CWII_IPC_HLE_Device_fs: couldn't create new file");
|
||||
PanicAlert("CWII_IPC_HLE_Device_fs: couldn't create new file");
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
|
||||
INFO_LOG(WII_IPC_FILEIO, "\tresult = FS_RESULT_OK");
|
||||
return FS_RESULT_OK;
|
||||
INFO_LOG(WII_IPC_FILEIO, "\tresult = IPC_SUCCESS");
|
||||
return IPC_SUCCESS;
|
||||
}
|
||||
break;
|
||||
case IOCTL_SHUTDOWN:
|
||||
@ -571,7 +571,7 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||
break;
|
||||
}
|
||||
|
||||
return FS_RESULT_FATAL;
|
||||
return FS_EINVAL;
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
||||
|
@ -23,18 +23,6 @@ struct NANDStat
|
||||
u32 Used_Inodes;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FS_RESULT_OK = 0,
|
||||
FS_INVALID = -4,
|
||||
FS_DIRFILE_NOT_FOUND = -6,
|
||||
FS_RESULT_FATAL = -101,
|
||||
FS_NO_ACCESS = -102,
|
||||
FS_FILE_EXIST = -105,
|
||||
FS_FILE_NOT_EXIST = -106,
|
||||
FS_NO_HANDLE = -106,
|
||||
};
|
||||
|
||||
class CWII_IPC_HLE_Device_fs : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
@ -56,7 +56,7 @@ void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid)
|
||||
|
||||
void CWII_IPC_HLE_Device_hid::handleUsbUpdates(struct libusb_transfer* transfer)
|
||||
{
|
||||
int ret = HIDERR_NO_DEVICE_FOUND;
|
||||
int ret = IPC_EINVAL;
|
||||
u32 replyAddress = (u32)(size_t)transfer->user_data;
|
||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED)
|
||||
{
|
||||
@ -169,7 +169,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
||||
u16 wLength = Memory::Read_U16(BufferIn + 0x1A);
|
||||
u32 data = Memory::Read_U32(BufferIn + 0x1C);
|
||||
|
||||
ReturnValue = HIDERR_NO_DEVICE_FOUND;
|
||||
ReturnValue = IPC_EINVAL;
|
||||
|
||||
libusb_device_handle* dev_handle = GetDeviceByDevNum(dev_num);
|
||||
|
||||
@ -204,7 +204,7 @@ IPCCommandResult CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
||||
|
||||
u32 data = Memory::Read_U32(BufferIn + 0x1C);
|
||||
|
||||
ReturnValue = HIDERR_NO_DEVICE_FOUND;
|
||||
ReturnValue = IPC_EINVAL;
|
||||
|
||||
libusb_device_handle* dev_handle = GetDeviceByDevNum(dev_num);
|
||||
|
||||
|
@ -31,8 +31,6 @@ struct libusb_transfer;
|
||||
#define HID_ID_MASK 0x0000FFFFFFFFFFFF
|
||||
#define MAX_HID_INTERFACES 1
|
||||
|
||||
#define HIDERR_NO_DEVICE_FOUND -4
|
||||
|
||||
class CWII_IPC_HLE_Device_hid : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
@ -42,11 +42,11 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_immediate::IOCtl(u32 command_address)
|
||||
case IOCTL_STM_RELEASE_EH:
|
||||
if (s_event_hook_address == 0)
|
||||
{
|
||||
return_value = FS_ENOENT;
|
||||
return_value = IPC_ENOENT;
|
||||
break;
|
||||
}
|
||||
Memory::Write_U32(0, Memory::Read_U32(s_event_hook_address + 0x18));
|
||||
Memory::Write_U32(FS_SUCCESS, s_event_hook_address + 4);
|
||||
Memory::Write_U32(IPC_SUCCESS, s_event_hook_address + 4);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(s_event_hook_address);
|
||||
s_event_hook_address = 0;
|
||||
break;
|
||||
@ -102,7 +102,7 @@ IPCCommandResult CWII_IPC_HLE_Device_stm_eventhook::IOCtl(u32 command_address)
|
||||
if (parameter != IOCTL_STM_EVENTHOOK)
|
||||
{
|
||||
ERROR_LOG(WII_IPC_STM, "Bad IOCtl in CWII_IPC_HLE_Device_stm_eventhook");
|
||||
Memory::Write_U32(FS_EINVAL, command_address + 4);
|
||||
Memory::Write_U32(IPC_EINVAL, command_address + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ void CWII_IPC_HLE_Device_stm_eventhook::TriggerEvent(const u32 event) const
|
||||
u32 buffer_out = Memory::Read_U32(s_event_hook_address + 0x18);
|
||||
Memory::Write_U32(event, buffer_out);
|
||||
|
||||
Memory::Write_U32(FS_SUCCESS, s_event_hook_address + 4);
|
||||
Memory::Write_U32(IPC_SUCCESS, s_event_hook_address + 4);
|
||||
WII_IPC_HLE_Interface::EnqueueReply(s_event_hook_address);
|
||||
s_event_hook_address = 0;
|
||||
}
|
||||
|
@ -28,13 +28,13 @@ IPCCommandResult CWII_IPC_HLE_Device_stub::Close(u32 command_address, bool force
|
||||
IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtl(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtl()", m_Name.c_str());
|
||||
Memory::Write_U32(FS_SUCCESS, command_address + 4);
|
||||
Memory::Write_U32(IPC_SUCCESS, command_address + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
IPCCommandResult CWII_IPC_HLE_Device_stub::IOCtlV(u32 command_address)
|
||||
{
|
||||
WARN_LOG(WII_IPC_HLE, "%s faking IOCtlV()", m_Name.c_str());
|
||||
Memory::Write_U32(FS_SUCCESS, command_address + 4);
|
||||
Memory::Write_U32(IPC_SUCCESS, command_address + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_base::IOCtl(u32 command_add
|
||||
{
|
||||
// NeoGamma (homebrew) is known to use this path.
|
||||
ERROR_LOG(WII_IPC_WIIMOTE, "Bad IOCtl to /dev/usb/oh1/57e/305");
|
||||
Memory::Write_U32(FS_EINVAL, command_address + 4);
|
||||
Memory::Write_U32(IPC_EINVAL, command_address + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ IPCCommandResult CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::IOCtl(u32 _CommandAddr
|
||||
{
|
||||
// NeoGamma (homebrew) is known to use this path.
|
||||
ERROR_LOG(WII_IPC_WIIMOTE, "Bad IOCtl in CWII_IPC_HLE_Device_usb_oh1_57e_305");
|
||||
Memory::Write_U32(FS_EINVAL, _CommandAddress + 4);
|
||||
Memory::Write_U32(IPC_EINVAL, _CommandAddress + 4);
|
||||
return GetDefaultReply();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user