Merge pull request #18107 from hrydgard/android-fix-homebrew

Fix running homebrew on Android with content URIs (scoped storage)
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2023-09-08 17:43:07 +02:00
commit a92a48e4b1
2 files changed
+6 -3

No files matched your search

+5 -2
View File
@@ -18,6 +18,7 @@
#include <algorithm>
#include <cstdio>
#include "Common/File/AndroidContentURI.h"
#include "Common/File/FileUtil.h"
#include "Common/File/Path.h"
#include "Common/StringUtils.h"
@@ -263,10 +264,9 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
switch (type) {
case IdentifiedFileType::PSP_PBP_DIRECTORY:
{
// TODO: Perhaps we should/can never get here now?
fileLoader = ResolveFileLoaderTarget(fileLoader);
if (fileLoader->Exists()) {
INFO_LOG(LOADER, "File is a PBP in a directory!");
INFO_LOG(LOADER, "File is a PBP in a directory: %s", fileLoader->GetPath().c_str());
IdentifiedFileType ebootType = Identify_File(fileLoader, error_string);
if (ebootType == IdentifiedFileType::PSP_ISO_NP) {
InitMemoryForGameISO(fileLoader);
@@ -284,6 +284,9 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) {
}
std::string dir = fileLoader->GetPath().GetDirectory();
if (fileLoader->GetPath().Type() == PathType::CONTENT_URI) {
dir = AndroidContentURI(dir.c_str()).FilePath();
}
size_t pos = dir.find("PSP/GAME/");
if (pos != std::string::npos) {
dir = ResolvePBPDirectory(Path(dir)).ToString();
+1 -1
View File
@@ -382,7 +382,7 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
std::string file = full_path.GetFilename();
if (full_path.Type() == PathType::CONTENT_URI) {
path = AndroidContentURI(full_path.c_str()).FilePath();
path = AndroidContentURI(full_path.GetDirectory().c_str()).FilePath();
}
size_t pos = path.find("PSP/GAME/");