Merge pull request #12509 from shenweip/Pangya-fix

Fix Pangya(KS).
This commit is contained in:
Henrik Rydgård 2019-12-25 16:14:09 +01:00 committed by GitHub
commit 08ca4ee235
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 12 deletions

View file

@ -226,7 +226,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath
currentDirectory = &(it->second);
}
if ( RealPath(*currentDirectory, inpath, realpath) )
if (RealPath(*currentDirectory, inpath, realpath))
{
std::string prefix = realpath;
size_t prefixPos = realpath.find(':');
@ -243,7 +243,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());
return 0;
return error == SCE_KERNEL_ERROR_NOCWD ? error : 0;
}
}
}
@ -350,7 +350,8 @@ PSPFileInfo MetaFileSystem::GetFileInfo(std::string filename)
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;
IFileSystem *system;
if (MapFilePath(filename, of, &system) == 0)
int error = MapFilePath(filename, of, &system);
if (error == 0)
{
return system->GetFileInfo(of);
}
@ -366,7 +367,8 @@ bool MetaFileSystem::GetHostPath(const std::string &inpath, std::string &outpath
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;
IFileSystem *system;
if (MapFilePath(inpath, of, &system) == 0) {
int error = MapFilePath(inpath, of, &system);
if (error == 0) {
return system->GetHostPath(of, outpath);
} else {
return false;
@ -378,7 +380,8 @@ std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(std::string path)
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;
IFileSystem *system;
if (MapFilePath(path, of, &system) == 0)
int error = MapFilePath(path, of, &system);
if (error == 0)
{
return system->GetDirListing(of);
}
@ -406,7 +409,8 @@ int MetaFileSystem::ChDir(const std::string &dir)
std::string of;
MountPoint *mountPoint;
if (MapFilePath(dir, of, &mountPoint) == 0)
int error = MapFilePath(dir, of, &mountPoint);
if (error == 0)
{
currentDir[curThread] = mountPoint->prefix + of;
return 0;
@ -435,7 +439,8 @@ bool MetaFileSystem::MkDir(const std::string &dirname)
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;
IFileSystem *system;
if (MapFilePath(dirname, of, &system) == 0)
int error = MapFilePath(dirname, of, &system);
if (error == 0)
{
return system->MkDir(of);
}
@ -450,7 +455,8 @@ bool MetaFileSystem::RmDir(const std::string &dirname)
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;
IFileSystem *system;
if (MapFilePath(dirname, of, &system) == 0)
int error = MapFilePath(dirname, of, &system);
if (error == 0)
{
return system->RmDir(of);
}
@ -467,12 +473,14 @@ int MetaFileSystem::RenameFile(const std::string &from, const std::string &to)
std::string rf;
IFileSystem *osystem;
IFileSystem *rsystem = NULL;
if (MapFilePath(from, of, &osystem) == 0)
int error = MapFilePath(from, of, &osystem);
if (error == 0)
{
// If it's a relative path, it seems to always use from's filesystem.
if (to.find(":/") != to.npos)
{
if (!MapFilePath(to, rf, &rsystem))
error = MapFilePath(to, rf, &rsystem);
if (error < 0)
return -1;
}
else
@ -497,7 +505,8 @@ bool MetaFileSystem::RemoveFile(const std::string &filename)
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;
IFileSystem *system;
if (MapFilePath(filename, of, &system) == 0)
int error = MapFilePath(filename, of, &system);
if (error == 0)
{
return system->RemoveFile(of);
}
@ -604,7 +613,8 @@ u64 MetaFileSystem::FreeSpace(const std::string &path)
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;
IFileSystem *system;
if (MapFilePath(path, of, &system) == 0)
int error = MapFilePath(path, of, &system);
if (error == 0)
return system->FreeSpace(of);
else
return 0;

View file

@ -2531,6 +2531,10 @@ static int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr,
// TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem.
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) // 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 {
u64 offset;