mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 23:40:39 +00:00
Io: Cleanup file not found error codes.
Replay (#10888) caused error to be non zero, which was later translated to something else, confusingly...
This commit is contained in:
parent
8959a9087f
commit
f4e8e68c44
@ -181,8 +181,10 @@ bool DirectoryFileHandle::Open(std::string &basePath, std::string &fileName, Fil
|
|||||||
#if HOST_IS_CASE_SENSITIVE
|
#if HOST_IS_CASE_SENSITIVE
|
||||||
if (access & (FILEACCESS_APPEND|FILEACCESS_CREATE|FILEACCESS_WRITE)) {
|
if (access & (FILEACCESS_APPEND|FILEACCESS_CREATE|FILEACCESS_WRITE)) {
|
||||||
DEBUG_LOG(FILESYS, "Checking case for path %s", fileName.c_str());
|
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?)
|
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
|
// else we try fopen first (in case we're lucky) before simulating case insensitivity
|
||||||
#endif
|
#endif
|
||||||
@ -250,6 +252,8 @@ bool DirectoryFileHandle::Open(std::string &basePath, std::string &fileName, Fil
|
|||||||
I18NCategory *err = GetI18NCategory("Error");
|
I18NCategory *err = GetI18NCategory("Error");
|
||||||
host->NotifyUserMessage(err->T("Disk full while writing data"));
|
host->NotifyUserMessage(err->T("Disk full while writing data"));
|
||||||
error = SCE_KERNEL_ERROR_ERRNO_NO_PERM;
|
error = SCE_KERNEL_ERROR_ERRNO_NO_PERM;
|
||||||
|
} else {
|
||||||
|
error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -310,6 +314,8 @@ bool DirectoryFileHandle::Open(std::string &basePath, std::string &fileName, Fil
|
|||||||
I18NCategory *err = GetI18NCategory("Error");
|
I18NCategory *err = GetI18NCategory("Error");
|
||||||
host->NotifyUserMessage(err->T("Disk full while writing data"));
|
host->NotifyUserMessage(err->T("Disk full while writing data"));
|
||||||
error = SCE_KERNEL_ERROR_ERRNO_NO_PERM;
|
error = SCE_KERNEL_ERROR_ERRNO_NO_PERM;
|
||||||
|
} else {
|
||||||
|
error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -597,7 +603,7 @@ u32 DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const
|
|||||||
u32 err = 0;
|
u32 err = 0;
|
||||||
bool success = entry.hFile.Open(basePath, filename, access, err);
|
bool success = entry.hFile.Open(basePath, filename, access, err);
|
||||||
if (err == 0 && !success) {
|
if (err == 0 && !success) {
|
||||||
err = -1;
|
err = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ReplayApplyDisk(ReplayAction::FILE_OPEN, err, CoreTiming::GetGlobalTimeUs());
|
err = ReplayApplyDisk(ReplayAction::FILE_OPEN, err, CoreTiming::GetGlobalTimeUs());
|
||||||
|
@ -62,7 +62,6 @@ extern "C" {
|
|||||||
// For headless screenshots.
|
// For headless screenshots.
|
||||||
#include "Core/HLE/sceDisplay.h"
|
#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_ERRNO_IO_ERROR = 0x80010005;
|
||||||
static const int ERROR_MEMSTICK_DEVCTL_BAD_PARAMS = 0x80220081;
|
static const int ERROR_MEMSTICK_DEVCTL_BAD_PARAMS = 0x80220081;
|
||||||
static const int ERROR_MEMSTICK_DEVCTL_TOO_MANY_CALLBACKS = 0x80220082;
|
static const int ERROR_MEMSTICK_DEVCTL_TOO_MANY_CALLBACKS = 0x80220082;
|
||||||
@ -805,7 +804,7 @@ static u32 sceIoGetstat(const char *filename, u32 addr) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DEBUG_LOG(SCEIO, "sceIoGetstat(%s, %08x) : FILE NOT FOUND", filename, addr);
|
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
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(SCEIO, "ERROR_ERRNO_FILE_NOT_FOUND=sceIoOpen(%s, %08x, %08x) - file not found", filename, flags, mode);
|
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.
|
// TODO: This timing isn't necessarily accurate, low end for now.
|
||||||
if(!pspFileSystem.GetFileInfo(filename).exists)
|
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);
|
pspFileSystem.RemoveFile(filename);
|
||||||
return hleDelayResult(0, "file removed", 100);
|
return hleDelayResult(0, "file removed", 100);
|
||||||
@ -1433,7 +1432,7 @@ static u32 sceIoRmdir(const char *dirname) {
|
|||||||
if (pspFileSystem.RmDir(dirname))
|
if (pspFileSystem.RmDir(dirname))
|
||||||
return hleDelayResult(0, "rmdir", 1000);
|
return hleDelayResult(0, "rmdir", 1000);
|
||||||
else
|
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) {
|
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.
|
// TODO: Timing isn't terribly accurate.
|
||||||
if (!pspFileSystem.GetFileInfo(from).exists)
|
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);
|
int result = pspFileSystem.RenameFile(from, to);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
@ -1933,7 +1932,7 @@ static u32 sceIoOpenAsync(const char *filename, int flags, int mode)
|
|||||||
f = new FileNode();
|
f = new FileNode();
|
||||||
f->handle = kernelObjects.Create(f);
|
f->handle = kernelObjects.Create(f);
|
||||||
f->fullpath = filename;
|
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;
|
f->closePending = true;
|
||||||
|
|
||||||
fd = __IoAllocFd(f);
|
fd = __IoAllocFd(f);
|
||||||
@ -2142,9 +2141,8 @@ public:
|
|||||||
static u32 sceIoDopen(const char *path) {
|
static u32 sceIoDopen(const char *path) {
|
||||||
DEBUG_LOG(SCEIO, "sceIoDopen(\"%s\")", path);
|
DEBUG_LOG(SCEIO, "sceIoDopen(\"%s\")", path);
|
||||||
|
|
||||||
if(!pspFileSystem.GetFileInfo(path).exists)
|
if (!pspFileSystem.GetFileInfo(path).exists) {
|
||||||
{
|
return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||||
return ERROR_ERRNO_FILE_NOT_FOUND;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DirListing *dir = new DirListing();
|
DirListing *dir = new DirListing();
|
||||||
|
@ -44,6 +44,7 @@ enum {
|
|||||||
SCE_KERNEL_ERROR_BAD_FILE = 0x80000209,
|
SCE_KERNEL_ERROR_BAD_FILE = 0x80000209,
|
||||||
SCE_KERNEL_ERROR_ACCESS_ERROR = 0x8000020D,
|
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_ARG_LIST_TOO_LONG = 0x80010007,
|
||||||
SCE_KERNEL_ERROR_ERRNO_INVALID_FILE_DESCRIPTOR = 0x80010009,
|
SCE_KERNEL_ERROR_ERRNO_INVALID_FILE_DESCRIPTOR = 0x80010009,
|
||||||
SCE_KERNEL_ERROR_ERRNO_RESOURCE_UNAVAILABLE = 0x8001000B,
|
SCE_KERNEL_ERROR_ERRNO_RESOURCE_UNAVAILABLE = 0x8001000B,
|
||||||
|
@ -1811,8 +1811,7 @@ u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) {
|
|||||||
s64 size = (s64)info.size;
|
s64 size = (s64)info.size;
|
||||||
|
|
||||||
if (!info.exists) {
|
if (!info.exists) {
|
||||||
const int ERROR_ERRNO_FILE_NOT_FOUND = 0x80010002;
|
const u32 error = hleLogError(LOADER, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "file does not exist");
|
||||||
const u32 error = hleLogError(LOADER, ERROR_ERRNO_FILE_NOT_FOUND, "file does not exist");
|
|
||||||
return hleDelayResult(error, "module loaded", 500);
|
return hleDelayResult(error, "module loaded", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user