From b3c2252b28dc2da546a42f97875a8da0cec5fede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 25 Jul 2021 18:14:46 +0200 Subject: [PATCH] Fix further issues when the memstick dir is the PSP dir --- Core/FileSystems/DirectoryFileSystem.cpp | 6 ++++-- Core/System.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index 4a7bde8f8b..4e2ab9b2d8 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -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); diff --git a/Core/System.cpp b/Core/System.cpp index d2427d43fd..d11fb469fe 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -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));