diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index 40184ee07d..6dfb0ad1f1 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -337,7 +337,7 @@ bool DirectoryFileHandle::Open(const std::string &basePath, std::string &fileNam #endif // Try to detect reads/writes to PSP/GAME to avoid them in replays. - if (fullName.find("/PSP/GAME/") != fullName.npos || fullName.find("\\PSP\\GAME\\") != fullName.npos) { + if (fullName.find("PSP/GAME/") != fullName.npos || fullName.find("PSP\\GAME\\") != fullName.npos) { inGameDir_ = true; } diff --git a/Core/Loaders.cpp b/Core/Loaders.cpp index cb4ebf9199..db9d9df949 100644 --- a/Core/Loaders.cpp +++ b/Core/Loaders.cpp @@ -177,7 +177,7 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) { // If so we just move up and return the directory itself as the game. std::string path = File::GetDir(fileLoader->GetPath()); // If loading from memstick... - size_t pos = path.find("/PSP/GAME/"); + size_t pos = path.find("PSP/GAME/"); if (pos != std::string::npos) { return IdentifiedFileType::PSP_PBP_DIRECTORY; } @@ -260,10 +260,10 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) { return false; } std::string path = fileLoader->GetPath(); - size_t pos = path.find("/PSP/GAME/"); + size_t pos = path.find("PSP/GAME/"); if (pos != std::string::npos) { path = ResolvePBPDirectory(path); - pspFileSystem.SetStartingDirectory("ms0:" + path.substr(pos)); + pspFileSystem.SetStartingDirectory("ms0:/" + path.substr(pos)); } return Load_PSP_ELF_PBP(fileLoader, error_string); } else { diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index eeab0755b5..6a1aac2d81 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -374,11 +374,17 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) { std::string full_path = fileLoader->GetPath(); std::string path, file, extension; SplitPath(ReplaceAll(full_path, "\\", "/"), &path, &file, &extension); + if (!path.empty() && path.back() == '/') + path.resize(path.size() - 1); +#ifdef _WIN32 + if (!path.empty() && path.back() == '\\') + path.resize(path.size() - 1); +#endif - size_t pos = path.find("/PSP/GAME/"); + size_t pos = path.find("PSP/GAME/"); std::string ms_path; if (pos != std::string::npos) { - ms_path = "ms0:" + path.substr(pos); + ms_path = "ms0:/" + path.substr(pos) + "/"; } else { // This is wrong, but it's better than not having a working directory at all. // Note that umd0:/ is actually the writable containing directory, in this case.