diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index dc1f6a1ac2fa..00177fae7362 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -181,8 +181,10 @@ bool DirectoryFileHandle::Open(std::string &basePath, std::string &fileName, Fil #if HOST_IS_CASE_SENSITIVE if (access & (FILEACCESS_APPEND|FILEACCESS_CREATE|FILEACCESS_WRITE)) { DEBUG_LOG(FILESYS, "Checking case for path %s", fileName.c_str()); - if (!FixPathCase(basePath, fileName, FPC_PATH_MUST_EXIST) ) + if (!FixPathCase(basePath, fileName, FPC_PATH_MUST_EXIST)) { + error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; return false; // or go on and attempt (for a better error code than just 0?) + } } // else we try fopen first (in case we're lucky) before simulating case insensitivity #endif @@ -250,6 +252,8 @@ bool DirectoryFileHandle::Open(std::string &basePath, std::string &fileName, Fil I18NCategory *err = GetI18NCategory("Error"); host->NotifyUserMessage(err->T("Disk full while writing data")); error = SCE_KERNEL_ERROR_ERRNO_NO_PERM; + } else { + error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; } } #else @@ -310,6 +314,8 @@ bool DirectoryFileHandle::Open(std::string &basePath, std::string &fileName, Fil I18NCategory *err = GetI18NCategory("Error"); host->NotifyUserMessage(err->T("Disk full while writing data")); error = SCE_KERNEL_ERROR_ERRNO_NO_PERM; + } else { + error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; } #endif @@ -597,7 +603,7 @@ u32 DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const u32 err = 0; bool success = entry.hFile.Open(basePath, filename, access, err); if (err == 0 && !success) { - err = -1; + err = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; } err = ReplayApplyDisk(ReplayAction::FILE_OPEN, err, CoreTiming::GetGlobalTimeUs()); diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 8935e0dc3c4e..f2f5eebf6b14 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -62,7 +62,6 @@ extern "C" { // For headless screenshots. #include "Core/HLE/sceDisplay.h" -static const int ERROR_ERRNO_FILE_NOT_FOUND = 0x80010002; static const int ERROR_ERRNO_IO_ERROR = 0x80010005; static const int ERROR_MEMSTICK_DEVCTL_BAD_PARAMS = 0x80220081; static const int ERROR_MEMSTICK_DEVCTL_TOO_MANY_CALLBACKS = 0x80220082; @@ -805,7 +804,7 @@ static u32 sceIoGetstat(const char *filename, u32 addr) { } } else { DEBUG_LOG(SCEIO, "sceIoGetstat(%s, %08x) : FILE NOT FOUND", filename, addr); - return hleDelayResult(ERROR_ERRNO_FILE_NOT_FOUND, "io getstat", usec); + return hleDelayResult(SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "io getstat", usec); } } @@ -1383,7 +1382,7 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) { else { ERROR_LOG(SCEIO, "ERROR_ERRNO_FILE_NOT_FOUND=sceIoOpen(%s, %08x, %08x) - file not found", filename, flags, mode); - return hleDelayResult(ERROR_ERRNO_FILE_NOT_FOUND, "file opened", 10000); + return hleDelayResult(SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "file opened", 10000); } } @@ -1412,7 +1411,7 @@ static u32 sceIoRemove(const char *filename) { // TODO: This timing isn't necessarily accurate, low end for now. if(!pspFileSystem.GetFileInfo(filename).exists) - return hleDelayResult(ERROR_ERRNO_FILE_NOT_FOUND, "file removed", 100); + return hleDelayResult(SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "file removed", 100); pspFileSystem.RemoveFile(filename); return hleDelayResult(0, "file removed", 100); @@ -1433,7 +1432,7 @@ static u32 sceIoRmdir(const char *dirname) { if (pspFileSystem.RmDir(dirname)) return hleDelayResult(0, "rmdir", 1000); else - return hleDelayResult(ERROR_ERRNO_FILE_NOT_FOUND, "rmdir", 1000); + return hleDelayResult(SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "rmdir", 1000); } static u32 sceIoSync(const char *devicename, int flag) { @@ -1855,7 +1854,7 @@ static u32 sceIoRename(const char *from, const char *to) { // TODO: Timing isn't terribly accurate. if (!pspFileSystem.GetFileInfo(from).exists) - return hleDelayResult(ERROR_ERRNO_FILE_NOT_FOUND, "file renamed", 1000); + return hleDelayResult(SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "file renamed", 1000); int result = pspFileSystem.RenameFile(from, to); if (result < 0) @@ -1933,7 +1932,7 @@ static u32 sceIoOpenAsync(const char *filename, int flags, int mode) f = new FileNode(); f->handle = kernelObjects.Create(f); f->fullpath = filename; - f->asyncResult = error == 0 ? ERROR_ERRNO_FILE_NOT_FOUND : error; + f->asyncResult = error == 0 ? SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND : error; f->closePending = true; fd = __IoAllocFd(f); @@ -2142,9 +2141,8 @@ class DirListing : public KernelObject { static u32 sceIoDopen(const char *path) { DEBUG_LOG(SCEIO, "sceIoDopen(\"%s\")", path); - if(!pspFileSystem.GetFileInfo(path).exists) - { - return ERROR_ERRNO_FILE_NOT_FOUND; + if (!pspFileSystem.GetFileInfo(path).exists) { + return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; } DirListing *dir = new DirListing(); diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index 7bc309717f6d..fa5928584bba 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -44,6 +44,7 @@ enum { SCE_KERNEL_ERROR_BAD_FILE = 0x80000209, SCE_KERNEL_ERROR_ACCESS_ERROR = 0x8000020D, + SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND = 0x80010002, SCE_KERNEL_ERROR_ERRNO_ARG_LIST_TOO_LONG = 0x80010007, SCE_KERNEL_ERROR_ERRNO_INVALID_FILE_DESCRIPTOR = 0x80010009, SCE_KERNEL_ERROR_ERRNO_RESOURCE_UNAVAILABLE = 0x8001000B, diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 82da25de654a..fe5cd6acf56c 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1811,8 +1811,7 @@ u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) { s64 size = (s64)info.size; if (!info.exists) { - const int ERROR_ERRNO_FILE_NOT_FOUND = 0x80010002; - const u32 error = hleLogError(LOADER, ERROR_ERRNO_FILE_NOT_FOUND, "file does not exist"); + const u32 error = hleLogError(LOADER, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "file does not exist"); return hleDelayResult(error, "module loaded", 500); }