mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-16 23:20:12 +00:00
Fail with an error in sceIoChdir for invalid dev.
This commit is contained in:
parent
7cab1c334b
commit
8e1193feba
@ -307,7 +307,7 @@ void MetaFileSystem::ThreadEnded(int threadID)
|
||||
currentDir.erase(threadID);
|
||||
}
|
||||
|
||||
void MetaFileSystem::ChDir(const std::string &dir)
|
||||
int MetaFileSystem::ChDir(const std::string &dir)
|
||||
{
|
||||
int curThread = __KernelGetCurThread();
|
||||
|
||||
@ -316,14 +316,24 @@ void MetaFileSystem::ChDir(const std::string &dir)
|
||||
if (MapFilePath(dir, of, &mountPoint))
|
||||
{
|
||||
currentDir[curThread] = mountPoint->prefix + of;
|
||||
//return true;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: PSP's sceIoChdir seems very forgiving, but does it always accept bad paths and what happens when it does?
|
||||
WARN_LOG(HLE, "ChDir failed to map path \"%s\", saving as current directory anyway", dir.c_str());
|
||||
currentDir[curThread] = dir;
|
||||
//return false;
|
||||
for (size_t i = 0; i < fileSystems.size(); i++)
|
||||
{
|
||||
const std::string &prefix = fileSystems[i].prefix;
|
||||
if (strncasecmp(prefix.c_str(), dir.c_str(), prefix.size()) == 0)
|
||||
{
|
||||
// The PSP is completely happy with invalid current dirs as long as they have a valid device.
|
||||
WARN_LOG(HLE, "ChDir failed to map path \"%s\", saving as current directory anyway", dir.c_str());
|
||||
currentDir[curThread] = dir;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
WARN_LOG(HLE, "ChDir failed to map device for \"%s\", failing", dir.c_str());
|
||||
return SCE_KERNEL_ERROR_NODEV;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
return SeekFile(handle, 0, FILEMOVE_CURRENT);
|
||||
}
|
||||
|
||||
virtual void ChDir(const std::string &dir);
|
||||
virtual int ChDir(const std::string &dir);
|
||||
|
||||
virtual bool MkDir(const std::string &dirname);
|
||||
virtual bool RmDir(const std::string &dirname);
|
||||
|
@ -1149,8 +1149,7 @@ u32 sceIoRename(const char *from, const char *to) {
|
||||
|
||||
u32 sceIoChdir(const char *dirname) {
|
||||
DEBUG_LOG(HLE, "sceIoChdir(%s)", dirname);
|
||||
pspFileSystem.ChDir(dirname);
|
||||
return 0;
|
||||
return pspFileSystem.ChDir(dirname);
|
||||
}
|
||||
|
||||
int sceIoChangeAsyncPriority(int id, int priority)
|
||||
|
Loading…
x
Reference in New Issue
Block a user