mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Assorted directory fixes
This commit is contained in:
parent
fff3850096
commit
b0558b2174
7 changed files with 25 additions and 6 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -52,6 +52,8 @@ enum PSPDirectories {
|
|||
DIRECTORY_VIDEO,
|
||||
DIRECTORY_AUDIO,
|
||||
DIRECTORY_MEMSTICK_ROOT,
|
||||
DIRECTORY_EXDATA,
|
||||
DIRECTORY_CUSTOM_SHADERS,
|
||||
};
|
||||
|
||||
class GraphicsContext;
|
||||
|
|
|
@ -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> shaderInfo;
|
||||
|
@ -186,7 +187,7 @@ void LoadPostShaderInfo(const std::vector<Path> &directories) {
|
|||
void ReloadAllPostShaderInfo() {
|
||||
std::vector<Path> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue