diff --git a/Common/File/FileUtil.cpp b/Common/File/FileUtil.cpp index c2328c914a..8917763b1e 100644 --- a/Common/File/FileUtil.cpp +++ b/Common/File/FileUtil.cpp @@ -115,7 +115,7 @@ FILE *OpenCFile(const Path &path, const char *mode) { // Need to be able to create the file here if it doesn't exist. // Not exactly sure which abstractions are best, let's start simple. if (!File::Exists(path)) { - INFO_LOG(COMMON, "Opening content file '%s' for write. Doesn't exist, creating empty and reopening.", path.c_str()); + INFO_LOG(COMMON, "OpenCFile(%s): Opening content file for write. Doesn't exist, creating empty and reopening.", path.c_str()); std::string name = path.GetFilename(); if (path.CanNavigateUp()) { Path parent = path.NavigateUp(); @@ -128,7 +128,7 @@ FILE *OpenCFile(const Path &path, const char *mode) { return nullptr; } } else { - INFO_LOG(COMMON, "Opening file by fd for write"); + INFO_LOG(COMMON, "OpenCFile(%s): Opening existing content file for write (truncating). Requested mode: '%s'", path.c_str(), mode); } // TODO: Support append modes and stuff... For now let's go with the most common one. diff --git a/Common/File/PathBrowser.h b/Common/File/PathBrowser.h index 66227990b0..dd8cdeebb2 100644 --- a/Common/File/PathBrowser.h +++ b/Common/File/PathBrowser.h @@ -27,9 +27,10 @@ public: bool CanNavigateUp(); void NavigateUp(); + void Navigate(const std::string &subdir); - Path GetPath() const { + const Path &GetPath() const { return path_; } std::string GetFriendlyPath() const; diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 7ffd58f324..73702ae4e3 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -645,7 +645,7 @@ void __IoInit() { if (g_RemasterMode) { const std::string gameId = g_paramSFO.GetDiscID(); - const Path exdataPath = g_Config.memStickDirectory / "exdata" / gameId; + const Path exdataPath = GetSysDirectory(DIRECTORY_EXDATA) / gameId; if (File::Exists(exdataPath)) { exdataSystem = new DirectoryFileSystem(&pspFileSystem, exdataPath, FileSystemFlags::SIMULATE_FAT32 | FileSystemFlags::CARD); pspFileSystem.Mount("exdata0:", exdataSystem); diff --git a/Core/System.cpp b/Core/System.cpp index 808e39ff76..aace6ccfa7 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -603,6 +603,8 @@ Path GetSysDirectory(PSPDirectories directoryType) { return pspDirectory / "SYSTEM"; case DIRECTORY_PAUTH: return memStickDirectory / "PAUTH"; // This one's at the root... + case DIRECTORY_EXDATA: + return memStickDirectory / "EXDATA"; // This one's traditionally at the root... case DIRECTORY_DUMP: return pspDirectory / "SYSTEM/DUMP"; case DIRECTORY_SAVESTATE: @@ -622,6 +624,9 @@ Path GetSysDirectory(PSPDirectories directoryType) { return pspDirectory / "VIDEO"; case DIRECTORY_AUDIO: return pspDirectory / "AUDIO"; + case DIRECTORY_CUSTOM_SHADERS: + return pspDirectory / "shaders"; + case DIRECTORY_MEMSTICK_ROOT: return g_Config.memStickDirectory; // Just return the memory stick root if we run into some sort of problem. diff --git a/Core/System.h b/Core/System.h index d9e3cdb3a1..29b95bb7a4 100644 --- a/Core/System.h +++ b/Core/System.h @@ -52,6 +52,8 @@ enum PSPDirectories { DIRECTORY_VIDEO, DIRECTORY_AUDIO, DIRECTORY_MEMSTICK_ROOT, + DIRECTORY_EXDATA, + DIRECTORY_CUSTOM_SHADERS, }; class GraphicsContext; diff --git a/GPU/Common/PostShader.cpp b/GPU/Common/PostShader.cpp index 96e4405b36..ff106531b7 100644 --- a/GPU/Common/PostShader.cpp +++ b/GPU/Common/PostShader.cpp @@ -28,9 +28,10 @@ #include "Common/File/DirListing.h" #include "Common/File/VFS/VFS.h" #include "Common/GPU/OpenGL/GLFeatures.h" - #include "Common/StringUtils.h" + #include "Core/Config.h" +#include "Core/System.h" #include "GPU/Common/PostShader.h" static std::vector shaderInfo; @@ -186,7 +187,7 @@ void LoadPostShaderInfo(const std::vector &directories) { void ReloadAllPostShaderInfo() { std::vector directories; directories.push_back(Path("shaders")); // For VFS - directories.push_back(g_Config.memStickDirectory / "PSP" / "shaders"); + directories.push_back(GetSysDirectory(DIRECTORY_CUSTOM_SHADERS)); LoadPostShaderInfo(directories); } diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 1f82b654a8..8872fdd716 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -541,10 +541,20 @@ UI::EventReturn GameBrowser::StorageClick(UI::EventParams &e) { } UI::EventReturn GameBrowser::HomeClick(UI::EventParams &e) { + if (System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) { + if (path_.GetPath().Type() == PathType::CONTENT_URI) { + path_.SetPath(path_.GetPath().GetRootVolume()); + return UI::EVENT_DONE; + } + } + SetPath(HomePath()); return UI::EVENT_DONE; } +// TODO: This doesn't make that much sense for Android, especially after scoped storage.. +// Maybe we should have no home directory in this case. Or it should just navigate to the root +// of the current folder tree. Path GameBrowser::HomePath() { #if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(SWITCH) || defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP) return g_Config.memStickDirectory;