mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Loaders: Look for PSP/GAME/ not /PSP/GAME/.
Because upcoming Path changes will affect path string comparisons.
This commit is contained in:
parent
ac68dac029
commit
cc3868db97
3 changed files with 12 additions and 6 deletions
|
@ -337,7 +337,7 @@ bool DirectoryFileHandle::Open(const std::string &basePath, std::string &fileNam
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Try to detect reads/writes to PSP/GAME to avoid them in replays.
|
// 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;
|
inGameDir_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader) {
|
||||||
// If so we just move up and return the directory itself as the game.
|
// If so we just move up and return the directory itself as the game.
|
||||||
std::string path = File::GetDir(fileLoader->GetPath());
|
std::string path = File::GetDir(fileLoader->GetPath());
|
||||||
// If loading from memstick...
|
// If loading from memstick...
|
||||||
size_t pos = path.find("/PSP/GAME/");
|
size_t pos = path.find("PSP/GAME/");
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
return IdentifiedFileType::PSP_PBP_DIRECTORY;
|
return IdentifiedFileType::PSP_PBP_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
@ -260,10 +260,10 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string path = fileLoader->GetPath();
|
std::string path = fileLoader->GetPath();
|
||||||
size_t pos = path.find("/PSP/GAME/");
|
size_t pos = path.find("PSP/GAME/");
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
path = ResolvePBPDirectory(path);
|
path = ResolvePBPDirectory(path);
|
||||||
pspFileSystem.SetStartingDirectory("ms0:" + path.substr(pos));
|
pspFileSystem.SetStartingDirectory("ms0:/" + path.substr(pos));
|
||||||
}
|
}
|
||||||
return Load_PSP_ELF_PBP(fileLoader, error_string);
|
return Load_PSP_ELF_PBP(fileLoader, error_string);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -374,11 +374,17 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
|
||||||
std::string full_path = fileLoader->GetPath();
|
std::string full_path = fileLoader->GetPath();
|
||||||
std::string path, file, extension;
|
std::string path, file, extension;
|
||||||
SplitPath(ReplaceAll(full_path, "\\", "/"), &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;
|
std::string ms_path;
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
ms_path = "ms0:" + path.substr(pos);
|
ms_path = "ms0:/" + path.substr(pos) + "/";
|
||||||
} else {
|
} else {
|
||||||
// This is wrong, but it's better than not having a working directory at all.
|
// 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.
|
// Note that umd0:/ is actually the writable containing directory, in this case.
|
||||||
|
|
Loading…
Add table
Reference in a new issue