mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #14644 from hrydgard/even-more-scoped-storage-commits
Even more scoped storage commits
This commit is contained in:
commit
af1b4deb42
6 changed files with 18 additions and 12 deletions
|
@ -279,7 +279,6 @@ Path Path::GetRootVolume() const {
|
|||
return Path(path);
|
||||
}
|
||||
#endif
|
||||
|
||||
return Path("/");
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ LocalFileLoader::LocalFileLoader(const Path &filename)
|
|||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
if (filename.Type() == PathType::CONTENT_URI) {
|
||||
int fd = Android_OpenContentUriFd(filename.ToString(), Android_OpenContentUriMode::READ);
|
||||
INFO_LOG(SYSTEM, "Fd %d for content URI: '%s'", fd, filename.c_str());
|
||||
VERBOSE_LOG(SYSTEM, "Fd %d for content URI: '%s'", fd, filename.c_str());
|
||||
if (fd < 0) {
|
||||
ERROR_LOG(FILESYS, "LoadFileLoader failed to open content URI: '%s'", filename.c_str());
|
||||
return;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -540,10 +540,15 @@ UI::EventReturn GameBrowser::StorageClick(UI::EventParams &e) {
|
|||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameBrowser::HomeClick(UI::EventParams &e) {
|
||||
if (System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) {
|
||||
UI::EventReturn GameBrowser::OnHomeClick(UI::EventParams &e) {
|
||||
if (path_.GetPath().Type() == PathType::CONTENT_URI) {
|
||||
path_.SetPath(path_.GetPath().GetRootVolume());
|
||||
Path rootPath = path_.GetPath().GetRootVolume();
|
||||
if (rootPath != path_.GetPath()) {
|
||||
SetPath(rootPath);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
if (System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) {
|
||||
// There'll be no sensible home, ignore.
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
}
|
||||
|
@ -669,7 +674,7 @@ void GameBrowser::Refresh() {
|
|||
if (browseFlags_ & BrowseFlags::NAVIGATE) {
|
||||
topBar->Add(new Spacer(2.0f));
|
||||
topBar->Add(new TextView(path_.GetFriendlyPath().c_str(), ALIGN_VCENTER | FLAG_WRAP_TEXT, true, new LinearLayoutParams(FILL_PARENT, 64.0f, 1.0f)));
|
||||
topBar->Add(new Choice(ImageID("I_HOME"), new LayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Handle(this, &GameBrowser::HomeClick);
|
||||
topBar->Add(new Choice(ImageID("I_HOME"), new LayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Handle(this, &GameBrowser::OnHomeClick);
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_ADDITIONAL_STORAGE)) {
|
||||
topBar->Add(new Choice(ImageID("I_SDCARD"), new LayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Handle(this, &GameBrowser::StorageClick);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ private:
|
|||
UI::EventReturn LastClick(UI::EventParams &e);
|
||||
UI::EventReturn BrowseClick(UI::EventParams &e);
|
||||
UI::EventReturn StorageClick(UI::EventParams &e);
|
||||
UI::EventReturn HomeClick(UI::EventParams &e);
|
||||
UI::EventReturn OnHomeClick(UI::EventParams &e);
|
||||
UI::EventReturn PinToggleClick(UI::EventParams &e);
|
||||
UI::EventReturn GridSettingsClick(UI::EventParams &e);
|
||||
UI::EventReturn OnRecentClear(UI::EventParams &e);
|
||||
|
|
Loading…
Add table
Reference in a new issue