Don't ignore SCE_KERNEL_ERROR_NOCWD in many cases.

Use a error 1 to mean the uccessful mapping but carry with  SCE_KERNEL_ERROR_NOCWD error.
This commit is contained in:
shenweip 2019-12-13 17:59:55 +08:00
parent fd6b0554d6
commit c3a489fa90
3 changed files with 16 additions and 16 deletions

View File

@ -244,7 +244,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath
VERBOSE_LOG(FILESYS, "MapFilePath: mapped \"%s\" to prefix: \"%s\", path: \"%s\"", inpath.c_str(), fileSystems[i].prefix.c_str(), outpath.c_str());
if (error == SCE_KERNEL_ERROR_NOCWD)
return error;
return 1; // This means successful mapping but carry with SCE_KERNEL_ERROR_NOCWD error.
else
return 0;
}
@ -342,9 +342,9 @@ int MetaFileSystem::OpenFile(std::string filename, FileAccess access, const char
std::string of;
MountPoint *mount;
int error = MapFilePath(filename, of, &mount);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD) {
if (error >= 0) {
int h = mount->system->OpenFile(of, access, mount->prefix.c_str());
if (h < 0 && error == SCE_KERNEL_ERROR_NOCWD)
if (h < 0 && error == 1)
return SCE_KERNEL_ERROR_NOCWD;
else
return h;
@ -358,7 +358,7 @@ PSPFileInfo MetaFileSystem::GetFileInfo(std::string filename)
std::string of;
IFileSystem *system;
int error = MapFilePath(filename, of, &system);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
if (error >= 0)
{
return system->GetFileInfo(of);
}
@ -375,7 +375,7 @@ bool MetaFileSystem::GetHostPath(const std::string &inpath, std::string &outpath
std::string of;
IFileSystem *system;
int error = MapFilePath(inpath, of, &system);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD) {
if (error >= 0) {
return system->GetHostPath(of, outpath);
} else {
return false;
@ -388,7 +388,7 @@ std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(std::string path)
std::string of;
IFileSystem *system;
int error = MapFilePath(path, of, &system);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
if (error >= 0)
{
return system->GetDirListing(of);
}
@ -417,7 +417,7 @@ int MetaFileSystem::ChDir(const std::string &dir)
std::string of;
MountPoint *mountPoint;
int error = MapFilePath(dir, of, &mountPoint);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
if (error >= 0)
{
currentDir[curThread] = mountPoint->prefix + of;
return 0;
@ -447,7 +447,7 @@ bool MetaFileSystem::MkDir(const std::string &dirname)
std::string of;
IFileSystem *system;
int error = MapFilePath(dirname, of, &system);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
if (error >= 0)
{
return system->MkDir(of);
}
@ -463,7 +463,7 @@ bool MetaFileSystem::RmDir(const std::string &dirname)
std::string of;
IFileSystem *system;
int error = MapFilePath(dirname, of, &system);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
if (error >= 0)
{
return system->RmDir(of);
}
@ -481,13 +481,13 @@ int MetaFileSystem::RenameFile(const std::string &from, const std::string &to)
IFileSystem *osystem;
IFileSystem *rsystem = NULL;
int error = MapFilePath(from, of, &osystem);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
if (error >= 0)
{
// If it's a relative path, it seems to always use from's filesystem.
if (to.find(":/") != to.npos)
{
error = MapFilePath(to, rf, &rsystem);
if (error != 0)
if (error < 0)
return -1;
}
else
@ -513,7 +513,7 @@ bool MetaFileSystem::RemoveFile(const std::string &filename)
std::string of;
IFileSystem *system;
int error = MapFilePath(filename, of, &system);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
if (error >= 0)
{
return system->RemoveFile(of);
}
@ -621,7 +621,7 @@ u64 MetaFileSystem::FreeSpace(const std::string &path)
std::string of;
IFileSystem *system;
int error = MapFilePath(path, of, &system);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
if (error >= 0)
return system->FreeSpace(of);
else
return 0;

View File

@ -79,7 +79,7 @@ public:
inline int MapFilePath(const std::string &_inpath, std::string &outpath, IFileSystem **system) {
MountPoint *mountPoint;
int error = MapFilePath(_inpath, outpath, &mountPoint);
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD) {
if (error >= 0) {
*system = mountPoint->system;
return error;
}

View File

@ -2532,8 +2532,8 @@ static int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr,
INFO_LOG(SCEIO, "sceIoIoctl: Sector seek for file %i", id);
// Even if the size is 4, it still actually reads a 16 byte struct, it seems.
if (GetIOTimingMethod() == IOTIMING_REALISTIC)
usec = 15000;// Fantasy Golf Pangya Portable(KS) needs a delay over 15000us.
//if (GetIOTimingMethod() == IOTIMING_REALISTIC) // Need a check for io timing method?
usec = 15000;// Fantasy Golf Pangya Portable(KS) needs a delay over 15000us.
if (Memory::IsValidAddress(indataPtr) && inlen >= 4) {
struct SeekInfo {