Fix further issues when the memstick dir is the PSP dir

This commit is contained in:
Henrik Rydgård 2021-07-25 18:14:46 +02:00
parent d14a90001b
commit b3c2252b28
2 changed files with 6 additions and 4 deletions

View file

@ -187,7 +187,7 @@ Path DirectoryFileHandle::GetLocalPath(const Path &basePath, std::string localpa
localpath.erase(0, 1);
if (fileSystemFlags_ & FileSystemFlags::STRIP_PSP) {
if (startsWith(localpath, "/PSP")) {
if (startsWith(localpath, "PSP/")) {
localpath = localpath.substr(4);
}
}
@ -203,7 +203,7 @@ Path DirectoryFileSystem::GetLocalPath(std::string internalPath) const {
internalPath.erase(0, 1);
if (flags & FileSystemFlags::STRIP_PSP) {
if (startsWith(internalPath, "/PSP")) {
if (startsWith(internalPath, "PSP/")) {
internalPath = internalPath.substr(4);
}
}
@ -638,6 +638,7 @@ bool DirectoryFileSystem::RemoveFile(const std::string &filename) {
int DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
OpenFileEntry entry;
entry.hFile.fileSystemFlags_ = flags;
u32 err = 0;
bool success = entry.hFile.Open(basePath, filename, access, err);
if (err == 0 && !success) {
@ -964,6 +965,7 @@ void DirectoryFileSystem::DoState(PointerWrap &p) {
CloseAll();
u32 key;
OpenFileEntry entry;
entry.hFile.fileSystemFlags_ = flags;
for (u32 i = 0; i < num; i++) {
Do(p, key);
Do(p, entry.guestFilename);

View file

@ -708,8 +708,8 @@ void InitSysDirectories() {
// Create the default directories that a real PSP creates. Good for homebrew so they can
// expect a standard environment. Skipping THEME though, that's pointless.
File::CreateDir(g_Config.memStickDirectory / "PSP");
File::CreateDir(g_Config.memStickDirectory / "PSP/COMMON");
File::CreateDir(GetSysDirectory(DIRECTORY_PSP));
File::CreateDir(GetSysDirectory(DIRECTORY_PSP) / "COMMON");
File::CreateDir(GetSysDirectory(DIRECTORY_GAME));
File::CreateDir(GetSysDirectory(DIRECTORY_SAVEDATA));
File::CreateDir(GetSysDirectory(DIRECTORY_SAVESTATE));